Пример #1
0
        private void BindData()
        {
            GeneralUtilities.BindDataBoundControl(gvPages, wpSite.ContentPages);
            GeneralUtilities.BindDataBoundControl(gvPosts, wpSite.ContentPosts);

            GeneralUtilities.BindList(ddlTemplatePage, cmsHelper.Templates);
            GeneralUtilities.BindList(ddlTemplatePost, cmsHelper.Templates);

            lblPages.Text = gvPages.Rows.Count.ToString();
            lblPosts.Text = gvPosts.Rows.Count.ToString();

            SetDDLDefaultTemplates();
        }
Пример #2
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);
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.UsesSaved = true;
            Master.HideSave();

            guidContentID = GetGuidPageIDFromQuery();

            cmsHelper.OverrideKey(guidContentID);

            if (cmsHelper.cmsAdminContent != null)
            {
                pageContents     = cmsHelper.cmsAdminContent;
                litPageName.Text = pageContents.FileName;

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

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

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

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

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

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

                    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);
                    }

                    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());
                }
            }
        }
Пример #4
0
        private void BindData()
        {
            GeneralUtilities.BindDataBoundControl(gvPages, exSite.TheContentPages.Select(s => s.ThePage).OrderBy(s => s.NavOrder));
            GeneralUtilities.BindDataBoundControl(gvPosts, exSite.TheBlogPages.Select(s => s.ThePage).OrderByDescending(s => s.CreateDate));
            GeneralUtilities.BindDataBoundControl(gvSnippets, exSite.TheSnippets.OrderByDescending(s => s.ContentSnippetName));

            GeneralUtilities.BindList(ddlTemplatePage, cmsHelper.Templates);
            GeneralUtilities.BindList(ddlTemplatePost, cmsHelper.Templates);

            lblPages.Text    = gvPages.Rows.Count.ToString();
            lblPosts.Text    = gvPosts.Rows.Count.ToString();
            lblSnippets.Text = gvSnippets.Rows.Count.ToString();
            lblComments.Text = exSite.TheComments.Count.ToString();
            SetDDLDefaultTemplates();
        }
Пример #5
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();
            }
        }
Пример #6
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();
        }
Пример #7
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;
            }
        }
Пример #8
0
        //protected void Page_Load(object sender, EventArgs e) {
        protected void Page_Init(object sender, EventArgs e)
        {
            guidContentID = GetGuidIDFromQuery();

            EditorPrefs = UserEditState.cmsUserEditState;
            if (EditorPrefs == null)
            {
                EditorPrefs = new UserEditState();
                EditorPrefs.Init();
            }

            string sCurrentPage = SiteData.CurrentScriptName;
            string sScrubbedURL = SiteData.AlternateCurrentScriptName;

            if (sScrubbedURL.ToLowerInvariant() != sCurrentPage.ToLowerInvariant())
            {
                sCurrentPage = sScrubbedURL;
            }

            ContentPage pageContents = new ContentPage();

            if (guidContentID == Guid.Empty)
            {
                pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage);
            }
            else
            {
                pageContents = pageHelper.FindContentByID(SiteData.CurrentSiteID, guidContentID);
            }

            PageType           = pageContents.ContentType;
            EditedPageFileName = pageContents.FileName;

            btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPageInfo();";

            if (pageContents.ContentType == ContentPageType.PageType.BlogEntry)
            {
                btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPostInfo();";
                btnSortChildPages.Visible             = false;
            }

            if (cmsHelper.cmsAdminContent != null)
            {
                EditedPageFileName = cmsHelper.cmsAdminContent.FileName;
            }

            if (cmsHelper.ToolboxPlugins.Any())
            {
                GeneralUtilities.BindRepeater(rpTools, cmsHelper.ToolboxPlugins);
            }
            else
            {
                rpTools.Visible = false;
            }

            bLocked = pageHelper.IsPageLocked(pageContents.Root_ContentID, SiteData.CurrentSiteID, SecurityData.CurrentUserGuid);

            GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates);
            try { GeneralUtilities.SelectListValue(ddlTemplate, cmsHelper.cmsAdminContent.TemplateFile.ToLowerInvariant()); } catch { }

            if (!bLocked)
            {
                foreach (Control c in plcIncludes.Controls)
                {
                    this.Page.Header.Controls.Add(c);
                }

                //jquerybasic jquerybasic2 = new jquerybasic();
                //jquerybasic2.SelectedSkin = jquerybasic.jQueryTheme.NotUsed;
                //Page.Header.Controls.AddAt(0, jquerybasic2);

                //BasicControlUtils.InsertjQuery(this.Page);

                BasicControlUtils.InsertjQueryMain(this.Page);
                BasicControlUtils.InsertjQueryUI(this.Page);

                guidContentID = pageContents.Root_ContentID;

                if (cmsHelper.cmsAdminContent == null)
                {
                    pageContents.LoadAttributes();
                    cmsHelper.cmsAdminContent = pageContents;
                }
                else
                {
                    pageContents = cmsHelper.cmsAdminContent;
                }

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

                cmsDivEditing.Visible = false;

                BasicControlUtils.MakeXUACompatibleFirst(this.Page);
            }
            else
            {
                pnlCMSEditZone.Visible  = false;
                rpTools.Visible         = false;
                btnToolboxSave1.Visible = false;
                btnToolboxSave2.Visible = false;
                btnToolboxSave3.Visible = false;
                btnTemplate.Visible     = false;
                btnEditCoreInfo.Visible = false;
                cmsDivEditing.Visible   = true;

                if (bLocked && pageContents.Heartbeat_UserId != null)
                {
                    MembershipUser usr = SecurityData.GetUserByGuid(pageContents.Heartbeat_UserId.Value);
                    EditUserName = usr.UserName;
                    litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the page.<br />" +
                                   " Click <b><a href=\"" + pageContents.FileName + "\">here</a></b> to return to the browse view.<br />";
                }
            }
        }
Пример #9
0
        protected void rpProps_Bind(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                HiddenField  hdnName   = (HiddenField)e.Item.FindControl("hdnName");
                TextBox      txtValue  = (TextBox)e.Item.FindControl("txtValue");
                DropDownList ddlValue  = (DropDownList)e.Item.FindControl("ddlValue");
                CheckBox     chkValue  = (CheckBox)e.Item.FindControl("chkValue");
                CheckBoxList chkValues = (CheckBoxList)e.Item.FindControl("chkValues");

                txtValue.Visible = true;
                string sName = hdnName.Value;

                ObjectProperty ListSourceProperty = new ObjectProperty();

                string sListSourcePropertyName = (from p in lstDefProps
                                                  where p.Name.ToLower() == sName.ToLower() &&
                                                  !String.IsNullOrEmpty(p.CompanionSourceFieldName)
                                                  select p.CompanionSourceFieldName).FirstOrDefault();

                if (String.IsNullOrEmpty(sListSourcePropertyName))
                {
                    sListSourcePropertyName = String.Empty;
                }

                ListSourceProperty = (from p in lstDefProps
                                      where p.CanRead == true &&
                                      p.CanWrite == false &&
                                      p.Name.ToLower() == sListSourcePropertyName.ToLower()
                                      select p).FirstOrDefault();

                var dp = (from p in lstDefProps
                          where p.Name.ToLower() == sName.ToLower()
                          select p).FirstOrDefault();

                if (ListSourceProperty != null)
                {
                    if (ListSourceProperty.DefValue is Dictionary <string, string> )
                    {
                        txtValue.Visible = false;

                        //work with a drop down list, only allow one item in the drop down.
                        if (dp.FieldMode == WidgetAttribute.FieldMode.DropDownList)
                        {
                            ddlValue.Visible = true;

                            ddlValue.DataTextField  = "Value";
                            ddlValue.DataValueField = "Key";

                            GeneralUtilities.BindListDefaultText(ddlValue, ListSourceProperty.DefValue, null, "Select Value", "");

                            if (!String.IsNullOrEmpty(txtValue.Text))
                            {
                                try {
                                    GeneralUtilities.SelectListValue(ddlValue, txtValue.Text);
                                } catch { }
                            }
                        }

                        // work with a checkbox list, allow more than one value
                        if (dp.FieldMode == WidgetAttribute.FieldMode.CheckBoxList)
                        {
                            chkValues.Visible = true;

                            chkValues.DataTextField  = "Value";
                            chkValues.DataValueField = "Key";

                            GeneralUtilities.BindList(chkValues, ListSourceProperty.DefValue);

                            // since this is a multi selected capable field, look for anything that starts with the
                            // field name and has the delimeter trailing
                            var pp = (from p in lstProps
                                      where p.KeyName.ToLower().StartsWith(sName.ToLower() + "|")
                                      select p).ToList();

                            if (pp.Any())
                            {
                                foreach (ListItem v in chkValues.Items)
                                {
                                    v.Selected = (from p in pp
                                                  where p.KeyValue == v.Value
                                                  select p.KeyValue).Count() < 1 ? false : true;
                                }
                            }
                        }
                    }
                }

                if (dp.FieldMode == WidgetAttribute.FieldMode.RichHTMLTextBox ||
                    dp.FieldMode == WidgetAttribute.FieldMode.MultiLineTextBox)
                {
                    txtValue.Visible  = true;
                    txtValue.TextMode = TextBoxMode.MultiLine;
                    txtValue.Columns  = 60;
                    txtValue.Rows     = 5;
                    if (dp.FieldMode == WidgetAttribute.FieldMode.RichHTMLTextBox)
                    {
                        txtValue.CssClass = "mceEditor";
                    }
                }

                if (dp.PropertyType == typeof(bool) || dp.FieldMode == WidgetAttribute.FieldMode.CheckBox)
                {
                    txtValue.Visible = false;
                    chkValue.Visible = true;

                    chkValue.Checked = Convert.ToBoolean(txtValue.Text);
                }
            }
        }