示例#1
0
        public void Process(SC.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            SC.Data.Items.Item item = args.Item;

            if (item == null)
            {
                return;
            }

            if (SC.Context.IsAdministrator || CheckIn.CanCheckIn(item))
            {
                if (item.Locking.IsLocked() && (string.Compare(item.Locking.GetOwner(), SC.Context.User.Name, StringComparison.InvariantCultureIgnoreCase) != 0))
                {
                    SC.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning warning = args.Add();
                    warning.Title = SC.Globalization.Translate.Text("'{0}' has locked this item.", new object[] { item.Locking.GetOwnerWithoutDomain() });
                    warning.AddOption(SC.Globalization.Translate.Text("Check In"), string.Format("item:checkin(id={0},language={1},version={2})", item.ID, item.Language, item.Version.Number));
                }
            }
            else if (item.Locking.IsLocked())
            {
                if (!item.Locking.HasLock())
                {
                    args.Add(SC.Globalization.Translate.Text("You cannot edit this item because '{0}' has locked it.", new object[] { item.Locking.GetOwnerWithoutDomain() }), string.Empty);
                }
            }
            else if (SC.Configuration.Settings.RequireLockBeforeEditing && SC.Data.Managers.TemplateManager.IsFieldPartOfTemplate(SC.FieldIDs.Lock, item))
            {
                SC.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning warning = args.Add();
                warning.Title = SC.Globalization.Translate.Text("You must lock this item before you can edit it.");
                warning.Text  = SC.Globalization.Translate.Text("To lock this item, click Edit on the Home tab.");
                warning.AddOption(SC.Globalization.Translate.Text("Lock and Edit"), "item:checkout");
            }
        }
示例#2
0
        protected void AddWarning(
            string message,
            Sitecore.Data.Items.Item item,
            Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs args)
        {
            Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning warning
                          = args.Add();
            warning.Title = "Publishing Status";
            warning.Text  = message;
            string command = String.Format(
                "item:load(id={0},language={1},version={2})",
                item.ID,
                item.Language,
                item.Version.Number);

            warning.AddOption("Refresh", command);
        }
示例#3
0
        protected void AddLinkToRedirectItem(string message, Sitecore.Data.Items.Item item, Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs args)
        {
            Database db     = Sitecore.Data.Database.GetDatabase("master");
            Item     target = db.GetItem(item["Redirect To Item"]);

            if (target != null)
            {
                Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning note = args.Add();
                note.Title = Translate.Text("Redirect Manager");
                note.Text  = Translate.Text("This item is a redirect item.  Would you like to manage the redirect target?");
                note.AddOption(target.DisplayName, string.Format("item:load(id={0}, language={1}, version={2})", target.ID, target.Language, target.Version));
            }
        }
示例#4
0
 protected void AddNotification(string message, Sitecore.Data.Items.Item item, Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs args, Item redirectitem)
 {
     Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning note = args.Add();
     note.Title = Translate.Text("Redirect Manager");
     note.Text  = String.Format(Translate.Text("The URL \"{0}\" is currently redirecting to this page."), redirectitem["Requested Url"]);
     note.AddOption(Translate.Text("Review the redirect definition"), string.Format("item:load(id={0}, language={1}, version={2})", redirectitem.ID, redirectitem.Language, redirectitem.Version));
     note.AddOption(Translate.Text("Delete the redirect definition"), string.Format("redirectmanager:delete(id={0}, language={1}, version={2}, item={3})", redirectitem.ID, redirectitem.Language, redirectitem.Version, item.ID));
 }
示例#5
0
 protected void AddNotification(string message, Sitecore.Data.Items.Item item, Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs args)
 {
     Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning warning = args.Add();
     warning.Title = "Item Naming";
     warning.Text  = message;
     warning.Icon  = "/assets/img/about.png";
 }