Exemple #1
0
 static void Main(string[] args)
 {
     try
     {
         ReturnColumnName colName = new ReturnColumnName();
         string           input   = "<?xml version=\"1.0\"?><open></open>";
         XmlDocument      doc     = new XmlDocument();
         doc.LoadXml(input);
         XmlElement opener   = (XmlElement)doc.GetElementsByTagName("open")[0];
         XmlElement dataNode = doc.CreateElement("dataex");
         XmlElement child    = (XmlElement)colName.GenerateColumnsForTable("code", doc, dataNode);
         if (opener.ChildNodes.Count == 0)
         {
             opener.AppendChild(child);
         }
         else
         {
             opener.PrependChild(child);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("The error is :" + ex);
         Console.ReadKey();
     }
 }
Exemple #2
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);
            }
        }
    }
Exemple #3
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);
 }