Beispiel #1
0
 public override void Process(CommandContext state)
 {
     if (versionMaker.IsVersionable(state.Content))
     {
         versionMaker.SaveVersion(state.Content);
     }
 }
 public override void Process(CommandContext state)
 {
     if (versionMaker.IsVersionable(state.Content))
     {
         versionMaker.AddVersion(state.Content, asPreviousVersion: true);
     }
 }
        private void InitButtons()
        {
            if (Request["cancel"] == "reloadTop")
            {
                hlCancel.NavigateUrl = "javascript:window.top.location.reload();";
            }
            else
            {
                hlCancel.NavigateUrl = CancelUrl();
            }

            bool isPublicableByUser = Security.IsAuthorized(User, ie.CurrentItem, Permission.Publish);
            bool isVersionable      = Versions.IsVersionable(ie.CurrentItem);
            bool isPublicableItem   = ie.CurrentItem.IsPage || !isVersionable; // !ie.CurrentItem.IsVersionable();
            bool isWritableByUser   = Security.IsAuthorized(User, Selection.SelectedItem, Permission.Write);
            bool isExisting         = ie.CurrentItem.ID != 0;

            btnSavePublish.Visible = isPublicableItem && isPublicableByUser && ie.CurrentItem.IsPage;
            if (btnSavePublish.Visible)
            {
                btnSavePublish.CssClass += " primary-action";
            }
            else
            {
                btnPreview.CssClass += " primary-action";
            }

            btnPreview.CssClass += " primary-action";
            btnPreview.Visible   = isVersionable && isWritableByUser;
            // same as preview/draft btnSaveUnpublished.Visible = isVersionable && isWritableByUser;
            hlFuturePublish.Visible = isVersionable && isPublicableByUser && ie.CurrentItem.IsPage;
            btnUnpublish.Visible    = isExisting && isPublicableByUser && ie.CurrentItem.IsPublished() && ie.CurrentItem.IsPage;
        }
Beispiel #4
0
 public override void Process(CommandContext state)
 {
     if (versionMaker.IsVersionable(state.Content) && (state.Content.State == ContentState.Published || state.Content.State == ContentState.Unpublished))
     {
         state.Content = versionMaker.AddVersion(state.Content, asPreviousVersion: false);
     }
 }
Beispiel #5
0
		protected override void OnInit(EventArgs e)
		{
			Page.Title = string.Format("{0}: {1}", GetLocalResourceString("VersionsPage.Title", "Versions"), Selection.SelectedItem.Title);

			persister = Engine.Persister;
			versioner = Engine.Resolve<IVersionManager>();

			bool isVersionable = versioner.IsVersionable(Selection.SelectedItem);
			cvVersionable.IsValid = isVersionable;

			publishedItem = Selection.SelectedItem.VersionOf.Value ?? Selection.SelectedItem;

			base.OnInit(e);
		}
Beispiel #6
0
        private void InitButtons()
        {
            bool isPublicableByUser = Security.IsAuthorized(User, ie.CurrentItem, Permission.Publish);
            bool isPublicableItem   = ie.CurrentItem.IsPage || !ie.CurrentItem.IsVersionable();
            bool isVersionable      = Versions.IsVersionable(ie.CurrentItem);
            bool isWritableByUser   = Security.IsAuthorized(User, Selection.SelectedItem, Permission.Write);
            bool isExisting         = ie.CurrentItem.ID != 0;

            btnSavePublish.Visible     = isPublicableItem && isPublicableByUser;
            btnPreview.Visible         = isVersionable && isWritableByUser;
            btnSaveUnpublished.Visible = isVersionable && isWritableByUser;
            hlFuturePublish.Visible    = isVersionable && isPublicableByUser;
            btnUnpublish.Visible       = isExisting && isPublicableByUser && ie.CurrentItem.IsPublished();
        }
Beispiel #7
0
        protected override void OnInit(EventArgs e)
        {
            Page.Title = string.Format("{0}: {1}", GetLocalResourceString("VersionsPage.Title", "Versions"), Selection.SelectedItem.Title);

            persister = Engine.Persister;
            versioner = Engine.Resolve <IVersionManager>();

            bool isVersionable = versioner.IsVersionable(Selection.SelectedItem);

            cvVersionable.IsValid = isVersionable;

            publishedItem = Selection.SelectedItem.VersionOf.Value ?? Selection.SelectedItem;

            base.OnInit(e);
        }
Beispiel #8
0
        // see also UseDraftCommand.cs (should use it here?)
        public static PathData EnsureDraft(ContentItem item, IVersionManager versions, ContentVersionRepository versionRepository, out bool isNew)
        {
            isNew = false;

            // find containing page
            var page = Find.ClosestPage(item);

            if (versions.IsVersionable(page) && page.State != ContentState.Draft)
            {
                // current version is not draft, see if there are any drafts
                // page is not versioned, add a new version
                page = versions.AddVersion(page, asPreviousVersion: false);

                // find part to be modified on new page version
                item  = page.FindPartVersion(item);
                isNew = true;
            }

            return(new PathData(page, item));
        }
Beispiel #9
0
        private void InitButtons()
        {
            if (Request["cancel"] == "reloadTop")
            {
                hlCancel.NavigateUrl = "javascript:window.top.location.reload();";
            }
            else
            {
                hlCancel.NavigateUrl = CancelUrl();
            }

            bool isPublicableByUser = Security.IsAuthorized(User, ie.CurrentItem, Permission.Publish);
            bool isVersionable      = Versions.IsVersionable(ie.CurrentItem);
            bool isWritableByUser   = Security.IsAuthorized(User, Selection.SelectedItem, Permission.Write);
            bool isExisting         = ie.CurrentItem.ID != 0;

            btnSavePublish.Visible     = isPublicableByUser;
            btnPreview.Visible         = isVersionable && isWritableByUser;
            btnSaveUnpublished.Visible = isVersionable && isWritableByUser;
            hlFuturePublish.Visible    = isVersionable && isPublicableByUser;
        }
Beispiel #10
0
 private bool ShouldCreateVersionOf(ContentItem item)
 {
     return(EnableVersioning && !IsNew(item) && versioner.IsVersionable(item));
 }
Beispiel #11
0
		private void InitButtons()
		{
			bool isPublicableByUser = Security.IsAuthorized(User, ie.CurrentItem, Permission.Publish);
			bool isPublicableItem = ie.CurrentItem.IsPage || !ie.CurrentItem.IsVersionable();
			bool isVersionable = Versions.IsVersionable(ie.CurrentItem);
			bool isWritableByUser = Security.IsAuthorized(User, Selection.SelectedItem, Permission.Write);
			bool isExisting = ie.CurrentItem.ID != 0;

			var config = new ConfigurationManagerWrapper();

			//save and publish
			btnSavePublish.Visible = config.Sections.Management.CommandButtons.PublishButton.Enabled && isPublicableItem && isPublicableByUser;
			if (btnSavePublish.Visible)
            {
				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.PublishButton.Text) == false)
					btnSavePublish.Text = config.Sections.Management.CommandButtons.PublishButton.Text;

				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.PublishButton.ToolTip) == false)
					btnSavePublish.ToolTip = config.Sections.Management.CommandButtons.PublishButton.ToolTip;
			}

			//save and preview
			btnPreview.Visible = config.Sections.Management.CommandButtons.SaveAndPreviewButton.Enabled && isVersionable && isWritableByUser;
			if (btnPreview.Visible)
			{
				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.SaveAndPreviewButton.Text) == false)
					btnPreview.Text = config.Sections.Management.CommandButtons.SaveAndPreviewButton.Text;

				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.SaveAndPreviewButton.ToolTip) == false)
					btnPreview.ToolTip = config.Sections.Management.CommandButtons.SaveAndPreviewButton.ToolTip;
			}

			//save
			btnSaveUnpublished.Visible = config.Sections.Management.CommandButtons.SaveButton.Enabled && isVersionable && isWritableByUser;
			if (btnSaveUnpublished.Visible)
			{
				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.SaveButton.Text) == false)
					btnSaveUnpublished.Text = config.Sections.Management.CommandButtons.SaveButton.Text;

				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.SaveButton.ToolTip) == false)
					btnSaveUnpublished.ToolTip = config.Sections.Management.CommandButtons.SaveButton.ToolTip;
			}

			//save version in future
			hlFuturePublish.Visible = config.Sections.Management.CommandButtons.SaveVersionInFutureButton.Enabled && isVersionable && isPublicableByUser;
			if (hlFuturePublish.Visible)
			{
				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.SaveVersionInFutureButton.Text) == false)
					hlFuturePublish.Text = config.Sections.Management.CommandButtons.SaveVersionInFutureButton.Text;

				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.SaveVersionInFutureButton.ToolTip) == false)
					hlFuturePublish.ToolTip = config.Sections.Management.CommandButtons.SaveVersionInFutureButton.ToolTip;
			}

			//unpublish
			btnUnpublish.Visible = config.Sections.Management.CommandButtons.UnpublishButton.Enabled && isVersionable && isPublicableByUser;
			if (btnUnpublish.Visible)
			{
				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.UnpublishButton.Text) == false)
					btnUnpublish.Text = config.Sections.Management.CommandButtons.UnpublishButton.Text;

				if (string.IsNullOrWhiteSpace(config.Sections.Management.CommandButtons.UnpublishButton.ToolTip) == false)
					btnUnpublish.ToolTip = config.Sections.Management.CommandButtons.UnpublishButton.ToolTip;
			}

		}