Ejemplo n.º 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 );
            }
        }
Ejemplo n.º 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();
        }