public override void Execute(CommandContext context) { if (!AnalyticsSettings.Enabled) { SheerResponse.Alert(Translate.Text("You need to enable Analytics to use this functionality")); } else { Assert.ArgumentNotNull((object)context, "context"); if (context.Items.Length != 1) return; if (!SecurityHelper.CanRunApplication("Content Editor/Ribbons/Chunks/Analytics - Attributes/Attributes")) { SheerResponse.Alert("You don't have sufficient rights for this operation"); } else { NameValueCollection parameters = new NameValueCollection(); parameters["items"] = this.SerializeItems(context.Items); parameters["fieldid"] = context.Parameters["fieldid"]; parameters["user"] = Context.User.Name; parameters["searchString"] = context.Parameters.GetValues("url")[0].Replace("\"", string.Empty); ClientPipelineArgs args = new ClientPipelineArgs(parameters); if (ContinuationManager.Current != null) ContinuationManager.Current.Start((ISupportsContinuation)this, "Run", args); else Context.ClientPage.Start((object)this, "Run", args); } } }
// Methods public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); var parameters = new NameValueCollection(); var args = new ClientPipelineArgs(parameters); ContinuationManager.Current.Start(this, "Run", args); }
public void SelectFields(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (!args.IsPostBack) { UrlString urlString = new UrlString(UIUtil.GetUri("control:TreeListExEditor")); UrlHandle urlHandle = new UrlHandle(); urlHandle["title"] = PullUpFieldsSettings.SelectFieldsDialogTitle; urlHandle["text"] = PullUpFieldsSettings.SelectFieldsDialogText; urlHandle["source"] = GetSelectFieldsDialogSource(args); urlHandle.Add(urlString); SheerResponse.ShowModalDialog ( urlString.ToString(), PullUpFieldsSettings.SelectFieldsDialogWidth, PullUpFieldsSettings.SelectFieldsDialogHeight, string.Empty, true ); args.WaitForPostBack(); } else if (args.HasResult) { args.Parameters["fieldIds"] = args.Result; args.IsPostBack = false; } else { CancelOperation(args); } }
/// <summary> /// This method is fired in the pipeline as a validation check before the process executes. /// </summary> /// <param name = "args"></param> /// <returns></returns> public void ConstrainMove(ClientPipelineArgs args) { //check for postback //this occurs when an Administrator fires the event and is prompted with a confirmation message if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && args.Result != "yes") { args.AbortPipeline(); } return; } //get selected item and target item Assert.ArgumentNotNull(args, "args"); List<Item> items = GetItems(args); if (items.Count == 0) return; Assert.IsNotNull(items, typeof (List<Item>)); Item targetItem = GetTarget(args); Assert.IsNotNull(targetItem, typeof (Item)); //validate the event if (!MoveUtil.IsValidCopy(items[0], targetItem)) { //validation failed, prompt user MoveUtil.PromptUser(args); } }
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); }
/// <summary> /// This method is fired in the pipeline as a validation check before the process executes. /// </summary> /// <param name = "args"></param> /// <returns></returns> public void ConstrainDragTo(ClientPipelineArgs args) { //check for postback //this occurs when an Administrator fires the event and is prompted with a confirmation message if (args.IsPostBack) { if (!string.IsNullOrEmpty(args.Result) && args.Result != "yes") { args.AbortPipeline(); } return; } //get database as listed in args Database database = GetDatabase(args); if (database == null) return; //get selected item and target item Item targetItem = GetTarget(args); Item copiedItem = GetSource(args, database); if (targetItem.IsNull() || copiedItem.IsNull()) return; //validate the event if (!MoveUtil.IsValidCopy(copiedItem, targetItem)) { //validation failed, prompt user MoveUtil.PromptUser(args); } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string dbName = args.Parameters["databasename"]; string id = args.Parameters["id"]; string lang = args.Parameters["language"]; string ver = args.Parameters["version"]; Database database = Factory.GetDatabase(dbName); Assert.IsNotNull(database, dbName); Item obj = database.Items[id, Language.Parse(lang), Version.Parse(ver)]; if (obj == null) { SheerResponse.Alert("Item not found."); } else { if (!SheerResponse.CheckModified()) return; if (args.IsPostBack) { return; } UrlString urlString = new UrlString(UIUtil.GetUri("control:SchedulePublish")); urlString.Append("id", obj.ID.ToString()); urlString.Append("unpublish", args.Parameters["unpublish"]); SheerResponse.ShowModalDialog(urlString.ToString(), "600", "600", string.Empty, true); args.WaitForPostBack(); } }
/// <summary> /// Run Command /// </summary> /// <param name="args"> /// The args. /// </param> protected void Run(ClientPipelineArgs args) { if (args.IsPostBack) { if (args.HasResult) { if (args.Result == "yes") { var parentId = Context.ContentDatabase.GetItem(args.Parameters["id"]).Parent.ID; Context.ClientPage.SendMessage(this, "item:bucket(id=" + parentId + ")"); Context.ClientPage.SendMessage(this, "item:refreshchildren(id=" + parentId + ")"); args.Result = string.Empty; } else { args.Result = string.Empty; args.IsPostBack = false; return; } } } else { Context.ClientPage.ClientResponse.Confirm("You have reached the recommended sibling item count and it is recommended to turn the parent item into a bucket. Continue?"); args.WaitForPostBack(); } }
public void Start(ClientPipelineArgs args) { if (args.IsPostBack) { Database database = Sitecore.Configuration.Factory.GetDatabase( Settings.Instance.ConfigurationDatabase); Assert.IsNotNull(database, "configuration database is null"); Item report = database.GetItem(Current.Context.ReportItem.ID); Assert.IsNotNull(report, "can't find report item"); Sitecore.Context.ClientPage.SendMessage(this, "ASR.MainForm:updateparameters"); using (new Sitecore.SecurityModel.SecurityDisabler()) { Item newItem = ItemUtil.AddFromTemplate(args.Result, "System/ASR/Saved Report", report); using (new EditContext(newItem)) { newItem["parameters"] = Current.Context.ReportItem.SerializeParameters("^", "&"); newItem[Sitecore.FieldIDs.Owner] = Sitecore.Context.User.Name; } } } else { Sitecore.Context.ClientPage.ClientResponse.Input("Enter the name of the new blog entry:", "report name", Sitecore.Configuration.Settings.ItemNameValidation, "'$Input' is not a valid name.", Sitecore.Configuration.Settings.MaxItemNameLength); args.WaitForPostBack(true); } }
protected virtual void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); var id = args.Parameters["id"]; var language = args.Parameters["language"]; var version = args.Parameters["version"]; var item = Context.ContentDatabase.Items[id, Language.Parse(language), Version.Parse(version)]; if (item == null) { SheerResponse.Alert("Item not found"); return; } if (Context.IsAdministrator || item.Access.CanWrite() && (item.Locking.CanLock() || item.Locking.HasLock())) { if (SheerResponse.CheckModified()) { Version[] versionNumbers = item.Versions.GetVersionNumbers(false); Log.Audit(this, "Add version:{0}", AuditFormatter.FormatItem(item)); var newVersion = item.Versions.AddVersion(); if (newVersion != null) { Context.ClientPage.SendMessage(this,string.Format("item:versionadded(id={0},version={1},language={2})",newVersion.ID,newVersion.Version,newVersion.Language)); } } } else { SheerResponse.Alert("You don't have permissions to do this"); } }
/// <summary> /// Copied Sitecore.Shell.Framework.Pipelines.DragItemTo /// Method is listed as private in Sitecore /// </summary> /// <param name = "args"></param> /// <returns>Item</returns> private static Database GetDatabase(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Database database = Factory.GetDatabase(args.Parameters["database"]); Error.Assert(database != null, "Database \"" + args.Parameters["database"] + "\" not found."); return database; }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (args.Result == "yes") { var str = new ListString(args.Parameters["item"]); foreach (string str2 in str) { Directory.Delete(str2, true); } SheerResponse.SetLocation(string.Empty); } } else { var str3 = new ListString(args.Parameters["item"]); if (str3.Count == 1) { SheerResponse.Confirm(Translate.Text("Are you sure you want to permanently delete \"{0}\"?", new object[] { str3 })); } else { SheerResponse.Confirm(Translate.Text("Are you sure you want to permanently delete these {0} items?", new object[] { str3.Count })); } args.WaitForPostBack(); } }
protected virtual void Run(ClientPipelineArgs args) { string databaseName = args.Parameters["databasename"]; string id = args.Parameters["id"]; Database database = Factory.GetDatabase(databaseName); Assert.IsNotNull(database, typeof (Database), "Database \"" + database + "\" not found.", new object[0]); Item item = database.Items[id]; if (item != null) { if (item.Fields[FieldIDs.LayoutField] != null && item.Fields[FieldIDs.LayoutField].Value != string.Empty) { if (!args.IsPostBack) { UrlString url = new UrlString(UIUtil.GetUri("control:Calendar.ConfigureControls")); url.Append("id", item.ID.ToString()); url.Append("db", item.Database.Name); Windows.RunApplication("Calendar ConfigureControls", url.GetUrl()); } } else { Context.ClientPage.ClientResponse.Alert(ResourceManager.Localize("ITEM_HAS_NO_LAYOUT")); } } else { SheerResponse.Alert("Item not found.", new string[0]); } }
protected void Process(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) return; SheerResponse.ShowModalDialog(new UrlString(UIUtil.GetUri("control:ConfigurationWizard")).ToString(), true); args.WaitForPostBack(); }
public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); var layoutAsJson = WebUtil.GetFormValue("scLayout"); var deviceId = ShortID.Decode(WebUtil.GetFormValue("scDeviceID")); var uniqueId = context.Parameters["referenceId"]; var layoutAsXml = Sitecore.Web.WebEditUtil.ConvertJSONLayoutToXML(layoutAsJson); Assert.IsNotNull(layoutAsXml, "layoutAsXml"); WebUtil.SetSessionValue(this.HandleName, layoutAsXml); var layoutDef = LayoutDefinition.Parse(layoutAsXml); var deviceDefinition = layoutDef.GetDevice(deviceId); var index = deviceDefinition.GetIndex(uniqueId); var parameters = new NameValueCollection(); parameters["handleName"] = HandleName; parameters["deviceId"] = deviceId; parameters["selectedindex"] = index.ToString(); parameters.Add(context.Parameters); var args = new ClientPipelineArgs(parameters); Sitecore.Context.ClientPage.Start(this, "Run", args); }
public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); string str = context.Parameters["ids"]; if (!String.IsNullOrEmpty(str)) { TargetAudience ta = Sitecore.Modules.EmailCampaign.Factory.GetTargetAudience(str); if (ta != null) { Item item = ta.InnerItem; if (CanBeDeleted(ta)) { ClientPipelineArgs args = new ClientPipelineArgs(); args.Parameters["rid"] = str; args.Parameters["rname"] = ta.Name; Util.StartClientPipeline(this, "Run", args); } else { NotificationManager.Instance.Notify("MessageFromCommand", new MessageEventArgs("This Recipient List is used in messages and cannot be deleted.")); return; } } } else { NotificationManager.Instance.Notify("MessageFromCommand", new MessageEventArgs("Please select a Recipient List.")); } }
protected virtual void HandleResult(ClientPipelineArgs args) { var layoutAsXml = WebUtil.GetSessionString(args.Parameters["handleName"]); var layoutAsJson = Sitecore.Web.WebEditUtil.ConvertXMLLayoutToJSON(layoutAsXml); SheerResponse.SetAttribute("scLayoutDefinition", "value", layoutAsJson); SheerResponse.Eval("window.parent.Sitecore.PageModes.ChromeManager.handleMessage('chrome:rendering:propertiescompleted');"); }
protected virtual void Run(ClientPipelineArgs args) { //if (Sitecore.Context.IsAdministrator || allowNonAdminDownload()) //{ // string tempPath = GetFilePath(); // SheerResponse.Download(tempPath); //} //else //{ if (!args.IsPostBack) { string email = Sitecore.Context.User.Profile.Email; SheerResponse.Input("Enter your email address", email); args.WaitForPostBack(); } else { if (args.HasResult) { System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add(args.Result); string tempPath = GetFilePath(); message.Attachments.Add(new System.Net.Mail.Attachment(tempPath)); message.Subject = string.Format("ASR Report ({0})", Current.Context.ReportItem.Name); message.From = new System.Net.Mail.MailAddress(Current.Context.Settings.EmailFrom); message.Body = "Attached is your report sent at " + DateTime.Now.ToString("dd/MM/yyyy HH:mm"); Sitecore.MainUtil.SendMail(message); } } //} }
protected virtual void StartWizard(ClientPipelineArgs args) { if (!SheerResponse.CheckModified()) { return; } if (!args.IsPostBack) { UrlString url = new UrlString(UIUtil.GetUri("control:DMSPollWizard")); url.Add("id", args.Parameters["parentID"]); url.Add("language", args.Parameters["language"]); url.Add("showpageeditorfunctionality", args.Parameters["showpageeditorfunctionality"]); SheerResponse.ShowModalDialog(url.ToString(), true); args.WaitForPostBack(); } else { _wizardPipeline = null; if (args.HasResult) { var pollItem = Context.ContentDatabase.GetItem(args.Result); if (pollItem != null) { var itemToRefresh = pollItem.Parent; Context.ClientPage.SendMessage(this, "item:updated(id=" + itemToRefresh.ID + ")"); Context.ClientPage.SendMessage(this, "item:refreshchildren(id=" + itemToRefresh.ID + ")"); } } } }
protected static void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (SheerResponse.CheckModified()) { if (args.IsPostBack) { SheerResponse.Eval("window.top.location.href=window.top.location.href"); var itemId = ParseForAttribute(args.Result, "id"); Item item = Sitecore.Context.ContentDatabase.GetItem(itemId); if (item.IsNotNull()) { var url = new UrlString("http://" + HttpContext.Current.Request.Url.Host + LinkManager.GetItemUrl(item).Replace("/sitecore/shell", "")); WebEditCommand.Reload(url); } } else { SheerResponse.ShowModalDialog( new UrlString("/sitecore/shell/Applications/Dialogs/Bucket%20link.aspx?").ToString(), "1000", "700", "", true); args.WaitForPostBack(); } } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Item item = DeserializeItems(args.Parameters["items"])[0]; if (args.IsPostBack) { if (args.HasResult) { string datePath = Utilities.NormalizeDate(DateTime.Now); Item eventItem = Utilities.CreateDatePath(item, datePath); if (eventItem != null) { eventItem = eventItem.Add(args.Result, new TemplateID(CalendarIDs.EventTemplate)); } } } else { string text = "Enter the name of the new item:"; string defaultValue = "New Event"; Context.ClientPage.ClientResponse.Input(text, defaultValue, Settings.ItemNameValidation, "'$Input' is not a valid name.", 100); args.WaitForPostBack(); } }
protected void Run(ClientPipelineArgs args) { if (!args.IsPostBack) { SheerResponse.CheckModified(true); args.WaitForPostBack(); } else if (args.Result != "cancel") { if (args.HasResult && (args.Result != "cancel")) { if ((args.Result == "yes") || (args.Result == "no")) { if (args.Result == "yes") { this.SaveChanges(); } SheerResponse.Input(EcmTexts.Localize("Enter the name of the new Recipient List:", new object[0]), "New Recipient List", Settings.ItemNameValidation, EcmTexts.Localize("'{0}' is not a valid name.", new object[] { "$Input" }), 100); args.WaitForPostBack(); } else { if (CreateList(args.Result)) { NotificationManager.Instance.Notify("RefreshRecipientLists", new EventArgs()); } else { SheerResponse.Alert(EcmTexts.Localize("The '{0}' list already exists, please choose another name.", new object[] { args.Result }), new string[0]); } } } } }
public void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string controlId = args.Parameters["controlid"]; if (args.IsPostBack) { if (!args.HasResult) return; SheerResponse.SetAttribute("scHtmlValue", "value", YouTubeVideoField.FormatValueForPageEditorDisplay(args.Result)); SheerResponse.SetAttribute("scPlainValue", "value", args.Result); SheerResponse.Eval("scSetHtmlValue('" + controlId + "', false, true)"); } else { var urlString = new UrlString(UIUtil.GetUri(DialogUrl)); urlString["val"] = args.Parameters.Get("fieldValue"); Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), "650px", "700px", string.Empty, true); args.WaitForPostBack(); } }
/// <summary> /// If postback: sets profile key to supplied value /// Otherwise: prompt user for new value /// </summary> /// <param name="args">The args.</param> protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.Parameters["profilename"], "profilename"); Assert.ArgumentNotNull(args.Parameters["profilekey"], "profilekey"); if (args.IsPostBack) { if (args.HasResult) { int profileKeyValue; if(int.TryParse(args.Result,out profileKeyValue)) { PersonaHelper personaHelper = PersonaHelper.GetHelper(); personaHelper.UpdateProfileKey(args.Parameters["profilename"], args.Parameters["profilekey"], profileKeyValue); SheerResponse.Redraw(); } } } else { Context.ClientPage.ClientResponse.Input("Please enter new profile key value.", "0"); args.WaitForPostBack(); } }
public new void Execute(ClientPipelineArgs args) { var item = Context.ContentDatabase.GetItem(args.Parameters[1]); if (item.IsNotNull()) { Error.AssertItem(item, "item"); if (!args.IsPostBack) { if (item.IsABucket()) { new ClientResponse().Confirm("You are about to delete an item which is an item bucket with lots of hidden items below it. Are you sure you want to do this?"); args.WaitForPostBack(); } } else { if (args.Result != "yes") { args.AbortPipeline(); args.Result = string.Empty; args.IsPostBack = false; return; } Event.RaiseEvent("item:bucketing:deleting", args, this); } } }
public void Run(ClientPipelineArgs args) { string fieldValue = args.Parameters["fieldValue"]; if (!args.IsPostBack) { var url = UIUtil.GetUri("control:ProductBrowser", "product=" + fieldValue); SheerResponse.ShowModalDialog(url,true); args.WaitForPostBack(); } else { if (args.HasResult) { var result = args.Result; SheerResponse.SetAttribute("scHtmlValue", "value", result); SheerResponse.SetAttribute("scPlainValue", "value", result); var builder = new ScriptInvokationBuilder("scSetHtmlValue"); builder.AddString(args.Parameters["controlid"], new object[0]); if (string.IsNullOrEmpty(result)) { builder.Add("true"); } SheerResponse.Eval(builder.ToString()); } } }
/// <summary> /// This method runs the rotating image modal /// </summary> /// <param name="args"></param> public void RunEditForm(ClientPipelineArgs args) { if (!args.IsPostBack) { //get url for field type selector modal UrlString ustr = new UrlString(UIUtil.GetUri("control:FieldSuiteEditForm")); ustr.Parameters.Add(args.Parameters); //open field type selector Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(ustr.ToString(), "712", "485", "", true); //wait for response args.WaitForPostBack(); } else { string itemId = args.Parameters["id"]; if(!string.IsNullOrEmpty(itemId) && Sitecore.Context.ContentDatabase != null) { Item item = Sitecore.Context.ContentDatabase.GetItem(itemId); if(item.IsNotNull()) { UnlockItem(item); //send command to update list update's field gutter if (args.Parameters["fieldid"] != null && !string.IsNullOrEmpty(args.Parameters["fieldid"])) { string fieldGutterHtml = GetFieldGutterHtml(new FieldGutterArgs(item, args.Parameters["fieldid"])); SheerResponse.Eval("FieldSuite.Fields.UpdateItemFieldGutter(\"" + args.Parameters["fieldid"] + "\",\"" + HttpUtility.HtmlEncode(fieldGutterHtml) + "\",\"" + item.ID + "\")"); } } } } }
public void RunCommand(ClientPipelineArgs args) { //get parameters from the ui Sitecore.Context.ClientPage.SendMessage(this, "ASR.MainForm:updateparameters"); Current.Context.Report = Current.Context.ReportItem.TransformToReport(Current.Context.Report); //if (Current.Context.Report == null) //{ // Current.Context.Report = new Report(); //} //foreach (var sItem in Current.Context.ReportItem.Scanners) //{ // Current.Context.Report.AddScanner(sItem); //} //foreach (var vItem in Current.Context.ReportItem.Viewers) //{ // Current.Context.Report.AddViewer(vItem); //} //foreach (var fItem in Current.Context.ReportItem.Filters) //{ // Current.Context.Report.AddFilter(fItem); //} Sitecore.Shell.Applications.Dialogs.ProgressBoxes.ProgressBox.Execute( "Scanning...", "Scanning items", "", Current.Context.Report.Run, "MainForm:runfinished", new object[] { }); }
public override void Execute(CommandContext context) { /*TODO * Prüfung auf Cloned und Adoption Item * Prüfen auf Berechtigung Adoption:Change * JA: Disable field editing! Info Anzeige dass Item Adopted ist und nicht geändert werden darf * */ Assert.ArgumentNotNull(context, "context"); if (context.Items.Length == 1) { NameValueCollection parameters = new NameValueCollection(); parameters["items"] = base.SerializeItems(context.Items); parameters["domainname"] = context.Parameters["domainname"]; parameters["accountname"] = context.Parameters["accountname"]; parameters["accounttype"] = context.Parameters["accounttype"]; parameters["fieldid"] = context.Parameters["fieldid"]; ClientPipelineArgs args = new ClientPipelineArgs(parameters); if (ContinuationManager.Current != null) { ContinuationManager.Current.Start(this, "Run", args); } else { Context.ClientPage.Start(this, "Run", args); } } }
protected void Run(ClientPipelineArgs args) { if (!args.IsPostBack) { SheerResponse.CheckModified(true); args.WaitForPostBack(); } else if ((args.Result != "cancel") && (args.HasResult && (args.Result != "cancel"))) { if ((args.Result == "yes") || (args.Result == "no")) { if (args.Result == "yes") { this.SaveChanges(); } SheerResponse.Input("Enter the number of latest emails to export: ", "50", "^[1-9][0-9]", String.Format("'{0}' is not a valid number.", new object[] { "$Input" }), 100); args.WaitForPostBack(); } else if (this.CreateList(args.Result)) { //SheerResponse.Alert("Finished", new string[0]); //NotificationManager.Instance.Notify("RefreshRecipientLists", new EventArgs()); } else { //SheerResponse.Alert(EcmTexts.Localize("The '{0}' list already exists, please choose another name.", new object[] { args.Result }), new string[0]); } } }
public void ProcessDelete(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.Parameters[CancelationKey] == CancelationValue) { return; } var itemIDs = new ListString(args.Parameters["items"]); foreach (var itemID in itemIDs) { if (!string.IsNullOrWhiteSpace((string)args.CustomData[itemID]) && args.CustomData[itemID + "parentID"] != null) { this.AddToTable(PrefixDelete, (string)args.CustomData[itemID], (ID)args.CustomData[itemID + "parentID"]); } } }
protected void ShowRelated(ClientPipelineArgs args) { if (args.IsPostBack) { } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.RelatedScreen"))); UrlHandle handle = new UrlHandle(); handle["itemId"] = ItemId; handle["taxonomyValue"] = GetValue(); handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "900px", "400px", string.Empty, true); args.WaitForPostBack(); } }
public void Run(ClientPipelineArgs args) { if (!args.IsPostBack) { ShowDatasourceSettingsDialog(); args.WaitForPostBack(); } else { if (!args.HasResult) { return; } var itemId = ID.Parse(args.Parameters["item"]); CreateDatasourceConfigurationItem(itemId, args.Result); } }
protected void SaveItem(ClientPipelineArgs args) { if (string.IsNullOrEmpty(ScriptItemId)) { SaveAs(args); } else { var scriptItem = ScriptItem; if (scriptItem == null) { return; } scriptItem.Edit( editArgs => { scriptItem.Fields[ScriptItemFieldNames.Script].Value = Editor.Value; }); SheerResponse.Eval("cognifide.powershell.updateModificationFlag(true);"); } }
protected void RunPlugin(ClientPipelineArgs args) { var scriptSession = ScriptSessionManager.NewSession(ApplicationNames.ISE, true); var scriptDb = args.Parameters["scriptDb"]; var scriptItem = args.Parameters["scriptId"]; var script = Factory.GetDatabase(scriptDb).GetItem(scriptItem); if (!script.IsPowerShellScript()) { return; } scriptSession.SetVariable("scriptText", Editor.Value); scriptSession.SetVariable("selectionText", SelectionText.Value.Trim()); scriptSession.SetVariable("scriptItem", ScriptItem); scriptSession.Interactive = true; JobExecuteScript(args, script[Templates.Script.Fields.ScriptBody], scriptSession, true, false); }
private FieldEditorOptions GetOptions(ClientPipelineArgs args, NameValueCollection form) { Item item = Database.GetItem(ItemUri.Parse(args.Parameters["uri"])); List <FieldDescriptor> fieldDescriptors = new List <FieldDescriptor>(); fieldDescriptors.Add(new FieldDescriptor(item, Data.ProjectFieldId.ToString())); List <FieldDescriptor> fieldDescriptors1 = fieldDescriptors; Assert.IsNotNull(item, "item"); FieldEditorOptions pageEditFieldEditorOption = new FieldEditorOptions(fieldDescriptors1); pageEditFieldEditorOption.Title = "Select Project"; pageEditFieldEditorOption.Icon = ""; pageEditFieldEditorOption.DialogTitle = "Select Project"; FieldEditorOptions pageEditFieldEditorOption1 = pageEditFieldEditorOption; return(pageEditFieldEditorOption1); }
protected virtual void ToggleRuntimeBreakpoint(ClientPipelineArgs args) { var line = int.Parse(args.Parameters["Line"]) + 1; var state = args.Parameters["State"] == "true"; if (!(ScriptSessionManager.GetSessionIfExists(Monitor.SessionID) is ScriptSession session)) { return; } var bPointScript = state ? $"Set-PSBreakpoint -Script {session.DebugFile} -Line {line}" : $"Get-PSBreakpoint -Script {session.DebugFile} | ? {{ $_.Line -eq {line}}} | Remove-PSBreakpoint"; bPointScript += " | Out-Null"; session.TryInvokeInRunningSession(bPointScript); InBreakpoint = false; }
private void Refresh(ClientPipelineArgs args) { Item rootItem = GetItemByUri(args.Parameters["itemUri"]); if (rootItem == null) { return; } List <IndexingQueueItem> itemsToIndex = this.GetIndexingList(rootItem); this.indexingService.IndexPageItemsAsync(itemsToIndex).Wait(); if (Context.Job != null) { Context.Job.Status.Messages.Add("Item indexed"); } }
private bool RequestSessionElevationEx(ClientPipelineArgs args, string appName, string action) { if (!SessionElevationManager.IsSessionTokenElevated(appName)) { if (args.Parameters.AllKeys.Contains("elevationResult")) { SessionElevationErrors.OperationRequiresElevation(); return(false); } var pipelineArgs = new ClientPipelineArgs(); pipelineArgs.Parameters["message"] = args.Parameters["message"]; pipelineArgs.Parameters["app"] = appName; pipelineArgs.Parameters["action"] = action; Context.ClientPage.Start(this, nameof(SessionElevationPipeline), pipelineArgs); return(false); } return(true); }
/// <summary>Updates the HTML.</summary> /// <param name="args">The arguments.</param> protected virtual void UpdateHtml(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, ExtensionMethods.nameof(() => args)); string str = args.Result; if (str == "__#!$No value$!#__") { str = string.Empty; } string text = this.ProcessValidateScripts(str); if (text != this.Value) { this.SetModified(); } SheerResponse.Eval("scForm.browser.getControl('" + this.ID + "').contentWindow.scSetText(" + StringUtil.EscapeJavascriptString(text) + ")"); SheerResponse.Eval("scContent.startValidators()"); }
private void runCommand(ClientPipelineArgs args) { string commandname = args.Parameters["name"]; StringList sl = new StringList(); foreach (var item in ItemList.SelectedItems) { sl.Add(item.Value); } if (sl.Count > 0) { Current.Context.ReportItem.RunCommand(commandname, sl); } else { SheerResponse.Alert("You need to select at least one item"); } }
private void Rebuild(ClientPipelineArgs args) { var languages = LanguageManager.GetLanguages(Database.GetDatabase(Settings.IndexingDatabase)); foreach (Language language in languages) { string indexName = this.indexingService.GetPagesIndexName(language.Name); Context.Job.Status.Messages.Add("Rebuilding index: " + indexName); var messages = this.indexingService.RebuildIndex(language.Name); foreach (string message in messages) { Context.Job.Status.Messages.Add(message); } } }
protected void OnPollSettingsChange(ClientPipelineArgs args) { if (CurrentPoll != null) { var fieldCollection = new NameValueCollection { { "fields", "Intro|Thank you|__Tracking" }, { "title", string.Format("Change settings for the poll: {0}", CurrentPoll.Name) }, { "icon", CurrentPoll.InnerItem.Appearance.Icon } }; CommandContext commandContext = new CommandContext(CurrentPoll.InnerItem); //start the Field Editor commandContext.Parameters.Add(fieldCollection); var fieldEditor = new PollFieldEditor(); fieldEditor.Execute(commandContext); } }
protected virtual void UpdateProgress(ClientPipelineArgs args) { var showProgress = !string.Equals(args.Parameters["RecordType"], "Completed", StringComparison.OrdinalIgnoreCase); LvProgressOverlay.Visible = showProgress; var sb = new StringBuilder(); if (showProgress) { sb.AppendFormat("<div class='progressActivity'>{0}</div>", args.Parameters["Activity"]); sb.AppendFormat("<div class='progressStatus'>"); if (!string.IsNullOrEmpty(args.Parameters["StatusDescription"])) { sb.AppendFormat("{0}", args.Parameters["StatusDescription"]); } if (!string.IsNullOrEmpty(args.Parameters["SecondsRemaining"])) { var secondsRemaining = Int32.Parse(args.Parameters["SecondsRemaining"]); if (secondsRemaining > -1) { sb.AppendFormat("<strong class='progressRemaining'>, {0:c} </strong> remaining", new TimeSpan(0, 0, secondsRemaining)); } } if (!string.IsNullOrEmpty(args.Parameters["CurrentOperation"])) { sb.AppendFormat(", {0}", args.Parameters["CurrentOperation"]); } sb.AppendFormat(".</div>"); if (!string.IsNullOrEmpty(args.Parameters["PercentComplete"])) { var percentComplete = Int32.Parse(args.Parameters["PercentComplete"]); if (percentComplete > -1) { sb.AppendFormat("<div id='lvProgressbar'><div style='width:{0}%'></div></div>", percentComplete); } } } Progress.Text = sb.ToString(); }
/// <summary>Edits the text.</summary> /// <param name="args">The args.</param> protected void EditHtmlTinyMCE(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, ExtensionMethods.nameof(() => args)); if (this.Disabled) { return; } if (args.IsPostBack) { if (args.Result == null || !(args.Result != "undefined")) { return; } this.UpdateHtml(args); } else { TinyMCEEditorUrl richTextEditorUrl = new TinyMCEEditorUrl() { Conversion = TinyMCEEditorUrl.HtmlConversion.DoNotConvert, Disabled = this.Disabled, FieldID = this.FieldID, ID = this.ID, ItemID = this.ItemID, Language = this.ItemLanguage, Mode = string.Empty, ShowInFrameBasedDialog = true, Source = this.Source, Url = "/sitecore/shell/Controls/TinyMCE Editor/EditorPage.aspx", Value = this.Value, Version = this.ItemVersion }; UrlString url = richTextEditorUrl.GetUrl(); this.handle = richTextEditorUrl.Handle; SheerResponse.ShowModalDialog(new ModalDialogOptions(url.ToString()) { Width = "1200", Height = "730px", Response = true, Header = Translate.Text("Rich Text Editor") }); args.WaitForPostBack(); } }
protected void Open(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (!args.HasResult) { return; } var path = args.Result.Split(':'); LoadItem(path[0], path[1]); UpdateRibbon(); } else { const string header = "Open Script"; const string text = "Select the script item that you want to open."; const string icon = "powershell/48x48/script.png"; const string button = "Open"; const string root = ApplicationSettings.ScriptLibraryPath; const string selected = ApplicationSettings.ScriptLibraryPath; var str = selected; if (selected.EndsWith("/")) { var obj = Context.ContentDatabase.Items[StringUtil.Left(selected, selected.Length - 1)]; if (obj != null) { str = obj.ID.ToString(); } } var urlString = new UrlString(UIUtil.GetUri("control:PowerShellScriptBrowser")); urlString.Append("id", selected); urlString.Append("fo", str); urlString.Append("ro", root); urlString.Append("he", header); urlString.Append("txt", text); urlString.Append("ic", icon); urlString.Append("btn", button); urlString.Append("opn", "1"); SheerResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } }
protected void Set(ClientPipelineArgs args) { Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; if (args.IsPostBack) { if (args.HasResult && (args.Result != "undefined")) { Item item = db.GetItem(args.Parameters["item"]); using (new EditContext(item)) { item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")] = args.Result; } } } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.SetTags"))); UrlHandle handle = new UrlHandle(); handle["categories"] = GetCategories(args.Parameters["item"]); Item item = db.GetItem(args.Parameters["item"]); handle["value"] = item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")]; ID categoriesRootId = new ID("{41E44203-3CB9-45DD-8EED-9E36B5282D68}"); string source = item.Fields[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")].Source; if (!string.IsNullOrEmpty(source)) { var classificationSourceItems = LookupSources.GetItems(item, source); if ((classificationSourceItems != null) && (classificationSourceItems.Length > 0)) { Item taxonomies = classificationSourceItems.ToList().Find(sourceItem => sourceItem.Name.Equals("Taxonomies")); if (taxonomies != null) { categoriesRootId = taxonomies.ID; } } } handle["categoriesRootId"] = categoriesRootId.ToString(); handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "400px", "150px", string.Empty, true); args.WaitForPostBack(); } }
/// <summary>Edits the text.</summary> /// <param name="args">The args.</param> protected void EditHtmlTinyMCE(ClientPipelineArgs args) { TinyEditorConfigurationResult configurationResult = Utils.LoadTinyEditorConfiguration(); int windowWidth, windowHeight; if (!int.TryParse(configurationResult.EditorWindowWidth, out windowWidth)) { windowWidth = 1220; } if (!int.TryParse(configurationResult.EditorWindowHeight, out windowHeight)) { windowHeight = 730; } Assert.ArgumentNotNull((object)args, ExtensionMethods.nameof(() => args)); if (this.Disabled) return; if (args.IsPostBack) { if (args.Result == null || !(args.Result != "undefined")) return; this.UpdateHtml(args); } else { TinyMCEEditorUrl richTextEditorUrl = new TinyMCEEditorUrl() { Conversion = TinyMCEEditorUrl.HtmlConversion.DoNotConvert, Disabled = this.Disabled, FieldID = this.FieldID, ID = this.ID, ItemID = this.ItemID, Language = this.ItemLanguage, Mode = string.Empty, ShowInFrameBasedDialog = true, Source = this.Source, Url = "/sitecore/shell/Controls/TinyMCE Editor/EditorPage.aspx", Value = this.Value, Version = this.ItemVersion }; UrlString url = richTextEditorUrl.GetUrl(); this.handle = richTextEditorUrl.Handle; SheerResponse.ShowModalDialog(new ModalDialogOptions(url.ToString()) { Width = string.Format("{0}px", windowWidth), Height = string.Format("{0}px", windowHeight), Response = true, Header = Translate.Text("Rich Text Editor") }); args.WaitForPostBack(); } }
public void Delete([NotNull] ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); var blobName = StringUtil.GetString(Context.ClientPage.ServerProperties["Blob"]); if (args.IsPostBack) { if (args.Result == "yes") { if (string.IsNullOrEmpty(blobName)) { return; } try { var blob = LogStorageManager.GetBlob(blobName); blob.DeleteAsync(); Log.Audit($"Delete the '{blob.Name}' cloud blob.", this); this.SetBlob(string.Empty); } catch (Exception ex) { SheerResponse.Alert(Texts.THE_FILE_COULD_NOT_BE_DELETED_ERROR_MESSAGE + ex.Message); } } } else { if (Context.ClientPage.ServerProperties["Blob"] == null) { Context.ClientPage.ClientResponse.Alert(Texts.YOU_MUST_OPEN_A_LOG_FILE_FIRST); return; } var blob = LogStorageManager.GetBlob(blobName); blobName = blob.Uri.Segments.Last(); SheerResponse.Confirm(Translate.Text(Texts.ARE_YOU_SURE_YOU_WANT_TO_DELETE_0, blobName)); args.WaitForPostBack(); } }
public void Process(ClientPipelineArgs args) { using (new Sitecore.SecurityModel.SecurityDisabler()) { try { string databaseName = args.Parameters["database"]; var ids = args.Parameters["items"]; var db = Sitecore.Configuration.Factory.GetDatabase("master"); if (String.IsNullOrEmpty(ids) || String.IsNullOrEmpty(databaseName)) { return; } var item = db.GetItem(ids); var path = item.Paths.Path.ToLower(); if (!path.StartsWith("/sitecore/content/")) { return; } if (databaseName.ToLower() == "master") { var workbox = db.GetItem("/sitecore/system/Modules/Deletion Workbox/Workbox"); if (workbox == null) { return; } workbox.Locking.Unlock(); workbox.Editing.BeginEdit(); workbox.Fields["Deleted Items"].Value += ids + "|"; workbox.Editing.EndEdit(); workbox.Locking.Lock(); } } catch (Exception ex) { Sitecore.Diagnostics.Log.Error("Failed to retrieve ID of deleted item", this); } } }
protected void SelectTag(ClientPipelineArgs args) { string tagNotFound = args.Parameters["tagNotFound"]; if (args.IsPostBack) { string oldValue = "|" + GetValue() + "|"; string newValue = oldValue; if (!string.IsNullOrEmpty(tagNotFound)) { newValue = newValue.Replace(string.Format("|{0}:{1}|", Sitecore.Data.ID.Null, tagNotFound), "|"); SetValue(newValue.Trim("|".ToCharArray())); SheerResponse.Eval("{0}RemoveTagNotFound('{1}');", scriptBase, tagNotFound); } if (args.HasResult && args.Result != "undefined") { Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; CategoryItem categoryItem = new CategoryItem(db.GetItem(new ID(args.Result))); string tagId = categoryItem.ID.ToString(); string tagValue = categoryItem.CategoryName; newValue += string.Format("{0}:{1}|", tagId, "{C1453A1D-9ED2-428A-8BB3-50B4A877BEA7}"); SetValue(newValue.Trim("|".ToCharArray())); SetModified(); SheerResponse.Eval("{0}SetTag('{1}','{2}');", scriptBase, tagValue, tagId); } CheckTags(); } else { UrlString url = new UrlString( ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.TagBrowser"))); UrlHandle handle = new UrlHandle(); if (!string.IsNullOrEmpty(tagNotFound)) { handle["tagNotFound"] = tagNotFound; } handle["categoriesRootId"] = CategoriesRootId; handle["value"] = GetValue() ?? string.Empty; handle.Add(url); SheerResponse.ShowModalDialog(url.ToString(), "650px", "600px", string.Empty, true); args.WaitForPostBack(); } }
protected virtual void JobExecuteScript(ClientPipelineArgs args, string scriptToExecute, bool debug) { if (!RequestSessionElevationEx(args, ApplicationNames.ISE, SessionElevationManager.ExecuteAction)) { return; } Debugging = debug; var sessionName = CurrentSessionId; if (string.Equals(sessionName, StringTokens.PersistentSessionId, StringComparison.OrdinalIgnoreCase)) { var script = ScriptItem; sessionName = script != null ? script[Templates.Script.Fields.PersistentSessionId] : string.Empty; } var autoDispose = string.IsNullOrEmpty(sessionName); var scriptSession = autoDispose ? ScriptSessionManager.NewSession(ApplicationNames.ISE, true) : ScriptSessionManager.GetSession(sessionName, ApplicationNames.ISE, true); if (debug) { scriptSession.DebugFile = FileUtil.MapPath(Settings.TempFolderPath) + "\\" + Path.GetFileNameWithoutExtension(Path.GetTempFileName()) + ".ps1"; File.WriteAllText(scriptSession.DebugFile, scriptToExecute); if (!string.IsNullOrEmpty(Breakpoints.Value)) { var strBrPoints = (Breakpoints.Value ?? string.Empty).Split(','); var bPoints = strBrPoints.Select(int.Parse); scriptSession.SetBreakpoints(bPoints); } scriptToExecute = scriptSession.DebugFile; } if (UseContext) { scriptSession.SetItemLocationContext(ContextItem); } scriptSession.Interactive = true; JobExecuteScript(args, scriptToExecute, scriptSession, autoDispose, debug); }
/// <summary> /// Executes the command in the specified context. /// </summary> /// <param name="context">The context.</param> public override void Execute(Sitecore.Shell.Framework.Commands.CommandContext context) { if (context.Items.Length == 1) { Sitecore.Data.Items.Item item = context.Items[0]; ClientPipelineArgs args = new ClientPipelineArgs(); System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection(); parameters["id"] = item.ID.ToString(); parameters["language"] = item.Language.ToString(); parameters["database"] = item.Database.Name; args.Parameters = parameters; Sitecore.Context.ClientPage.Start(this, "Run", args); } }
protected virtual void JobAbort(ClientPipelineArgs args) { if (ScriptSessionManager.GetSessionIfExists(Monitor.SessionID) is ScriptSession currentSession) { currentSession.Abort(); if (currentSession.AutoDispose) { currentSession.Dispose(); } } else { ScriptRunning = false; UpdateRibbon(); } Monitor.SessionID = string.Empty; ScriptRunning = false; }
protected static void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Item item = Context.ContentDatabase.GetItem(args.Parameters["itemid"]); Assert.IsNotNull(item, typeof(Item)); Field field = item.Fields[args.Parameters["fieldid"]]; Assert.IsNotNull(field, typeof(Field)); string value = args.Parameters["controlid"]; if (args.IsPostBack) { if (args.HasResult) { RenderFieldResult renderFieldResult = RenderLink(args); string text = renderFieldResult.ToString(); SheerResponse.SetAttribute("scHtmlValue", "value", string.IsNullOrEmpty(text) ? WebEditLinkCommand.GetDefaultText() : text); SheerResponse.SetAttribute("scPlainValue", "value", args.Result); ScriptInvokationBuilder scriptInvokationBuilder = new ScriptInvokationBuilder("scSetHtmlValue"); scriptInvokationBuilder.AddString(value); if (!string.IsNullOrEmpty(text) && string.IsNullOrEmpty(StringUtil.RemoveTags(text))) { scriptInvokationBuilder.Add("true"); } SheerResponse.Eval(scriptInvokationBuilder.ToString()); } } else { UrlString urlString = new UrlString(Context.Site.XmlControlPage); urlString["xmlcontrol"] = "UltraLink"; UrlHandle urlHandle = new UrlHandle(); urlHandle["va"] = new XmlValue(args.Parameters["fieldValue"], "ultralink").ToString(); urlHandle.Add(urlString); urlString.Append("ro", field.Source); Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), "550", "650", string.Empty, response: true); args.WaitForPostBack(); } }
/// <summary> /// Runs the specified args. /// </summary> /// <param name="args">The arguments.</param> protected void Run(ClientPipelineArgs args) { string item = args.Parameters["id"]; string str = args.Parameters["language"]; string item1 = args.Parameters["version"]; string str1 = args.Parameters["database"]; Database database = Factory.GetDatabase(str1); Error.Assert(database != null, string.Concat("Database \"", str1, "\" not found.")); Item item2 = database.GetItem(ID.Parse(item), Language.Parse(str), Sitecore.Data.Version.Parse(item1)); Error.AssertItemFound(item2); Item item3 = item2.Database.GetItem(ItemIDs.TemplateRoot); if (item3 != null && !item3.Axes.IsAncestorOf(item2)) { item2 = item3; } if (!args.IsPostBack) { UrlString urlString = new UrlString("/sitecore/client/Asserts/StandardValuesTool?itemid=" + item); if (item2.TemplateID != TemplateIDs.Template) { urlString.Append("fo", item2.ID.ToString()); } else { urlString.Append("fo", item2.Parent.ID.ToString()); } Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), true); args.WaitForPostBack(); } else if (args.Result != null && args.Result.Length > 0 && args.Result != "undefined") { TemplateItem templateItem = Context.ContentDatabase.Templates[args.Result]; if (templateItem != null) { Context.ClientPage.SendMessage(this, string.Concat("template:added(id=", templateItem.ID, ")")); Context.ClientPage.SendMessage(this, string.Concat("item:load(id=", templateItem.ID, ")")); return; } } }
/// <summary> /// Shows the properties. /// /// </summary> /// <param name="args">The args.</param> protected new void ShowProperties(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (Disabled) { return; } var attribute = XmlValue.GetAttribute("mediaid"); if (string.IsNullOrEmpty(attribute)) { SheerResponse.Alert("Select an image from the Media Library first."); } else if (args.IsPostBack) { if (!args.HasResult) { return; } XmlValue = new XmlValue(args.Result, "image"); Value = XmlValue.GetAttribute("mediapath"); SetModified(); Update(); } else { var urlString = new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Media.ExtendedImageProperties.aspx"); var obj = Client.ContentDatabase.GetItem(attribute, Language.Parse(ItemLanguage)); if (obj == null) { SheerResponse.Alert("Select an image from the Media Library first."); } else { obj.Uri.AddToUrlString(urlString); var urlHandle = new UrlHandle(); urlHandle["xmlvalue"] = XmlValue.ToString(); urlHandle.Add(urlString); SheerResponse.ShowModalDialog(urlString.ToString(), "700", "700", string.Empty, true); args.WaitForPostBack(); } } }
protected void Run(ClientPipelineArgs args) { if (args.IsPostBack) { if (!args.HasResult) { return; } } else { UrlString str = new UrlString(UIUtil.GetUri("control:ProjectItems")); str["id"] = args.Parameters["id"]; str["la"] = args.Parameters["Language"]; str["vs"] = args.Parameters["Version"]; SheerResponse.ShowModalDialog(str.ToString()); args.WaitForPostBack(true); } }
public virtual void Run(ClientPipelineArgs args) { if (args.IsPostBack) { return; } ModalDialogOptions mdo = new ModalDialogOptions($"/SitecoreCognitiveServices/IntelligentMedia/ViewImageDescription?id={Id}&language={Language}&db={Db}") { Header = "Set Alt Tag", Height = "350", Width = "475", Message = "", Response = true }; SheerResponse.ShowModalDialog(mdo); args.WaitForPostBack(); }
/// <summary> /// Executes the command in the specified context. /// </summary> /// <param name="context">The context.</param> public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); var item = context.Parameters["username"]; if (!ValidationHelper.ValidateUserWithMessage(item)) { return; } NameValueCollection nameValueCollection = new NameValueCollection(); nameValueCollection["username"] = item; ClientPipelineArgs clientPipelineArg = new ClientPipelineArgs(nameValueCollection); ContinuationManager.Current.Start(this, "Run", clientPipelineArg); }