protected override void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); node = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id"))); ArrayList actionList = BusinessLogic.Actions.Action.GetAll(); foreach (interfaces.IAction a in actionList) { if (a.ShowInNotifier) { CheckBox c = new CheckBox(); c.ID = a.Letter.ToString(); if (base.getUser().GetNotifications(node.Path).IndexOf(a.Letter) > -1) { c.Checked = true; } uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel(); pp.CssClass = "inline"; pp.Text = ui.Text("actions", a.Alias); pp.Controls.Add(c); pane_form.Controls.Add(pp); actions.Add(c); } } }
private umbraco.uicontrols.PropertyPanel AddProperty(string Caption, Control C) { umbraco.uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel(); pp.Controls.Add(C); pp.Text = Caption; return(pp); }
protected override void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); node = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id"))); ArrayList actionList = BusinessLogic.Actions.Action.GetAll(); foreach (interfaces.IAction a in actionList) { if (a.ShowInNotifier) { CheckBox c = new CheckBox(); c.ID = a.Letter.ToString(); if (base.getUser().GetNotifications(node.Path).IndexOf(a.Letter) > -1) c.Checked = true; uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel(); pp.Text = ui.Text("actions", a.Alias); pp.Controls.Add(c); pane_form.Controls.Add(pp); actions.Add(c); } } }
protected void Page_Load(object sender, System.EventArgs e) { pane_edit.Text = ui.Text("general", "edit", this.getUser()) + " " + ui.Text("general", "macro", this.getUser()); pane_insert.Text = ui.Text("general", "insert", this.getUser()) + " " + ui.Text("general", "macro", this.getUser()); if (Request["macroID"] != null || Request["macroAlias"] != null) { // Put user code to initialize the page here cms.businesslogic.macro.Macro m; if (helper.Request("macroID") != "") { m = new umbraco.cms.businesslogic.macro.Macro(int.Parse(helper.Request("macroID"))); } else { m = cms.businesslogic.macro.Macro.GetByAlias(helper.Request("macroAlias")); } String macroAssembly = ""; String macroType = ""; 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")); 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 (Request[mp.Alias] != null) { if (Request[mp.Alias] != "") { type.GetProperty("Value").SetValue(control, Convert.ChangeType(Request[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); /* * macroProperties.Controls.Add(new LiteralControl("<script>\nregisterAlias('" + control.ID + "');\n</script>")); * macroProperties.Controls.Add(new LiteralControl("<tr><td class=\"propertyHeader\">" + mp.Name + "</td><td class=\"propertyContent\">")); * macroProperties.Controls.Add(control); * macroProperties.Controls.Add(new LiteralControl("</td></tr>")); */ } 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); } } } 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"); } macroAlias.DataSource = macroRenderings; macroAlias.DataValueField = "macroAlias"; macroAlias.DataTextField = "macroName"; macroAlias.DataBind(); macroRenderings.Close(); } }
private void askForProperties(string alias) { pl_edit.Visible = true; pl_insert.Visible = false; m = cms.businesslogic.macro.Macro.GetByAlias(alias); String macroAssembly = ""; String macroType = ""; _macroAlias = m.Alias; //If no properties, we will exit now... if (m.Properties.Length == 0) { Literal noProps = new Literal(); noProps.Text = "<script type='text/javascript'>updateMacro()</script>"; 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")); 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); } } } // 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("<script type=\"text/javascript\"> registerAlias('" + control.ClientID + "','" + mp.Alias + "'); </script>\n")); } 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); } } } }
protected void Page_Load(object sender, System.EventArgs e) { pane_edit.Text = ui.Text("general", "edit",this.getUser()) + " " + ui.Text("general", "macro",this.getUser()); pane_insert.Text = ui.Text("general", "insert",this.getUser()) + " " + ui.Text("general", "macro",this.getUser()); if (Request["macroID"] != null || Request["macroAlias"] != null) { // Put user code to initialize the page here cms.businesslogic.macro.Macro m; if (helper.Request("macroID") != "") m = new umbraco.cms.businesslogic.macro.Macro(int.Parse(helper.Request("macroID"))); else m = cms.businesslogic.macro.Macro.GetByAlias(helper.Request("macroAlias")); String macroAssembly = ""; String macroType = ""; 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")); 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 (Request[mp.Alias] != null) { if (Request[mp.Alias] != "") { type.GetProperty("Value").SetValue(control, Convert.ChangeType(Request[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); /* macroProperties.Controls.Add(new LiteralControl("<script>\nregisterAlias('" + control.ID + "');\n</script>")); macroProperties.Controls.Add(new LiteralControl("<tr><td class=\"propertyHeader\">" + mp.Name + "</td><td class=\"propertyContent\">")); macroProperties.Controls.Add(control); macroProperties.Controls.Add(new LiteralControl("</td></tr>")); */ } 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); } } } 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"); macroAlias.DataSource = macroRenderings; macroAlias.DataValueField = "macroAlias"; macroAlias.DataTextField = "macroName"; macroAlias.DataBind(); macroRenderings.Close(); } }
private void AskForProperties(string alias) { pl_edit.Visible = true; pl_insert.Visible = false; MacroObject = cms.businesslogic.macro.Macro.GetByAlias(alias); _macroAlias = MacroObject.Alias; //If no properties, we will exit now... if (MacroObject.Properties.Length == 0) { //var noProps = new Literal(); //noProps.Text = "<script type='text/javascript'>Umbraco.Dialogs.EditMacro.getInstance().updateMacro()</script>"; //macroProperties.Controls.Add(noProps); } else { //if we have properties, we'll render the controls for them... foreach (cms.businesslogic.macro.MacroProperty mp in MacroObject.Properties) { var macroAssembly = mp.Type.Assembly; var macroType = mp.Type.Type; try { Assembly assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll")); Type type = assembly.GetType(macroAssembly + "." + macroType); var typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering; if (typeInstance != null) { var 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); } } } // register alias var pp = new umbraco.uicontrols.PropertyPanel(); pp.Text = mp.Name; pp.Controls.Add(control); macroProperties.Controls.Add(pp); pp.Controls.Add(new LiteralControl("<script type=\"text/javascript\">Umbraco.Dialogs.EditMacro.getInstance().registerAlias('" + control.ClientID + "','" + mp.Alias + "'); </script>\n")); } 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); } } } }
private umbraco.uicontrols.PropertyPanel AddProperty(string Caption, Control C) { umbraco.uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel(); pp.Controls.Add(C); pp.Text = Caption; return pp; }