コード例 #1
0
        /// <summary>
        /// LoadCacheProperties loads the Module Definitions Default Cache Time properties
        /// </summary>
        /// <history>
        ///     [cnurse]	4/21/2005   created
        /// </history>
        private void LoadCacheProperties(int ModuleDefId)
        {
            ModuleDefinitionController objModuleDefinitionController = new ModuleDefinitionController();
            ModuleDefinitionInfo       objModuleDefinition           = objModuleDefinitionController.GetModuleDefinition(ModuleDefId);

            txtCacheTime.Text = objModuleDefinition.DefaultCacheTime.ToString();
        }
コード例 #2
0
        /// <summary>
        /// cmdUpdateCacheTime_Click runs when the Update Cache Time Button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	4/20/2005	Created
        /// </history>
        protected void cmdUpdateCacheTime_Click(object sender, EventArgs e)
        {
            if (cboDefinitions.SelectedItem != null)
            {
                int ModuleDefId = int.Parse(cboDefinitions.SelectedItem.Value);
                ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
                ModuleDefinitionInfo       objModuleDefinition  = objModuleDefinitions.GetModuleDefinition(ModuleDefId);

                try
                {
                    objModuleDefinition.DefaultCacheTime = int.Parse(txtCacheTime.Text);
                    objModuleDefinitions.UpdateModuleDefinition(objModuleDefinition);
                }
                catch (Exception)
                {
                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UpdateCache.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
                }
            }
            else
            {
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("MissingDefinition.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
            }
        }
コード例 #3
0
        /// <summary>
        /// BindData loads the settings from the Database
        /// </summary>
        /// <history>
        ///     [cnurse]	10/18/2004	documented
        /// </history>
        private void BindData()
        {
            // declare roles
            ArrayList arrAvailableAuthViewRoles = new ArrayList();
            ArrayList arrAvailableAuthEditRoles = new ArrayList();

            // add an entry of All Users for the View roles
            arrAvailableAuthViewRoles.Add(new ListItem("All Users", Globals.glbRoleAllUsers));
            // add an entry of Unauthenticated Users for the View roles
            arrAvailableAuthViewRoles.Add(new ListItem("Unauthenticated Users", Globals.glbRoleUnauthUser));
            // add an entry of All Users for the Edit roles
            arrAvailableAuthEditRoles.Add(new ListItem("All Users", Globals.glbRoleAllUsers));

            // process portal roles
            RoleController objRoles = new RoleController();
            RoleInfo       objRole;
            ArrayList      arrRoleInfo = objRoles.GetPortalRoles(PortalId);

            foreach (RoleInfo tempLoopVar_objRole in arrRoleInfo)
            {
                objRole = tempLoopVar_objRole;
                arrAvailableAuthViewRoles.Add(new ListItem(objRole.RoleName, objRole.RoleID.ToString()));
            }
            foreach (RoleInfo tempLoopVar_objRole in arrRoleInfo)
            {
                objRole = tempLoopVar_objRole;
                arrAvailableAuthEditRoles.Add(new ListItem(objRole.RoleName, objRole.RoleID.ToString()));
            }

            // get module
            ModuleController objModules = new ModuleController();
            ModuleInfo       objModule  = objModules.GetModule(moduleId, TabId, false);

            if (objModule != null)
            {
                // configure grid
                DesktopModuleController objDeskMod    = new DesktopModuleController();
                DesktopModuleInfo       desktopModule = objDeskMod.GetDesktopModule(objModule.DesktopModuleID);
                dgPermissions.ResourceFile = Globals.ApplicationPath + "/DesktopModules/" + desktopModule.FolderName + "/" + Localization.LocalResourceDirectory + "/" + Localization.LocalSharedResourceFile;

                chkInheritPermissions.Checked = objModule.InheritViewPermissions;
                dgPermissions.InheritViewPermissionsFromTab = objModule.InheritViewPermissions;

                txtTitle.Text = objModule.ModuleTitle;
                ctlIcon.Url   = objModule.IconFile;

                if (cboTab.Items.FindByValue(objModule.TabID.ToString()) != null)
                {
                    cboTab.Items.FindByValue(objModule.TabID.ToString()).Selected = true;
                }

                chkAllTabs.Checked          = objModule.AllTabs;
                cboVisibility.SelectedIndex = (int)objModule.Visibility;

                ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();
                ModuleDefinitionInfo       objModuleDef           = objModuleDefController.GetModuleDefinition(objModule.ModuleDefID);
                if (objModuleDef.DefaultCacheTime == Null.NullInteger)
                {
                    rowCache.Visible = false;
                }
                else
                {
                    txtCacheTime.Text = objModule.CacheTime.ToString();
                }

                txtCacheTime.Text = objModule.CacheTime.ToString();

                // populate view roles
                ArrayList arrAssignedAuthViewRoles = new ArrayList();
                Array     arrAuthViewRoles         = objModule.AuthorizedViewRoles.Split(new char[] { ';' });
                foreach (string strRole in arrAuthViewRoles)
                {
                    if (!String.IsNullOrEmpty(strRole))
                    {
                        foreach (ListItem objListItem in arrAvailableAuthViewRoles)
                        {
                            if (objListItem.Value == strRole)
                            {
                                arrAssignedAuthViewRoles.Add(objListItem);
                                arrAvailableAuthViewRoles.Remove(objListItem);
                                break;
                            }
                        }
                    }
                }

                // populate edit roles
                ArrayList arrAssignedAuthEditRoles = new ArrayList();
                Array     arrAuthEditRoles         = objModule.AuthorizedEditRoles.Split(new char[] { ';' });
                foreach (string strRole in arrAuthEditRoles)
                {
                    if (!String.IsNullOrEmpty(strRole))
                    {
                        foreach (ListItem objListItem in arrAvailableAuthEditRoles)
                        {
                            if (objListItem.Value == strRole)
                            {
                                arrAssignedAuthEditRoles.Add(objListItem);
                                arrAvailableAuthEditRoles.Remove(objListItem);
                                break;
                            }
                        }
                    }
                }

                if (objModule.Alignment == "")
                {
                    objModule.Alignment = "left";
                }
                cboAlign.Items.FindByValue(objModule.Alignment).Selected   = true;
                cboTab.Items.FindByValue(Convert.ToString(TabId)).Selected = true;
                txtColor.Text  = objModule.Color;
                txtBorder.Text = objModule.Border;

                txtHeader.Text = objModule.Header;
                txtFooter.Text = objModule.Footer;

                if (!Null.IsNull(objModule.StartDate))
                {
                    txtStartDate.Text = objModule.StartDate.ToShortDateString();
                }
                if (!Null.IsNull(objModule.EndDate))
                {
                    txtEndDate.Text = objModule.EndDate.ToShortDateString();
                }

                ctlModuleContainer.Width    = "250px";
                ctlModuleContainer.SkinRoot = SkinInfo.RootContainer;
                ctlModuleContainer.SkinSrc  = objModule.ContainerSrc;

                chkDisplayTitle.Checked     = objModule.DisplayTitle;
                chkDisplayPrint.Checked     = objModule.DisplayPrint;
                chkDisplaySyndicate.Checked = objModule.DisplaySyndicate;
            }
        }
コード例 #4
0
        /// <summary>
        /// Serializes all portal Tabs
        /// </summary>
        /// <param name="xmlTemplate">Reference to XmlDocument context</param>
        /// <param name="nodeTabs">Node to add the serialized objects</param>
        /// <param name="objportal">Portal to serialize</param>
        /// <param name="hRoles">A hastable with all serialized roles</param>
        /// <remarks>
        /// Only portal tabs will be exported to the template, Admin tabs are not exported.
        /// On each tab, all modules will also be exported.
        /// </remarks>
        /// <history>
        ///     [VMasanas]	23/09/2004	Created
        /// </history>
        public void SerializeTabs(XmlDocument xmlTemplate, XmlNode nodeTabs, PortalInfo objportal, Hashtable hRoles)
        {
            TabController objtabs = new TabController();

            //supporting object to build the tab hierarchy
            Hashtable hTabs = new Hashtable();

            XmlSerializer xserTabs = new XmlSerializer(typeof(TabInfo));

            foreach (TabInfo objtab in objtabs.GetTabs(objportal.PortalID))
            {
                //if not an admin tab & not deleted
                if (objtab.TabOrder < 10000 && !objtab.IsDeleted)
                {
                    StringWriter sw = new StringWriter();
                    xserTabs.Serialize(sw, objtab);

                    XmlDocument xmlTab = new XmlDocument();
                    xmlTab.LoadXml(sw.GetStringBuilder().ToString());
                    XmlNode nodeTab = xmlTab.SelectSingleNode("tab");
                    nodeTab.Attributes.Remove(nodeTab.Attributes["xmlns:xsd"]);
                    nodeTab.Attributes.Remove(nodeTab.Attributes["xmlns:xsi"]);

                    XmlNode newnode;
                    if (objtab.TabID == objportal.SplashTabId)
                    {
                        newnode          = xmlTab.CreateElement("tabtype");
                        newnode.InnerXml = "splashtab";
                        nodeTab.AppendChild(newnode);
                    }
                    else if (objtab.TabID == objportal.HomeTabId)
                    {
                        newnode          = xmlTab.CreateElement("tabtype");
                        newnode.InnerXml = "hometab";
                        nodeTab.AppendChild(newnode);
                    }
                    else if (objtab.TabID == objportal.UserTabId)
                    {
                        newnode          = xmlTab.CreateElement("tabtype");
                        newnode.InnerXml = "usertab";
                        nodeTab.AppendChild(newnode);
                    }
                    else if (objtab.TabID == objportal.LoginTabId)
                    {
                        newnode          = xmlTab.CreateElement("tabtype");
                        newnode.InnerXml = "logintab";
                        nodeTab.AppendChild(newnode);
                    }

                    if (!Null.IsNull(objtab.ParentId))
                    {
                        newnode          = xmlTab.CreateElement("parent");
                        newnode.InnerXml = Server.HtmlEncode(hTabs[objtab.ParentId].ToString());
                        nodeTab.AppendChild(newnode);

                        // save tab as: ParentTabName/CurrentTabName
                        hTabs.Add(objtab.TabID, hTabs[objtab.ParentId] + "/" + objtab.TabName);
                    }
                    else
                    {
                        // save tab as: CurrentTabName
                        hTabs.Add(objtab.TabID, objtab.TabName);
                    }

                    // Serialize modules
                    XmlNode nodePanes;
                    nodePanes = nodeTab.AppendChild(xmlTab.CreateElement("panes"));
                    ModuleController           objmodules             = new ModuleController();
                    DesktopModuleController    objDesktopModules      = new DesktopModuleController();
                    ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();

                    XmlSerializer xserModules         = new XmlSerializer(typeof(ModuleInfo));
                    Dictionary <int, ModuleInfo> dict = objmodules.GetTabModules(objtab.TabID);
                    foreach (KeyValuePair <int, ModuleInfo> pair in dict)
                    {
                        ModuleInfo objmodule = pair.Value;

                        if (!objmodule.IsDeleted)
                        {
                            sw = new StringWriter();
                            xserModules.Serialize(sw, objmodule);

                            XmlDocument xmlModule = new XmlDocument();
                            xmlModule.LoadXml(sw.GetStringBuilder().ToString());
                            XmlNode nodeModule = xmlModule.SelectSingleNode("module");
                            nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsd"]);
                            nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsi"]);

                            if (nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']") == null)
                            {
                                // new pane found
                                XmlNode nodePane = xmlModule.CreateElement("pane");
                                XmlNode nodeName = nodePane.AppendChild(xmlModule.CreateElement("name"));
                                nodeName.InnerText = objmodule.PaneName;
                                nodePane.AppendChild(xmlModule.CreateElement("modules"));
                                nodePanes.AppendChild(xmlTab.ImportNode(nodePane, true));
                            }
                            XmlNode nodeModules = nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']/modules");
                            newnode = xmlModule.CreateElement("definition");

                            ModuleDefinitionInfo objModuleDef = objModuleDefController.GetModuleDefinition(objmodule.ModuleDefID);
                            newnode.InnerText = objDesktopModules.GetDesktopModule(objModuleDef.DesktopModuleID).ModuleName;
                            nodeModule.AppendChild(newnode);

                            //Add Module Definition Info
                            XmlNode nodeDefinition = xmlModule.CreateElement("moduledefinition");
                            nodeDefinition.InnerText = objModuleDef.FriendlyName;
                            nodeModule.AppendChild(nodeDefinition);

                            if (chkContent.Checked)
                            {
                                AddContent(nodeModule, objmodule);
                            }

                            nodeModules.AppendChild(xmlTab.ImportNode(nodeModule, true));
                        }
                    }
                    nodeTabs.AppendChild(xmlTemplate.ImportNode(nodeTab, true));
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if ((Request.QueryString["desktopmoduleid"] != null))
                {
                    DesktopModuleId = int.Parse(Request.QueryString["desktopmoduleid"]);
                    if (DesktopModuleId == -2)
                    {
                        DesktopModuleId = Null.NullInteger;
                    }
                }
                else
                {
                    DesktopModuleId = Null.NullInteger;
                }

                if ((Request.QueryString["moduledefid"] != null))
                {
                    ModuleDefId = int.Parse(Request.QueryString["moduledefid"]);
                }
                else
                {
                    ModuleDefId = Null.NullInteger;
                }

                if ((Request.QueryString["modulecontrolid"] != null))
                {
                    ModuleControlId = int.Parse(Request.QueryString["modulecontrolid"]);
                }
                else
                {
                    ModuleControlId = Null.NullInteger;
                }

                if (Page.IsPostBack == false)
                {
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    DesktopModuleInfo       objDesktopModule;

                    objDesktopModule = objDesktopModules.GetDesktopModule(DesktopModuleId);
                    if (objDesktopModule != null)
                    {
                        txtModule.Text = objDesktopModule.FriendlyName;
                    }
                    else
                    {
                        txtModule.Text       = Localization.GetString("SkinObjects");
                        txtTitle.Enabled     = false;
                        cboType.Enabled      = false;
                        txtViewOrder.Enabled = false;
                        cboIcon.Enabled      = false;
                    }

                    ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
                    ModuleDefinitionInfo       objModuleDefinition;

                    objModuleDefinition = objModuleDefinitions.GetModuleDefinition(ModuleDefId);
                    if (objModuleDefinition != null)
                    {
                        txtDefinition.Text = objModuleDefinition.FriendlyName;
                    }

                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    ModuleControlController objModuleControls = new ModuleControlController();
                    ModuleControlInfo       objModuleControl;

                    objModuleControl = objModuleControls.GetModuleControl(ModuleControlId);

                    // Added to populate cboSource with desktop module or skin controls
                    // Issue #586
                    BindControlList("DesktopModules", true);
                    BindControlList("Admin/Skins", false);
                    if (objDesktopModule == null)  // Add Container Controls
                    {
                        BindControlList("Admin/Containers", false);
                    }

                    if (!Null.IsNull(ModuleControlId))
                    {
                        if (objModuleControl != null)
                        {
                            txtKey.Text   = objModuleControl.ControlKey;
                            txtTitle.Text = objModuleControl.ControlTitle;
                            if (cboSource.Items.FindByValue(objModuleControl.ControlSrc.ToString().ToLower()) != null)
                            {
                                cboSource.Items.FindByValue(objModuleControl.ControlSrc.ToString().ToLower()).Selected = true;
                                LoadIcons();
                            }
                            if (cboType.Items.FindByValue(Convert.ToInt32(objModuleControl.ControlType).ToString()) != null)
                            {
                                cboType.Items.FindByValue(Convert.ToInt32(objModuleControl.ControlType).ToString()).Selected = true;
                            }
                            if (!Null.IsNull(objModuleControl.ViewOrder))
                            {
                                txtViewOrder.Text = objModuleControl.ViewOrder.ToString();
                            }
                            if (cboIcon.Items.FindByValue(objModuleControl.IconFile.ToLower()) != null)
                            {
                                cboIcon.Items.FindByValue(objModuleControl.IconFile.ToLower()).Selected = true;
                            }
                            if (!Null.IsNull(objModuleControl.HelpURL))
                            {
                                txtHelpURL.Text = objModuleControl.HelpURL;
                            }
                        }
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }