예제 #1
0
        /// <summary>
        /// The BindData helper method is used to update the tab's
        /// layout panes with the current configuration information
        /// </summary>
        private void BindData()
        {
            PageSettings tab = this.PortalSettings.ActivePage;

            // Populate Page Names, etc.
            tabName.Text        = "New Page";
            mobilePageName.Text = "";
            showMobile.Checked  = false;

            // Populate the "ParentPage" Data
            PagesDB          t     = new PagesDB();
            IList <PageItem> items = t.GetPagesParent(this.PortalSettings.PortalID, PageID);

            parentPage.DataSource = items;
            parentPage.DataBind();

            // Translate
            if (parentPage.Items.FindByText(" ROOT_LEVEL") != null)
            {
                parentPage.Items.FindByText(" ROOT_LEVEL").Text =
                    General.GetString("ROOT_LEVEL", "Root Level", parentPage);
            }

            // Populate checkbox list with all security roles for this portal
            // and "check" the ones already configured for this tab
            UsersDB users = new UsersDB();
            IList <AppleseedRole> roles = users.GetPortalRoles(this.PortalSettings.PortalAlias);

            // Clear existing items in checkboxlist
            authRoles.Items.Clear();

            foreach (AppleseedRole role in roles)
            {
                ListItem item = new ListItem();
                item.Text  = role.Name;
                item.Value = role.Id.ToString();

                if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1)
                {
                    item.Selected = true;
                }

                authRoles.Items.Add(item);
            }
        }
예제 #2
0
        /// <summary>
        /// The BindData helper method is used to update the tab's
        ///   layout panes with the current configuration information
        /// </summary>
        /// <remarks>
        /// </remarks>
        private void BindData()
        {
            var page = this.PortalSettings.ActivePage;

            // Populate Page Names, etc.
            this.tabName.Text        = page.PageName;
            this.mobilePageName.Text = page.MobilePageName;
            this.showMobile.Checked  = page.ShowMobile;

            // Populate the "ParentPage" Data
            var t     = new PagesDB();
            var items = t.GetPagesParent(this.PortalSettings.PortalID, this.PageID);

            this.parentPage.DataSource = items;
            this.parentPage.DataBind();

            if (this.parentPage.Items.FindByValue(page.ParentPageID.ToString()) != null)
            {
                // parentPage.Items.FindByValue( tab.ParentPageID.ToString() ).Selected = true;
                this.parentPage.SelectedValue = page.ParentPageID.ToString();
            }

            // Translate
            if (this.parentPage.Items.FindByText(" ROOT_LEVEL") != null)
            {
                this.parentPage.Items.FindByText(" ROOT_LEVEL").Text = General.GetString(
                    "ROOT_LEVEL", "Root Level", this.parentPage);
            }

            // Populate checkbox list with all security roles for this portal
            // and "check" the ones already configured for this tab
            var users = new UsersDB();
            var roles = users.GetPortalRoles(this.PortalSettings.PortalAlias);

            // Clear existing items in checkboxlist
            this.authRoles.Items.Clear();

            foreach (var role in roles)
            {
                var item = new ListItem();
                item.Text  = role.Name;
                item.Value = role.Id.ToString();

                if (page.AuthorizedRoles.LastIndexOf(item.Text) > -1)
                {
                    item.Selected = true;
                }

                this.authRoles.Items.Add(item);
            }

            // Populate the "Add Module" Data
            var m       = new ModulesDB();
            var modules = new SortedList <string, string>();
            var drCurrentModuleDefinitions = m.GetCurrentModuleDefinitions(this.PortalSettings.PortalID);
            //if (PortalSecurity.IsInRoles("Admins") || !bool.Parse(drCurrentModuleDefinitions["Admin"].ToString()))
            //{
            var htmlId = "0";

            try {
                while (drCurrentModuleDefinitions.Read())
                {
                    if ((!modules.ContainsKey(drCurrentModuleDefinitions["FriendlyName"].ToString())) &&
                        (PortalSecurity.IsInRoles("Admins") || !bool.Parse(drCurrentModuleDefinitions["Admin"].ToString())))
                    {
                        modules.Add(
                            // moduleType.Items.Add(
                            // new ListItem(drCurrentModuleDefinitions["FriendlyName"].ToString(),
                            // drCurrentModuleDefinitions["ModuleDefID"].ToString()));
                            drCurrentModuleDefinitions["FriendlyName"].ToString(),
                            drCurrentModuleDefinitions["ModuleDefID"].ToString());
                        if (drCurrentModuleDefinitions["FriendlyName"].ToString().Equals("HTML Content"))
                        {
                            htmlId = drCurrentModuleDefinitions["ModuleDefID"].ToString();
                        }
                    }
                }
            }
            finally {
                drCurrentModuleDefinitions.Close();
            }
            //}

            // Dictionary<string, string> actions = ModelServices.GetMVCActionModules();
            // foreach (string key in actions.Keys) {
            // modules.Add(key, actions[key]);
            // }
            this.moduleType.DataSource = modules;
            this.moduleType.DataBind();
            this.moduleType.SelectedValue = htmlId;


            // Now it's the load is by ajax 1/september/2011
            // Populate Top Pane Module Data
            //this.topList = this.GetModules("TopPane");
            //this.topPane.DataBind();

            //// Populate Left Hand Pane Module Data
            //this.leftList = this.GetModules("LeftPane");
            //this.leftPane.DataBind();

            //// Populate Content Pane Module Data
            //this.contentList = this.GetModules("ContentPane");
            //this.contentPane.DataBind();

            //// Populate Right Hand Module Data
            //this.rightList = this.GetModules("RightPane");
            //this.rightPane.DataBind();

            //// Populate Bottom Module Data
            //this.bottomList = this.GetModules("BottomPane");
            //this.bottomPane.DataBind();
        }
예제 #3
0
        /// <summary>
        /// The BindData helper method is used to update the tab's
        ///   layout panes with the current configuration information
        /// </summary>
        /// <remarks>
        /// </remarks>
        private void BindData()
        {
            var page = this.PortalSettings.ActivePage;

            // Populate Page Names, etc.
            this.txtPageID.Text          = page.PageID.ToString();
            this.tabName.Text            = page.PageName;
            this.friendlyUrl.Text        = page.FriendlyURL;
            this.mobilePageName.Text     = page.MobilePageName;
            this.showMobile.Checked      = page.ShowMobile;
            this.lblCurrentPageLink.Text = HttpUrlBuilder.BuildUrl(page.PageID);

            // Populate the "ParentPage" Data
            var t     = new PagesDB();
            var items = t.GetPagesParent(this.PortalSettings.PortalID, this.PageID);

            this.parentPage.DataSource = items;
            this.parentPage.DataBind();

            if (this.parentPage.Items.FindByValue(page.ParentPageID.ToString()) != null)
            {
                // parentPage.Items.FindByValue( tab.ParentPageID.ToString() ).Selected = true;
                this.parentPage.SelectedValue = page.ParentPageID.ToString();
            }

            // Translate
            if (this.parentPage.Items.FindByText(" ROOT_LEVEL") != null)
            {
                this.parentPage.Items.FindByText(" ROOT_LEVEL").Text = General.GetString(
                    "ROOT_LEVEL", "Root Level", this.parentPage);
            }

            // Populate checkbox list with all security roles for this portal
            // and "check" the ones already configured for this tab
            var users = new UsersDB();
            var roles = users.GetPortalRoles(this.PortalSettings.PortalAlias);

            // Clear existing items in checkboxlist
            this.authRoles.Items.Clear();

            foreach (var role in roles)
            {
                var item = new ListItem();
                item.Text  = role.Name;
                item.Value = role.Id.ToString();

                if (page.AuthorizedRoles.LastIndexOf(item.Text) > -1)
                {
                    item.Selected = true;
                }

                this.authRoles.Items.Add(item);
            }

            // Populate the "Add Module" Data
            var m       = new ModulesDB();
            var modules = new SortedList <string, string>();
            var drCurrentModuleDefinitions = m.GetCurrentModuleDefinitions(this.PortalSettings.PortalID);
            var htmlId = "0";

            try
            {
                foreach (var item in drCurrentModuleDefinitions)
                {
                    if ((!modules.ContainsKey(item.FriendlyName)) &&
                        (PortalSecurity.IsInRoles("Admins") || !item.Admin))
                    {
                        modules.Add(

                            item.FriendlyName,
                            item.ModuleDefId.ToString());
                        if (item.FriendlyName.ToString().Equals("HTML Content"))
                        {
                            htmlId = item.ModuleDefId.ToString();
                        }
                    }
                }
            }
            finally
            {
            }

            this.moduleType.DataSource = modules;
            this.moduleType.DataBind();
            this.moduleType.SelectedValue = htmlId;
        }
예제 #4
0
        /// <summary>
        /// The BindData helper method is used to update the tab's
        /// layout panes with the current configuration information
        /// </summary>
        private void BindData()
        {
            PageSettings page = portalSettings.ActivePage;

            // Populate Page Names, etc.
            tabName.Text        = page.PageName;
            mobilePageName.Text = page.MobilePageName;
            showMobile.Checked  = page.ShowMobile;

            // Populate the "ParentPage" Data
            PagesDB          t     = new PagesDB();
            IList <PageItem> items = t.GetPagesParent(portalSettings.PortalID, PageID);

            parentPage.DataSource = items;
            parentPage.DataBind();

            if (parentPage.Items.FindByValue(page.ParentPageID.ToString()) != null)
            {
                //parentPage.Items.FindByValue( tab.ParentPageID.ToString() ).Selected = true;

                parentPage.SelectedValue = page.ParentPageID.ToString();
            }

            // Translate
            if (parentPage.Items.FindByText(" ROOT_LEVEL") != null)
            {
                parentPage.Items.FindByText(" ROOT_LEVEL").Text =
                    General.GetString("ROOT_LEVEL", "Root Level", parentPage);
            }

            // Populate checkbox list with all security roles for this portal
            // and "check" the ones already configured for this tab
            UsersDB             users = new UsersDB();
            IList <RainbowRole> roles = users.GetPortalRoles(portalSettings.PortalAlias);

            // Clear existing items in checkboxlist
            authRoles.Items.Clear();

            foreach (RainbowRole role in roles)
            {
                ListItem item = new ListItem();
                item.Text  = role.Name;
                item.Value = role.Id.ToString();

                if ((page.AuthorizedRoles.LastIndexOf(item.Text)) > -1)
                {
                    item.Selected = true;
                }

                authRoles.Items.Add(item);
            }

            // Populate the "Add Module" Data
            ModulesDB m = new ModulesDB();

            SqlDataReader drCurrentModuleDefinitions = m.GetCurrentModuleDefinitions(portalSettings.PortalID);

            try {
                while (drCurrentModuleDefinitions.Read())
                {
                    if (PortalSecurity.IsInRoles("Admins") == true ||
                        !(bool.Parse(drCurrentModuleDefinitions["Admin"].ToString())))
                    {
                        moduleType.Items.Add(
                            new ListItem(drCurrentModuleDefinitions["FriendlyName"].ToString(),
                                         drCurrentModuleDefinitions["ModuleDefID"].ToString()));
                    }
                }
            }
            finally {
                drCurrentModuleDefinitions.Close();
            }

            // Populate Right Hand Module Data
            rightList = GetModules("RightPane");
            rightPane.DataBind();

            // Populate Content Pane Module Data
            contentList = GetModules("ContentPane");
            contentPane.DataBind();

            // Populate Left Hand Pane Module Data
            leftList = GetModules("LeftPane");
            leftPane.DataBind();
        }