示例#1
0
        protected void rpMap_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            PlaceHolder ph = (PlaceHolder)e.Item.FindControl("ph");

            if (ph != null)
            {
                var d   = (ContentPage)e.Item.DataItem;
                var lst = (from l in lstSite
                           orderby l.NavOrder, l.NavMenuText
                           where l.Parent_ContentID == d.Root_ContentID
                           select l).ToList();

                if (lst.Any())
                {
                    Repeater rp = new Repeater();

                    rp.HeaderTemplate = rpSub.HeaderTemplate;
                    rp.ItemTemplate   = rpSub.ItemTemplate;
                    rp.FooterTemplate = rpSub.FooterTemplate;
                    ph.Controls.Add(rp);

                    rp.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rpMap_ItemDataBound);

                    GeneralUtilities.BindRepeater(rp, lst);
                }
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!HideList && cmsHelper.AdminModules.Any())
                {
                    GeneralUtilities.BindRepeater(rpModuleList, cmsHelper.AdminModules);
                }
                else
                {
                    rpModuleList.Visible = false;
                }
            }

            pnlNav.Visible = !HideList;

            if (ModuleID != Guid.Empty)
            {
                pnlSetter.Visible = true;
                int x = 0;
                foreach (var row in cmsHelper.AdminModules)
                {
                    if (ModuleID.ToString().ToLower() == row.PluginID.ToString().ToLower())
                    {
                        SelMenu = x.ToString();
                        break;
                    }
                    x++;
                }
            }
        }
示例#3
0
        protected void rpModuleList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Repeater    rpModuleContents = (Repeater)e.Item.FindControl("rpModuleContents");
            HiddenField hdnID            = (HiddenField)e.Item.FindControl("hdnID");

            if (rpModuleContents != null)
            {
                var d = (CMSAdminModule)e.Item.DataItem;

                GeneralUtilities.BindRepeater(rpModuleContents, d.PluginMenus.Where(z => z.IsVisible == true).OrderBy(x => x.Caption).OrderBy(x => x.SortOrder).ToList());
            }
        }
        protected void DoDataBind()
        {
            List <SiteNav> lstNav = null;

            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                lstNav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, guidContentID, !SecurityData.IsAuthEditor);
            }

            if (bClickedSort && ddlAlternateSort.SelectedIndex > 0)
            {
                switch (ddlAlternateSort.SelectedValue)
                {
                case "alpha":
                    lstNav = lstNav.OrderBy(x => x.NavMenuText).ToList();
                    break;

                case "datecreated":
                    lstNav = lstNav.OrderBy(x => x.CreateDate).ToList();
                    break;

                case "dateupdated":
                    lstNav = lstNav.OrderBy(x => x.EditDate).ToList();
                    break;

                case "alpha2":
                    lstNav = lstNav.OrderByDescending(x => x.NavMenuText).ToList();
                    break;

                case "datecreated2":
                    lstNav = lstNav.OrderByDescending(x => x.CreateDate).ToList();
                    break;

                case "dateupdated2":
                    lstNav = lstNav.OrderByDescending(x => x.EditDate).ToList();
                    break;

                default:
                    lstNav = lstNav.OrderBy(x => x.NavOrder).ToList();
                    break;
                }
            }

            lstNav.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            GeneralUtilities.BindRepeater(rpPages, lstNav);

            if (lstNav.Count < 2)
            {
                btnSave.Visible = false;
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!this.HideList && cmsHelper.AdminModules.Any())
                {
                    GeneralUtilities.BindRepeater(rpModuleList, cmsHelper.AdminModules);
                }
                else
                {
                    rpModuleList.Visible = false;
                }
            }

            pnlNav.Visible = !this.HideList;

            if (this.ModuleID != Guid.Empty)
            {
                pnlSetter.Visible = true;
                int x = 0;
                foreach (var row in cmsHelper.AdminModules)
                {
                    if (this.ModuleID.ToString().ToLowerInvariant() == row.PluginID.ToString().ToLowerInvariant())
                    {
                        this.SelMenu = x.ToString();
                        break;
                    }
                    x++;
                }

                this.ModuleFamily = (from m in cmsHelper.AdminModules
                                     where m.PluginID == this.ModuleID
                                     select m).FirstOrDefault();
                if (this.ModuleFamily != null)
                {
                    litModuleTitle.Text = this.ModuleFamily.PluginName;

                    this.PluginItem = (from m in this.ModuleFamily.PluginMenus
                                       orderby m.Caption, m.SortOrder
                                       where m.PluginParm == pf
                                       select m).FirstOrDefault();

                    if (this.PluginItem != null)
                    {
                        litModuleTitle.Text = String.Format("{0} : {1}", this.ModuleFamily.PluginName, this.PluginItem.Caption);
                    }
                }
            }
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rpSub.ItemTemplate = rpTop.ItemTemplate;

                lstSite = (from c in pageHelper.GetAllLatestContentList(SiteID)
                           orderby c.TemplateFile
                           select c).ToList();

                var topPages = (from l in lstSite
                                orderby l.NavOrder, l.NavMenuText
                                where l.Parent_ContentID == null
                                select l).ToList();

                GeneralUtilities.BindRepeater(rpTop, topPages);
            }
        }
        protected void LoadLists()
        {
            var fldr = helpFile.GetFolders(sQueryPath);
            var fls  = helpFile.GetFiles(sQueryPath);

            GeneralUtilities.BindRepeater(rpFolders, fldr);

            if (sViewMode.ToLower() != defaultBrowseMode)
            {
                GeneralUtilities.BindRepeater(rpThumbs, fls.Where(x => x.MimeType.StartsWith("image/")).ToList());
                rpThumbs.Visible = true;
                rpFiles.Visible  = false;
            }
            else
            {
                GeneralUtilities.BindRepeater(rpFiles, fls);
                rpFiles.Visible  = true;
                rpThumbs.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DatabaseUpdate du = new DatabaseUpdate(true);

            if (!String.IsNullOrEmpty(Request.QueryString["signout"]))
            {
                FormsAuthentication.SignOut();
            }

            List <DatabaseUpdateMessage> lst = new List <DatabaseUpdateMessage>();

            btnLogin.Visible  = false;
            btnCreate.Visible = false;

            if (DatabaseUpdate.LastSQLError != null)
            {
                du.HandleResponse(lst, DatabaseUpdate.LastSQLError);
                DatabaseUpdate.LastSQLError = null;
            }
            else
            {
                bool bUpdate = true;

                if (!du.DoCMSTablesExist())
                {
                    bUpdate = false;
                }

                bUpdate = du.DatabaseNeedsUpdate();

                if (bUpdate)
                {
                    DatabaseUpdateStatus status = du.PerformUpdates();
                    lst = du.MergeMessages(lst, status.Messages);
                }
                else
                {
                    DataInfo ver = DatabaseUpdate.GetDbSchemaVersion();
                    du.HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                }

                bUpdate = du.DatabaseNeedsUpdate();

                if (!bUpdate && DatabaseUpdate.LastSQLError == null)
                {
                    if (DatabaseUpdate.UsersExist)
                    {
                        btnLogin.Visible = true;
                    }
                    else
                    {
                        btnCreate.Visible = true;
                    }
                }
            }

            if (DatabaseUpdate.LastSQLError != null)
            {
                du.HandleResponse(lst, DatabaseUpdate.LastSQLError);
            }

            if (lst.Where(x => !String.IsNullOrEmpty(x.ExceptionText)).Count() > 0)
            {
                bOK = false;
            }
            else
            {
                bOK = true;
            }

            GeneralUtilities.BindRepeater(rpMessages, lst.OrderBy(x => x.Order));

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                cmsHelper.ResetConfigs();
            }
        }
示例#9
0
        protected void SetSourceFiles(string sDir)
        {
            List <FileData> flsWorking  = new List <FileData>();
            List <FileData> fldrWorking = new List <FileData>();

            List <string> lstFileExtensions = new List <string>();

            lstFileExtensions.Add(".css");
            lstFileExtensions.Add(".js");
            lstFileExtensions.Add(".ascx");
            lstFileExtensions.Add(".master");

            if (Directory.Exists(sDir))
            {
                string sDirParent = "";

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

                FileData skinFolder = helpFile.GetFolderInfo("/", sDir);

                skinFolder.FolderPath = FileDataHelper.MakeWebFolderPath(sDir);

                fldrWorking = helpFile.SpiderDeepFoldersFD(FileDataHelper.MakeWebFolderPath(sDir));

                fldrWorking.Add(skinFolder);

                try {
                    if (Directory.Exists(Server.MapPath("~/includes")))
                    {
                        FileData incFolder = helpFile.GetFolderInfo("/", Server.MapPath("~/includes"));
                        fldrWorking.Add(incFolder);
                    }
                    if (Directory.Exists(Server.MapPath("~/js")))
                    {
                        FileData incFolder = helpFile.GetFolderInfo("/", Server.MapPath("~/js"));
                        fldrWorking.Add(incFolder);
                    }
                    if (Directory.Exists(Server.MapPath("~/css")))
                    {
                        FileData incFolder = helpFile.GetFolderInfo("/", Server.MapPath("~/css"));
                        fldrWorking.Add(incFolder);
                    }
                } catch (Exception ex) { }

                helpFile.IncludeAllFiletypes();

                foreach (FileData f in fldrWorking)
                {
                    List <FileData> fls = helpFile.GetFiles(f.FolderPath);

                    flsWorking = (from m in flsWorking.Union(fls).ToList()
                                  join e in lstFileExtensions on m.FileExtension.ToLowerInvariant() equals e
                                  select m).ToList();
                }

                flsWorking = flsWorking.Where(x => x.MimeType.StartsWith("text") && (x.FolderPath.ToLowerInvariant().StartsWith(SiteData.AdminFolderPath) == false)).ToList();

                GeneralUtilities.BindRepeater(rpFiles, flsWorking.Distinct().OrderBy(x => x.FileName).OrderBy(x => x.FolderPath).ToList());
            }
        }
示例#10
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 />";
                }
            }
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.UsesSaved = true;
            Master.HideSave();

            guidWidget = GetGuidIDFromQuery();

            guidContentID = GetGuidPageIDFromQuery();

            cmsHelper.OverrideKey(guidContentID);

            Widget w = (from aw in cmsHelper.cmsAdminWidget
                        where aw.Root_WidgetID == guidWidget
                        orderby aw.WidgetOrder, aw.EditDate
                        select aw).FirstOrDefault();

            if (!IsPostBack)
            {
                lstProps = w.ParseDefaultControlProperties();

                Control widget = new Control();

                if (w.ControlPath.EndsWith(".ascx"))
                {
                    try {
                        widget = Page.LoadControl(w.ControlPath);
                    } catch (Exception ex) {
                    }
                }

                if (w.ControlPath.ToLower().StartsWith("class:"))
                {
                    try {
                        Assembly a         = Assembly.GetExecutingAssembly();
                        var      className = w.ControlPath.Replace("CLASS:", "");
                        Type     t         = Type.GetType(className);
                        Object   o         = Activator.CreateInstance(t);
                        if (o != null)
                        {
                            widget = o as Control;
                        }
                    } catch (Exception ex) {
                    }
                }

                List <ObjectProperty> props     = new List <ObjectProperty>();
                List <ObjectProperty> props_tmp = new List <ObjectProperty>();

                if (widget is BaseUserControl)
                {
                    props_tmp = ObjectProperty.GetTypeProperties(typeof(BaseUserControl));
                    props     = props.Union(props_tmp).ToList();
                }

                if (widget is BaseShellUserControl)
                {
                    props_tmp = ObjectProperty.GetTypeProperties(typeof(BaseShellUserControl));
                    props     = props.Union(props_tmp).ToList();
                }

                if (widget is UserControl)
                {
                    props_tmp = ObjectProperty.GetTypeProperties(typeof(UserControl));
                    props     = props.Union(props_tmp).ToList();
                }

                if (widget is IAdminModule)
                {
                    var w1 = (IAdminModule)widget;
                    w1.SiteID = SiteData.CurrentSiteID;
                    props_tmp = ObjectProperty.GetTypeProperties(typeof(IAdminModule));
                    props     = props.Union(props_tmp).ToList();
                }

                if (widget is IWidget)
                {
                    var w1 = (IWidget)widget;
                    w1.SiteID        = SiteData.CurrentSiteID;
                    w1.PageWidgetID  = w.Root_WidgetID;
                    w1.RootContentID = w.Root_ContentID;
                    props_tmp        = ObjectProperty.GetTypeProperties(typeof(IWidget));
                    props            = props.Union(props_tmp).ToList();
                }

                if (widget is IWidgetEditStatus)
                {
                    props_tmp = ObjectProperty.GetTypeProperties(typeof(IWidgetEditStatus));
                    props     = props.Union(props_tmp).ToList();
                }

                if (widget is IWidgetParmData)
                {
                    props_tmp = ObjectProperty.GetTypeProperties(typeof(IWidgetParmData));
                    props     = props.Union(props_tmp).ToList();
                }

                if (widget is IWidgetRawData)
                {
                    var w1 = (IWidgetRawData)widget;
                    w1.RawWidgetData = w.ControlProperties;
                    props_tmp        = ObjectProperty.GetTypeProperties(typeof(IWidgetRawData));
                    props            = props.Union(props_tmp).ToList();
                }

                lstDefProps = ObjectProperty.GetObjectProperties(widget);

                List <string> limitedPropertyList = new List <string>();
                if (widget is IWidgetLimitedProperties)
                {
                    limitedPropertyList = ((IWidgetLimitedProperties)(widget)).LimitedPropertyList;
                }
                else
                {
                    limitedPropertyList = (from p in lstDefProps
                                           select p.Name.ToLower()).ToList();
                }
                if (limitedPropertyList != null && limitedPropertyList.Any())
                {
                    limitedPropertyList = (from p in limitedPropertyList
                                           select p.ToLower()).ToList();
                }

                var defprops = (from p in lstDefProps
                                join l in limitedPropertyList on p.Name.ToLower() equals l.ToLower()
                                where p.CanRead == true &&
                                p.CanWrite == true &&
                                !props.Contains(p)
                                select p).ToList();

                GeneralUtilities.BindRepeater(rpProps, defprops);
            }
        }