Ejemplo n.º 1
0
        protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
        {
            if (!Sitecore.Web.UI.Sheer.SheerResponse.CheckModified())
            {
                return;
            }

            if (args.IsPostBack)
            {
                Sitecore.Web.UI.Sheer.SheerResponse.Confirm(Sitecore.Globalization.Translate.Text(
                                                                "Reset {0} to its standard value?",
                                                                new object[] { args.Parameters["field"] }));
                args.WaitForPostBack();
            }

            if (!args.HasResult)
            {
                return;
            }

            if (args.Result != "yes")
            {
                return;
            }

            Sitecore.Data.Database          database = Sitecore.Configuration.Factory.GetDatabase(args.Parameters["database"]);
            Sitecore.Globalization.Language language = Sitecore.Globalization.Language.Parse(args.Parameters["language"]);
            Sitecore.Data.Version           version  = Sitecore.Data.Version.Parse(args.Parameters["version"]);
            Sitecore.Data.Items.Item        item     = database.GetItem(args.Parameters["id"], language, version);

            using (new Sitecore.Data.Items.EditContext(item))
            {
                item.Fields[args.Parameters["field"]].Reset();
            }
        }
Ejemplo n.º 2
0
        protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs oArgs)
        {
            Database db = Factory.GetDatabase(oArgs.Parameters["database"]);
            Dictionary <string, Guid> oText  = new Dictionary <string, Guid>();
            Dictionary <string, Guid> oTitle = new Dictionary <string, Guid>();
            Item oHelpText;
            Item oTextFolder;
            Item oTitleFolder;
            Item oMetaData;

            if ((oMetaData = db.GetItem(METADATAPATH)) != null)
            {
                using (new SecurityDisabler())
                    if ((oHelpText = oMetaData.Children[HELPTEXTFOLDERNAME]) == null)
                    {
                        oHelpText = oMetaData.Add(HELPTEXTFOLDERNAME, new TemplateID(new ID(HELPTEXTFOLDERID)));
                    }
                if ((oTitleFolder = oMetaData.Children[TITLEFOLDERNAME]) == null)
                {
                    oTitleFolder = oMetaData.Add(TITLEFOLDERNAME, new TemplateID(new ID(TITLEFOLDERID)));
                }
                if ((oTextFolder = oMetaData.Children[TEXTFOLDERNAMR]) == null)
                {
                    oTextFolder = oMetaData.Add(TEXTFOLDERNAMR, new TemplateID(new ID(TEXTFOLDERID)));
                }
                db.SelectItemsUsingXPath("fast:/sitecore/content//*[@@templatename=\"Context Sensitive Help\"]");
            }
        }
Ejemplo n.º 3
0
        protected new void Edit(SC.Web.UI.Sheer.ClientPipelineArgs args)
        {
            SC.Diagnostics.Assert.ArgumentNotNull(args, "args");

            if (this.Enabled)
            {
                if (args.IsPostBack)
                {
                    if ((args.Result != null) && (args.Result != "undefined"))
                    {
                        string result = args.Result;

                        if (result == "-")
                        {
                            result = string.Empty;
                        }
                        else if (this.Value != result)
                        {
                            SC.Context.ClientPage.Modified = true;
                        }

                        this.Value = result;
                        HtmlTextWriter output = new HtmlTextWriter(new StringWriter());
                        this.RenderItems(output);
                        SC.Web.UI.Sheer.SheerResponse.SetInnerHtml(
                            this.ID,
                            output.InnerWriter.ToString());
                    }
                }
                else
                {
                    SC.Text.UrlString urlString = new SC.Text.UrlString(
                        UIUtil.GetUri("control:TreeListExEditor"));
                    SC.Web.UrlHandle handle = new SC.Web.UrlHandle();
                    string           str3   = this.Value;

                    if (str3 == "__#!$No value$!#__")
                    {
                        str3 = string.Empty;
                    }

                    handle["value"]        = str3;
                    handle["source"]       = this.Source;
                    handle["language"]     = this.ItemLanguage;
                    handle["itemid"]       = this.ItemID;
                    handle["itemlanguage"] = this.ItemLanguage;
                    handle["itemversion"]  = this.ItemVersion;
                    handle.Add(urlString);
                    SC.Web.UI.Sheer.SheerResponse.ShowModalDialog(
                        urlString.ToString(),
                        "800px",
                        "500px",
                        string.Empty,
                        true);
                    args.WaitForPostBack();
                }
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="args"></param>
 protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
 {
     if (args.IsPostBack)
     {
         if ((!String.IsNullOrEmpty(args.Result)) && args.Result != "undefined")
         {
             Sitecore.Data.Database   db   = Sitecore.Configuration.Factory.GetDatabase(args.Parameters["database"]);
             Sitecore.Data.Items.Item item = db.GetItem(args.Parameters["id"], Sitecore.Globalization.Language.Parse(args.Parameters["language"]));
         }
     }
 }
Ejemplo n.º 5
0
        protected void Process(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(args, "args");

            if (!args.IsPostBack)
            {
                string url = new Sitecore.Text.UrlString(
                    Sitecore.UIUtil.GetUri("control:RunAgent")).ToString();
                Sitecore.Web.UI.Sheer.SheerResponse.ShowModalDialog(url, true);
                args.WaitForPostBack();
            }
        }
        protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs oArgs)
        {
            Database db = Factory.GetDatabase(sDataBaseName);
            Item     oNotificationItem = db.GetItem(sNotificationTemplateID);
            Item     oNotificationOld;
            Item     oItemCommand = db.GetItem(oArgs.Parameters["item"]);

            if (oNotificationItem != null)
            {
                TemplateItem oNotificationTemplate = new TemplateItem(oNotificationItem);
                if (oNotificationTemplate != null)
                {
                    //find items with notifications template
                    Item[] oItems = db.SelectItems(sQuery);
                    using (new SecurityDisabler())
                    {
                        ChangeItemTemplate(oItems, oNotificationItem);

                        oNotificationOld = db.GetItem(sNotificationOldTemplateID);

                        foreach (Item ochild in oNotificationItem.Children)
                        {
                            ochild.CopyTo(oNotificationOld, ochild.Name);
                        }

                        Item oStandarValue = db.GetItem(oNotificationOld[FieldIDs.StandardValues]);
                        using (new EditContext(oNotificationOld))
                        {
                            oNotificationOld.Fields[FieldIDs.BaseTemplate].Value = oNotificationItem[FieldIDs.BaseTemplate];
                            oNotificationOld[FieldIDs.StandardValues]            = oStandarValue.ID.ToString();
                        }

                        using (new EditContext(oStandarValue))
                        {
                            oStandarValue["Title"] = "$name";
                        }

                        oNotificationTemplate = new TemplateItem(oNotificationOld);
                        ChangeItemTemplate(oItems, oNotificationTemplate);
                        oNotificationItem.Delete();
                        //remove inserted options

                        using (new EditContext(oItemCommand))
                        {
                            oItemCommand[sInsertOptionsFieldName] = oItemCommand[sInsertOptionsFieldName].Replace(sCommandID, "").Replace("||", "|").TrimEnd('|');
                        }

                        //delete command
                        db.GetItem(sCommandFolder).Delete();
                    }
                }
            }
        }
        protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
        {
            if (args.IsPostBack)
            {
                if (!(String.IsNullOrEmpty(args.Result)) && (args.Result != "undefined") && (args.Result != "null"))
                {
                }
            }
            else
            {
                //Sitecore.Text.UrlString url = new Sitecore.Text.UrlString("/sitecore modules/shell/Demo/News.aspx");
                //url.Append("id", args.Parameters["id"]);
                //url.Append("database", args.Parameters["database"]);

                var trackingItem     = Factory.GetDatabase("master").GetItem("{BECB151A-562F-4D0C-87A7-A3CBAC3220D9}");
                var newID            = args.Parameters["id"];
                var currentItemsList = trackingItem["Untrack Items"];
                if (string.IsNullOrWhiteSpace(currentItemsList))
                {
                    trackingItem.Editing.BeginEdit();
                    trackingItem["Untrack Items"] = args.Parameters["id"];
                    trackingItem.Editing.EndEdit();
                }
                else
                {
                    if (currentItemsList.Contains(newID))
                    {
                        //Do Nothing
                    }
                    else
                    {
                        trackingItem.Editing.BeginEdit();
                        trackingItem["Untrack Items"] = currentItemsList + "\r\n" + newID;
                        trackingItem.Editing.EndEdit();
                    }
                }

                //Remove Item ID from Current Saved Items, if present.
                var currentTrackedItems = trackingItem["Current Saved Items"];
                if (currentTrackedItems.Contains(newID))
                {
                    currentTrackedItems = currentTrackedItems.Replace("\r\n" + newID, "");
                    currentTrackedItems = currentTrackedItems.Replace(newID, "");
                    trackingItem.Editing.BeginEdit();
                    trackingItem["Current Saved Items"] = currentTrackedItems;
                    trackingItem.Editing.EndEdit();
                }

                args.WaitForPostBack(true);
            }
        }
        protected void Run(Sitecore.Web.UI.Sheer.ClientPipelineArgs args)
        {
            if (!Sitecore.Web.UI.Sheer.SheerResponse.CheckModified())
            {
                return;
            }

            if (!args.IsPostBack)
            {
                Sitecore.Web.UI.Sheer.SheerResponse.Confirm(
                    Sitecore.Globalization.Translate.Text("Cascade all renderings from this placeholder to child pages?")
                    );
                args.WaitForPostBack();
            }

            if (!args.HasResult)
            {
                return;
            }
            if (args.Result != "yes")
            {
                return;
            }

            var database       = Sitecore.Configuration.Factory.GetDatabase(args.Parameters["database"]);
            var language       = Sitecore.Globalization.Language.Parse(args.Parameters["language"]);
            var version        = Sitecore.Data.Version.Parse(args.Parameters["version"]);
            var item           = database.GetItem(args.Parameters["id"], language, version);
            var placeholderKey = args.Parameters["ph"];

            if (item.Fields[LayoutIDs.CascadePlaceholdersField] == null)
            {
                return;
            }

            using (new EditContext(item, SecurityCheck.Disable))
            {
                var value = item.Fields[LayoutIDs.CascadePlaceholdersField].Value ?? "";
                value = string.Join("|", value.Split('|')
                                    .Where(x => !string.IsNullOrWhiteSpace(x))
                                    .Union(new[] { placeholderKey })
                                    .Distinct());
                item.Fields[LayoutIDs.CascadePlaceholdersField].Value = value;
            }
            Sitecore.Web.UI.Sheer.SheerResponse.Redraw();
        }
Ejemplo n.º 9
0
        protected new void Run(SC.Web.UI.Sheer.ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!SC.Web.UI.Sheer.SheerResponse.CheckModified())
            {
                return;
            }

            SC.Data.Items.Item item = SC.Client.GetItemNotNull(args.Parameters["id"], SC.Globalization.Language.Parse(args.Parameters["language"]), SC.Data.Version.Parse(args.Parameters["version"]));

            if (!(item.Locking.HasLock() || SC.Context.IsAdministrator || CheckIn.HasUnlockAccess(item)))
            {
                return;
            }

            SC.Diagnostics.Log.Audit(this, "Check in: {0}", new string[] { SC.Diagnostics.AuditFormatter.FormatItem(item) });

            using (new SC.Data.Items.EditContext(item, SC.SecurityModel.SecurityCheck.Disable))
                item.Locking.Unlock();

            SC.Context.ClientPage.SendMessage(this, "item:checkedin");
        }