protected void Run(ClientPipelineArgs args) { Item itemNotNull = Sitecore.Client.GetItemNotNull(args.Parameters["itemid"], Language.Parse(args.Parameters["language"]), new Sitecore.Data.Version(args.Parameters["version"]), Database.GetDatabase(args.Parameters["database"])); UrlString urlString = ResourceUri.Parse("Control:EditPageProperties").ToUrlString(); itemNotNull.Uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), false); }
protected virtual void Run(ClientPipelineArgs args) { var uri = ItemUri.Parse(args.Parameters["uri"]); Item item = Database.GetItem(uri); Error.AssertItemFound(item); if (!args.IsPostBack) { UrlString urlString = ResourceUri.Parse("control:ExportMedia").ToUrlString(); uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "280", "220", "", true); args.WaitForPostBack(); return; } if (string.IsNullOrEmpty(args.Result) || args.Result == "undefined") { return; } string[] paramsArray = args.Result.Split('|'); string exportFileName = paramsArray[0]; if (string.IsNullOrWhiteSpace(exportFileName)) { return; } bool recursive = extractRecursiveParam(paramsArray); string exportfolderName = Settings.DataFolder + "/" + Settings.GetSetting("SharedSource.MediaExporterModule.ExportFolderName", "MediaExports"); string exportFileNameWithExtension = exportFileName.EndsWith(".zip") ? exportFileName : exportFileName + ".zip"; FileUtil.CreateFolder(FileUtil.MapPath(exportfolderName)); string zipPath = FileUtil.MapPath(FileUtil.MakePath(exportfolderName, exportFileNameWithExtension, '/')); Log.Info("Starting export of media items to: " + zipPath, this); Sitecore.Shell.Applications.Dialogs.ProgressBoxes.ProgressBox.Execute( "Export Media Items...", "Export Media Items", new Sitecore.Shell.Applications.Dialogs.ProgressBoxes.ProgressBoxMethod(StartProcess), new[] { item as object, zipPath, recursive }); Context.ClientPage.ClientResponse.Download(zipPath); }
protected static void Run(ClientPipelineArgs args) { if (args.IsPostBack) { if (!args.HasResult) { return; } SheerResponse.Eval("window.parent.Sitecore.PageModes.ChromeManager.handleMessage('chrome:field:imageinserted',{{html:{0}}})", (object)args.Result); } else { UrlString urlString = ResourceUri.Parse("control:TinyMCE.InsertImage").ToUrlString(); urlString.Add("mo", "webedit"); urlString.Add("la", args.Parameters["language"]); SheerResponse.ShowModalDialog(urlString.ToString(), "1200", "700", string.Empty, true); args.WaitForPostBack(); } }
protected void Run(ClientPipelineArgs args) { string index = args.Parameters["id"]; string name = args.Parameters["language"]; string str = args.Parameters["version"]; Item obj = Context.ContentDatabase.Items[index, Language.Parse(name), Sitecore.Data.Version.Parse(str)]; Error.AssertItemFound(obj); if (!SheerResponse.CheckModified()) { return; } if (args.IsPostBack) { Context.ClientPage.SendMessage((object)this, "item:load(id=" + index + ",language=" + name + ",version=" + str + ")"); } else { UrlString urlString = ResourceUri.Parse("control:ArchiveSpecificVersion").ToUrlString(); obj.Uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } }
protected void Add(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, "args"); parentItem = Sitecore.Client.GetItemNotNull(args.Parameters["itemid"], Language.Parse(args.Parameters["language"])); if (args.IsPostBack) { if (!args.HasResult) { return; } if (parentItem == null) { SheerResponse.Alert("Parent item not found."); } else if (!parentItem.Access.CanCreate()) { SheerResponse.Alert("You do not have permission to create items here."); } else { try { string[] strArray = args.Result.Split(new[] { "||" }, StringSplitOptions.None); string id = strArray[0]; string name = Uri.UnescapeDataString(strArray[1]); Item selectedTemplate = Context.ContentDatabase.GetItem(id); Item newChildPage; if (selectedTemplate.TemplateID == TemplateIDs.BranchTemplate) { BranchItem branch = (BranchItem)selectedTemplate; newChildPage = Context.Workflow.AddItem(name, branch, parentItem); } else { TemplateItem template = (TemplateItem)selectedTemplate; newChildPage = Context.Workflow.AddItem(name, template, parentItem); } if (newChildPage == null) { return; } if (strArray.Length == 4) // process displayName and metaTitle inputs { string displayName = Uri.UnescapeDataString(strArray[2]); string metaTitle = Uri.UnescapeDataString(strArray[3]); HealthIS.Apps.Util.SetDisplayNameAndMetaTitle(newChildPage, displayName, metaTitle); } } catch (WorkflowException ex) { Log.Error("Workflow error: could not add item from master", (Exception)ex, (object)this); SheerResponse.Alert(ex.Message); } } } else { Item parentTemplate = parentItem.Template; string parentTemplatePath = parentTemplate.Paths.Path.ToString(); UrlString urlString; if (HealthIS.Apps.Util.isUserDefinedPageItem(parentTemplatePath)) { urlString = ResourceUri.Parse("control:CustomAddFromTemplate").ToUrlString(); } else { urlString = ResourceUri.Parse("control:AddFromTemplate").ToUrlString(); } parentItem.Uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1200px", "700px", string.Empty, true); args.WaitForPostBack(); } }
protected void Add(ClientPipelineArgs args) { if (!SheerResponse.CheckModified()) { return; } Item selectedTemplate = Context.ContentDatabase.GetItem(args.Parameters["Master"]); parentItemID = args.Parameters["itemid"]; Item parent = Sitecore.Client.GetItemNotNull(args.Parameters["itemid"], Language.Parse(args.Parameters["language"])); if (selectedTemplate == null) { SheerResponse.Alert(Translate.Text("Branch \"{0}\" not found.", (object)args.Parameters["Master"])); } else if (selectedTemplate.TemplateID == TemplateIDs.CommandMaster) { string message = selectedTemplate["Command"]; if (string.IsNullOrEmpty(message)) { return; } Context.ClientPage.SendMessage((object)this, message); } else if (args.IsPostBack) { if (!args.HasResult) { return; } if (parent == null) { SheerResponse.Alert("Parent item not found."); } else if (!parent.Access.CanCreate()) { Context.ClientPage.ClientResponse.Alert("You do not have permission to create items here."); } else { try { string[] strArray = args.Result.Split(new[] { "||" }, StringSplitOptions.None); string name = strArray[0]; if (strArray.Length == 1) // new item is NOT a page item, displayName or metaTitle information not needed { if (selectedTemplate.TemplateID == TemplateIDs.BranchTemplate) { BranchItem branch = (BranchItem)selectedTemplate; Context.Workflow.AddItem(name, branch, parent); } else { TemplateItem template = (TemplateItem)selectedTemplate; Context.Workflow.AddItem(name, template, parent); } } else if (strArray.Length == 3) // new item is a page item, process displayName and metaTitle inputs { string displayName = Uri.UnescapeDataString(strArray[1]); string metaTitle = Uri.UnescapeDataString(strArray[2]); Item newChildPage; if (selectedTemplate.TemplateID == TemplateIDs.BranchTemplate) { BranchItem branch = (BranchItem)selectedTemplate; newChildPage = Context.Workflow.AddItem(name, branch, parent); } else { TemplateItem template = (TemplateItem)selectedTemplate; newChildPage = Context.Workflow.AddItem(name, template, parent); } if (newChildPage == null) { return; } HealthIS.Apps.Util.SetDisplayNameAndMetaTitle(newChildPage, displayName, metaTitle); } } catch (WorkflowException ex) { Log.Error("Workflow error: could not add item from master", (Exception)ex, (object)this); SheerResponse.Alert(ex.Message); } } } else { string selectedTemplatePath = selectedTemplate.Paths.Path.ToString(); if (HealthIS.Apps.Util.isUserDefinedPageItem(selectedTemplatePath)) { UrlString urlString = ResourceUri.Parse("control:CustomAddMasterContentManager").ToUrlString(); parent.Uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "500px", "275px", string.Empty, true); } else { SheerResponse.Input("Enter a name for the new item:", selectedTemplate.DisplayName, Settings.ItemNameValidation, "'$Input' is not a valid name.", Settings.MaxItemNameLength); } args.WaitForPostBack(); } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, "args"); parentItemID = args.Parameters["itemid"]; Item itemNotNull = Sitecore.Client.GetItemNotNull(args.Parameters["itemid"], Language.Parse(args.Parameters["language"])); if (args.IsPostBack) { if (!args.HasResult) { return; } string[] strArray = args.Result.Split(new[] { "||" }, StringSplitOptions.None); string id = strArray[0]; string name = Uri.UnescapeDataString(strArray[1]); string displayName = Uri.UnescapeDataString(strArray[2]); string metaTitle = Uri.UnescapeDataString(strArray[3]); if (ShortID.IsShortID(id)) { id = ShortID.Parse(id).ToID().ToString(); } BranchItem branch = Sitecore.Client.ContentDatabase.Branches[id, itemNotNull.Language]; Assert.IsNotNull((object)branch, typeof(BranchItem)); this.ExecuteCommand(itemNotNull, branch, name); Sitecore.Client.Site.Notifications.Disabled = true; Item obj = Context.Workflow.AddItem(name, branch, itemNotNull); Sitecore.Client.Site.Notifications.Disabled = false; if (obj == null) { return; } this.PolicyBasedUnlock(obj); if (!HasPresentationPipeline.Run(obj) || !MainUtil.GetBool(args.Parameters["navigate"], true)) { WebEditCommand.Reload(); } else { UrlOptions defaultOptions = UrlOptions.DefaultOptions; SiteContext site = SiteContext.GetSite(string.IsNullOrEmpty(args.Parameters["sc_pagesite"]) ? Sitecore.Web.WebEditUtil.SiteName : args.Parameters["sc_pagesite"]); if (site == null) { return; } string url = string.Empty; using (new SiteContextSwitcher(site)) { using (new LanguageSwitcher(obj.Language)) url = LinkManager.GetItemUrl(obj, defaultOptions); } WebEditCommand.Reload(new UrlString(url)); SheerResponse.Alert("New page item created."); } HealthIS.Apps.Util.SetDisplayNameAndMetaTitle(obj, displayName, metaTitle); } else if (!itemNotNull.Access.CanCreate()) { SheerResponse.Alert("You do not have permission to create an item here."); } else { UrlString urlString = ResourceUri.Parse("control:CustomAddMasterWebEdit").ToUrlString(); itemNotNull.Uri.AddToUrlString(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "1200px", "700px", string.Empty, true); args.WaitForPostBack(); } }