diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 1bea5abe0d..44436304c5 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -145,6 +145,7 @@ True ..\packages\SqlServerCE.4.0.0.0\lib\System.Data.SqlServerCe.Entity.dll + System.Web @@ -285,6 +286,13 @@ StarterKits.aspx + + EditMacro.aspx + ASPXCodeBehind + + + EditMacro.aspx + ASPXCodeBehind @@ -418,6 +426,7 @@ + @@ -1678,7 +1687,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/EditMacro.aspx.cs b/src/Umbraco.Web.UI/umbraco/dialogs/EditMacro.aspx.cs new file mode 100644 index 0000000000..8ae91686d2 --- /dev/null +++ b/src/Umbraco.Web.UI/umbraco/dialogs/EditMacro.aspx.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Umbraco.Web.UI.Umbraco.Dialogs +{ + public partial class EditMacro : global::umbraco.dialogs.editMacro + { + + } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/EditMacro.aspx.designer.cs b/src/Umbraco.Web.UI/umbraco/dialogs/EditMacro.aspx.designer.cs new file mode 100644 index 0000000000..b743b51253 --- /dev/null +++ b/src/Umbraco.Web.UI/umbraco/dialogs/EditMacro.aspx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Umbraco.Dialogs { + + + public partial class EditMacro { + } +} diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx index 88c3b8c59e..0ff9d50bfb 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx +++ b/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx @@ -1,99 +1,97 @@ -<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoPage.Master" ValidateRequest="false" - CodeBehind="editMacro.aspx.cs" AutoEventWireup="True" Inherits="umbraco.dialogs.editMacro" - Trace="false" %> +<%@ Page Language="C#" MasterPageFile="../MasterPages/UmbracoPage.Master" AutoEventWireup="true" CodeBehind="EditMacro.aspx.cs" Inherits="Umbraco.Web.UI.Umbraco.Dialogs.EditMacro" %> <%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols" Assembly="controls" %> - - - - - - - - - - " - onclick="updateMacro()" /> - or - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> - - - - - - - - - - - or - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> - - - - - - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/editMacro.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/editMacro.aspx.cs index d64c2a0509..a6b157fe3b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/editMacro.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/editMacro.aspx.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.ComponentModel; using System.Data; @@ -27,122 +27,126 @@ namespace umbraco.dialogs private cms.businesslogic.macro.Macro m; - public string _macroAlias = ""; + public string _macroAlias = ""; - protected void renderProperties(object sender, EventArgs e) { - if (umb_macroAlias.SelectedValue != "") { - askForProperties(umb_macroAlias.SelectedValue); - }else { - pl_insert.Visible = true; - pl_edit.Visible = false; - } - } + protected void renderProperties(object sender, EventArgs e) + { + if (umb_macroAlias.SelectedValue != "") + { + askForProperties(umb_macroAlias.SelectedValue); + } + else + { + pl_insert.Visible = true; + pl_edit.Visible = false; + } + } - private void askForProperties(string alias) - { - pl_edit.Visible = true; - pl_insert.Visible = false; + private void askForProperties(string alias) + { + pl_edit.Visible = true; + pl_insert.Visible = false; - m = cms.businesslogic.macro.Macro.GetByAlias(alias); + m = cms.businesslogic.macro.Macro.GetByAlias(alias); - String macroAssembly = ""; - String macroType = ""; + String macroAssembly = ""; + String macroType = ""; - _macroAlias = m.Alias; + _macroAlias = m.Alias; - //If no properties, we will exit now... - if (m.Properties.Length == 0) - { - Literal noProps = new Literal(); - noProps.Text = ""; - macroProperties.Controls.Add(noProps); - } - else - { - //if we have properties, we'll render the controls for them... - foreach (cms.businesslogic.macro.MacroProperty mp in m.Properties) - { - macroAssembly = mp.Type.Assembly; - macroType = mp.Type.Type; - try - { + //If no properties, we will exit now... + if (m.Properties.Length == 0) + { + Literal noProps = new Literal(); + noProps.Text = ""; + macroProperties.Controls.Add(noProps); + } + else + { + //if we have properties, we'll render the controls for them... + foreach (cms.businesslogic.macro.MacroProperty mp in m.Properties) + { + macroAssembly = mp.Type.Assembly; + macroType = mp.Type.Type; + try + { - Assembly assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll")); + Assembly assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll")); - Type type = assembly.GetType(macroAssembly + "." + macroType); - interfaces.IMacroGuiRendering typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering; - if (typeInstance != null) - { - Control control = Activator.CreateInstance(type) as Control; - control.ID = mp.Alias; + Type type = assembly.GetType(macroAssembly + "." + macroType); + interfaces.IMacroGuiRendering typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering; + if (typeInstance != null) + { + Control control = Activator.CreateInstance(type) as Control; + control.ID = mp.Alias; - if (!IsPostBack) - { - if (Request["umb_" + mp.Alias] != null) - { - if (Request["umb_" + mp.Alias] != "") - { - type.GetProperty("Value").SetValue(control, Convert.ChangeType(Request["umb_" + mp.Alias], type.GetProperty("Value").PropertyType), null); - } - } - } + if (!IsPostBack) + { + if (Request["umb_" + mp.Alias] != null) + { + if (Request["umb_" + mp.Alias] != "") + { + type.GetProperty("Value").SetValue(control, Convert.ChangeType(Request["umb_" + mp.Alias], type.GetProperty("Value").PropertyType), null); + } + } + } - // register alias - umbraco.uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel(); - pp.Text = mp.Name; - pp.Controls.Add(control); - macroProperties.Controls.Add(pp); + // register alias + umbraco.uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel(); + pp.Text = mp.Name; + pp.Controls.Add(control); + macroProperties.Controls.Add(pp); - pp.Controls.Add(new LiteralControl("\n")); + pp.Controls.Add(new LiteralControl("\n")); - } - else - { - Trace.Warn("umbEditContent", "Type doesn't exist or is not umbraco.interfaces.DataFieldI ('" + macroAssembly + "." + macroType + "')"); - } + } + else + { + Trace.Warn("umbEditContent", "Type doesn't exist or is not umbraco.interfaces.DataFieldI ('" + macroAssembly + "." + macroType + "')"); + } - } - catch (Exception fieldException) - { - Trace.Warn("umbEditContent", "Error creating type '" + macroAssembly + "." + macroType + "'", fieldException); - } - } - } - } + } + catch (Exception fieldException) + { + Trace.Warn("umbEditContent", "Error creating type '" + macroAssembly + "." + macroType + "'", fieldException); + } + } + } + } protected void Page_Load(object sender, System.EventArgs e) { - if (!Page.IsPostBack) - { - if (!string.IsNullOrEmpty(presentation.UmbracoContext.Current.Request["alias"])) - { - askForProperties(presentation.UmbracoContext.Current.Request["alias"]); - } - else - { - IRecordsReader macroRenderings; - if (helper.Request("editor") != "") - macroRenderings = SqlHelper.ExecuteReader("select macroAlias, macroName from cmsMacro where macroUseInEditor = 1 order by macroName"); - else - macroRenderings = SqlHelper.ExecuteReader("select macroAlias, macroName from cmsMacro order by macroName"); + if (!Page.IsPostBack) + { + if (!string.IsNullOrEmpty(presentation.UmbracoContext.Current.Request["alias"])) + { + askForProperties(presentation.UmbracoContext.Current.Request["alias"]); + } + else + { + IRecordsReader macroRenderings; + if (helper.Request("editor") != "") + macroRenderings = SqlHelper.ExecuteReader("select macroAlias, macroName from cmsMacro where macroUseInEditor = 1 order by macroName"); + else + macroRenderings = SqlHelper.ExecuteReader("select macroAlias, macroName from cmsMacro order by macroName"); - umb_macroAlias.DataSource = macroRenderings; - umb_macroAlias.DataValueField = "macroAlias"; - umb_macroAlias.DataTextField = "macroName"; - umb_macroAlias.DataBind(); - macroRenderings.Close(); - } - } - else - { + umb_macroAlias.DataSource = macroRenderings; + umb_macroAlias.DataValueField = "macroAlias"; + umb_macroAlias.DataTextField = "macroName"; + umb_macroAlias.DataBind(); + macroRenderings.Close(); + } + } + else + { - ScriptManager.RegisterOnSubmitStatement(Page, Page.GetType(), "myHandlerKey", "updateMacro()"); - } - } + ScriptManager.RegisterOnSubmitStatement(Page, Page.GetType(), "myHandlerKey", "updateMacro()"); + } + } #region Web Form Designer generated code override protected void OnInit(EventArgs e) @@ -153,18 +157,18 @@ namespace umbraco.dialogs InitializeComponent(); base.OnInit(e); } - + /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() - { - + { + } #endregion - /* + /* private void renderMacro_Click(object sender, EventArgs e) { int pageID = int.Parse(helper.Request("umbPageId")); @@ -207,5 +211,88 @@ namespace umbraco.dialogs } */ - } + + /// + /// pl_edit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pl_edit; + + /// + /// pane_edit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Pane pane_edit; + + /// + /// macroProperties control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder macroProperties; + + /// + /// pl_insert control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pl_insert; + + /// + /// pane_insert control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Pane pane_insert; + + /// + /// pp_chooseMacro control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.PropertyPanel pp_chooseMacro; + + /// + /// umb_macroAlias control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ListBox umb_macroAlias; + + /// + /// bt_insert control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button bt_insert; + + /// + /// renderHolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder renderHolder; + + + } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/editMacro.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/editMacro.aspx.designer.cs deleted file mode 100644 index 78037bdbd8..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/editMacro.aspx.designer.cs +++ /dev/null @@ -1,96 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace umbraco.dialogs { - - - public partial class editMacro { - - /// - /// pl_edit control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pl_edit; - - /// - /// pane_edit control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane_edit; - - /// - /// macroProperties control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder macroProperties; - - /// - /// pl_insert control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pl_insert; - - /// - /// pane_insert control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane_insert; - - /// - /// pp_chooseMacro control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_chooseMacro; - - /// - /// umb_macroAlias control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ListBox umb_macroAlias; - - /// - /// bt_insert control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button bt_insert; - - /// - /// renderHolder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder renderHolder; - } -}
- " - onclick="updateMacro()" /> - or - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> -
- - or - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> -