コード例 #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 bind the list of
        /// security roles for this portal to an asp:datalist server control
        /// </summary>
        private void BindData()
        {
            // Get the portal's roles from the database
            UsersDB users = new UsersDB();

            IList<AppleseedRole> roles = users.GetPortalRoles(this.PortalSettings.PortalAlias);

            // remove "All Users", "Authenticated Users" and "Unauthenticated Users" pseudo-roles
            AppleseedRole pseudoRole = new AppleseedRole(AppleseedRoleProvider.AllUsersGuid, AppleseedRoleProvider.AllUsersRoleName);
            if (roles.Contains(pseudoRole))
            {
                roles.Remove(pseudoRole);
            }
            pseudoRole = new AppleseedRole(AppleseedRoleProvider.AuthenticatedUsersGuid, AppleseedRoleProvider.AuthenticatedUsersRoleName);
            if (roles.Contains(pseudoRole))
            {
                roles.Remove(pseudoRole);
            }
            pseudoRole = new AppleseedRole(AppleseedRoleProvider.UnauthenticatedUsersGuid, AppleseedRoleProvider.UnauthenticatedUsersRoleName);
            if (roles.Contains(pseudoRole))
            {
                roles.Remove(pseudoRole);
            }

            rolesList.DataSource = roles;
            rolesList.DataBind();
        }
コード例 #4
0
        /// <summary>
        /// The BindData helper method is used to bind the list of
        /// security roles for this portal to an asp:datalist server control
        /// </summary>
        private void BindData()
        {
            // Bind the Email and Password
            UsersDB users = new UsersDB();

            Guid currentUserID = this.userID;// PortalSettings.CurrentUser.Identity.ProviderUserKey;
            // bind users in role to DataList
            IList<AppleseedRole> roles = new List<AppleseedRole>();
            try {
                roles = users.GetRolesByUser(currentUserID, this.PortalSettings.PortalAlias);
            } catch (Exception exc) {
                ErrorHandler.Publish(LogLevel.Error, exc);
            }
            userRoles.DataKeyField = "Id";
            userRoles.DataSource = roles;
            userRoles.DataBind();

            // bind all portal roles to dropdownlist
            IList<AppleseedRole> allRolesList = users.GetPortalRoles(this.PortalSettings.PortalAlias);

            // remove "All Users", "Authenticated Users" and "Unauthenticated Users" pseudo-roles
            AppleseedRole pseudoRole = new AppleseedRole(AppleseedRoleProvider.AllUsersGuid, AppleseedRoleProvider.AllUsersRoleName);

            if (allRolesList.Contains(pseudoRole))
            {
                allRolesList.Remove(pseudoRole);
            }
            pseudoRole = new AppleseedRole(AppleseedRoleProvider.AuthenticatedUsersGuid, AppleseedRoleProvider.AuthenticatedUsersRoleName);
            if (allRolesList.Contains(pseudoRole))
            {
                allRolesList.Remove(pseudoRole);
            }
            pseudoRole = new AppleseedRole(AppleseedRoleProvider.UnauthenticatedUsersGuid, AppleseedRoleProvider.UnauthenticatedUsersRoleName);
            if (allRolesList.Contains(pseudoRole))
            {
                allRolesList.Remove(pseudoRole);
            }

            allRoles.DataSource = allRolesList;
            allRoles.DataBind();
        }
コード例 #5
0
        /// <summary>
        /// Populates the roles.
        /// </summary>
        /// <param name="listRoles">The list roles.</param>
        /// <param name="moduleRoles">The module roles.</param>
        private void PopulateRoles(ref CheckBoxList listRoles, string moduleRoles)
        {
            // Get roles from db
            var users = new UsersDB();
            var roles = users.GetPortalRoles(this.PortalSettings.PortalAlias);

            // Clear existing items in checkbox list
            listRoles.Items.Clear();

            // All Users
            var allItem = new ListItem("All Users");
            listRoles.Items.Add(allItem);

            // Authenticated user role added 15 nov 2002 - by manudea
            var authItem = new ListItem("Authenticated Users");
            listRoles.Items.Add(authItem);

            // Unauthenticated user role added 30/01/2003 - by manudea
            var unauthItem = new ListItem("Unauthenticated Users");
            listRoles.Items.Add(unauthItem);

            listRoles.DataSource = roles;
            listRoles.DataTextField = "Name";
            listRoles.DataValueField = "Id";
            listRoles.DataBind();

            // Splits up the role string and use array 30/01/2003 - by manudea
            while (moduleRoles.EndsWith(";"))
            {
                moduleRoles = moduleRoles.Substring(0, moduleRoles.Length - 1);
            }

            var arrModuleRoles = moduleRoles.Split(';');
            var roleCount = arrModuleRoles.GetUpperBound(0);

            // Cycle every role and select it if needed
            foreach (ListItem ls in listRoles.Items)
            {
                for (var i = 0; i <= roleCount; i++)
                {
                    if (arrModuleRoles[i].ToLower() == ls.Text.ToLower())
                    {
                        ls.Selected = true;
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Articles" /> class.
        /// </summary>
        public Articles()
        {
            this.SupportsWorkflow = true;

            if (this.PortalSettings == null)
            {
                return;
            }

            // check for avoid design time errors

            // modified by Hongwei Shen([email protected]) 12/9/2005
            const SettingItemGroup Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            const int GroupBase = (int)Group;

            // end of modification

            // Set Editor Settings [email protected] 2004/07/30
            // modified by Hongwei Shen
            // HtmlEditorDataType.HtmlEditorSettings (this._baseSettings, SettingItemGroup.MODULE_SPECIAL_SETTINGS);
            HtmlEditorDataType.HtmlEditorSettings(this.BaseSettings, Group);

            // end of modification

            // Switches date display on/off
            var showDate = new SettingItem<bool, CheckBox>
                {
                    Value = true, EnglishName = "Show Date", Group = Group, Order = GroupBase + 20
                };

            // modified by Hongwei Shen
            // ShowDate.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // ShowDate.Order = 10;

            // end of modification
            this.BaseSettings.Add("ShowDate", showDate);

            // Added by Rob Siera
            var defaultVisibleDays = new SettingItem<int, TextBox>
                {
                    Value = 90, EnglishName = "Default Days Visible", Group = Group, Order = GroupBase + 25
                };

            // modified by Hongwei Shen
            // DefaultVisibleDays.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // DefaultVisibleDays.Order = 20;

            // end of modification
            this.BaseSettings.Add("DefaultVisibleDays", defaultVisibleDays);

            var richAbstract = new SettingItem<bool, CheckBox>
                {
                    Value = true,
                    EnglishName = "Rich Abstract",
                    Description = "User rich editor for abstract",
                    Group = Group,
                    Order = GroupBase + 30
                };

            // modified by Hongwei Shen
            // RichAbstract.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // RichAbstract.Order = 30;

            // end of modification
            this.BaseSettings.Add("ARTICLES_RICHABSTRACT", richAbstract);

            var users = new UsersDB();
            var rolesViewExpiredItems =
                new SettingItem<string, CheckBoxList>(
                    new CheckBoxListDataType(
                        users.GetPortalRoles(this.PortalSettings.PortalAlias), "RoleName", "RoleName"))
                    {
                        Value = "Admins",
                        EnglishName = "Expired items visible to",
                        Description = "Role that can see expire items",
                        Group = Group,
                        Order = GroupBase + 40
                    };

            // modified by Hongwei Shen
            // RolesViewExpiredItems.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // RolesViewExpiredItems.Order = 40;

            // end of modification
            this.BaseSettings.Add("EXPIRED_PERMISSION_ROLE", rolesViewExpiredItems);
        }