コード例 #1
0
        private void BindData()
        {
            switch (optModuleType.SelectedItem.Value)
            {
            case "0":     // new module
                cboTabs.Visible           = false;
                cboModules.Visible        = false;
                cboDesktopModules.Visible = true;
                txtTitle.Visible          = true;
                lblModule.Text            = Localization.GetString("Module", this.LocalResourceFile);
                lblTitle.Text             = Localization.GetString("Title", this.LocalResourceFile);
                cboPermission.Enabled     = true;

                DesktopModuleController objDesktopModules = new DesktopModuleController();
                cboDesktopModules.DataSource = objDesktopModules.GetDesktopModulesByPortal(PortalSettings.PortalId);
                cboDesktopModules.DataBind();
                cboDesktopModules.Items.Insert(0, new ListItem("<" + Localization.GetString("SelectModule", this.LocalResourceFile) + ">", "-1"));
                foreach (ListItem item in cboDesktopModules.Items)
                {
                    item.Attributes.Add("title", item.Text);
                }
                break;

            case "1":     // existing module
                cboTabs.Visible           = true;
                cboModules.Visible        = true;
                cboDesktopModules.Visible = false;
                txtTitle.Visible          = false;
                lblModule.Text            = Localization.GetString("Tab", this.LocalResourceFile);
                lblTitle.Text             = Localization.GetString("Module", this.LocalResourceFile);
                cboPermission.Enabled     = false;

                ArrayList arrTabs = new ArrayList();

                ArrayList arrPortalTabs = Globals.GetPortalTabs(PortalSettings.DesktopTabs, true, true);
                foreach (TabInfo objTab in arrPortalTabs)
                {
                    if (objTab.TabID == -1)
                    {
                        // <none specified>
                        objTab.TabName = "<" + Localization.GetString("SelectPage", this.LocalResourceFile) + ">";
                        arrTabs.Add(objTab);
                    }
                    else
                    {
                        if (objTab.TabID != PortalSettings.ActiveTab.TabID)
                        {
                            if (PortalSecurity.IsInRoles(objTab.AuthorizedRoles))
                            {
                                arrTabs.Add(objTab);
                            }
                        }
                    }
                }

                cboTabs.DataSource = arrTabs;
                cboTabs.DataBind();
                break;
            }
        }
コード例 #2
0
        protected void rbPackType_SelectedIndexChanged(Object sender, EventArgs e)
        {
            pnlLogs.Visible = false;
            switch ((LanguagePackType)Enum.Parse(typeof(LanguagePackType), rbPackType.SelectedValue))
            {
            case LanguagePackType.Core:

                rowitems.Visible    = false;
                txtFileName.Text    = "Core";
                lblFilenameFix.Text = Server.HtmlEncode(".<version>.<locale>.zip");
                break;

            case LanguagePackType.Module:

                rowitems.Visible = true;
                lbItems.Items.Clear();
                lbItems.ClearSelection();
                lbItems.SelectionMode = ListSelectionMode.Multiple;
                txtFileName.Text      = "Module.version";
                lblFilenameFix.Text   = Server.HtmlEncode(".<locale>.zip");

                DesktopModuleController objDesktopModules = new DesktopModuleController();
                foreach (DesktopModuleInfo objDM in objDesktopModules.GetDesktopModulesByPortal(PortalSettings.PortalId))
                {
                    if (Null.IsNull(objDM.Version))
                    {
                        lbItems.Items.Add(new ListItem(objDM.FriendlyName, objDM.FolderName));
                    }
                    else
                    {
                        lbItems.Items.Add(new ListItem(objDM.FriendlyName + " [" + objDM.Version + "]", objDM.FolderName));
                    }
                }
                lblItems.Text = Localization.GetString("SelectModules", LocalResourceFile);
                break;

            case LanguagePackType.Provider:

                rowitems.Visible = true;
                lbItems.Items.Clear();
                lbItems.ClearSelection();
                lbItems.SelectionMode = ListSelectionMode.Multiple;
                txtFileName.Text      = "Provider.version";
                lblFilenameFix.Text   = Server.HtmlEncode(".<locale>.zip");

                DirectoryInfo objFolder = new DirectoryInfo(Server.MapPath("~/Providers/HtmlEditorProviders"));
                foreach (DirectoryInfo folder in objFolder.GetDirectories())
                {
                    lbItems.Items.Add(new ListItem(folder.Name, folder.Name));
                }

                lblItems.Text = Localization.GetString("SelectProviders", LocalResourceFile);
                break;

            case LanguagePackType.Full:

                rowitems.Visible    = false;
                txtFileName.Text    = "Full";
                lblFilenameFix.Text = Server.HtmlEncode(".<version>.<locale>.zip");
                break;
            }
        }
コード例 #3
0
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <history>
        ///     [cnurse]	10/06/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    //Localization
                    lblAdmin.Text             = Localization.GetString("Admin", this.LocalResourceFile);
                    cmdAddTab.Text            = Localization.GetString("AddTab", this.LocalResourceFile);
                    cmdAddTab.ToolTip         = Localization.GetString("AddTab.ToolTip", this.LocalResourceFile);
                    cmdEditTab.Text           = Localization.GetString("EditTab", this.LocalResourceFile);
                    cmdEditTab.ToolTip        = Localization.GetString("EditTab.ToolTip", this.LocalResourceFile);
                    cmdCopyTab.Text           = Localization.GetString("CopyTab", this.LocalResourceFile);
                    cmdCopyTab.ToolTip        = Localization.GetString("CopyTab.ToolTip", this.LocalResourceFile);
                    cmdHelpShow.AlternateText = Localization.GetString("ShowHelp.AlternateText", this.LocalResourceFile);
                    cmdHelpHide.AlternateText = Localization.GetString("HideHelp.AlternateText", this.LocalResourceFile);
                    lblModule.Text            = Localization.GetString("Module", this.LocalResourceFile);
                    lblPane.Text       = Localization.GetString("Pane", this.LocalResourceFile);
                    lblAlign.Text      = Localization.GetString("Align", this.LocalResourceFile);
                    cmdAdd.Text        = Localization.GetString("AddModule", this.LocalResourceFile);
                    cmdAdd.ToolTip     = Localization.GetString("AddModule.ToolTip", this.LocalResourceFile);
                    chkContent.Text    = Localization.GetString("Content.Text", this.LocalResourceFile);
                    chkPreview.Text    = Localization.GetString("Preview.Text", this.LocalResourceFile);
                    chkContent.ToolTip = Localization.GetString("Content.ToolTip", this.LocalResourceFile);
                    chkPreview.ToolTip = Localization.GetString("Preview.ToolTip", this.LocalResourceFile);

                    cmdAddTab.NavigateUrl = Globals.NavigateURL("Tab");
                    if (!PortalSettings.ActiveTab.IsAdminTab)
                    {
                        cmdEditTab.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=edit");
                        cmdCopyTab.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=copy");
                    }
                    else
                    {
                        cmdEditTab.Visible = false;
                        cmdCopyTab.Visible = false;
                    }

                    cmdHelpShow.ImageUrl = "~/images/help.gif";
                    cmdHelpShow.Visible  = true;

                    cmdHelpHide.ImageUrl = "~/images/cancel.gif";
                    cmdHelpHide.Visible  = false;

                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    cboDesktopModules.DataSource = objDesktopModules.GetDesktopModulesByPortal(PortalSettings.PortalId);
                    cboDesktopModules.DataBind();


                    for (int intItem = 0; intItem < PortalSettings.ActiveTab.Panes.Count; intItem++)
                    {
                        cboPanes.Items.Add(Convert.ToString(PortalSettings.ActiveTab.Panes[intItem]));
                    }
                    cboPanes.Items.FindByValue(Globals.glbDefaultPane).Selected = true;

                    if (cboAlign.Items.Count > 0)
                    {
                        cboAlign.SelectedIndex = 0;
                    }

                    chkContent.Checked = ShowContent;
                    chkPreview.Checked = IsPreview;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #4
0
        protected void AddNewModule(string title, int desktopModuleId, string paneName, int position, ViewPermissionType permissionType, string align)
        {
            TabPermissionCollection    objTabPermissions       = PortalSettings.ActiveTab.TabPermissions;
            PermissionController       objPermissionController = new PermissionController();
            ModuleController           objModules           = new ModuleController();
            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();

            Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
            int intIndex;

            try
            {
                DesktopModuleController objDesktopModules = new DesktopModuleController();
                ArrayList arrDM        = objDesktopModules.GetDesktopModulesByPortal(PortalSettings.PortalId);
                bool      isSelectable = false;
                for (int intloop = 0; intloop < arrDM.Count; intloop++)
                {
                    if (((DesktopModuleInfo)(arrDM[intloop])).DesktopModuleID == desktopModuleId)
                    {
                        isSelectable = true;
                        break;
                    }
                }
                if (isSelectable == false)
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            int UserId = -1;

            if (Request.IsAuthenticated)
            {
                UserInfo objUserInfo = UserController.GetCurrentUserInfo();
                UserId = objUserInfo.UserID;
            }

            ArrayList arrModuleDefinitions = objModuleDefinitions.GetModuleDefinitions(desktopModuleId);

            for (intIndex = 0; intIndex < arrModuleDefinitions.Count; intIndex++)
            {
                ModuleDefinitionInfo objModuleDefinition = (ModuleDefinitionInfo)(arrModuleDefinitions[intIndex]);



                ModuleInfo objModule = new ModuleInfo();
                objModule.Initialize(PortalSettings.PortalId);

                objModule.PortalID    = PortalSettings.PortalId;
                objModule.TabID       = PortalSettings.ActiveTab.TabID;
                objModule.ModuleOrder = position;
                if (String.IsNullOrEmpty(title))
                {
                    objModule.ModuleTitle = objModuleDefinition.FriendlyName;
                }
                else
                {
                    objModule.ModuleTitle = title;
                }

                objModule.ModuleTitle = title;
                objModule.PaneName    = paneName;
                objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                objModule.CacheTime   = objModuleDefinition.DefaultCacheTime;

                // initialize module permissions
                ModulePermissionCollection objModulePermissions = new ModulePermissionCollection();
                objModule.ModulePermissions      = objModulePermissions;
                objModule.InheritViewPermissions = false;

                // get the default module view permissions
                ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");

                // get the permissions from the page
                foreach (TabPermissionInfo objTabPermission in objTabPermissions)
                {
                    // get the system module permissions for the permissionkey
                    ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey);
                    // loop through the system module permissions
                    int j;
                    for (j = 0; j < arrSystemModulePermissions.Count; j++)
                    {
                        // create the module permission
                        PermissionInfo       objSystemModulePermission = (PermissionInfo)(arrSystemModulePermissions[j]);
                        ModulePermissionInfo objModulePermission       = AddModulePermission(objModule.ModuleID, objSystemModulePermission, objTabPermission.RoleID);

                        // add the permission to the collection
                        if (!(objModulePermissions.Contains(objModulePermission)) & objModulePermission.AllowAccess)
                        {
                            objModulePermissions.Add(objModulePermission);
                        }

                        // ensure that every EDIT permission which allows access also provides VIEW permission
                        if (objModulePermission.PermissionKey == "EDIT" & objModulePermission.AllowAccess)
                        {
                            ModulePermissionInfo objModuleViewperm = new ModulePermissionInfo();
                            objModuleViewperm.ModuleID      = objModulePermission.ModuleID;
                            objModuleViewperm.PermissionID  = ((PermissionInfo)(arrSystemModuleViewPermissions[0])).PermissionID;
                            objModuleViewperm.RoleID        = objModulePermission.RoleID;
                            objModuleViewperm.PermissionKey = "VIEW";
                            objModuleViewperm.AllowAccess   = true;
                            if (!(objModulePermissions.Contains(objModuleViewperm)))
                            {
                                objModulePermissions.Add(objModuleViewperm);
                            }
                        }
                    }

                    //Get the custom Module Permissions,  Assume that roles with Edit Tab Permissions
                    //are automatically assigned to the Custom Module Permissions
                    if (objTabPermission.PermissionKey == "EDIT")
                    {
                        ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID);

                        // loop through the custom module permissions
                        for (j = 0; j < arrCustomModulePermissions.Count; j++)
                        {
                            // create the module permission
                            PermissionInfo       objCustomModulePermission = (PermissionInfo)(arrCustomModulePermissions[j]);
                            ModulePermissionInfo objModulePermission       = AddModulePermission(objModule.ModuleID, objCustomModulePermission, objTabPermission.RoleID);

                            // add the permission to the collection
                            if (!(objModulePermissions.Contains(objModulePermission)) & objModulePermission.AllowAccess)
                            {
                                objModulePermissions.Add(objModulePermission);
                            }
                        }
                    }
                }

                switch (permissionType)
                {
                case ViewPermissionType.View:
                    objModule.InheritViewPermissions = true;
                    break;

                case ViewPermissionType.Edit:
                    objModule.ModulePermissions = objModulePermissions;
                    break;
                }

                objModule.AllTabs    = false;
                objModule.Visibility = VisibilityState.Maximized;
                objModule.Alignment  = align;

                objModules.AddModule(objModule);
                objEventLog.AddLog(objModule, PortalSettings, UserId, "", Services.Log.EventLog.EventLogController.EventLogType.MODULE_CREATED);
            }
        }