protected override void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls) { InstallerInfo.Log.AddInfo(REGISTER_Controls); ModuleControlController objModuleControls = new ModuleControlController(); ModuleControlInfo objModuleControl; foreach (ModuleControlInfo tempLoopVar_objModuleControl in Controls) { objModuleControl = tempLoopVar_objModuleControl; // Skins Objects have a null ModuleDefID objModuleControl.ModuleDefID = Null.NullInteger; // check if control exists ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(Null.NullInteger, 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); }
/// <summary> /// AddModuleControl adds a new Module Control to the system /// </summary> /// <remarks> /// </remarks> /// <param name="ModuleDefId">The Module Definition Id</param> /// <param name="ControlKey">The key for this control in the Definition</param> /// <param name="ControlTitle">The title of this control</param> /// <param name="ControlSrc">Te source of ths control</param> /// <param name="IconFile">The icon file</param> /// <param name="ControlType">The type of control</param> /// <param name="ViewOrder">The vieworder for this module</param> /// <param name="HelpURL">The Help Url</param> private static void AddModuleControl(int ModuleDefId, string ControlKey, string ControlTitle, string ControlSrc, string IconFile, SecurityAccessLevel ControlType, int ViewOrder, string HelpURL) { ModuleControlController objModuleControls = new ModuleControlController(); // check if module control exists ModuleControlInfo objModuleControl = objModuleControls.GetModuleControlByKeyAndSrc(ModuleDefId, ControlKey, ControlSrc); if (objModuleControl == null) { objModuleControl = new ModuleControlInfo(); objModuleControl.ModuleControlID = Null.NullInteger; objModuleControl.ModuleDefID = ModuleDefId; objModuleControl.ControlKey = ControlKey; objModuleControl.ControlTitle = ControlTitle; objModuleControl.ControlSrc = ControlSrc; objModuleControl.ControlType = ControlType; objModuleControl.ViewOrder = ViewOrder; objModuleControl.IconFile = IconFile; objModuleControl.HelpURL = HelpURL; objModuleControls.AddModuleControl(objModuleControl); } }
/// <summary> /// cmdUpdate_Click runs when the Update Button is clicked /// </summary> /// <returns></returns> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/28/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void cmdUpdate_Click( object sender, EventArgs e ) { try { if( Page.IsValid ) { ModuleControlInfo objModuleControl = new ModuleControlInfo(); objModuleControl.ModuleControlID = ModuleControlId; objModuleControl.ModuleDefID = ModuleDefId; if( !String.IsNullOrEmpty(txtKey.Text) ) { objModuleControl.ControlKey = txtKey.Text; } else { objModuleControl.ControlKey = Null.NullString; } if( !String.IsNullOrEmpty(txtTitle.Text) ) { objModuleControl.ControlTitle = txtTitle.Text; } else { objModuleControl.ControlTitle = Null.NullString; } objModuleControl.ControlSrc = cboSource.SelectedItem.Text; objModuleControl.ControlType = (SecurityAccessLevel)Enum.Parse(typeof(SecurityAccessLevel), cboType.SelectedItem.Value); if( !String.IsNullOrEmpty(txtViewOrder.Text) ) { objModuleControl.ViewOrder = int.Parse( txtViewOrder.Text ); } else { objModuleControl.ViewOrder = Null.NullInteger; } if( cboIcon.SelectedIndex > 0 ) { objModuleControl.IconFile = cboIcon.SelectedItem.Text; } else { objModuleControl.IconFile = Null.NullString; } if( !String.IsNullOrEmpty(txtHelpURL.Text) ) { objModuleControl.HelpURL = txtHelpURL.Text; } else { objModuleControl.HelpURL = Null.NullString; } ModuleControlController objModuleControls = new ModuleControlController(); if( Null.IsNull( ModuleControlId ) ) { try { objModuleControls.AddModuleControl( objModuleControl ); } catch { UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "AddControl.ErrorMessage", this.LocalResourceFile ), ModuleMessageType.RedError ); return; } } else { objModuleControls.UpdateModuleControl( objModuleControl ); } if( DesktopModuleId == - 1 ) { DesktopModuleId = - 2; } Response.Redirect( EditUrl( "desktopmoduleid", DesktopModuleId.ToString() ), true ); } } catch( Exception exc ) //Module failed to load { Exceptions.ProcessModuleLoadException( this, exc ); } }
/// <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 ); } }