コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.QueryString["ModuleId"], out _moduleId))
            {
                throw new ArgumentException("Invalid module id.");
            }
            if (!int.TryParse(Request.QueryString["InstanceId"], out _pageInstanceId))
            {
                throw new ArgumentException("Invalid module id.");
            }

            _culture = CultureCode.Current;

            if (!Page.IsPostBack)
            {
                //check user permissions.
                if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_pageInstanceId, Page.User))
                {
                    throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE);
                }

                Content activeContent        = Content.GetActiveContent(_moduleId, _culture);
                Content pendingContent       = Content.GetPendingContent(_moduleId, _culture);
                Collection <Content> history = Content.GetArchivedContent(_moduleId, _culture);

                if (null == activeContent && null == pendingContent)
                {
                    ModifiedDatePanel.Visible = false;
                    HistoryPanel.Visible      = false;
                }

                if (null != activeContent)
                {
                    InitContent("Current (Published)", activeContent, (null == pendingContent));
                }

                if (null != pendingContent)
                {
                    InitContent("Pending (Not Published)", pendingContent, true);
                }

                //init archives
                RestoreArchived.Visible = false;
                foreach (Content c in history)
                {
                    ContentVersions.Items.Add(
                        new ListItem("Archived - " + FormatDate(c.Modified),
                                     c.ContentVersionId.ToString()));
                }
            }
        }
コード例 #2
0
        protected void Propose_Click(object sender, EventArgs e)
        {
            Content pendingContent = Content.GetPendingContent(_moduleId, _culture);

            if (null == pendingContent)
            {
                SaveNewContent(1);//1=pending
            }
            else
            {
                pendingContent.Text     = ContentTextEditor.Text;
                pendingContent.Modified = DateTime.Now;
                pendingContent.UpdateContent();
            }

            SendProposedContentNotificationEmail();

            leavePage();
        }