示例#1
0
        protected PageViewMode GetUserViewMode()
        {
            PageViewMode viewMode = PageViewMode.WorkInProgress;

            // we let the query string value trump because we pass it in an url from the Admin workflow pages
            if (!string.IsNullOrEmpty(Request.QueryString["vm"]))
            {
                try
                {
                    viewMode = (PageViewMode)Enum.Parse(typeof(PageViewMode), Request.QueryString["vm"]);
                }
                catch (ArgumentException)
                { }
            }
            else
            {
                // if query string is not passed use the cookie
                string viewCookieValue = CookieHelper.GetCookieValue(GetViewModeCookieName());
                if (!string.IsNullOrEmpty(viewCookieValue))
                {
                    try
                    {
                        viewMode = (PageViewMode)Enum.Parse(typeof(PageViewMode), viewCookieValue);
                    }
                    catch (ArgumentException)
                    { }
                }
            }

            return(viewMode);
        }
示例#2
0
 protected override void Construct()
 {
     base.Construct();
     this.pages    = this.CreatePagesInstance();
     this.viewMode = PageViewMode.Strip;
     this.UpdateUI();
 }
示例#3
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     userIsAdmin        = WebUser.IsAdmin;
     userIsContentAdmin = WebUser.IsContentAdmin;
     userIsSiteEditor   = SiteUtils.UserIsSiteEditor();
     viewMode           = GetUserViewMode();
 }
示例#4
0
        protected void SetupWorkflowControls()
        {
            if (
                (WebConfigSettings.EnableContentWorkflow && siteSettings.EnableContentWorkflow) &&
                (
                    (WebUser.IsInRoles(CurrentPage.DraftEditOnlyRoles)) || (WebUser.IsInRoles(CurrentPage.EditRoles))
                )
                )
            {
                viewMode = GetUserViewMode();

                if ((WebConfigSettings.EnableContentWorkflow) && (siteSettings.EnableContentWorkflow))
                {
                    ddlContentView.EnableTheming = false;
                    ddlContentView.CssClass      = "ddworkflow";
                    ddlContentView.Items.Add(new ListItem(Resource.ViewWorkInProgress, PageViewMode.WorkInProgress.ToString()));
                    ddlContentView.Items.Add(new ListItem(Resource.ViewLive, PageViewMode.Live.ToString()));

                    ListItem item = ddlContentView.Items.FindByValue(viewMode.ToString());
                    if (item != null)
                    {
                        ddlContentView.ClearSelection();
                        item.Selected = true;
                    }

                    ddlContentView.SelectedIndexChanged += new EventHandler(ddlContentView_SelectedIndexChanged);
                    ddlContentView.AutoPostBack          = true;

                    if (UseIconsForAdminLinks)
                    {
                        this.MPPageEdit.Controls.Add(new LiteralControl(" "));
                    }
                    this.MPPageEdit.Controls.Add(ddlContentView);
                }
            }
        }
示例#5
0
 public RadPageViewModeEventArgs(PageViewMode mode)
 {
     this.viewMode = mode;
 }
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     userIsAdmin = WebUser.IsAdmin;
     userIsContentAdmin = WebUser.IsContentAdmin;
     userIsSiteEditor = SiteUtils.UserIsSiteEditor();
     viewMode = GetUserViewMode();
 }
        protected PageViewMode GetUserViewMode()
        {
            PageViewMode viewMode = PageViewMode.WorkInProgress;

            // we let the query string value trump because we pass it in an url from the Admin workflow pages
            if (!string.IsNullOrEmpty(Request.QueryString["vm"]))
            {
                try
                {
                    viewMode = (PageViewMode)Enum.Parse(typeof(PageViewMode), Request.QueryString["vm"]);

                }
                catch (ArgumentException)
                { }

            }
            else
            {
                // if query string is not passed use the cookie
                string viewCookieValue = CookieHelper.GetCookieValue(GetViewModeCookieName());
                if (!string.IsNullOrEmpty(viewCookieValue))
                {
                    try
                    {
                        viewMode = (PageViewMode)Enum.Parse(typeof(PageViewMode), viewCookieValue);

                    }
                    catch (ArgumentException)
                    { }
                }

            }

            return viewMode;
        }
示例#8
0
        protected void SetupWorkflowControls(bool forceShowWorkflow)
        {
            if (
                (WebConfigSettings.EnableContentWorkflow && siteSettings.EnableContentWorkflow)
                    && (
                    forceShowWorkflow
                    //||(WebUser.IsInRoles(CurrentPage.DraftEditOnlyRoles))
                    //|| WebUser.IsContentAdmin
                    //|| (WebUser.IsInRoles(CurrentPage.EditRoles)
                    //|| SiteUtils.UserIsSiteEditor())
                    || UserCanSeeWorkflowControls()
                    )
                )
            {

                viewMode = GetUserViewMode();

                ddlContentView.SkinID = "workflow";
                ddlContentView.CssClass = "ddworkflow";
                ddlContentView.Items.Add(new ListItem(Resource.ViewWorkInProgress, PageViewMode.WorkInProgress.ToString()));
                ddlContentView.Items.Add(new ListItem(Resource.ViewLive, PageViewMode.Live.ToString()));

                ListItem item = ddlContentView.Items.FindByValue(viewMode.ToString());
                if (item != null)
                {
                    ddlContentView.ClearSelection();
                    item.Selected = true;

                }

                ddlContentView.SelectedIndexChanged += new EventHandler(ddlContentView_SelectedIndexChanged);
                ddlContentView.AutoPostBack = true;

                if (UseIconsForAdminLinks)
                {
                    this.MPPageEdit.Controls.Add(new LiteralControl(" "));
                }
                this.MPPageEdit.Controls.Add(ddlContentView);

            }
            else
            {
                viewMode = PageViewMode.Live;
            }
        }
示例#9
0
 public void ReadFrom(DomDocument document)
 {
     _Options      = document.Options.Clone();
     _PageViewMode = document.PageViewMode;
 }
示例#10
0
 public RadPageViewModeChangingEventArgs(PageViewMode mode)
     : base(mode)
 {
 }