コード例 #1
0
    /// <summary>
    /// Page load event.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Add "(default)" if required
        CurrentSelector.AllowDefault = AddDefaultRecord;

        // If site specified, restrict to stylesheets assigned to the site
        if (SiteId > 0)
        {
            usStyleSheet.WhereCondition = SqlHelper.AddWhereCondition(usStyleSheet.WhereCondition, "StylesheetID IN (SELECT StylesheetID FROM CMS_CssStylesheetSite WHERE SiteID = " + SiteId + ")");
        }

        // Check if user can edit the stylesheet
        var  currentUser = MembershipContext.AuthenticatedUser;
        bool uiElement   = currentUser.IsAuthorizedPerUIElement("CMS.Content", new[] { "Properties", "Properties.General", "General.Design" }, SiteContext.CurrentSiteName);

        if (AllowEditButtons && uiElement && ReturnColumnName.EqualsCSafe("StylesheetID", true))
        {
            usStyleSheet.AdditionalDropDownCSSClass = "SelectorDropDown";
            usStyleSheet.ElementResourceName        = "CMS.Design";
            usStyleSheet.EditItemElementName        = "EditStylesheet";
            usStyleSheet.NewItemElementName         = "newcssstylesheet";

            if (!String.IsNullOrEmpty(AliasPath))
            {
                usStyleSheet.AdditionalUrlParameters = "&aliaspath=" + HttpUtility.UrlEncode(AliasPath);
            }
        }
    }
コード例 #2
0
 /// <summary>
 /// Returns true if user control is valid.
 /// </summary>
 public override bool IsValid()
 {
     if (ReturnColumnName.EqualsCSafe("ClassName", true))
     {
         string[] values = ValidationHelper.GetString(uniSelector.Value, "").Split(new[] { ';' });
         foreach (string className in values)
         {
             if ((className != "") && !MacroProcessor.ContainsMacro(className) && !className.Contains("*"))
             {
                 DataClassInfo di = DataClassInfoProvider.GetDataClassInfo(className);
                 if (di == null)
                 {
                     ValidationError = GetString("formcontrols_selectclassnames.notexist").Replace("%%code%%", className);
                     return(false);
                 }
             }
         }
     }
     return(true);
 }