public string SaveCss(string fileName, string oldName, string fileContents, int fileID)
        {
            if (AuthorizeRequest(DefaultApps.settings.ToString()))
            {
                string returnValue;
                var stylesheet = new StyleSheet(fileID)
                    {
                        Content = fileContents, Text = fileName
                    };

                try
                {
                    stylesheet.saveCssToFile();
                    stylesheet.Save();
                    returnValue = "true";


                    //deletes the old css file if the name was changed... 
                    if (fileName.ToLowerInvariant() != oldName.ToLowerInvariant())
                    {
                        var p = IOHelper.MapPath(SystemDirectories.Css + "/" + oldName + ".css");
                        if (File.Exists(p))
                            File.Delete(p);
                    }

                }
                catch (Exception ex)
                {
                    return ex.ToString();
                }

                return returnValue;
            }
            return "false";
        }
示例#2
0
        public string SaveCss(string fileName, string oldName, string fileContents, int fileID)
        {
            if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID))
            {
                string returnValue = "false";
                StyleSheet stylesheet = new StyleSheet(fileID);

                if (stylesheet != null)
                {
                    stylesheet.Content = fileContents;
                    stylesheet.Text = fileName;
                    try
                    {
                        stylesheet.saveCssToFile();
                        stylesheet.Save();
                        returnValue = "true";


                        //deletes the old css file if the name was changed... 
                        if (fileName != oldName)
                        {
                            string p = IOHelper.MapPath(SystemDirectories.Css + "/" + oldName + ".css");
                            if (System.IO.File.Exists(p))
                                System.IO.File.Delete(p);
                        }

                    }
                    catch (Exception ex)
                    {
                        return ex.ToString();
                    }

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