示例#1
0
        protected void BuildFolderList()
        {
            List <FileData> lstFolders = new List <FileData>();

            string sRoot = Server.MapPath("~/");

            string[] subdirs;
            try {
                subdirs = Directory.GetDirectories(sRoot);
            } catch {
                subdirs = null;
            }

            if (subdirs != null)
            {
                foreach (string theDir in subdirs)
                {
                    string w = FileDataHelper.MakeWebFolderPath(theDir);
                    lstFolders.Add(new FileData {
                        FileName = w, FolderPath = w, FileDate = DateTime.Now
                    });
                }
            }

            lstFolders.RemoveAll(f => f.FileName.ToLowerInvariant().StartsWith(SiteData.AdminFolderPath));
            lstFolders.RemoveAll(f => f.FileName.ToLowerInvariant().StartsWith("/app_code/"));
            lstFolders.RemoveAll(f => f.FileName.ToLowerInvariant().StartsWith("/app_data/"));
            lstFolders.RemoveAll(f => f.FileName.ToLowerInvariant().StartsWith("/aspnet_client/"));
            lstFolders.RemoveAll(f => f.FileName.ToLowerInvariant().StartsWith("/bin/"));
            lstFolders.RemoveAll(f => f.FileName.ToLowerInvariant().StartsWith("/obj/"));

            GeneralUtilities.BindListDefaultText(ddlFolders, lstFolders.OrderBy(f => f.FileName), null, "Folders", "-[none]-");
        }
		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.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");
            }
        }
示例#4
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;
            }
        }
示例#5
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;
        }
示例#6
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);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                string sCurrentPage = SiteData.CurrentScriptName;
                string sScrubbedURL = SiteData.AlternateCurrentScriptName;

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

                ContentPage currentPage = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage);

                if (currentPage == null && SiteData.IsPageReal)
                {
                    IsPageTemplate = true;
                }

                if ((SiteData.IsPageSampler || IsPageTemplate) && currentPage == null)
                {
                    currentPage = ContentPageHelper.GetSamplerView();
                }

                litVersion.Text  = SiteData.CarrotCakeCMSVersion;
                litRelease.Text  = currentPage.GoLiveDate.ToString();
                litRetire.Text   = currentPage.RetireDate.ToString();
                litTemplate.Text = currentPage.TemplateFile;

                CurrentPageID   = currentPage.Root_ContentID;
                lnkCurrent.HRef = SiteData.CurrentScriptName;

                EditPageURL  = SiteFilename.PageAddEditURL;
                PageIndexURL = SiteFilename.PageIndexURL;

                if (currentPage.ContentType == ContentPageType.PageType.BlogEntry)
                {
                    EditPageURL  = SiteFilename.BlogPostAddEditURL;
                    PageIndexURL = SiteFilename.BlogPostIndexURL;
                }

                if (!IsPostBack)
                {
                    List <SiteNav> nav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, CurrentPageID, !SecurityData.IsAuthEditor);

                    SiteNav pageContents2 = navHelper.GetParentPageNavigation(SiteData.CurrentSiteID, CurrentPageID);
                    if (pageContents2 != null)
                    {
                        pageContents2.NavMenuText = "Parent: " + pageContents2.NavMenuText;
                        pageContents2.NavOrder    = -110;
                        lnkParent.Visible         = true;
                        lnkParent.HRef            = pageContents2.FileName;
                    }
                    else
                    {
                        lnkParent.Visible = false;
                    }

                    ContentPage homePage = pageHelper.FindHome(SiteData.CurrentSiteID);

                    List <SiteNav> lstNavTop = null;
                    if (homePage != null && homePage.Root_ContentID == CurrentPageID)
                    {
                        lstNavTop = (from n in navHelper.GetTopNavigation(SiteData.CurrentSiteID, !SecurityData.IsAuthEditor)
                                     where n.Root_ContentID != CurrentPageID
                                     orderby n.NavOrder
                                     select new SiteNav {
                            NavOrder = n.NavOrder,
                            FileName = n.FileName,
                            NavMenuText = (n.NavOrder > 0 ? "  -- " : "") + n.FileName + "  [[" + (n.PageActive ? "" : "{*U*}  ") + n.NavMenuText + "]]",
                            PageActive = n.PageActive,
                            ContentID = n.ContentID,
                            Root_ContentID = n.Root_ContentID,
                            PageHead = n.PageHead,
                            SiteID = n.SiteID
                        }).ToList();
                    }

                    List <SiteNav> lstNav = (from n in nav
                                             orderby n.NavOrder
                                             select new SiteNav {
                        NavOrder = n.NavOrder,
                        FileName = n.FileName,
                        NavMenuText = (n.NavOrder > 0 ? "  -- " : "") + n.FileName + "  [[" + (n.PageActive ? "" : "{*U*}  ") + n.NavMenuText + "]]",
                        PageActive = n.PageActive,
                        ContentID = n.ContentID,
                        Root_ContentID = n.Root_ContentID,
                        PageHead = n.PageHead,
                        SiteID = n.SiteID
                    }).ToList();

                    if (lstNavTop != null)
                    {
                        lstNav = lstNavTop.Union(lstNav).ToList();
                    }

                    GeneralUtilities.BindListDefaultText(ddlCMSLinks, lstNav, null, "Navigate", "00000");

                    if (lstNav.Count < 1)
                    {
                        ddlCMSLinks.Visible = false;
                        lblChildDDL.Visible = false;
                    }
                }
            }
        }