protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.UserAdmin);
            createWizard.Visible = SecurityData.IsAdmin;

            divMsg.Visible = false;
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSkinEdit);

            //get the detected templates in use and mask off the template that is baked in as a the default template.
            GeneralUtilities.BindDataBoundControl(gvPages, cmsHelper.Templates.Where(x => x.TemplatePath.ToLowerInvariant() != SiteData.DefaultTemplateFilename.ToLowerInvariant()).ToList());
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.GroupAdmin);

            groupID = GetGuidIDFromQuery();

            btnApply.Visible    = SecurityData.IsAdmin;
            btnAddUsers.Visible = SecurityData.IsAdmin;
            btnRemove.Visible   = SecurityData.IsAdmin;

            if (groupID == Guid.Empty)
            {
                btnApply.Text = "Add";
            }
            else
            {
                pnlUsers.Visible = true;
            }

            if (!IsPostBack)
            {
                if (groupID != Guid.Empty)
                {
                    MembershipRole role = getCurrentGroup();

                    txtRoleName.Text    = role.RoleName;
                    txtRoleName.Enabled = CheckValidEditing(role.RoleName);

                    btnApply.Visible = CheckValidEditing(role.RoleName);

                    GetUserList(role.RoleName);
                }
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogTag);
            RedirectIfNoSite();

            GeneralUtilities.BindDataBoundControl(gvPages, SiteData.CurrentSite.GetTagList());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.DataImport);

            lblWarning.Text = "";
            lblWarning.Attributes["style"] = "color: #000000;";

            CMSConfigHelper.CleanUpSerialData();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.SiteExport);

            if (!IsPostBack)
            {
                txtBegin.Text = SiteData.CurrentSite.Now.AddMonths(-6).ToString(Helper.ShortDatePattern);
                txtEnd.Text   = SiteData.CurrentSite.Now.AddDays(5).ToString(Helper.ShortDatePattern);
            }
        }
		protected void Page_Load(object sender, EventArgs e) {
			ucCommentAddEdit1.FetchItem();

			if (ucCommentAddEdit1.pageType == ContentPageType.PageType.BlogEntry) {
				Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogComment);
			}

			if (ucCommentAddEdit1.pageType == ContentPageType.PageType.ContentEntry) {
				Master.ActivateTab(AdminBaseMasterPage.SectionID.PageComment);
			}
		}
		protected void Page_Load(object sender, EventArgs e) {
			Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentHistory);

			if (!IsPostBack) {
				txtDate.Text = SiteData.CurrentSite.Now.ToString(Helper.ShortDatePattern);
				ddlSize.SelectedValue = pagedDataGrid.PageSize.ToString();

				GeneralUtilities.BindListDefaultText(ddlUsers, ExtendedUserData.GetUserList(), null, "select user", Guid.Empty.ToString());
			}

			LoadGrid();
		}
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.TextWidget);

            if (!IsPostBack)
            {
                using (CMSConfigHelper cfg = new CMSConfigHelper()) {
                    PickerValues         = cfg.GetAllWidgetSettings(SiteID);
                    gvContent.DataSource = PickerValues;
                    gvContent.DataBind();
                }
            }
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentTemplate);

            RedirectIfNoSite();

            if (!IsPostBack)
            {
                GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates);

                SetGrid(false, null);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentIndex);

            RedirectIfNoSite();

            CMSConfigHelper.CleanUpSerialData();

            if (!IsPostBack)
            {
                ddlSize.SelectedValue = pagedDataGrid.PageSize.ToString();
            }

            LoadGrid();
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.QueryString["type"]))
            {
                pageType = ContentPageType.GetTypeByName(Request.QueryString["type"].ToString());
            }

            if (pageType == ContentPageType.PageType.ContentEntry)
            {
                Master.ActivateTab(AdminBaseMasterPage.SectionID.PageComment);
            }
            else
            {
                Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogComment);
            }
        }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSkinEdit);

            if (!String.IsNullOrEmpty(Request.QueryString["path"]))
            {
                sTemplateFileQS = Request.QueryString["path"].ToString();
                sTemplateFile   = CMSConfigHelper.DecodeBase64(sTemplateFileQS);
                sFullFilePath   = HttpContext.Current.Server.MapPath(sTemplateFile);
                sEditFile       = sFullFilePath;
            }

            if (!String.IsNullOrEmpty(Request.QueryString["alt"]))
            {
                string sAltFileQS = Request.QueryString["alt"].ToString();
                string sAltFile   = CMSConfigHelper.DecodeBase64(sAltFileQS);
                sEditFile = HttpContext.Current.Server.MapPath(sAltFile);
            }

            litSkinFileName.Text = sTemplateFile;

            litEditFileName.Text = sEditFile.Replace(Server.MapPath("~"), @"\");

            if (File.Exists(sEditFile))
            {
                if (!IsPostBack)
                {
                    using (StreamReader sr = new StreamReader(sEditFile)) {
                        txtPageContents.Text = sr.ReadToEnd();
                    }
                }

                litDateMod.Text = File.GetLastWriteTime(sEditFile).ToString();

                if (sFullFilePath.LastIndexOf(@"\") > 0)
                {
                    sDirectory = sFullFilePath.Substring(0, sFullFilePath.LastIndexOf(@"\"));
                }
                else
                {
                    sDirectory = sFullFilePath.Substring(0, sFullFilePath.LastIndexOf(@"/"));
                }

                SetSourceFiles(sDirectory);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.SiteTemplate);

            Guid siteID = SiteData.CurrentSiteID;

            pageHome = pageHelper.FindHome(siteID, true);

            if (!IsPostBack)
            {
                List <CMSTemplate> lstTemplate = cmsHelper.Templates;

                GeneralUtilities.BindListDefaultText(ddlBlogIndex, lstTemplate, null, sSelTemplate, "0");
                GeneralUtilities.BindListDefaultText(ddlHome, lstTemplate, null, sSelTemplate, "0");

                if (pageHome != null && pageHome.Root_ContentID != Guid.Empty)
                {
                    if (SiteData.CurrentSite.Blog_Root_ContentID.HasValue)
                    {
                        pageIndex = pageHelper.FindContentByID(siteID, SiteData.CurrentSite.Blog_Root_ContentID.Value);
                    }

                    litHomepage.Text = pageHome.NavMenuText + "  [" + pageHome.FileName + "]";

                    GeneralUtilities.BindListDefaultText(ddlHome, lstTemplate, pageHome.TemplateFile, sSelTemplate, "0");

                    if (pageIndex != null)
                    {
                        ParentPagePicker.SelectedPage = pageIndex.Root_ContentID;
                        GeneralUtilities.SelectListValue(ddlBlogIndex, pageIndex.TemplateFile);
                    }
                    else
                    {
                        ParentPagePicker.SelectedPage = null;
                        //ddlBlogIndex.Enabled = false;
                    }
                }

                GeneralUtilities.BindListDefaultText(ddlAll, lstTemplate, null, sSelTemplate, "0");
                GeneralUtilities.BindListDefaultText(ddlTop, lstTemplate, null, sSelTemplate, "0");
                GeneralUtilities.BindListDefaultText(ddlSub, lstTemplate, null, sSelTemplate, "0");
                GeneralUtilities.BindListDefaultText(ddlPages, lstTemplate, null, sSelTemplate, "0");
                GeneralUtilities.BindListDefaultText(ddlPosts, lstTemplate, null, sSelTemplate, "0");
            }
        }
Exemple #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogTemplate);

            RedirectIfNoSite();

            if (!IsPostBack)
            {
                txtDate.Text = SiteData.CurrentSite.Now.ToString(Helper.ShortDatePattern);
                ContentPage cp = pageHelper.GetLatestPosts(SiteData.CurrentSiteID, 2, false).FirstOrDefault();
                if (cp != null)
                {
                    txtDate.Text = cp.GoLiveDate.ToString(Helper.ShortDatePattern);
                }

                GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates);

                LoadGrid();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.StatusChange);

            RedirectIfNoSite();

            if (!IsPostBack)
            {
                BindDDLs();

                txtDate.Text = SiteData.CurrentSite.Now.ToShortDateString();
                ContentPage cp = pageHelper.GetLatestPosts(SiteData.CurrentSiteID, 2, false).FirstOrDefault();
                if (cp != null)
                {
                    txtDate.Text = cp.GoLiveDate.ToShortDateString();
                }

                LoadGrid();
            }
        }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.UserFn);

            Master.UsesSaved = true;
            Master.HideSave();
            Master.SetSaveMessage("Profile Updated");

            divInfoMsg.Visible = false;
            InfoMessage.Text   = String.Empty;

            if (!IsPostBack)
            {
                txtEmail.Text = SecurityData.CurrentUser.Email;
                ExtendedUserData exUsr = new ExtendedUserData(SecurityData.CurrentUser.UserName);
                txtNickName.Text  = exUsr.UserNickName;
                txtFirstName.Text = exUsr.FirstName;
                txtLastName.Text  = exUsr.LastName;
                reBody.Text       = exUsr.UserBio;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogTag);

            guidItemID = GetGuidIDFromQuery();

            if (!IsPostBack)
            {
                ContentTag item = ContentTag.Get(guidItemID);
                if (item != null)
                {
                    txtSlug.Text      = item.TagSlug;
                    txtLabel.Text     = item.TagText;
                    chkPublic.Checked = item.IsPublic;
                }
                else
                {
                    btnDeleteButton.Visible = false;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogIndex);

            RedirectIfNoSite();

            CMSConfigHelper.CleanUpSerialData();

            if (!IsPostBack)
            {
                txtDate.Text = SiteData.CurrentSite.Now.ToShortDateString();
                ContentPage cp = pageHelper.GetLatestPosts(SiteData.CurrentSiteID, 2, false).FirstOrDefault();
                if (cp != null)
                {
                    txtDate.Text = cp.GoLiveDate.ToShortDateString();
                }

                ddlSize.SelectedValue = pagedDataGrid.PageSize.ToString();
            }

            LoadGrid();
        }
Exemple #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSiteMap);

            Master.UsesSaved = true;

            if (IsPostBack)
            {
                Master.ShowSave();
            }
            else
            {
                if (!SiteData.RefererScriptName.ToLower().EndsWith(SiteData.CurrentScriptName.ToLower()))
                {
                    Master.HideSave();
                }
                else
                {
                    Master.ShowSave();
                }
            }
        }
Exemple #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.SiteIndex);
            guidSiteID = GetGuidIDFromQuery();

            btnAddUsers.Visible = SecurityData.IsAdmin;
            btnRemove.Visible   = SecurityData.IsAdmin;

            theSite = SiteData.GetSiteByID(guidSiteID);

            if (theSite != null)
            {
                litID.Text       = theSite.SiteID.ToString();
                litSiteName.Text = theSite.SiteName;
                litTagline.Text  = theSite.SiteTagline;
                litURL.Text      = theSite.MainURL;
            }

            if (!IsPostBack)
            {
                GetUserList();
            }
        }
Exemple #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.SiteDashboard);

            if (!IsPostBack)
            {
                CheckDatabase();
            }

            RedirectIfNoSite();

            CMSConfigHelper.CleanUpSerialData();

            phUserSecurity.Visible = SecurityData.IsAdmin;

            litPage.Text = String.Format(" ({0}) ", pageHelper.GetSitePageCount(SiteID, ContentPageType.PageType.ContentEntry));
            litPost.Text = String.Format(" ({0}) ", pageHelper.GetSitePageCount(SiteID, ContentPageType.PageType.BlogEntry));

            litCat.Text = String.Format(" ({0}) ", ContentCategory.GetSiteCount(SiteID));
            litTag.Text = String.Format(" ({0}) ", ContentTag.GetSiteCount(SiteID));

            litSmippet.Text = String.Format(" ({0}) ", pageHelper.GetSiteSnippetCount(SiteID));
        }
Exemple #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSnippet);

            guidRootItemID    = GetGuidIDFromQuery();
            guidVersionItemID = GetGuidParameterFromQuery("versionid");

            guidItemID = guidRootItemID;

            if (guidItemID == Guid.Empty)
            {
                guidItemID = guidVersionItemID;
            }

            if (!IsPostBack)
            {
                DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);
                ucReleaseDate.SetDate(dtSite);
                ucRetireDate.SetDate(dtSite.AddYears(200));

                ContentSnippet item = null;

                if (guidRootItemID != Guid.Empty)
                {
                    item = ContentSnippet.Get(guidRootItemID);
                }
                else
                {
                    item = ContentSnippet.GetVersion(guidVersionItemID);
                }

                if (item != null)
                {
                    bool bRet = item.RecordSnippetLock(SecurityData.CurrentUserGuid);
                    bLocked = item.IsSnippetLocked();

                    if (bLocked && item.Heartbeat_UserId != null)
                    {
                        MembershipUser usr = SecurityData.GetUserByGuid(item.Heartbeat_UserId.Value);
                        litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the snippet.";
                    }

                    txtSlug.Text   = item.ContentSnippetSlug;
                    txtLabel.Text  = item.ContentSnippetName;
                    reBody.Text    = item.ContentBody;
                    guidRootItemID = item.Root_ContentSnippetID;

                    ucReleaseDate.SetDate(item.GoLiveDate);
                    ucRetireDate.SetDate(item.RetireDate);

                    chkPublic.Checked       = item.ContentSnippetActive;
                    btnDeleteButton.Visible = true;
                    pnlReview.Visible       = true;

                    Dictionary <string, string> dataVersions = (from v in ContentSnippet.GetHistory(guidRootItemID)
                                                                join u in ExtendedUserData.GetUserList() on v.EditUserId equals u.UserId
                                                                orderby v.EditDate descending
                                                                select new KeyValuePair <string, string>(v.ContentSnippetID.ToString(), string.Format("{0} ({1}) {2}", v.EditDate, u.UserName, (v.IsLatestVersion ? " [**] " : " ")))
                                                                ).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

                    GeneralUtilities.BindListDefaultText(ddlVersions, dataVersions, null, "Versions", "00000");
                }
                else
                {
                    btnDeleteButton.Visible = false;
                    pnlReview.Visible       = false;
                }
            }

            sPageMode = GetStringParameterFromQuery("mode");
            if (sPageMode.ToLowerInvariant() == "raw")
            {
                reBody.CssClass   = "rawEditor";
                divCenter.Visible = false;
            }

            pnlHB.Visible      = !bLocked;
            pnlHBEmpty.Visible = bLocked;
            pnlButtons.Visible = !bLocked;
            divEditing.Visible = bLocked;
        }
Exemple #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.SiteIndex);

            GeneralUtilities.BindDataBoundControl(gvSites, SiteData.GetSiteList());
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSiteMap);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.UserAdmin);

            userID = GetGuidIDFromQuery();

            btnApply.Visible = SecurityData.IsAdmin;

            if (!IsPostBack)
            {
                if (userID != Guid.Empty)
                {
                    var dsRoles            = SecurityData.GetRoleListRestricted();
                    ExtendedUserData exUsr = new ExtendedUserData(userID);

                    CheckBox chkSelected = null;

                    gvSites.Visible = false;

                    if (SecurityData.IsAdmin)
                    {
                        gvSites.Visible = true;

                        GeneralUtilities.BindDataBoundControl(gvSites, SiteData.GetSiteList());

                        List <SiteData> lstSites = exUsr.GetSiteList();

                        chkSelected = null;

                        if (lstSites.Any())
                        {
                            HiddenField hdnSiteID = null;
                            foreach (GridViewRow dgItem in gvSites.Rows)
                            {
                                hdnSiteID = (HiddenField)dgItem.FindControl("hdnSiteID");
                                if (hdnSiteID != null)
                                {
                                    Guid locID = new Guid(hdnSiteID.Value);
                                    chkSelected = (CheckBox)dgItem.FindControl("chkSelected");
                                    int ct = (from l in lstSites where l.SiteID == locID select l).Count();
                                    if (ct > 0)
                                    {
                                        chkSelected.Checked = true;
                                    }
                                }
                            }
                        }
                    }

                    MembershipUser usr = Membership.GetUser(userID);
                    Email.Text          = usr.Email;
                    lblUserName.Text    = usr.UserName;
                    UserName.Text       = usr.UserName;
                    lblUserName.Visible = true;
                    UserName.Visible    = false;

                    chkLocked.Checked = usr.IsLockedOut;

                    txtNickName.Text  = exUsr.UserNickName;
                    txtFirstName.Text = exUsr.FirstName;
                    txtLastName.Text  = exUsr.LastName;
                    reBody.Text       = exUsr.UserBio;

                    GeneralUtilities.BindDataBoundControl(gvRoles, dsRoles);

                    chkSelected = null;

                    HiddenField hdnRoleId = null;
                    foreach (GridViewRow dgItem in gvRoles.Rows)
                    {
                        hdnRoleId = (HiddenField)dgItem.FindControl("hdnRoleId");
                        if (hdnRoleId != null)
                        {
                            chkSelected = (CheckBox)dgItem.FindControl("chkSelected");
                            if (Roles.IsUserInRole(usr.UserName, hdnRoleId.Value))
                            {
                                chkSelected.Checked = true;
                            }
                        }
                    }
                }
            }
        }
Exemple #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.SiteInfo);

            bNewSite = !SiteData.CurretSiteExists;

            litID.Text = SiteData.CurrentSiteID.ToString();

            if (!IsPostBack)
            {
                CheckDatabase();

                SiteData site = siteHelper.GetCurrentSite();

                if (site == null || !SiteData.CurretSiteExists)
                {
                    site = SiteData.InitNewSite(SiteID);
                }

                ReadOnlyCollection <TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones();

                GeneralUtilities.BindList(ddlTimeZone, timeZones, TimeZoneInfo.Local.Id);

                trSiteIndex.Visible = false;

                if (site != null)
                {
                    if (site.GetSitePageCount(ContentPageType.PageType.ContentEntry) > 0)
                    {
                        trSiteIndex.Visible = true;
                    }

                    txtSiteName.Text    = site.SiteName;
                    txtTagline.Text     = site.SiteTagline;
                    txtTitleBar.Text    = site.SiteTitlebarPattern;
                    txtURL.Text         = site.MainURL;
                    txtKey.Text         = site.MetaKeyword;
                    txtDescription.Text = site.MetaDescription;

                    chkHide.Checked             = site.BlockIndex;
                    chkSendTrackback.Checked    = site.SendTrackbacks;
                    chkAcceptTrackbacks.Checked = site.AcceptTrackbacks;

                    txtFolderPath.Text   = site.Blog_FolderPath;
                    txtCategoryPath.Text = site.Blog_CategoryPath;
                    txtTagPath.Text      = site.Blog_TagPath;
                    txtEditorPath.Text   = site.Blog_EditorPath;
                    txtDatePath.Text     = site.Blog_DatePath;

                    GeneralUtilities.SelectListValue(ddlTimeZone, site.TimeZoneIdentifier);

                    GeneralUtilities.SelectListValue(ddlDatePattern, site.Blog_DatePattern);

                    ParentPagePicker.SelectedPage = site.Blog_Root_ContentID;
                }

                phCreatePage.Visible = false;

                if (!SiteData.CurretSiteExists)
                {
                    btnSave.Text         = "Click to Create Site";
                    phCreatePage.Visible = true;
                }
            }

            CMSConfigHelper.CleanUpSerialData();
        }
Exemple #28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Master.ActivateTab(AdminBaseMasterPage.SectionID.UserFn);
 }
Exemple #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogContentAdd);

            RedirectIfNoSite();

            lblUpdated.Text    = SiteData.CurrentSite.Now.ToString();
            lblCreateDate.Text = SiteData.CurrentSite.Now.ToString();

            guidContentID        = GetGuidIDFromQuery();
            guidVersionContentID = GetGuidParameterFromQuery("versionid");
            guidImportContentID  = GetGuidParameterFromQuery("importid");

            sPageMode = GetStringParameterFromQuery("mode");
            if (sPageMode.ToLower() == "raw")
            {
                reBody.CssClass      = "rawEditor";
                reLeftBody.CssClass  = "rawEditor";
                reRightBody.CssClass = "rawEditor";
                divCenter.Visible    = false;
                divRight.Visible     = false;
                divLeft.Visible      = false;
            }

            if (!IsPostBack)
            {
                DateTime dtSite = CalcNearestFiveMinTime(SiteData.CurrentSite.Now);
                txtReleaseDate.Text = dtSite.ToShortDateString();
                txtReleaseTime.Text = dtSite.ToShortTimeString();
                txtRetireDate.Text  = dtSite.AddYears(200).ToShortDateString();
                txtRetireTime.Text  = dtSite.AddYears(200).ToShortTimeString();

                hdnRootID.Value = Guid.Empty.ToString();

                GeneralUtilities.BindList(listCats, SiteData.CurrentSite.GetCategoryList().OrderBy(x => x.CategoryText));
                GeneralUtilities.BindList(listTags, SiteData.CurrentSite.GetTagList().OrderBy(x => x.TagText));

                ContentPage pageContents = null;
                if (guidVersionContentID != Guid.Empty)
                {
                    pageContents = pageHelper.GetVersion(SiteID, guidVersionContentID);
                }
                if (guidContentID != Guid.Empty && pageContents == null)
                {
                    pageContents = pageHelper.FindContentByID(SiteID, guidContentID);
                }

                if (guidImportContentID != Guid.Empty)
                {
                    ContentPageExport cpe = ContentImportExportUtils.GetSerializedContentPageExport(guidImportContentID);

                    if (cpe != null)
                    {
                        pageContents                  = cpe.ThePage;
                        pageContents.EditDate         = SiteData.CurrentSite.Now;
                        pageContents.Parent_ContentID = null;
                    }

                    var rp = pageHelper.GetLatestContentByURL(SiteID, false, pageContents.FileName);
                    if (rp != null)
                    {
                        pageContents.Root_ContentID = rp.Root_ContentID;
                        pageContents.ContentID      = rp.ContentID;
                    }
                    else
                    {
                        pageContents.Root_ContentID = Guid.Empty;
                        pageContents.ContentID      = Guid.Empty;
                    }
                    pageContents.Parent_ContentID = null;
                    pageContents.NavOrder         = SiteData.BlogSortOrderNumber;
                }

                //if (pageContents == null) {
                //    pageContents = new ContentPage(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
                //}

                List <ContentPage> lstContent = pageHelper.GetAllLatestContentList(SiteID);

                GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates);

                chkDraft.Visible   = false;
                divEditing.Visible = false;

                Dictionary <string, float> dictTemplates = pageHelper.GetPopularTemplateList(SiteID, ContentPageType.PageType.BlogEntry);
                if (dictTemplates.Any())
                {
                    try {
                        GeneralUtilities.SelectListValue(ddlTemplate, dictTemplates.First().Key);
                    } catch { }
                }

                if (pageContents == null)
                {
                    btnDeleteButton.Visible = false;
                }

                if (pageContents != null)
                {
                    bool bRet = pageHelper.RecordPageLock(pageContents.Root_ContentID, SiteData.CurrentSite.SiteID, SecurityData.CurrentUserGuid);

                    if (pageContents.ContentType != ContentPageType.PageType.BlogEntry)
                    {
                        Response.Redirect(SiteFilename.PageAddEditURL + "?id=" + Request.QueryString.ToString());
                    }

                    cmsHelper.OverrideKey(pageContents.Root_ContentID);
                    cmsHelper.cmsAdminContent = pageContents;
                    cmsHelper.cmsAdminWidget  = pageContents.GetWidgetList();

                    BindTextDataGrid();

                    guidRootContentID = pageContents.Root_ContentID;
                    hdnRootID.Value   = guidRootContentID.ToString();

                    txtOldFile.Text = pageContents.FileName;

                    if (guidImportContentID != Guid.Empty)
                    {
                        txtOldFile.Text = "";
                    }

                    Dictionary <string, string> dataVersions = (from v in pageHelper.GetVersionHistory(SiteID, pageContents.Root_ContentID)
                                                                join u in ExtendedUserData.GetUserList() on v.EditUserId equals u.UserId
                                                                orderby v.EditDate descending
                                                                select new KeyValuePair <string, string>(v.ContentID.ToString(), string.Format("{0} ({1}) {2}", v.EditDate, u.UserName, (v.IsLatestVersion ? " [**] " : " ")))
                                                                ).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

                    GeneralUtilities.BindListDefaultText(ddlVersions, dataVersions, null, "Page Versions", "00000");

                    bLocked = pageHelper.IsPageLocked(pageContents);

                    pnlHB.Visible      = !bLocked;
                    pnlButtons.Visible = !bLocked;
                    divEditing.Visible = bLocked;
                    chkDraft.Visible   = !bLocked;
                    pnlHBEmpty.Visible = bLocked;

                    if (bLocked && pageContents.Heartbeat_UserId != null)
                    {
                        MembershipUser usr = SecurityData.GetUserByGuid(pageContents.Heartbeat_UserId.Value);
                        litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the page.";
                    }

                    txtTitle.Text    = pageContents.TitleBar;
                    txtNav.Text      = pageContents.NavMenuText;
                    txtHead.Text     = pageContents.PageHead;
                    txtPageSlug.Text = pageContents.PageSlug;
                    txtThumb.Text    = pageContents.Thumbnail;

                    txtDescription.Text = pageContents.MetaDescription;
                    txtKey.Text         = pageContents.MetaKeyword;

                    lblUpdated.Text    = pageContents.EditDate.ToString();
                    lblCreateDate.Text = pageContents.CreateDate.ToString();

                    reBody.Text      = pageContents.PageText;
                    reLeftBody.Text  = pageContents.LeftPageText;
                    reRightBody.Text = pageContents.RightPageText;

                    chkActive.Checked = pageContents.PageActive;
                    chkHide.Checked   = pageContents.BlockIndex;

                    GeneralUtilities.BindDataBoundControl(gvTracks, pageContents.GetTrackbacks());

                    txtReleaseDate.Text = pageContents.GoLiveDate.ToShortDateString();
                    txtReleaseTime.Text = pageContents.GoLiveDate.ToShortTimeString();
                    txtRetireDate.Text  = pageContents.RetireDate.ToShortDateString();
                    txtRetireTime.Text  = pageContents.RetireDate.ToShortTimeString();

                    if (pageContents.CreditUserId.HasValue)
                    {
                        var usr = new ExtendedUserData(pageContents.CreditUserId.Value);
                        hdnCreditUserID.Value = usr.UserName;
                        txtSearchUser.Text    = string.Format("{0} ({1})", usr.UserName, usr.EmailAddress);
                    }

                    pageContents.Parent_ContentID = null;

                    GeneralUtilities.SelectListValue(ddlTemplate, pageContents.TemplateFile.ToLower());

                    GeneralUtilities.SelectListValues(listTags, pageContents.ContentTags.Cast <IContentMetaInfo>().Select(x => x.ContentMetaInfoID.ToString()).ToList());
                    GeneralUtilities.SelectListValues(listCats, pageContents.ContentCategories.Cast <IContentMetaInfo>().Select(x => x.ContentMetaInfoID.ToString()).ToList());
                }
            }

            SetBlankText(reBody);
            SetBlankText(reLeftBody);
            SetBlankText(reRightBody);

            if (ddlVersions.Items.Count < 1)
            {
                pnlReview.Visible = false;
            }
        }
Exemple #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.GroupAdmin);

            GeneralUtilities.BindDataBoundControl(gvRoles, SecurityData.GetRoleList());
        }