/// <summary>
 /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
 /// </summary>
 /// <param name="context">Context of Call</param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length == 1)
     {
         var itemId = context.Parameters[0];
         if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId))
         {
             SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')");
         }
         else
         {
             var urlString = new UrlString("/sitecore/shell/sitecore/content/Applications/Content%20Editor.aspx");
             urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId);
             TrackOpenTab(context);
             context.Items[0].Uri.AddToUrlString(urlString);
             UIUtil.AddContentDatabaseParameter(urlString);
             urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview");
             urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}");
             var language = context.Parameters["la"].IsNull() ? Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName : context.Parameters["la"];
             urlString.Add("la", language);
             AddLatestVersionToUrlString(urlString, itemId, language);
             SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(itemId).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = itemId, Closeable = true, Activate = Util.Constants.SettingsItem.Fields[Util.Constants.OpenSearchResult].Value == "New Tab Not Selected" ? false : true }.ToString());
         }
     }
 }
Esempio n. 2
0
        public override void Execute(CommandContext context)
        {
            var urlString = new UrlString(UIUtil.GetUri("control:PowerShellExternalView"));
            var keys      = context.Parameters.AllKeys;

            using (var session = ScriptSessionManager.GetSession(string.Empty, ApplicationNames.Default, false))
            {
                session.ExecuteScriptPart("");
                foreach (var key in keys)
                {
                    var param =
                        context.Parameters[key]
                        .Replace("{spe}", GetType().Assembly.GetName().Version.ToString())
                        .Replace("{ps}", ScriptSession.PsVersion.Major + "." + ScriptSession.PsVersion.Minor)
                        .Replace("{sc}",
                                 SitecoreVersion.Current.Major + "." +
                                 SitecoreVersion.Current.Minor);
                    urlString.Add(key, param);
                }
            }

            var width = keys.Contains("spe_w", StringComparer.OrdinalIgnoreCase)
                ? context.Parameters["spe_w"]
                : keys.Contains("width", StringComparer.OrdinalIgnoreCase) ? context.Parameters["width"] : "800";

            var height = keys.Contains("spe_h", StringComparer.OrdinalIgnoreCase)
                ? context.Parameters["spe_h"]
                : keys.Contains("height", StringComparer.OrdinalIgnoreCase) ? context.Parameters["height"] : "800";

            SheerResponse.ShowModalDialog(urlString.ToString(), width, height);
        }
        /// <summary>
        /// If CDN is enabled for this request, replace the outgoing media url with the cdn version
        /// </summary>
        /// <param name="item"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override string GetMediaUrl(Sitecore.Data.Items.MediaItem item, MediaUrlOptions options)
        {
            string hostname = CDNManager.GetCDNHostName();
            string url = base.GetMediaUrl(item, options);

            bool shouldReplace = !string.IsNullOrEmpty(hostname) && // cdnHostname exists for site
                Sitecore.Context.PageMode.IsNormal;  // PageMode is normal

            bool dontReplace = !CDNManager.IsMediaPubliclyAccessible(item) ||  // media is publicly accessible
                CDNManager.IsMediaAnalyticsTracked(item); // media is analytics tracked

            CDNUrlState contextState = CDNUrlSwitcher.CurrentValue;

            if (contextState == CDNUrlState.Enabled)
            {
                shouldReplace = true;
            }
            else if (contextState == CDNUrlState.Disabled)
            {
                UrlString url2 = new UrlString(url);
                url2[CDNManager.StopToken] = "1";
                url = url2.ToString();
                shouldReplace = false;
            }

            
            if (shouldReplace && !dontReplace) // media not DMS tracked
            {
                return CDNManager.ReplaceMediaUrl(url, hostname);
            }
            else
            {
                return url;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Executes the command in the specified context.
        ///
        /// </summary>
        /// <param name="context">The context.</param>
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull((object)context, "context");
            UrlString urlString = new UrlString();

            Sitecore.Shell.Framework.Windows.RunApplication("Security Reporting", urlString.ToString());
        }
Esempio n. 5
0
        public override void Execute(CommandContext context)
        {
            var scriptId = context.Parameters["scriptId"];
            var scriptDb = context.Parameters["scriptDb"];

            var itemId   = string.Empty;
            var itemDb   = string.Empty;
            var itemLang = string.Empty;
            var itemVer  = string.Empty;

            if (context.Items.Length > 0)
            {
                itemId   = context.Items[0].ID.ToString();
                itemDb   = context.Items[0].Database.Name;
                itemLang = context.Items[0].Language.Name;
                itemVer  = context.Items[0].Version.Number.ToString(CultureInfo.InvariantCulture);
            }

            var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner"));

            str.Append(context.Parameters);
            str.Append("id", itemId);
            str.Append("db", itemDb);
            str.Append("lang", itemLang);
            str.Append("ver", itemVer);
            str.Append("scriptId", scriptId);
            str.Append("scriptDb", scriptDb);
            SheerResponse.ShowModalDialog(str.ToString(), "400", "260", "PowerShell Script Results", false);
        }
        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>
 /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
 /// </summary>
 /// <param name="context">Context of Call</param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length == 1)
     {
         string s = context.Parameters[0];
         if (s.IsGuid())
         {
             if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(s))
             {
                 SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + s + "')");
             }
             else
             {
                 UrlString urlString = new UrlString(Util.Constants.ContentEditorRawUrlAddress);
                 urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, s);
                 TrackOpenTab(context);
                 context.Items[0].Uri.AddToUrlString(urlString);
                 UIUtil.AddContentDatabaseParameter(urlString);
                 urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview");
                 urlString.Add("il", "0");
                 urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}");
                 string str3 = context.Parameters["la"] ?? Context.Language.CultureInfo.TwoLetterISOLanguageName;
                 urlString.Add("la", str3);
                 AddLatestVersionToUrlString(urlString, s, str3);
                 SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(s).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = s, Closeable = true, Activate = Util.Constants.SettingsItem[Util.Constants.OpenSearchResult] != "New Tab Not Selected" }.ToString());
             }
         }
     }
 }
Esempio n. 8
0
        public override void Execute(CommandContext context)
        {
            var urlString = new UrlString(UIUtil.GetUri("control:PowerShellExternalView"));
            var keys = context.Parameters.AllKeys;

            using (var session = ScriptSessionManager.GetSession(string.Empty, ApplicationNames.Default, false))
            {
                session.ExecuteScriptPart("");
                foreach (var key in keys)
                {
                    var param =
                        context.Parameters[key]
                            .Replace("{spe}", GetType().Assembly.GetName().Version.ToString())
                            .Replace("{ps}", ScriptSession.PsVersion.Major + "." + ScriptSession.PsVersion.Minor)
                            .Replace("{sc}",
                                SitecoreVersion.Current.Major + "." +
                                SitecoreVersion.Current.Minor);
                    urlString.Add(key, param);
                }

            }

            var width = keys.Contains("spe_w", StringComparer.OrdinalIgnoreCase)
                ? context.Parameters["spe_w"]
                : keys.Contains("width", StringComparer.OrdinalIgnoreCase) ? context.Parameters["width"] : "800";

            var height = keys.Contains("spe_h", StringComparer.OrdinalIgnoreCase)
                ? context.Parameters["spe_h"]
                : keys.Contains("height", StringComparer.OrdinalIgnoreCase) ? context.Parameters["height"] : "800";

            SheerResponse.ShowModalDialog(urlString.ToString(), width, height);
        }
        public void GetDestination(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Database database = GetDatabase(args);

            if (args.Result == "undefined")
            {
                args.AbortPipeline();
            }
            else if ((args.Result != null) && (args.Result.Length > 0))
            {
                args.Parameters["target"] = args.Result;
                Item item = database.GetItem(args.Result);
                Assert.IsNotNull(item, typeof(Item), "ID: {0}", new object[] { args.Result });
                if (!item.Access.CanCreate())
                {
                    Context.ClientPage.ClientResponse.Alert("You do not have permission to create items here.");
                    args.AbortPipeline();
                }
                args.IsPostBack = false;
            }
            else
            {
                ListString str   = new ListString(args.Parameters["items"], '|');
                Item       item2 = database.Items[str[0]];
                Assert.IsNotNull(item2, typeof(Item), "ID: {0}", new object[] { str[0] });
                UrlString str2 = new UrlString("/sitecore/shell/Applications/Dialogs/SmartMoveToSubItems.aspx");
                str2.Append("fo", item2.ID.ToString());
                str2.Append("sc_content", item2.Database.Name);
                Context.ClientPage.ClientResponse.ShowModalDialog(str2.ToString(), true);
                args.WaitForPostBack();
            }
        }
Esempio n. 10
0
        /// <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 + "\")");
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Executes the command in the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public override void Execute(CommandContext context)
        {
            // updated to publish the site configuration nodes. flushing will be handled by publish end events
            UrlString str = new UrlString(UIUtil.GetUri("control:MultisitesManager.FlushSites"));

            SheerResponse.ShowModalDialog(str.ToString());
        }
Esempio n. 12
0
        /// <summary>Closes this dialog.</summary>
        /// <param name="uploadedItemsRaw">The uploaded items raw.</param>
        public void Close(string uploadedItemsRaw)
        {
            Assert.ArgumentNotNull((object)uploadedItemsRaw, "uploadedItemsRaw");
            ListString listString = new ListString(uploadedItemsRaw);

            if (uploadedItemsRaw == "undefined" || listString.Count == 0)
            {
                base.OK_Click();
            }
            else
            {
                ItemUri itemUri = ItemUri.Parse(listString[0]);
                Assert.IsNotNull((object)itemUri, "uri");
                if (WebUtil.GetQueryString("edit") == "1")
                {
                    UrlString urlString = new UrlString("/sitecore/shell/Applications/Content Manager/default.aspx");
                    urlString["fo"]    = itemUri.ItemID.ToString();
                    urlString["mo"]    = "popup";
                    urlString["wb"]    = "0";
                    urlString["pager"] = "0";
                    urlString[Sitecore.Configuration.State.Client.UsesBrowserWindowsQueryParameterName] = WebUtil.GetQueryString(Sitecore.Configuration.State.Client.UsesBrowserWindowsQueryParameterName, "0");
                    urlString.Add("sc_content", WebUtil.GetQueryString("sc_content"));
                    SheerResponse.ShowModalDialog(urlString.ToString(), string.Equals(Sitecore.Context.Language.Name, "ja-jp", StringComparison.InvariantCultureIgnoreCase) ? "1115" : "955", "560");
                }
                SheerResponse.SetDialogValue(itemUri.ItemID.ToString());
                base.OK_Click();
            }
        }
Esempio n. 13
0
 protected void InsertLink(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
     if (args.IsPostBack)
     {
         if (!string.IsNullOrEmpty(args.Result) && (args.Result != "undefined"))
         {
             this.XmlValue = new Sitecore.Shell.Applications.ContentEditor.XmlValue(args.Result, "link");
             this.SetValue();
             this.SetModified();
             Context.ClientPage.ClientResponse.SetAttribute(this.ID, "value", this.Value);
             SheerResponse.Eval("scContent.startValidators()");
         }
     }
     else
     {
         UrlString urlString = new UrlString(args.Parameters["url"]);
         string    width     = args.Parameters["width"];
         string    height    = args.Parameters["height"];
         this.GetHandle().Add(urlString);
         urlString.Append("ro", this.Source);
         urlString.Add("la", this.ItemLanguage);
         urlString.Append("sc_content", WebUtil.GetQueryString("sc_content"));
         Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), width, height, string.Empty, true);
         args.WaitForPostBack();
     }
 }
        public override void Execute(CommandContext context)
        {
            var scriptId = context.Parameters["script"];
            var scriptDb = context.Parameters["scriptDb"];

            var itemId = string.Empty;
            var itemDb = string.Empty;
            var itemLang = string.Empty;
            var itemVer = string.Empty;

            if (context.Items.Length > 0)
            {
                itemId = context.Items[0].ID.ToString();
                itemDb = context.Items[0].Database.Name;
                itemLang = context.Items[0].Language.Name;
                itemVer = context.Items[0].Version.Number.ToString(CultureInfo.InvariantCulture);
            }

            var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner"));
            str.Append("id", itemId);
            str.Append("db", itemDb);
            str.Append("lang", itemLang);
            str.Append("ver", itemVer);
            str.Append("scriptId", scriptId);
            str.Append("scriptDb", scriptDb);
            Context.ClientPage.ClientResponse.Broadcast(
                SheerResponse.ShowModalDialog(str.ToString(), "400", "260", "PowerShell Script Results", false),
                "Shell");
        }
Esempio n. 15
0
        /// <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 + "\")");
                        }
                    }
                }
            }
        }
        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>
        ///     Shows a confirmation dialog.
        /// </summary>
        protected override void ShowUI()
        {
            if (AdvancedDialog)
            {
                var urlString =
                    new UrlString("/sitecore/shell/Applications/Media/UploadManager/UploadManager.aspx");
                var item = Context.ContentDatabase.GetItem(Path);
                item.Uri.AddToUrlString(urlString);
                SheerResponse.ShowModalDialog(urlString.ToString(), true);
            }
            else
            {
                var urlString = new UrlString("/sitecore modules/Shell/PowerShell/UploadFile/PowerShellUploadFile.aspx");
                var handle    = new UrlHandle
                {
                    ["te"]        = Title ?? string.Empty,
                    ["ds"]        = Description ?? string.Empty,
                    ["ic"]        = Icon ?? string.Empty,
                    ["ok"]        = OkButtonName ?? string.Empty,
                    ["cancel"]    = CancelButtonName ?? string.Empty,
                    ["path"]      = Path,
                    ["mask"]      = "*.*",
                    ["de"]        = "txt",
                    ["versioned"] = Versioned ? "1" : string.Empty,
                    ["language"]  = Language ?? string.Empty,
                    ["overwrite"] = Overwrite ? "1" : string.Empty,
                    ["unpack"]    = Unpack ? "1" : string.Empty
                };

                handle.Add(urlString);
                SheerResponse.ShowModalDialog(urlString.ToString(), Width, Height, "", true);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// If CDN is enabled for this request, replace the outgoing media url with the cdn version
        /// </summary>
        /// <param name="item"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override string GetMediaUrl(Sitecore.Data.Items.MediaItem item, MediaUrlOptions options)
        {
            string hostname = CDNManager.GetCDNHostName();
            string url      = base.GetMediaUrl(item, options);

            bool shouldReplace = !string.IsNullOrEmpty(hostname) &&           // cdnHostname exists for site
                                 Sitecore.Context.PageMode.IsNormal;          // PageMode is normal

            bool dontReplace = !CDNManager.IsMediaPubliclyAccessible(item) || // media is publicly accessible
                               CDNManager.IsMediaAnalyticsTracked(item);      // media is analytics tracked

            CDNUrlState contextState = CDNUrlSwitcher.CurrentValue;

            if (contextState == CDNUrlState.Enabled)
            {
                shouldReplace = true;
            }
            else if (contextState == CDNUrlState.Disabled)
            {
                UrlString url2 = new UrlString(url);
                url2[CDNManager.StopToken] = "1";
                url           = url2.ToString();
                shouldReplace = false;
            }


            if (shouldReplace && !dontReplace) // media not DMS tracked
            {
                return(CDNManager.ReplaceMediaUrl(url, hostname));
            }
            else
            {
                return(url);
            }
        }
Esempio n. 19
0
        /// <summary>Raises the <see cref="E:System.Web.UI.Control.Load"></see> event.</summary>
        /// <param name="e">The <see cref="T:System.EventArgs"></see> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            Assert.ArgumentNotNull((object)e, ExtensionMethods.nameof(() => e));
            base.OnLoad(e);
            if (Sitecore.Context.ClientPage.IsEvent)
            {
                return;
            }
            TinyMCEEditorUrl tinyMCEEditorUrl = new TinyMCEEditorUrl()
            {
                Conversion             = TinyMCEEditorUrl.HtmlConversion.DoNotConvert,
                Disabled               = this.Disabled,
                FieldID                = this.FieldID,
                ID                     = this.ID,
                ItemID                 = this.ItemID,
                Language               = this.ItemLanguage,
                Mode                   = "ContentEditor",
                ShowInFrameBasedDialog = true,
                Source                 = this.Source,
                Url                    = string.Empty,
                Value                  = this.Value,
                Version                = this.ItemVersion
            };
            UrlString url = tinyMCEEditorUrl.GetUrl();

            this.handle = tinyMCEEditorUrl.Handle;
            this.setValueOnPreRender = true;
            this.SourceUri           = url.ToString();
        }
        /// <summary>
        /// Executes the command in the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public override void Execute(CommandContext context)
        {
            // updated to publish the site configuration nodes. flushing will be handled by publish end events
            UrlString str = new UrlString(UIUtil.GetUri("control:MultisitesManager.FlushSites"));

            SheerResponse.ShowModalDialog(str.ToString());
        }
Esempio n. 21
0
        public void Execute()
        {
            var expiration = Sitecore.Configuration.Settings.GetIntSetting(ExpirationSetting, 20);
            var resultSig  = Guid.NewGuid().ToString();

            HttpContext.Current.Cache.Insert(resultSig, this, null,
                                             Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(expiration));

            if (!Modal)
            {
                var urlString = new UrlString();
                urlString.Add("sid", resultSig);
                var appItem = Database.GetDatabase("core").GetItem("/sitecore/content/Applications/PowerShell/PowerShellListView");
                var icon    = Icon ?? appItem.Appearance.Icon;
                Sitecore.Shell.Framework.Windows.RunApplication(appItem, icon, Title, urlString.Query);
            }
            else
            {
                var urlString = new UrlString(UIUtil.GetUri("control:PowerShellResultViewerList"));
                urlString.Add("sid", resultSig);

                var options = new ModalDialogOptions(urlString.ToString())
                {
                    Width  = Width,
                    Height = Height,
                    Header = Title
                };
                SheerResponse.ShowModalDialog(options);
            }
        }
Esempio n. 22
0
        private static void ShowModal(ClientPipelineArgs args)
        {
            var sheerUrl = new UrlString("/sitecore/shell/~/xaml/Sitecore.SitecoreModule.Shell.Redirect.NewRedirect.aspx");

            SheerResponse.ShowModalDialog(sheerUrl.ToString(), "780", "350", string.Empty, true);
            args.WaitForPostBack();
        }
Esempio n. 23
0
        protected override void ProcessRecord()
        {
            LogErrors(() =>
            {
                string response = null;
                if (!string.IsNullOrEmpty(Url))
                {
                    response = JobContext.ShowModalDialog(Url, WidthString, HeightString);
                }
                else if (!string.IsNullOrEmpty(Control))
                {
                    UrlString url = new UrlString(UIUtil.GetUri("control:" + Control));
                    url["te"] = Title ?? "Sitecore";

                    if (Parameters != null)
                    {
                        foreach (string key in Parameters.Keys)
                        {
                            url.Add(key, WebUtil.SafeEncode(Parameters[key].ToString()));
                        }
                    }

                    var message = new ShowModalDialogPsMessage(url.ToString(), WidthString, HeightString, HandleParameters);
                    PutMessage(message);
                    response = (string)GetSheerResult(message);

                }
                WriteObject(response);
            });
        }
Esempio n. 24
0
        protected void SetColorAdvanced(ClientPipelineArgs args)
        {
            if (args.IsPostBack)
            {
                var colorCode = String.Empty;

                if (args.HasResult)
                {
                    colorCode = "#" + args.Result;
                }

                if (Value != colorCode)
                {
                    SetModified();
                }

                Value = colorCode;
            }
            else
            {
                var url = new UrlString("/sitecore/shell/~/xaml/Sitecore.CustomFields.ColorPicker.ColorPickerDialog.aspx");
                url.Add("value", GetValue());
                SheerResponse.ShowModalDialog(url.ToString(), "365", "524", string.Empty, true);
                args.WaitForPostBack();
            }
        }
Esempio n. 25
0
        protected override void OnOK(object sender, EventArgs args)
        {
            Assert.ArgumentNotNull(sender, "sender");
            Assert.ArgumentNotNull(args, "args");

            if (string.IsNullOrEmpty(ItemPicker.Value))
            {
                Context.ClientPage.ClientResponse.Alert("Please Select a Target Item");
                return;
            }

            if (string.IsNullOrEmpty(OldUrlEdit.Value))
            {
                Context.ClientPage.ClientResponse.Alert("Please enter an old Url for redirection");
                return;
            }

            UrlString results = new UrlString();

            results["itemid"]      = ItemPicker.Value;
            results["oldpath"]     = OldUrlEdit.Value;
            results["querystring"] = QueryStringEdit.Value;
            results["site"]        = SiteCombobox.Value;
            SheerResponse.SetDialogValue(results.ToString());
            base.OnOK(sender, args);
        }
Esempio n. 26
0
        protected void LoadImage()
        {
            string attribute = this.XmlValue.GetAttribute("mediaid");

            if (string.IsNullOrEmpty(attribute))
            {
                SheerResponse.Alert("Select an image from the Media Library first.", new string[0]);
                return;
            }
            if (!UserOptions.View.ShowEntireTree)
            {
                Item item = Client.CoreDatabase.GetItem("/sitecore/content/Applications/Content Editor/Applications/MediaLibraryForm");
                if (item != null)
                {
                    Item item1 = Client.ContentDatabase.GetItem(attribute);
                    if (item1 != null)
                    {
                        UrlString urlString = new UrlString(item["Source"]);
                        urlString["pa"]  = "1";
                        urlString["pa0"] = WebUtil.GetQueryString("pa0", string.Empty);
                        urlString["la"]  = WebUtil.GetQueryString("la", string.Empty);
                        urlString["pa1"] = HttpUtility.UrlEncode(item1.Uri.ToString());
                        SheerResponse.SetLocation(urlString.ToString());
                        return;
                    }
                }
            }
            Language   language   = Language.Parse(this.ItemLanguage);
            ClientPage clientPage = Sitecore.Context.ClientPage;

            string[] name = new string[] { "item:load(id=", attribute, ",language=", language.Name, ")" };
            clientPage.SendMessage(this, string.Concat(name));
        }
 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);
     }
 }
        public override void Execute([NotNull] CommandContext context)
        {
            Assert.ArgumentNotNull((object)context, "context");
            var item = context.Items[0];

            if (WebUtil.GetFormValue("scEditorTabs").Contains("youtube:tab:show"))
            {
                SheerResponse.Eval("scContent.onEditorTabClick(null, null, 'OpenSocialCenter')");
            }
            else
            {
                if (item == null)
                {
                    SheerResponse.Alert("You don't have permission to upload this video", new string[0]);
                }
                else
                {
                    UrlString str = new UrlString(UIUtil.GetUri("control:UploadYouTubeVideo"));
                    str["id"] = item.ID.ToString();

                    ShowEditorTab tab = new ShowEditorTab();
                    tab.Command   = "youtube:tab:show";
                    tab.Header    = "Upload Video to YouTube";
                    tab.Url       = str.ToString();
                    tab.Icon      = "/sitecore modules/youtube/images/youtube.png";
                    tab.Id        = "YouTubeUploadTab";
                    tab.Closeable = true;
                    SheerResponse.Eval(tab.ToString());
                }
            }
        }
Esempio n. 29
0
        protected override void ProcessItem(Item item)
        {
            var rendering = new RenderingDefinition
            {
                ItemID             = item.ID.ToString(),
                Placeholder        = PlaceHolder,
                Datasource         = DataSource?.ID.ToString(),
                Cachable           = Cacheable ? "1" : null,
                ClearOnIndexUpdate = ClearOnIndexUpdate ? "1" : null,
                VaryByData         = VaryByData ? "1" : null,
                VaryByDevice       = VaryByDevice ? "1" : null,
                VaryByLogin        = VaryByLogin ? "1" : null,
                VaryByParameters   = VaryByParameters ? "1" : null,
                VaryByQueryString  = VaryByQueryString ? "1" : null,
                VaryByUser         = VaryByUser ? "1" : null
            };

            if (Parameter != null)
            {
                var parameters = new UrlString();
                foreach (string name in Parameter.Keys)
                {
                    parameters.Add(name, Parameter[name].ToString());
                }
                rendering.Parameters = parameters.ToString();
            }

            //todo: add support for conditions
            //renderingDefinition.Conditions
            //todo: add support for multivariate tests
            //rendering.MultiVariateTest
            var psobj = ItemShellExtensions.WrapInItemOwner(SessionState, item, rendering);

            WriteObject(psobj);
        }
Esempio n. 30
0
        protected void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (args.IsPostBack)
            {
                if (args.HasResult)
                {
                    var result = args.Result;
                    var indexOfTypeQualifier = result.IndexOf("^");
                    if (indexOfTypeQualifier > -1)
                    {
                        result = result.Substring(0, indexOfTypeQualifier);
                    }
                    Context.ClientPage.SendMessage(this, $"ise:setuser(user={result})");
                }
            }
            else
            {
                //SheerResponse.CheckModified(false);
                UrlString str =
                    new UrlString("/sitecore/shell/~/xaml/Sitecore.Shell.Applications.Security.SelectAccount.aspx")
                {
                    ["ro"] = "0",
                    ["mu"] = "0"
                };

                SheerResponse.ShowModalDialog(str.ToString(), true);
                args.WaitForPostBack();
            }
        }
Esempio n. 31
0
        public void Execute()
        {
            var resultSig = Guid.NewGuid().ToString();

            HttpContext.Current.Cache[resultSig] = this;

            if (!Modal)
            {
                var urlString = new UrlString();
                urlString.Add("sid", resultSig);
                var appItem = Database.GetDatabase("core").GetItem("/sitecore/content/Applications/PowerShell/PowerShellListView");
                var icon    = Icon ?? appItem.Appearance.Icon;
                Sitecore.Shell.Framework.Windows.RunApplication(appItem, icon, Title, urlString.Query);
            }
            else
            {
                var urlString = new UrlString(UIUtil.GetUri("control:PowerShellResultViewerList"));
                urlString.Add("sid", resultSig);

                var options = new ModalDialogOptions(urlString.ToString())
                {
                    Width  = Width,
                    Height = Height,
                    Header = Title
                };
                SheerResponse.ShowModalDialog(options);
            }
        }
        public virtual void Process(RenderingPropertiesFieldEditorArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.StandardValuesItem, "args.StandardValuesItem");
            Assert.ArgumentNotNullOrEmpty(args.Handle, "args.Handle");
            Assert.ArgumentNotNull(args.RenderingDefinition, "args.RenderingDefinition");

            var renderingDef = args.RenderingDefinition;
            var fieldCol = args.StandardValuesItem.Fields;

            var parameters = new UrlString();
            var options = RenderingParametersFieldEditorOptions.Parse(args.Handle);

            //
            //save the parameters that have already been set
            if (! string.IsNullOrEmpty(args.RenderingDefinition.Parameters))
            {
                var currentParams = new UrlString(args.RenderingDefinition.Parameters);
                foreach (var key in currentParams.Parameters.AllKeys)
                {
                    var name = key;
                    var value = currentParams[key];
                    SetValue(renderingDef, parameters, name, value);
                }
            }

            foreach (var field in options.Fields)
            {
                SetValue(renderingDef, parameters, fieldCol[field.FieldID].Name, field.Value);
            }
            args.RenderingDefinition.Parameters = parameters.ToString();
        }
Esempio n. 33
0
        public override void HandleMessage(Message message)
        {
            Assert.ArgumentNotNull(message, "message");
            base.HandleMessage(message);

            if (message["id"] != ID)
            {
                return;
            }

            switch (message.Name)
            {
            case "contentlink:relativelink":
            {
                var url = new UrlString(UIUtil.GetUri("control:RelativePathForm"));
                Insert(url.ToString(), new NameValueCollection
                    {
                        {
                            "height",
                            "425"
                        }
                    });
                break;
            }

            default:
            {
                return;
            }
            }
        }
        /// <summary>
        ///     Shows a confirmation dialog.
        /// </summary>
        protected override void ShowUI()
        {
            var urlString = new UrlString(Url);

            if (HandleParams != null && HandleParams.Count > 0)
            {
                var handle = new UrlHandle();
                foreach (string key in HandleParams.Keys)
                {
                    var value = HandleParams[key];
                    if ((value is string) &&
                        ((string)value).StartsWith("packPath:", StringComparison.OrdinalIgnoreCase))
                    {
                        string strValue = (string)value;
                        strValue    = strValue.Substring(9);
                        handle[key] = ApplicationContext.StoreObject(strValue);
                    }
                    else
                    {
                        handle[key] = value != null?value.ToString() : string.Empty;
                    }
                }
                handle.Add(urlString);
            }

            Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), Width, Height, string.Empty, ReceiveResults);
        }
Esempio n. 35
0
        public void Process(WorkflowPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            var processorItem = args.ProcessorItem;
            if (processorItem == null)
            {
                return;
            }
            var actionItem = processorItem.InnerItem;

            var dataItem = args.DataItem;

            if (string.IsNullOrEmpty(actionItem[ScriptItemFieldNames.Script]))
            {
                return;
            }

            var scriptItem = actionItem.Database.GetItem(new ID(actionItem[ScriptItemFieldNames.Script]));

            if (RulesUtils.EvaluateRules(actionItem[ScriptItemFieldNames.EnableRule], dataItem) &&
                RulesUtils.EvaluateRules(scriptItem[ScriptItemFieldNames.EnableRule], dataItem))
            {
                var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner"));
                str.Append("id", dataItem.ID.ToString());
                str.Append("db", dataItem.Database.Name);
                str.Append("lang", dataItem.Language.Name);
                str.Append("ver", dataItem.Version.Number.ToString(CultureInfo.InvariantCulture));
                str.Append("scriptId", scriptItem.ID.ToString());
                str.Append("scriptDb", scriptItem.Database.Name);
                Context.ClientPage.ClientResponse.Broadcast(
                    SheerResponse.ShowModalDialog(str.ToString(), "400", "220", "PowerShell Script Results", false),
                    "Shell");
            }
        }
 protected void Process(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
     if (args.IsPostBack)
     {
         Context.ClientPage.SendMessage(this, $"item:refresh(id={itemId})");
         Context.ClientPage.SendMessage(this, $"item:refreshchildren(id={itemId})");
         if (args.HasResult && !args.Result.IsNullOrEmpty())
         {
             foreach (var closeMessage in args.Result.Split('\n'))
             {
                 Context.ClientPage.ClientResponse.Timer(closeMessage, 2);
             }
         }
     }
     else
     {
         var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner"));
         if (!string.IsNullOrWhiteSpace(itemId))
         {
             str.Append("id", itemId);
             str.Append("db", itemDb);
             str.Append("lang", itemLang);
             str.Append("ver", itemVer);
             if ((bool)(args.Properties["UsesBrowserWindows"] ?? false))
             {
                 str.Append("cfs", "1");
             }
         }
         str.Append("scriptId", scriptId);
         str.Append("scriptDb", scriptDb);
         SheerResponse.ShowModalDialog(str.ToString(), "400", "260", "", true);
         args.WaitForPostBack();
     }
 }
        /// <summary>
        /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
        /// </summary>
        /// <param name="context">Context of Call</param>
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            if (context.Items.Length == 1)
            {
                var itemId = context.Parameters[0];
                //if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId))
                //{
                //    SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')");
                //}
                //else
                //{

                      var urlString = new UrlString("/sitecore%20modules/Shell/Sitecore/ItemBuckets/ShowResult.aspx");
                      urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId);

                      context.Items[0].Uri.AddToUrlString(urlString);
                      UIUtil.AddContentDatabaseParameter(urlString);
                      urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview");
                      urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}");
                      var language = context.Parameters["la"].IsNull() ? Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName : context.Parameters["la"];
                      urlString.Add("la", language);

            //SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = "Another Search", Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = Id, Closeable = true, Activate = true }.ToString());

                    SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchblanktab", Header = "Search " + DateTime.Now.ToLongTimeString(), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = new Random().Next(0, 99999999).ToString(), Closeable = true, Activate = true }.ToString());
               // }
            }
        }
Esempio n. 38
0
        public static string GetLanguageUrl(Item item)
        {
            UrlString url = new UrlString(WebUtil.GetRawUrl());

            url["sc_lang"] = item.Name;
            return(url.ToString());
        }
Esempio n. 39
0
 protected void Run(ClientPipelineArgs args)
 {
     try
     {
         string str  = args.Parameters["id"];
         string name = args.Parameters["language"];
         string str3 = args.Parameters["version"];
         Item   item = Context.ContentDatabase.Items[str, Language.Parse(name), Sitecore.Data.Version.Parse(str3)];
         Error.AssertItemFound(item);
         if (SheerResponse.CheckModified())
         {
             if (args.IsPostBack)
             {
                 if (args.Result == "yes")
                 {
                     Context.ClientPage.SendMessage(this, "item:load(id=" + str + ",language=" + name + ",version=" + str3 + ")");
                 }
             }
             else
             {
                 UrlString str4 = new UrlString(UIUtil.GetUri("control:AddVersionAndCopy"));
                 str4.Add("id", item.ID.ToString());
                 str4.Add("la", item.Language.ToString());
                 str4.Add("vs", item.Version.ToString());
                 str4.Add("ci", item.Language.ToString());
                 SheerResponse.ShowModalDialog(str4.ToString(), true);
                 args.WaitForPostBack();
             }
         }
     }
     catch (Exception exception)
     {
         Sitecore.Diagnostics.Log.Error(exception.Message, this);
     }
 }
Esempio n. 40
0
        protected void ShowTags(string notFoundTag)
        {
            ClientPipelineArgs args = ContinuationManager.Current.CurrentArgs as ClientPipelineArgs;

            if (args.IsPostBack)
            {
                if (args.HasResult && args.Result != "undefined")
                {
                    Database db           = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database;
                    Item     categoryItem = db.GetItem(new ID(args.Result));
                    string   tagValue     = GetCategoryName(categoryItem);
                    string   tagId        = categoryItem.ID.ToString();
                    SheerResponse.Eval("SetTag('{0}','{1}')", tagValue, tagId);
                }
            }
            else
            {
                UrlString url =
                    new UrlString(
                        ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.TagBrowser")));
                UrlHandle currentHandle = UrlHandle.Get();
                UrlHandle handle        = new UrlHandle();
                handle["tagNotFound"]      = notFoundTag;
                handle["categoriesRootId"] = currentHandle["categoriesRootId"];
                handle.Add(url);
                SheerResponse.ShowModalDialog(url.ToString(), "650px", "600px", string.Empty, true);
                args.WaitForPostBack();
            }
        }
 protected virtual void Run(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull((object)args, "args");
     if (!SheerResponse.CheckModified())
     {
         return;
     }
     if (args.IsPostBack)
     {
         if (!args.HasResult)
         {
             return;
         }
         WebEditCommand.Reload();
     }
     else
     {
         //SheerResponse.ShowModalDialog(this.GetOptions(args).ToUrlString().ToString(), true);
         SortContentOptions sco = this.GetOptions(args);
         Assert.IsNotNull((object)Context.Site, "context site");
         UrlString urlString = new UrlString(Context.Site.XmlControlPage);
         urlString["xmlcontrol"] = "Sitecore.Shell.Applications.Dialogs.FacDirSort";
         sco.Item.Uri.AddToUrlString(urlString);
         SheerResponse.ShowModalDialog(urlString.ToString(), true);
         args.WaitForPostBack(true);
     }
 }
        public void Edit(ClientPipelineArgs args)
        {
            if (args.IsPostBack)
            {
                if (!args.HasResult)
                {
                    return;
                }

                Value = args.Result;
                SetModified();
                SheerResponse.Refresh(this);
            }
            else
            {
                Assert.IsNotNull(DialogUrl, "Dialog URL");

                var urlString = new UrlString(UIUtil.GetUri(DialogUrl));
                var itemUri   = new ItemUri(ItemId, Sitecore.Configuration.Factory.GetDatabase("master"));
                var fieldItem = Sitecore.Context.ContentDatabase.GetItem(FieldId);


                urlString["itemUri"]   = itemUri.ToString();
                urlString["fieldName"] = fieldItem.Name;

                Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), "650px", "700px", string.Empty, true);

                args.WaitForPostBack();
            }
        }
Esempio n. 43
0
        /// <summary>
        /// Copied without replacing the '-' with '_' and with URL encode.
        /// </summary>
        public void LoadValue(NameValueCollection formCollection)
        {
            if (this.ReadOnly || this.Disabled)
            {
                return;
            }

            var collection = formCollection ?? new NameValueCollection();
            var urlString  = new UrlString();

            foreach (string key in collection.Keys)
            {
                if (!string.IsNullOrEmpty(key) && key.StartsWith(this.ID + "_Param", StringComparison.InvariantCulture) && !key.EndsWith("_value", StringComparison.InvariantCulture))
                {
                    var resultKey   = collection[key];
                    var resultValue = collection[key + "_value"];
                    if (!string.IsNullOrEmpty(resultKey))
                    {
                        urlString[HttpUtility.UrlEncode(resultKey)] = HttpUtility.UrlEncode(resultValue) ?? string.Empty;
                    }
                }
            }

            this.Value = urlString.ToString();
        }
Esempio n. 44
0
        public override void Execute(CommandContext context)
        {
            string scriptId = context.Parameters["script"];
            string scriptDb = context.Parameters["scriptDb"];
            Item scriptItem = Factory.GetDatabase(scriptDb).GetItem(new ID(scriptId));

            string showResults = scriptItem[ScriptItemFieldNames.ShowResults];
            string itemId = string.Empty;
            string itemDb = string.Empty;

            if (context.Items.Length > 0)
            {
                itemId = context.Items[0].ID.ToString();
                itemDb = context.Items[0].Database.Name;
            }

            var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner"));
            str.Append("id", itemId);
            str.Append("db", itemDb);
            str.Append("scriptId", scriptId);
            str.Append("scriptDb", scriptDb);
            str.Append("autoClose", showResults);
            Context.ClientPage.ClientResponse.Broadcast(
                SheerResponse.ShowModalDialog(str.ToString(), "400", "220", "PowerShell Script Results", false),
                "Shell");
        }
Esempio n. 45
0
        protected static void ShowIEModelessDialog(string url, int width, int height)
        {
            Assert.ArgumentNotNull(url, "url");
            if (!UIUtil.IsIE())
            {
                throw new InvalidOperationException("Operation can be performed only for IE browser");
            }
            string str = url;

            try
            {
                UrlString str2 = new UrlString(url);
                str2["mdls"] = "1";
                str          = str2.ToString();
            }
            catch
            {
                str = url;
            }
            SheerResponse.Eval("scForm.browser.closePopups('ShowModelessWindowCommand');");
            string str3 = "{scCalleeForm:scForm, scCalleePipeline:request.pipeline}";
            string str4 = string.Format("dialogWidth:{0}px;dialogHeight:{1}px;help:no;scroll:auto;resizable:yes;center:yes;status:no", width, height);

            SheerResponse.Eval(string.Format("window.showModelessDialog(\"{0}\", {1},\"{2}\");", str, str3, str4));
        }
Esempio n. 46
0
 /// <summary>
 ///     Shows a confirmation dialog.
 /// </summary>
 protected override void ShowUI()
 {
     var resultSig = Guid.NewGuid().ToString();
     HttpContext.Current.Session[resultSig] = Html;
     var urlString = new UrlString(UIUtil.GetUri("control:PowerShellResultViewerText"));
     urlString.Add("sid", resultSig);
     SheerResponse.ShowModalDialog(urlString.ToString(), Width, Height);
 }
 /// <summary>
 /// Shows the video.
 /// </summary>
 /// <param name="args">The arguments.</param>
 protected virtual void ShowVideo(ClientPipelineArgs args)
 {
     var urlString = new UrlString(Sitecore.UIUtil.GetUri("control:ShowVideo"));
     UrlHandle handle = new UrlHandle();
     handle["value"] = this.Value;
     handle.Add(urlString);
     SheerResponse.ShowModalDialog(urlString.ToString(), "420px", "500px", string.Empty, true);
     args.WaitForPostBack();
 }
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length == 1)
     {
         UrlString parameters = new UrlString();
         parameters.Append("fo", context.Items[0].ID.ToString());
         Shell.Framework.Windows.RunApplication("Media Conversion Tool", parameters.ToString());
     }
 }
        /// <summary>
        /// //            Sitecore.Web.UI.HtmlControls.ClientCommand cc = SheerResponse.ShowModalDialog(str.ToString(),true);
        /// </summary>
        /// <param name="element">XML of calling condition rule or action</param>
        /// <param name="name">property of the condition/action that will be set by the macro</param>
        /// <param name="parameters">parameter details, the third comma in the text</param>
        /// <param name="value">currntly set value to the property</param>
        public void Execute(XElement element, string name, UrlString parameters, string value)
        {
            Assert.ArgumentNotNull((object)element, "element");
            Assert.ArgumentNotNull((object)name, "name");
            Assert.ArgumentNotNull((object)parameters, "parameters");
            Assert.ArgumentNotNull((object)value, "value");

            UrlString str = new UrlString("/sitecore/shell/~/xaml/ContactFacetDialog.aspx?ti=Contact Facet Picker&txt=Select a contact facet property&spk="+value);                        
            SheerResponse.ShowModalDialog(str.ToString(), true);
        }
Esempio n. 50
0
        /// <summary>
        /// Runs the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        protected void Run(ClientPipelineArgs args)
        {
            UrlString str = new UrlString(UIUtil.GetUri("control:GlassTypedRazor", "id={AE723732-6D09-4DBA-B553-A1B399EB077D}&locationId=" + args.Parameters["id"]));

            if (!args.IsPostBack)
            {
                SheerResponse.ShowModalDialog(str.ToString(), true);
                args.WaitForPostBack();
            }
        }
Esempio n. 51
0
        public override void Execute(CommandContext context)
        {
            string itemId = context.Items[0].ID.ToString();
            string itemDb = context.Items[0].Database.Name;
            Item item = Factory.GetDatabase(itemDb).GetItem(new ID(itemId));

            var urlString = new UrlString();
            urlString.Append("item", item.Paths.Path.ToLower().Replace("sitecore/", ""));
            urlString.Append("db", itemDb);
            Windows.RunApplication("PowerShell/PowerShell Console", urlString.ToString());
        }
 /// <summary>
 /// Refresh the content tree with the new item opened.
 /// </summary>
 /// <param name="item">Item that is being added.</param>
 /// <remarks>You will need to override this if you are running without HttpContext e.g. Unit Tests.</remarks>
 protected virtual void SetLocation(Item item)
 {
   if ((Context.GetSiteName() == "shell") && Context.ClientPage.IsNotNull() && !Client.Site.Notifications.Disabled)
   {
     var urlString = new UrlString(Constants.ContentEditorRawUrlAddress);
     urlString.Add(Constants.OpenItemEditorQueryStringKeyName, item.ID.ToString());
     item.Uri.AddToUrlString(urlString);
     UIUtil.AddContentDatabaseParameter(urlString);
     SheerResponse.SetLocation(urlString.ToString());
   }
 }
 /// <summary>
 /// Refresh the content tree with the new item opened
 /// </summary>
 /// <param name="item">Item that is being added</param>
 /// <remarks>You will need to override this if you are running without HttpContext e.g. Unit Tests</remarks>
 protected virtual void SetLocation(Item item)
 {
     if (HttpContext.Current.IsNotNull() && Context.ClientPage.IsNotNull()) //clientpage is never null?
     {
         var urlString = new UrlString(Constants.ContentEditorRawUrlAddress);
         urlString.Add(Constants.OpenItemEditorQueryStringKeyName, item.ID.ToString());
         item.Uri.AddToUrlString(urlString);
         UIUtil.AddContentDatabaseParameter(urlString);
         SheerResponse.SetLocation(urlString.ToString());
     }
 }
		/// <summary>
		/// Executes the command in the specified context.
		/// 
		/// </summary>
		/// <param name="context">The context.</param>
		public override void Execute(CommandContext context)
		{
			Error.AssertObject((object)context, "context");
			if (context.Items.Length != 1 || context.Items[0] == null)
				return;
			Item obj = context.Items[0];
			UrlString urlString = new UrlString(UIUtil.GetUri("control:CsvUserImport"));
			urlString.Append("id", obj.ID.ToString());
			urlString.Append("database", obj.Database.ToString());
			Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString());
		}
 protected virtual bool IsValueSet(XElement element, string name, UrlString parameters, string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         return false;
     }
     if (parameters != null && value.Equals(parameters.ToString()))
     {
         return false;
     }
     return true;
 }
Esempio n. 56
0
        /// <summary>
        /// Adds the trigger event string to query string.
        /// </summary>
        /// <param name="url">The request URL.</param>
        /// <param name="eventName">Name of the event.</param>
        /// <returns>The trigger event string to query string.</returns>
        public virtual string AddTriggerEventStringToQueryString(string url, string eventName)
        {
            Assert.ArgumentNotNull(url, "url");
            Assert.ArgumentNotNull(eventName, "eventName");

            string setting = Settings.GetSetting("Ecommerce.Analytics.EventQueryStringKey");

            UrlString urlString = new UrlString(url);
            urlString[setting] = eventName;

            return urlString.ToString();
        }
 public void ShowImmediateWindow(UrlString url)
 {
     var options = new ModalDialogOptions(url.ToString())
     {
         Header = "Immediate Window",
         Resizable = true,
         Width = "800",
         Height = "600",
         Response = true
     };
     SheerResponse.ShowModalDialog(options);
 }
 private static void ShowDatasourceSettingsDialog()
 {
   var urlString = new UrlString(Context.Site.XmlControlPage)
                   {
                     ["xmlcontrol"] = "DatasourceSettings"
                   };
   var dialogOptions = new ModalDialogOptions(urlString.ToString())
                       {
                         Response = true
                       };
   SheerResponse.ShowModalDialog(dialogOptions);
 }
 protected void Run(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
     if (!args.IsPostBack)
     {
         var str2 = new UrlString(UIUtil.GetUri("control:DataSyncWizard"));
         str2.Append("id", args.Parameters["id"]);
         str2.Append("la", args.Parameters["language"]);
         str2.Append("vs", args.Parameters["version"]);
         SheerResponse.ShowModalDialog(str2.ToString(), "550", "500");
         args.WaitForPostBack();
     }
 }
Esempio n. 60
0
        /// <summary>
        /// Adds the follow list to query string.
        /// </summary>
        /// <param name="url">The request URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <returns>The follow list to query string.</returns>
        public virtual string AddFollowListToQueryString(string url, string listName)
        {
            Assert.ArgumentNotNull(url, "url");
            Assert.ArgumentNotNull(listName, "listName");

            string setting = Settings.GetSetting("Ecommerce.Analytics.EventQueryStringKey");

            UrlString urlString = new UrlString(url);
            urlString[setting] = "followlist";
            urlString[setting + "_data"] = listName;

            return urlString.ToString();
        }