Example #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            if (cms.businesslogic.web.StyleSheet.GetAll().Length > 0)
            {
                cms.businesslogic.web.StyleSheet s = cms.businesslogic.web.StyleSheet.GetAll()[0];

                foreach (cms.businesslogic.web.StylesheetProperty sp in s.Properties)
                {
                    tableClass.Items.Add(new ListItem(sp.Text, sp.Alias.Replace(".", "")));
                }

                tableClass.Items.Insert(0, new System.Web.UI.WebControls.ListItem(ui.Text("general", "choose", base.getUser()), ""));
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                // editor source

                if (!UmbracoSettings.ScriptDisableEditor)
                {
                    // TODO: Register the some script editor js file if you can find a good one.
                }

                ClientTools
                .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadStylesheets>().Tree.Alias)
                .SyncTree(helper.Request("id"), false);
            }

            uicontrols.MenuIconI save = Panel1.Menu.NewIcon();
            save.ImageURL       = SystemDirectories.Umbraco + "/images/editor/save.gif";
            save.OnClickCommand = "doSubmit()";
            save.AltText        = "Save stylesheet";

            Panel1.Text  = ui.Text("stylesheet", "editstylesheet", base.getUser());
            pp_name.Text = ui.Text("name", base.getUser());
            pp_path.Text = ui.Text("path", base.getUser());

            stylesheet = new cms.businesslogic.web.StyleSheet(int.Parse(Request.QueryString["id"]));
            string appPath = Request.ApplicationPath;

            if (appPath == "/")
            {
                appPath = "";
            }
            lttPath.Text = "<a target='_blank' href='" + appPath + "/css/" + stylesheet.Text + ".css'>" + appPath + "/css/" + stylesheet.Text + ".css</a>";


            if (!IsPostBack)
            {
                NameTxt.Text      = stylesheet.Text;
                editorSource.Text = stylesheet.Content;
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if(!IsPostBack)
            {
                // editor source

                if (!UmbracoSettings.ScriptDisableEditor)
                {
                    // TODO: Register the some script editor js file if you can find a good one.
                }

                ClientTools
                    .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadStylesheets>().Tree.Alias)
                    .SyncTree(helper.Request("id"), false);
            }

             uicontrols.MenuIconI save = Panel1.Menu.NewIcon();
             save.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
             save.OnClickCommand = "doSubmit()";
             save.AltText = "Save stylesheet";

             Panel1.Text = ui.Text("stylesheet", "editstylesheet", base.getUser());
             pp_name.Text = ui.Text("name", base.getUser());
             pp_path.Text = ui.Text("path", base.getUser());

            stylesheet = new cms.businesslogic.web.StyleSheet(int.Parse(Request.QueryString["id"]));
            string appPath = Request.ApplicationPath;
            if (appPath == "/")
                appPath = "";
            lttPath.Text = "<a target='_blank' href='" + appPath + "/css/" + stylesheet.Text + ".css'>" + appPath + "/css/" + stylesheet.Text + ".css</a>";

            if (!IsPostBack)
            {
                NameTxt.Text = stylesheet.Text;
                editorSource.Text = stylesheet.Content;
            }
        }
        private string saveCss(string fileName, string fileContents, int fileID)
        {
            string returnValue = "false";

            cms.businesslogic.web.StyleSheet stylesheet = new cms.businesslogic.web.StyleSheet(fileID);

            if (stylesheet != null)
            {
                stylesheet.Content = fileContents;
                stylesheet.Text    = fileName;
                try
                {
                    stylesheet.saveCssToFile();
                    returnValue = "true";
                }
                catch (Exception ee)
                {
                    throw new Exception("Couldn't save file", ee);
                }

                //this.speechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editStylesheetSaved", base.getUser()), "");
            }
            return(returnValue);
        }
        private string saveCss(string fileName, string fileContents, int fileID)
        {
            string returnValue = "false";
            cms.businesslogic.web.StyleSheet stylesheet = new cms.businesslogic.web.StyleSheet(fileID);

            if (stylesheet != null)
            {
                stylesheet.Content = fileContents;
                stylesheet.Text = fileName;
                try
                {
                    stylesheet.saveCssToFile();
                    returnValue = "true";
                }
                catch (Exception ee)
                {
                    throw new Exception("Couldn't save file", ee);
                }

                //this.speechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editStylesheetSaved", base.getUser()), "");
            }
            return returnValue;
        }