diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 7fddd60b1d..03fb4b1c9a 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -449,12 +449,6 @@ QuickSearch.ascx - - ASPXCodeBehind - - - editTemplate.aspx - editstylesheet.aspx ASPXCodeBehind @@ -797,22 +791,6 @@ applications.config Designer - - Code - - - - - - - - - - - - Code - - @@ -868,9 +846,6 @@ - - - @@ -912,7 +887,6 @@ - @@ -932,7 +906,6 @@ Form - diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 94b063a5b7..59d066093e 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1176,9 +1176,6 @@ ASPXCodeBehind - - ASPXCodeBehind - ASPXCodeBehind @@ -1730,10 +1727,6 @@ Component - - templates.asmx - Component - ASPXCodeBehind @@ -1901,7 +1894,6 @@ Form - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs deleted file mode 100644 index 5aea269523..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs +++ /dev/null @@ -1,356 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Web.UI; -using System.Web.UI.WebControls; -using Umbraco.Core; -using Umbraco.Core.Configuration; -using Umbraco.Core.IO; -using umbraco.BasePages; -using umbraco.BusinessLogic; - -using umbraco.cms.businesslogic.template; -using umbraco.cms.presentation.Trees; -using umbraco.DataLayer; -using umbraco.uicontrols; -using System.Linq; - -namespace umbraco.cms.presentation.settings -{ - /// - /// Summary description for editTemplate. - /// - public partial class editTemplate : UmbracoEnsuredPage - { - private Template _template; - public MenuButton SaveButton; - - public editTemplate() - { - CurrentApp = DefaultApps.settings.ToString(); - } - - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - - ScriptManager.GetCurrent(Page).Services.Add( - new ServiceReference(IOHelper.ResolveUrl(SystemDirectories.WebServices + "/codeEditorSave.asmx"))); - ScriptManager.GetCurrent(Page).Services.Add( - new ServiceReference(IOHelper.ResolveUrl(SystemDirectories.WebServices + "/legacyAjaxCalls.asmx"))); - } - - protected string TemplateTreeSyncPath { get; private set; } - - protected void Page_Load(object sender, EventArgs e) - { - MasterTemplate.Attributes.Add("onchange", "changeMasterPageFile()"); - TemplateTreeSyncPath = "-1,init," + _template.Path.Replace("-1,", ""); - - if (!IsPostBack) - { - MasterTemplate.Items.Add(new ListItem(ui.Text("none"), "0")); - foreach (Template t in Template.GetAllAsList()) - { - if (t.Id != _template.Id) - { - var li = new ListItem(t.Text, t.Id.ToString()); - li.Attributes.Add("id", t.Alias.Replace(" ", "")); - MasterTemplate.Items.Add(li); - } - } - - NameTxt.Text = _template.GetRawText(); - AliasTxt.Text = _template.Alias; - editorSource.Text = _template.Design; - - try - { - if (_template.MasterTemplate > 0) - MasterTemplate.SelectedValue = _template.MasterTemplate.ToString(); - } - catch (Exception ex) - { - } - - ClientTools - .SetActiveTreeType(Constants.Trees.Templates) - .SyncTree(TemplateTreeSyncPath, false); - - LoadScriptingTemplates(); - LoadMacros(); - } - } - - protected override void OnInit(EventArgs e) - { - _template = new Template(int.Parse(Request.QueryString["templateID"])); - // - // CODEGEN: This call is required by the ASP.NET Web Form Designer. - // - InitializeComponent(); - base.OnInit(e); - Panel1.hasMenu = true; - - var editor = Panel1.NewTabPage(ui.Text("template")); - editor.Controls.Add(Pane8); - - var props = Panel1.NewTabPage(ui.Text("properties")); - props.Controls.Add(Pane7); - - SaveButton = Panel1.Menu.NewButton(); - SaveButton.Text = ui.Text("save"); - SaveButton.ButtonType = MenuButtonType.Primary; - SaveButton.ID = "save"; - SaveButton.CssClass = "client-side"; - - Panel1.Text = ui.Text("edittemplate"); - pp_name.Text = ui.Text("name", UmbracoUser); - pp_alias.Text = ui.Text("alias", UmbracoUser); - pp_masterTemplate.Text = ui.Text("mastertemplate", UmbracoUser); - - - // Editing buttons - MenuIconI umbField = editorSource.Menu.NewIcon(); - umbField.ImageURL = UmbracoPath + "/images/editor/insField.gif"; - umbField.OnClickCommand = - ClientTools.Scripts.OpenModalWindow( - IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + - editorSource.ClientID + "&tagName=UMBRACOGETDATA", ui.Text("template", "insertPageField"), 640, 550); - umbField.AltText = ui.Text("template", "insertPageField"); - - - // TODO: Update icon - MenuIconI umbDictionary = editorSource.Menu.NewIcon(); - umbDictionary.ImageURL = GlobalSettings.Path + "/images/editor/dictionaryItem.gif"; - umbDictionary.OnClickCommand = - ClientTools.Scripts.OpenModalWindow( - IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + - editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY", ui.Text("template", "insertDictionaryItem"), - 640, 550); - umbDictionary.AltText = "Insert umbraco dictionary item"; - - editorSource.Menu.NewElement("div", "splitButtonMacroPlaceHolder", "sbPlaceHolder", 40); - - if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) - { - MenuIconI umbContainer = editorSource.Menu.NewIcon(); - umbContainer.ImageURL = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif"; - umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder"); - umbContainer.OnClickCommand = - ClientTools.Scripts.OpenModalWindow( - IOHelper.ResolveUrl(SystemDirectories.Umbraco) + - "/dialogs/insertMasterpagePlaceholder.aspx?&id=" + _template.Id, - ui.Text("template", "insertContentAreaPlaceHolder"), 470, 320); - - MenuIconI umbContent = editorSource.Menu.NewIcon(); - umbContent.ImageURL = UmbracoPath + "/images/editor/masterpageContent.gif"; - umbContent.AltText = ui.Text("template", "insertContentArea"); - umbContent.OnClickCommand = - ClientTools.Scripts.OpenModalWindow( - IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/insertMasterpageContent.aspx?id=" + - _template.Id, ui.Text("template", "insertContentArea"), 470, 300); - } - - - //Spit button - editorSource.Menu.InsertSplitter(); - editorSource.Menu.NewElement("div", "splitButtonPlaceHolder", "sbPlaceHolder", 40); - - // Help - editorSource.Menu.InsertSplitter(); - - MenuIconI helpIcon = editorSource.Menu.NewIcon(); - helpIcon.OnClickCommand = - ClientTools.Scripts.OpenModalWindow( - IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" + - _template.Alias, ui.Text("template", "quickGuide"), 600, 580); - helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png"; - helpIcon.AltText = ui.Text("template", "quickGuide"); - } - - - private void LoadScriptingTemplates() - { - string path = SystemDirectories.Umbraco + "/scripting/templates/cshtml/"; - string abPath = IOHelper.MapPath(path); - - var files = new List>(); - - if (Directory.Exists(abPath)) - { - string extension = ".cshtml"; - - foreach (FileInfo fi in new DirectoryInfo(abPath).GetFiles("*" + extension)) - { - string filename = Path.GetFileName(fi.FullName); - - files.Add(new KeyValuePair( - filename, - filename.Replace(extension, "").SplitPascalCasing().ToFirstUpperInvariant() - )); - } - } - - rpt_codeTemplates.DataSource = files; - rpt_codeTemplates.DataBind(); - } - - private void LoadMacros() - { - using (var sqlHelper = BusinessLogic.Application.SqlHelper) - using (IRecordsReader macroRenderings = - sqlHelper.ExecuteReader("select id, macroAlias, macroName from cmsMacro order by macroName")) - { - rpt_macros.DataSource = macroRenderings; - rpt_macros.DataBind(); - } - } - - public string DoesMacroHaveSettings(string macroId) - { - using (var sqlHelper = BusinessLogic.Application.SqlHelper) - if ( - sqlHelper.ExecuteScalar(string.Format("select 1 from cmsMacroProperty where macro = {0}", macroId)) == - 1) - return "1"; - else - return "0"; - } - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - } - - /// - /// CssInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; - - /// - /// JsInclude control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude; - - /// - /// Panel1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.TabView Panel1; - - /// - /// Pane7 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane Pane7; - protected global::umbraco.uicontrols.Pane Pane8; - - /// - /// pp_name control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_name; - - /// - /// NameTxt control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox NameTxt; - - /// - /// pp_alias control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_alias; - - /// - /// AliasTxt control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox AliasTxt; - - /// - /// pp_masterTemplate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_masterTemplate; - - /// - /// MasterTemplate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList MasterTemplate; - - /// - /// pp_source control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_source; - - /// - /// editorSource control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.CodeArea editorSource; - - /// - /// rpt_codeTemplates control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater rpt_codeTemplates; - - /// - /// rpt_macros control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater rpt_macros; - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx deleted file mode 100644 index 318840e4f7..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="c#" Codebehind="templates.asmx.cs" Class="umbraco.webservices.templates" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs deleted file mode 100644 index b790c5d225..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Web; -using System.Web.Services; -using System.Xml; -using System.Web.Script.Services; -using Umbraco.Core; -using Umbraco.Core.IO; -using Umbraco.Web.WebServices; -using umbraco.BusinessLogic; -using umbraco.presentation.webservices; - -namespace umbraco.webservices -{ - /// - /// Summary description for templates. - /// - [WebService(Namespace="http://umbraco.org/webservices/")] - [ScriptService] - public class templates : UmbracoAuthorizedWebService - { - - [WebMethod] - public XmlNode GetTemplates(string Login, string Password) - { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) - { - var xmlDoc = new XmlDocument(); - xmlDoc.LoadXml(""); - foreach (cms.businesslogic.template.Template t in cms.businesslogic.template.Template.GetAllAsList()) - { - var tt = xmlDoc.CreateElement("template"); - tt.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "id", t.Id.ToString())); - tt.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "name", t.Text)); - xmlDoc.DocumentElement.AppendChild(tt); - } - return xmlDoc.DocumentElement; - } - return null; - } - - [WebMethod] - public XmlNode GetTemplate(int Id, string Login, string Password) - { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) - { - var t = new cms.businesslogic.template.Template(Id); - var xmlDoc = new XmlDocument(); - var tXml = xmlDoc.CreateElement("template"); - tXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "id", t.Id.ToString())); - tXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "master", t.MasterTemplate.ToString())); - tXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "name", t.Text)); - tXml.AppendChild(XmlHelper.AddCDataNode(xmlDoc, "design", t.Design)); - return tXml; - } - return null; - } - - [WebMethod] - public bool UpdateTemplate(int Id, int Master, string Design, string Login, string Password) - { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) - { - try - { - var t = new cms.businesslogic.template.Template(Id) - { - MasterTemplate = Master, - Design = Design - }; - //ensure events are raised - t.Save(); - return true; - } - catch (ArgumentException) - { - return false; - } - } - return false; - } - - [WebMethod] - [ScriptMethod] - public string GetCodeSnippet(object templateId) - { - //NOTE: The legacy code threw an exception so will continue to do that. - AuthorizeRequest(DefaultApps.settings.ToString(), true); - - var snippetPath = SystemDirectories.Umbraco + "/scripting/templates/cshtml/"; - var filePath = IOHelper.MapPath(snippetPath + templateId); - - //Directory check.. only allow files in script dir and below to be edited - if (filePath.StartsWith(IOHelper.MapPath(snippetPath))) - { - var templateFile = - System.IO.File.OpenText(filePath); - var content = templateFile.ReadToEnd(); - templateFile.Close(); - return content; - } - else - { - throw new ArgumentException("Couldn't open snippet - Illegal path"); - - } - } - - } -}