protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (helper.Request("nodeId") == "") { string appType = ui.Text("sections", helper.Request("app")).ToLower(); pane_chooseNode.Text = ui.Text("create", "chooseNode", appType, this.getUser()) + "?"; DataBind(); } else { int nodeId = int.Parse(helper.Request("nodeId")); //ensure they have access to create under this node!! if (helper.Request("app") == "media" || CheckCreatePermissions(nodeId)) { //pane_chooseName.Text = ui.Text("create", "updateData", this.getUser()); cms.businesslogic.CMSNode c = new cms.businesslogic.CMSNode(nodeId); path.Value = c.Path; pane_chooseNode.Visible = false; panel_buttons.Visible = false; pane_chooseName.Visible = true; XmlDocument createDef = new XmlDocument(); XmlTextReader defReader = new XmlTextReader(Server.MapPath(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/config/create/UI.xml")); createDef.Load(defReader); defReader.Close(); // Find definition for current nodeType XmlNode def = createDef.SelectSingleNode("//nodeType [@alias = '" + Request.QueryString["app"] + "']"); phCreate.Controls.Add(new UserControl().LoadControl(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + def.SelectSingleNode("./usercontrol").FirstChild.Value)); } else { PageNameHolder.type = umbraco.uicontrols.Feedback.feedbacktype.error; PageNameHolder.Text = ui.GetText("rights") + " " + ui.GetText("error"); JTree.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { // Put user code to initialize the page here if (Request.GetItemAsString("nodeId") == "") { var appType = ui.Text("sections", App).ToLower(); pane_chooseNode.Text = ui.Text("create", "chooseNode", appType, UmbracoUser) + "?"; DataBind(); } else { int nodeId = Request.GetItemAs <int>("nodeId"); //ensure they have access to create under this node!! if (App.InvariantEquals(Constants.Applications.Media) || CheckCreatePermissions(nodeId)) { var c = new CMSNode(nodeId); path.Value = c.Path; pane_chooseNode.Visible = false; panel_buttons.Visible = false; pane_chooseName.Visible = true; var createDef = new XmlDocument(); var defReader = new XmlTextReader(Server.MapPath(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/config/create/UI.xml")); createDef.Load(defReader); defReader.Close(); // Find definition for current nodeType XmlNode def = createDef.SelectSingleNode("//nodeType [@alias = '" + App + "']"); phCreate.Controls.Add(new UserControl().LoadControl(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + def.SelectSingleNode("./usercontrol").FirstChild.Value)); } else { PageNameHolder.type = uicontrols.Feedback.feedbacktype.error; PageNameHolder.Text = ui.GetText("rights") + " " + ui.GetText("error"); JTree.DataBind(); } } }
protected void Page_Load(object sender, System.EventArgs e) { JTree.DataBind(); // Put user code to initialize the page here if (!IsPostBack) { //Document Type copy Hack... string app = helper.Request("app"); if (app == "settings") { pane_form.Visible = false; pane_form_notice.Visible = false; pane_settings.Visible = true; ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); cms.businesslogic.web.DocumentType dt = new umbraco.cms.businesslogic.web.DocumentType(int.Parse(helper.Request("id"))); //Load master types... masterType.Attributes.Add("style", "width: 350px;"); masterType.Items.Add(new ListItem(ui.Text("none") + "...", "0")); foreach (cms.businesslogic.web.DocumentType docT in cms.businesslogic.web.DocumentType.GetAllAsList()) { masterType.Items.Add(new ListItem(docT.Text, docT.Id.ToString())); } masterType.SelectedValue = dt.MasterContentType.ToString(); //hack to close window if not a doctype... if (dt == null) { Response.Write("<script type=\"text/javascript\">javascript:parent.window.close()</script>"); } else { rename.Text = dt.Text + " (copy)"; pane_settings.Text = "Make a copy of the document type '" + dt.Text + "' and save it under a new name"; } } else { pane_form.Visible = true; pane_form_notice.Visible = true; pane_settings.Visible = false; // Caption and properies on BUTTON ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); ok.Attributes.Add("disabled", "true"); string currentPath = ""; CMSNode d = new CMSNode(int.Parse(helper.Request("id"))); foreach (string s in d.Path.Split(',')) { if (int.Parse(s) > 0) { currentPath += "/" + new CMSNode(int.Parse(s)).Text; } } // bool validAction = true; // only validate permissions in content if (app == "content" && d.HasChildren) { validAction = ValidAction(helper.Request("mode") == "cut" ? 'M' : 'O'); } if (helper.Request("mode") == "cut") { pane_form.Text = ui.Text("moveOrCopy", "moveTo", d.Text, base.getUser()); pp_relate.Visible = false; } else { pane_form.Text = ui.Text("moveOrCopy", "copyTo", d.Text, base.getUser()); pp_relate.Visible = true; } if (!validAction) { ScriptManager.RegisterStartupScript(this, this.GetType(), "notvalid", "notValid();", true); } } } }
protected void Page_Load(object sender, EventArgs e) { JTree.DataBind(); // Put user code to initialize the page here if (IsPostBack == false) { pp_relate.Text = ui.Text("moveOrCopy", "relateToOriginal"); //Document Type copy Hack... if (CurrentApp == Constants.Applications.Settings) { pane_form.Visible = false; pane_form_notice.Visible = false; pane_settings.Visible = true; ok.Text = ui.Text("general", "ok", UmbracoUser); ok.Attributes.Add("style", "width: 60px"); var documentType = new DocumentType(int.Parse(Request.GetItemAsString("id"))); //Load master types... masterType.Attributes.Add("style", "width: 350px;"); masterType.Items.Add(new ListItem(ui.Text("none") + "...", "0")); foreach (var docT in DocumentType.GetAllAsList()) { masterType.Items.Add(new ListItem(docT.Text, docT.Id.ToString())); } masterType.SelectedValue = documentType.MasterContentType.ToString(); rename.Text = documentType.Text + " (copy)"; pane_settings.Text = "Make a copy of the document type '" + documentType.Text + "' and save it under a new name"; } else { pane_form.Visible = true; pane_form_notice.Visible = true; pane_settings.Visible = false; // Caption and properies on BUTTON ok.Text = ui.Text("general", "ok", UmbracoUser); ok.Attributes.Add("style", "width: 60px"); ok.Attributes.Add("disabled", "true"); IContentBase currContent; if (CurrentApp == "content") { currContent = Services.ContentService.GetById(Request.GetItemAs <int>("id")); } else { currContent = Services.MediaService.GetById(Request.GetItemAs <int>("id")); } var validAction = true; if (CurrentApp == Constants.Applications.Content && Umbraco.Core.Models.ContentExtensions.HasChildren(currContent, Services)) { validAction = ValidAction(currContent, Request.GetItemAsString("mode") == "cut" ? 'M' : 'O'); } if (Request.GetItemAsString("mode") == "cut") { pane_form.Text = ui.Text("moveOrCopy", "moveTo", currContent.Name, UmbracoUser); pp_relate.Visible = false; } else { pane_form.Text = ui.Text("moveOrCopy", "copyTo", currContent.Name, UmbracoUser); pp_relate.Visible = true; } if (validAction == false) { panel_buttons.Visible = false; ScriptManager.RegisterStartupScript(this, GetType(), "notvalid", "notValid();", true); } } } }
protected void Page_Load(object sender, EventArgs e) { JTree.DataBind(); // Put user code to initialize the page here if (IsPostBack == false) { pp_relate.Text = ui.Text("moveOrCopy", "relateToOriginal"); //Document Type copy Hack... if (CurrentApp == "settings") { pane_form.Visible = false; pane_form_notice.Visible = false; pane_settings.Visible = true; ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); var documentType = new DocumentType(int.Parse(helper.Request("id"))); //Load master types... masterType.Attributes.Add("style", "width: 350px;"); masterType.Items.Add(new ListItem(ui.Text("none") + "...", "0")); foreach (var docT in DocumentType.GetAllAsList()) { masterType.Items.Add(new ListItem(docT.Text, docT.Id.ToString())); } masterType.SelectedValue = documentType.MasterContentType.ToString(); rename.Text = documentType.Text + " (copy)"; pane_settings.Text = "Make a copy of the document type '" + documentType.Text + "' and save it under a new name"; } else { pane_form.Visible = true; pane_form_notice.Visible = true; pane_settings.Visible = false; // Caption and properies on BUTTON ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); ok.Attributes.Add("disabled", "true"); var cmsNode = new CMSNode(int.Parse(helper.Request("id"))); var validAction = true; if (CurrentApp == "content" && cmsNode.HasChildren) { validAction = ValidAction(helper.Request("mode") == "cut" ? 'M' : 'O'); } if (helper.Request("mode") == "cut") { pane_form.Text = ui.Text("moveOrCopy", "moveTo", cmsNode.Text, base.getUser()); pp_relate.Visible = false; } else { pane_form.Text = ui.Text("moveOrCopy", "copyTo", cmsNode.Text, base.getUser()); pp_relate.Visible = true; } if (validAction == false) { ScriptManager.RegisterStartupScript(this, this.GetType(), "notvalid", "notValid();", true); } } } }