Beispiel #1
0
        /// <summary>
        /// cmdAddDefinition_Click runs when the Add Definition Button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdAddDefinition_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtDefinition.Text))
            {
                ModuleDefinitionInfo objModuleDefinition = new ModuleDefinitionInfo();

                objModuleDefinition.DesktopModuleID = DesktopModuleId;
                objModuleDefinition.FriendlyName    = txtDefinition.Text;

                try
                {
                    objModuleDefinition.DefaultCacheTime = int.Parse(txtCacheTime.Text);
                    if (objModuleDefinition.DefaultCacheTime < 0)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UpdateCache.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
                        return;
                    }
                }
                catch
                {
                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UpdateCache.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
                    return;
                }

                ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();

                int ModuleDefId;
                try
                {
                    ModuleDefId = objModuleDefinitions.AddModuleDefinition(objModuleDefinition);
                }
                catch
                {
                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AddDefinition.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
                    return;
                }

                LoadDefinitions();

                if (ModuleDefId > -1)
                {
                    //Set the Combo
                    cboDefinitions.SelectedIndex = -1;
                    cboDefinitions.Items.FindByValue(ModuleDefId.ToString()).Selected = true;
                    LoadCacheProperties(ModuleDefId);
                    LoadControls(ModuleDefId);
                    //Clear the Text Box
                    txtDefinition.Text = "";
                }
            }
            else
            {
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("MissingDefinition.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
            }
        }
Beispiel #2
0
        protected virtual void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls)
        {
            InstallerInfo.Log.StartJob(REGISTER_Module);

            DesktopModuleController objDesktopModules = new DesktopModuleController();

            // check if desktop module exists
            DesktopModuleInfo objDesktopModule = GetDesktopModule(Folder);

            if (objDesktopModule == null)
            {
                objDesktopModule = new DesktopModuleInfo();
                objDesktopModule.DesktopModuleID = Null.NullInteger;
            }

            objDesktopModule = GetDesktopModuleSettings(objDesktopModule, Folder);

            if (Null.IsNull(objDesktopModule.DesktopModuleID))
            {
                // new desktop module
                objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
            }
            else
            {
                // existing desktop module
                objDesktopModules.UpdateDesktopModule(objDesktopModule);
            }

            InstallerInfo.Log.AddInfo(REGISTER_Definition);

            ModuleDefinitionController objModuleDefinitons = new ModuleDefinitionController();

            foreach (ModuleDefinitionInfo objModuleDefinition in Modules)
            {
                // check if definition exists
                ModuleDefinitionInfo objModuleDefinition2 = objModuleDefinitons.GetModuleDefinitionByName(objDesktopModule.DesktopModuleID, objModuleDefinition.FriendlyName);
                if (objModuleDefinition2 == null)
                {
                    // add new definition
                    objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                    objModuleDefinition.ModuleDefID     = objModuleDefinitons.AddModuleDefinition(objModuleDefinition);
                }
                else
                {
                    // update existing definition
                    objModuleDefinition.ModuleDefID = objModuleDefinition2.ModuleDefID;
                    objModuleDefinitons.UpdateModuleDefinition(objModuleDefinition);
                }
            }

            InstallerInfo.Log.AddInfo(REGISTER_Controls);

            ModuleControlController objModuleControls = new ModuleControlController();

            foreach (ModuleControlInfo objModuleControl in Controls)
            {
                // get the real ModuleDefID from the associated Module
                objModuleControl.ModuleDefID = GetModDefID(objModuleControl.ModuleDefID, Modules);

                // check if control exists
                ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(objModuleControl.ModuleDefID, objModuleControl.ControlKey, objModuleControl.ControlSrc);
                if (objModuleControl2 == null)
                {
                    // add new control
                    objModuleControls.AddModuleControl(objModuleControl);
                }
                else
                {
                    // update existing control
                    objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID;
                    objModuleControls.UpdateModuleControl(objModuleControl);
                }
            }

            InstallerInfo.Log.EndJob(REGISTER_End);

            UpgradeModule(objDesktopModule);
        }
Beispiel #3
0
        /// <remarks>
        /// Loads the cboSource control list with locations of controls.
        /// </remarks>
        private void InstallManifest(string strManifest)
        {
            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(strManifest);

                XmlNode dnnRoot = doc.DocumentElement;
                foreach (XmlElement FolderElement in dnnRoot.SelectNodes("folders/folder"))
                {
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    DesktopModuleInfo       objDesktopModule  = new DesktopModuleInfo();

                    objDesktopModule.DesktopModuleID = Null.NullInteger;
                    objDesktopModule.ModuleName      = XmlUtils.GetNodeValue(FolderElement, "modulename", "");
                    objDesktopModule.FolderName      = XmlUtils.GetNodeValue(FolderElement, "foldername", "");
                    objDesktopModule.FriendlyName    = XmlUtils.GetNodeValue(FolderElement, "friendlyname", "");
                    if (objDesktopModule.FolderName == "")
                    {
                        objDesktopModule.FolderName = objDesktopModule.ModuleName;
                    }
                    objDesktopModule.Description             = XmlUtils.GetNodeValue(FolderElement, "description", "");
                    objDesktopModule.IsPremium               = false;
                    objDesktopModule.IsAdmin                 = false;
                    objDesktopModule.Version                 = XmlUtils.GetNodeValue(FolderElement, "version", "");
                    objDesktopModule.BusinessControllerClass = XmlUtils.GetNodeValue(FolderElement, "businesscontrollerclass", "");
                    objDesktopModule.CompatibleVersions      = XmlUtils.GetNodeValue(FolderElement, "compatibleversions", "");
                    objDesktopModule.DesktopModuleID         = objDesktopModules.AddDesktopModule(objDesktopModule);

                    foreach (XmlElement ModuleElement in FolderElement.SelectNodes("modules/module"))
                    {
                        ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
                        ModuleDefinitionInfo       objModuleDefinition  = new ModuleDefinitionInfo();

                        objModuleDefinition.ModuleDefID      = Null.NullInteger;
                        objModuleDefinition.DesktopModuleID  = objDesktopModule.DesktopModuleID;
                        objModuleDefinition.FriendlyName     = XmlUtils.GetNodeValue(ModuleElement, "friendlyname", "");
                        objModuleDefinition.DefaultCacheTime = XmlUtils.GetNodeValueInt(ModuleElement, "cachetime", 0);

                        objModuleDefinition.ModuleDefID = objModuleDefinitions.AddModuleDefinition(objModuleDefinition);

                        foreach (XmlElement ControlElement in ModuleElement.SelectNodes("controls/control"))
                        {
                            ModuleControlController objModuleControls = new ModuleControlController();
                            ModuleControlInfo       objModuleControl  = new ModuleControlInfo();

                            objModuleControl.ModuleControlID = Null.NullInteger;
                            objModuleControl.ModuleDefID     = objModuleDefinition.ModuleDefID;
                            objModuleControl.ControlKey      = XmlUtils.GetNodeValue(ControlElement, "key", "");
                            objModuleControl.ControlSrc      = XmlUtils.GetNodeValue(ControlElement, "src", "");
                            objModuleControl.ControlTitle    = XmlUtils.GetNodeValue(ControlElement, "title", "");
                            switch (XmlUtils.GetNodeValue(ControlElement, "type", ""))
                            {
                            case "Anonymous":

                                objModuleControl.ControlType = SecurityAccessLevel.Anonymous;
                                break;

                            case "View":

                                objModuleControl.ControlType = SecurityAccessLevel.View;
                                break;

                            case "Edit":

                                objModuleControl.ControlType = SecurityAccessLevel.Edit;
                                break;

                            case "Admin":

                                objModuleControl.ControlType = SecurityAccessLevel.Admin;
                                break;

                            case "Host":

                                objModuleControl.ControlType = SecurityAccessLevel.Host;
                                break;
                            }
                            objModuleControl.HelpURL   = XmlUtils.GetNodeValue(ControlElement, "helpurl", "");
                            objModuleControl.IconFile  = XmlUtils.GetNodeValue(ControlElement, "iconfile", "");
                            objModuleControl.ViewOrder = XmlUtils.GetNodeValueInt(ControlElement, "vieworder", 0);

                            objModuleControls.AddModuleControl(objModuleControl);
                        }
                    }
                    // update interfaces
                    UpdateModuleInterfaces(objDesktopModule.BusinessControllerClass);
                }

                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch
            {
                // can not open manifest
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InstallManifest.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
            }
        }