/// <summary>
        /// BindData fetches the data from the database and updates the controls
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        public void BindData()
        {
            if (!Page.IsPostBack)
            {
                GetFeatures();
            }

            if (Convert.ToString(Globals.HostSettings["CheckUpgrade"]) == "N")
            {
                lblUpdate.Visible = false;
                grdDefinitions.Columns[4].HeaderText = "";
            }

            // Get the portal's defs from the database
            DesktopModuleController objDesktopModules = new DesktopModuleController();

            ArrayList arr = objDesktopModules.GetDesktopModules();

            DesktopModuleInfo objDesktopModule = new DesktopModuleInfo();

            objDesktopModule.DesktopModuleID = - 2;
            objDesktopModule.FriendlyName = Localization.GetString( "SkinObjects" );
            objDesktopModule.Description = Localization.GetString( "SkinObjectsDescription" );
            objDesktopModule.IsPremium = false;

            arr.Insert( 0, objDesktopModule );

            //Localize Grid
            Localization.LocalizeDataGrid(ref grdDefinitions, this.LocalResourceFile );

            grdDefinitions.DataSource = arr;
            grdDefinitions.DataBind();
        }
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <history>
        /// 	[cnurse]	1/14/2005	created
        /// </history>
        protected void Page_Load( Object sender, EventArgs e )
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["desktopmoduleid"] != null)
                {
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModule(Int32.Parse(Request.QueryString["desktopmoduleid"]));
                    if (objDesktopModule != null)
                    {
                        txtFileName.Text = objDesktopModule.ModuleName + ".zip";

                        if (!objDesktopModule.IsAdmin)
                        {
                            //Create the DirectoryInfo object for the folder
                            DirectoryInfo folder = new DirectoryInfo(Globals.ApplicationMapPath + "\\DesktopModules\\" + objDesktopModule.FolderName);
                            if (folder.Exists)
                            {
                                //Determine Visibility of Source check box
                                rowSource.Visible = (folder.GetFiles("*.??proj").Length > 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"));
                    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;
            }

        }
 public static List<ListItem> GetModuleList(string ModuleName)
 {
     List<ListItem> lst = new List<ListItem>();
     PortalSettings portalSettings = PortalController.GetCurrentPortalSettings();
     List<TabInfo> objTabs = TabController.GetPortalTabs(portalSettings.PortalId, -1, true, true);
     var objTabController = new TabController();
     var objDesktopModuleController = new DesktopModuleController();
     var objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName(ModuleName);
     if (objDesktopModuleInfo == null)
     {
         objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName(ModuleName);
         if (objDesktopModuleInfo == null)
         {
             return lst;
         }
     }
     foreach (TabInfo objTab in objTabs.Where(tab => !tab.IsDeleted))
     {
         ModuleController objModules = new ModuleController();
         foreach (KeyValuePair<int, ModuleInfo> pair in objModules.GetTabModules(objTab.TabID))
         {
             ModuleInfo objModule = pair.Value;
             if (objModule.IsDeleted)
             {
                 continue;
             }
             if (objModule.DesktopModuleID != objDesktopModuleInfo.DesktopModuleID)
             {
                 continue;
             }
             string strPath = objTab.TabName;
             TabInfo objTabSelected = objTab;
             while (objTabSelected.ParentId != Null.NullInteger)
             {
                 objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, false);
                 if (objTabSelected == null)
                 {
                     break;
                 }
                 strPath = string.Format("{0} -> {1}", objTabSelected.TabName, strPath);
             }
             var objListItem = new ListItem
             {
                 Value = objModule.ModuleID.ToString(),
                 Text = string.Format("{0} -> {1}", strPath, objModule.ModuleTitle)
             };
             lst.Add(objListItem);
         }
     }
     return lst;
 }
        private void UpdateSupportedFeatures( object oObject, int desktopModuleId )
        {
            int SupportedFeatures = 0;

            if( oObject is IPortable )
            {
                SupportedFeatures = SupportedFeatures + (int)DesktopModuleSupportedFeature.IsPortable;
            }

            if( oObject is ISearchable )
            {
                SupportedFeatures = SupportedFeatures + (int)DesktopModuleSupportedFeature.IsSearchable;
            }

            if( oObject is IUpgradeable )
            {
                SupportedFeatures = SupportedFeatures + (int)DesktopModuleSupportedFeature.IsUpgradeable;
            }

            DesktopModuleController oDesktopModuleController = new DesktopModuleController();
            DesktopModuleInfo oDesktopModule = oDesktopModuleController.GetDesktopModule( desktopModuleId );
            oDesktopModule.SupportedFeatures = SupportedFeatures;
            oDesktopModuleController.UpdateDesktopModule( oDesktopModule );
        }
        /// <summary>
        /// Fills the module list.
        /// </summary>
        private void FillModuleList()
        {
            PortalSettings portalSettings = PortalController.GetCurrentPortalSettings();

            List<TabInfo> objTabs = TabController.GetPortalTabs(portalSettings.PortalId, -1, true, true);

            var objTabController = new TabController();

            var objDesktopModuleController = new DesktopModuleController();
            var objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName("DnnForge - NewsArticles");

            if (objDesktopModuleInfo == null)
            {
                objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName("DnnForge - NewsArticles");

                if (objDesktopModuleInfo == null)
                {
                    return;
                }
            }

            foreach (TabInfo objTab in objTabs.Where(tab => !tab.IsDeleted))
            {
                ModuleController objModules = new ModuleController();

                foreach (KeyValuePair<int, ModuleInfo> pair in objModules.GetTabModules(objTab.TabID))
                {
                    ModuleInfo objModule = pair.Value;

                    if (objModule.IsDeleted)
                    {
                        continue;
                    }

                    if (objModule.DesktopModuleID != objDesktopModuleInfo.DesktopModuleID)
                    {
                        continue;
                    }

                    string strPath = objTab.TabName;
                    TabInfo objTabSelected = objTab;

                    while (objTabSelected.ParentId != Null.NullInteger)
                    {
                        objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, false);
                        if (objTabSelected == null)
                        {
                            break;
                        }

                        strPath = string.Format("{0} -> {1}", objTabSelected.TabName, strPath);
                    }

                    var objListItem = new ListItem
                    {
                        Value = string.Format("{0}-{1}", objModule.TabID, objModule.ModuleID),
                        Text = string.Format("Page: {0} -> Module Instance: {1}", strPath, objModule.ModuleTitle)
                    };

                    ModuleListDropDown.Items.Add(objListItem);
                }
            }
        }
        /// <summary>
        /// cmdHelpShow_Click runs when the Hide Help Button is clicked
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/06/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdHelpShow_Click( object sender, ImageClickEventArgs e )
        {
            try
            {
                DesktopModuleController objDesktopModules = new DesktopModuleController();
                DesktopModuleInfo objDesktopModule;

                objDesktopModule = objDesktopModules.GetDesktopModule( int.Parse( cboDesktopModules.SelectedItem.Value ) );
                if( objDesktopModule != null )
                {
                    lblDescription.Text = "<br>" + objDesktopModule.Description + "<br>";
                }

                cmdHelpShow.Visible = false;
                cmdHelpHide.Visible = true;
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
Exemple #8
0
        /// <summary>
        /// GetModuleDefinition gets the Module Definition Id of a module
        /// </summary>
        ///	<param name="DesktopModuleName">The Friendly Name of the Module to Add</param>
        ///	<param name="ModuleDefinitionName">The Module Definition Name</param>
        ///	<returns>The Module Definition Id of the Module (-1 if no module definition)</returns>
        private static int GetModuleDefinition(string DesktopModuleName, string ModuleDefinitionName)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();

            // get desktop module
            DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModuleByName(DesktopModuleName);
            if (objDesktopModule == null)
            {
                return -1;
            }

            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();

            // get module definition
            ModuleDefinitionInfo objModuleDefinition = objModuleDefinitions.GetModuleDefinitionByName(objDesktopModule.DesktopModuleID, ModuleDefinitionName);
            if (objModuleDefinition == null)
            {
                return -1;
            }

            return objModuleDefinition.ModuleDefID;
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// DeleteDesktopModule deletes a Desktop Module
 /// </summary>
 /// <param name="moduleName">The Name of the Desktop Module to delete</param>
 /// <history>
 /// 	[cnurse]	05/14/2009   Documented
 /// </history>
 /// -----------------------------------------------------------------------------
 public static void DeleteDesktopModule(string moduleName)
 {
     DesktopModuleInfo desktopModule = GetDesktopModuleByModuleName(moduleName, Null.NullInteger);
     if (desktopModule != null)
     {
         var controller = new DesktopModuleController();
         controller.DeleteDesktopModule(desktopModule.DesktopModuleID);
         //Delete the Package
         PackageController.DeletePackage(desktopModule.PackageID);
     }
 }
		/// <summary>
		/// </summary>
		/// <remarks>
		/// Loads the cboSource control list with locations of controls.
		/// </remarks>
		/// <history>
		/// </history>
		private ModuleDefinitionInfo ImportControl(string controlSrc)
		{
			ModuleDefinitionInfo moduleDefinition = null;
			try
			{
				string folder = PathUtils.Instance.RemoveTrailingSlash(GetSourceFolder());
				string friendlyName = txtName.Text;
				string name = GetClassName();
				string moduleControl = "DesktopModules/" + folder + "/" + controlSrc;

                var packageInfo = PackageController.GetPackages().FirstOrDefault(p => p.Name == name || p.FriendlyName == friendlyName);
                if (packageInfo != null)
                {
                    UI.Skins.Skin.AddModuleMessage(this, String.Format(Localization.GetString("NonuniqueNameModule", LocalResourceFile), packageInfo.FriendlyName), ModuleMessage.ModuleMessageType.RedError);
                }
                else
                {
                    var package = new PackageInfo();
                    package.Name = name;
                    package.FriendlyName = friendlyName;
                    package.Description = txtDescription.Text;
                    package.Version = new Version(1, 0, 0);
                    package.PackageType = "Module";
                    package.License = Util.PACKAGE_NoLicense;

                    //Save Package
                    PackageController.SavePackage(package);

                    var objDesktopModules = new DesktopModuleController();
                    var objDesktopModule = new DesktopModuleInfo();

                    objDesktopModule.DesktopModuleID = Null.NullInteger;
                    objDesktopModule.ModuleName = name;
                    objDesktopModule.FolderName = folder;
                    objDesktopModule.FriendlyName = friendlyName;
                    objDesktopModule.Description = txtDescription.Text;
                    objDesktopModule.IsPremium = false;
                    objDesktopModule.IsAdmin = false;
                    objDesktopModule.Version = "01.00.00";
                    objDesktopModule.BusinessControllerClass = "";
                    objDesktopModule.CompatibleVersions = "";
                    objDesktopModule.Dependencies = "";
                    objDesktopModule.Permissions = "";
                    objDesktopModule.PackageID = package.PackageID;

#pragma warning disable 612,618
                    objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
#pragma warning restore 612,618

                    //Add module to all portals
                    DesktopModuleController.AddDesktopModuleToPortals(objDesktopModule.DesktopModuleID);

                    //Save module definition
                    moduleDefinition = new ModuleDefinitionInfo();

                    moduleDefinition.ModuleDefID = Null.NullInteger;
                    moduleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                    moduleDefinition.FriendlyName = friendlyName;
                    moduleDefinition.DefaultCacheTime = 0;

                    moduleDefinition.ModuleDefID = ModuleDefinitionController.SaveModuleDefinition(moduleDefinition, false, true);

                    //Save module control
                    var objModuleControl = new ModuleControlInfo();

                    objModuleControl.ModuleControlID = Null.NullInteger;
                    objModuleControl.ModuleDefID = moduleDefinition.ModuleDefID;
                    objModuleControl.ControlKey = "";
                    objModuleControl.ControlSrc = moduleControl;
                    objModuleControl.ControlTitle = "";
                    objModuleControl.ControlType = SecurityAccessLevel.View;
                    objModuleControl.HelpURL = "";
                    objModuleControl.IconFile = "";
                    objModuleControl.ViewOrder = 0;
                    objModuleControl.SupportsPartialRendering = false;

                    ModuleControlController.AddModuleControl(objModuleControl);
                }
			}
			catch (Exception exc)
			{
				Exceptions.LogException(exc);
				UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ImportControl.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
			}
			return moduleDefinition;
		}
        /// <summary>
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        private bool CreateModuleDefinition()
        {
            try
            {
                if (PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == GetClassName()) == null)
                {
                    var controlName = Null.NullString;

                    //Create module folder
                    CreateModuleFolder();

                    //Create module control
                    controlName = CreateModuleControl();
                    if (controlName != "")
                    {
                        //Create package
                        var objPackage = new PackageInfo();
                        objPackage.Name = GetClassName();
                        objPackage.FriendlyName = txtModule.Text;
                        objPackage.Description = txtDescription.Text;
                        objPackage.Version = new Version(1, 0, 0);
                        objPackage.PackageType = "Module";
                        objPackage.License = "";
                        objPackage.Owner = txtOwner.Text;
                        objPackage.Organization = txtOwner.Text;
                        objPackage.FolderName = "DesktopModules/" + GetFolderName();
                        objPackage.License = "The license for this package is not currently included within the installation file, please check with the vendor for full license details.";
                        objPackage.ReleaseNotes = "This package has no Release Notes.";
                        PackageController.Instance.SaveExtensionPackage(objPackage);

                        //Create desktopmodule
                        var objDesktopModules = new DesktopModuleController();
                        var objDesktopModule = new DesktopModuleInfo();
                        objDesktopModule.DesktopModuleID = Null.NullInteger;
                        objDesktopModule.ModuleName = GetClassName();
                        objDesktopModule.FolderName = GetFolderName();
                        objDesktopModule.FriendlyName = txtModule.Text;
                        objDesktopModule.Description = txtDescription.Text;
                        objDesktopModule.IsPremium = false;
                        objDesktopModule.IsAdmin = false;
                        objDesktopModule.Version = "01.00.00";
                        objDesktopModule.BusinessControllerClass = "";
                        objDesktopModule.CompatibleVersions = "";
                        objDesktopModule.Dependencies = "";
                        objDesktopModule.Permissions = "";
                        objDesktopModule.PackageID = objPackage.PackageID;
                        objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
                        objDesktopModule = objDesktopModules.GetDesktopModule(objDesktopModule.DesktopModuleID);

                        //Add OwnerName to the DesktopModule taxonomy and associate it with this module
                        var vocabularyId = -1;
                        var termId = -1;
                        var objTermController = DotNetNuke.Entities.Content.Common.Util.GetTermController();
                        var objTerms = objTermController.GetTermsByVocabulary("Module_Categories");
                        foreach (Term term in objTerms)
                        {
                            vocabularyId = term.VocabularyId;
                            if (term.Name == txtOwner.Text)
                            {
                                termId = term.TermId;
                            }
                        }
                        if (termId == -1)
                        {
                            termId = objTermController.AddTerm(new Term(vocabularyId) { Name = txtOwner.Text });
                        }
                        var objTerm = objTermController.GetTerm(termId);
                        var objContentController = DotNetNuke.Entities.Content.Common.Util.GetContentController();
                        var objContent = objContentController.GetContentItem(objDesktopModule.ContentItemId);
                        objTermController.AddTermToContent(objTerm, objContent);

                        //Add desktopmodule to all portals
                        DesktopModuleController.AddDesktopModuleToPortals(objDesktopModule.DesktopModuleID);

                        //Create module definition
                        var objModuleDefinition = new ModuleDefinitionInfo();
                        objModuleDefinition.ModuleDefID = Null.NullInteger;
                        objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                        // need core enhancement to have a unique DefinitionName  
                        objModuleDefinition.FriendlyName = GetClassName();
                        //objModuleDefinition.FriendlyName = txtModule.Text;
                        //objModuleDefinition.DefinitionName = GetClassName();
                        objModuleDefinition.DefaultCacheTime = 0;
                        objModuleDefinition.ModuleDefID = ModuleDefinitionController.SaveModuleDefinition(objModuleDefinition, false, true);

                        //Create modulecontrol
                        var objModuleControl = new ModuleControlInfo();
                        objModuleControl.ModuleControlID = Null.NullInteger;
                        objModuleControl.ModuleDefID = objModuleDefinition.ModuleDefID;
                        objModuleControl.ControlKey = "";
                        objModuleControl.ControlSrc = "DesktopModules/" + GetFolderName() + "/" + controlName;
                        objModuleControl.ControlTitle = "";
                        objModuleControl.ControlType = SecurityAccessLevel.View;
                        objModuleControl.HelpURL = "";
                        objModuleControl.IconFile = "";
                        objModuleControl.ViewOrder = 0;
                        objModuleControl.SupportsPartialRendering = false;
                        objModuleControl.SupportsPopUps = false;
                        ModuleControlController.AddModuleControl(objModuleControl);

                        //Update current module to reference new moduledefinition
                        var objModules = new ModuleController();
                        var objModule = objModules.GetModule(ModuleId, TabId, false);
                        objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                        objModule.ModuleTitle = txtModule.Text;

                        //HACK - need core enhancement to be able to update ModuleDefID
                        DotNetNuke.Data.DataProvider.Instance().ExecuteSQL("Update dbo.Modules set ModuleDefID = " + objModule.ModuleDefID.ToString() + " where ModuleID = " + ModuleId.ToString());

                        objModules.UpdateModule(objModule);

                        return true;
                    }
                    else
                    {
                        DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TemplateProblem.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                        return false;
                    }
                }
                else
                {
                    DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AlreadyExists.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    return false;
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, exc.ToString(), ModuleMessage.ModuleMessageType.RedError);
                return false;
            }
        }
Exemple #12
0
        public string CreatePrivateAssembly(int DesktopModuleId)
        {

            string Result = "";

            //Get the Module Definition File for this Module
            DesktopModuleController objDesktopModuleController = new DesktopModuleController();
            DesktopModuleInfo objModule = objDesktopModuleController.GetDesktopModule(DesktopModuleId);
            _Folder = Globals.ApplicationMapPath + "\\DesktopModules\\" + objModule.FolderName;
            _AppCodeFolder = Globals.ApplicationMapPath + "\\App_Code\\" + objModule.FolderName;

            if (IncludeSource)
            {
                _ResourceFileName = objModule.ModuleName + "_Source.zip";
                CreateResourceFile();
            }

            //Create File List
            CreateFileList();

            if (CreateManifest)
            {
                ProgressLog.StartJob(string.Format(Localization.GetString("LOG.PAWriter.CreateManifest"), objModule.FriendlyName));
                CreateDnnManifest(objModule);
                ProgressLog.EndJob((string.Format(Localization.GetString("LOG.PAWriter.CreateManifest"), objModule.FriendlyName)));
            }

            //Always add Manifest file to file list
            AddFile(new PaFileInfo(objModule.ModuleName + ".dnn", "", Folder), true);

            ProgressLog.StartJob(string.Format(Localization.GetString("LOG.PAWriter.CreateZipFile"), objModule.FriendlyName));
            CreateZipFile();
            ProgressLog.EndJob((string.Format(Localization.GetString("LOG.PAWriter.CreateZipFile"), objModule.FriendlyName)));

            return Result;
        }
        public override void UpdatePackage()
        {
            bool bUpdateSupportedFeatures = Null.NullBoolean;
            PackageInfo _Package = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == PackageID);

            //Update module settings
            if (desktopModuleForm.IsValid)
            {
                var desktopModule = desktopModuleForm.DataSource as DesktopModuleInfo;
                if (desktopModule != null && _Package != null)
                {
                    desktopModule.Shareable = (ModuleSharing) Enum.Parse(typeof (ModuleSharing), Shareable.ComboBox.SelectedValue.ToString());
                    desktopModule.FriendlyName = _Package.FriendlyName;
                    desktopModule.Version = Globals.FormatVersion(_Package.Version);
                    if (string.IsNullOrEmpty(desktopModule.BusinessControllerClass))
                    {
                        desktopModule.SupportedFeatures = 0;
                        //If there is no BusinessControllerClass, then there is no any implementation
                        
                    }
                    else
                    {
                        DesktopModuleController controller = new DesktopModuleController();
                        controller.UpdateModuleInterfaces(ref desktopModule);
                    }
                    DesktopModuleController.SaveDesktopModule(desktopModule, false, true);
                }

            }
        }
        /// <summary>
        /// cmdUpdate_Click runs when the Update LinkButton is clicked.
        /// It saves the current Site Settings
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/9/2004	Modified
        /// </history>
        protected void cmdUpdate_Click( object sender, EventArgs e )
        {
            try
            {
                string strLogo;
                string strBackground;

                strLogo = ctlLogo.Url;
                strBackground = ctlBackground.Url;

                double dblHostFee = 0;
                if( !String.IsNullOrEmpty( txtHostFee.Text ) )
                {
                    dblHostFee = double.Parse( txtHostFee.Text );
                }

                double dblHostSpace = 0;
                if( !String.IsNullOrEmpty( txtHostSpace.Text ) )
                {
                    dblHostSpace = double.Parse( txtHostSpace.Text );
                }

                int intPageQuota = 0;
                if( txtPageQuota.Text != "" )
                {
                    intPageQuota = int.Parse( txtPageQuota.Text );
                }

                double intUserQuota = 0;
                if( txtUserQuota.Text != "" )
                {
                    intUserQuota = int.Parse( txtUserQuota.Text );
                }

                int intSiteLogHistory = - 1;
                if( !String.IsNullOrEmpty( txtSiteLogHistory.Text ) )
                {
                    intSiteLogHistory = int.Parse( txtSiteLogHistory.Text );
                }

                DateTime datExpiryDate = Null.NullDate;
                if( !String.IsNullOrEmpty( txtExpiryDate.Text ) )
                {
                    datExpiryDate = Convert.ToDateTime( txtExpiryDate.Text );
                }

                int intSplashTabId = Null.NullInteger;
                if( cboSplashTabId.SelectedItem != null )
                {
                    intSplashTabId = int.Parse( cboSplashTabId.SelectedItem.Value );
                }

                int intHomeTabId = Null.NullInteger;
                if( cboHomeTabId.SelectedItem != null )
                {
                    intHomeTabId = int.Parse( cboHomeTabId.SelectedItem.Value );
                }

                int intLoginTabId = Null.NullInteger;
                if( cboLoginTabId.SelectedItem != null )
                {
                    intLoginTabId = int.Parse( cboLoginTabId.SelectedItem.Value );
                }

                int intUserTabId = Null.NullInteger;
                if( cboUserTabId.SelectedItem != null )
                {
                    intUserTabId = int.Parse( cboUserTabId.SelectedItem.Value );
                }

                if( txtPassword.Attributes["value"] != null )
                {
                    txtPassword.Attributes["value"] = txtPassword.Text;
                }

                // update Portal info in the database
                PortalController objPortalController = new PortalController();
                //check only relevant fields altered
                if( ! UserInfo.IsSuperUser )
                {
                    PortalInfo objPortal = objPortalController.GetPortal( intPortalId );
                    bool HostChanged = false;
                    if( dblHostFee != objPortal.HostFee )
                    {
                        HostChanged = true;
                    }
                    if( dblHostSpace != objPortal.HostSpace )
                    {
                        HostChanged = true;
                    }
                    if( intPageQuota != objPortal.PageQuota )
                    {
                        HostChanged = true;
                    }
                    if( intUserQuota != objPortal.UserQuota )
                    {
                        HostChanged = true;
                    }
                    if( intSiteLogHistory != objPortal.SiteLogHistory )
                    {
                        HostChanged = true;
                    }
                    if( datExpiryDate != objPortal.ExpiryDate )
                    {
                        HostChanged = true;
                    }
                    if( HostChanged )
                    {
                        throw new Exception();
                    }
                }

                objPortalController.UpdatePortalInfo( intPortalId, txtPortalName.Text, strLogo, txtFooterText.Text, datExpiryDate, optUserRegistration.SelectedIndex, optBannerAdvertising.SelectedIndex, cboCurrency.SelectedItem.Value, Convert.ToInt32( cboAdministratorId.SelectedItem.Value ), dblHostFee, dblHostSpace, intPageQuota, (int)intUserQuota, ( ( cboProcessor.SelectedValue == "" ) ? "" : cboProcessor.SelectedItem.Text ).ToString(), txtUserId.Text, txtPassword.Text, txtDescription.Text, txtKeyWords.Text, strBackground, intSiteLogHistory, intSplashTabId, intHomeTabId, intLoginTabId, intUserTabId, cboDefaultLanguage.SelectedValue, Convert.ToInt32( cboTimeZone.SelectedValue ), txtHomeDirectory.Text );
                bool blnAdminSkinChanged = SkinChanged( SkinInfo.RootSkin, PortalId, SkinType.Admin, ctlAdminSkin.SkinSrc ) || SkinChanged( SkinInfo.RootContainer, PortalId, SkinType.Admin, ctlAdminContainer.SkinSrc );

                //Dim objSkins As New UI.Skins.SkinController
                SkinController.SetSkin( SkinInfo.RootSkin, PortalId, SkinType.Portal, ctlPortalSkin.SkinSrc );
                SkinController.SetSkin( SkinInfo.RootContainer, PortalId, SkinType.Portal, ctlPortalContainer.SkinSrc );
                SkinController.SetSkin( SkinInfo.RootSkin, PortalId, SkinType.Admin, ctlAdminSkin.SkinSrc );
                SkinController.SetSkin( SkinInfo.RootContainer, PortalId, SkinType.Admin, ctlAdminContainer.SkinSrc );

                if( UserInfo.IsSuperUser )
                {
                    // delete old portal module assignments
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    objDesktopModules.DeletePortalDesktopModules( intPortalId, Null.NullInteger );
                    // add new portal module assignments                    
                    foreach( ListItem objListItem in ctlDesktopModules.Assigned )
                    {
                        objDesktopModules.AddPortalDesktopModule( intPortalId, int.Parse( objListItem.Value ) );
                    }
                }

                // Redirect to this site to refresh only if admin skin changed
                if( blnAdminSkinChanged )
                {
                    Response.Redirect( Request.RawUrl, true );
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
        /// <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;
            }
        }
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/8/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["pid"] != null ) && ( PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId || UserInfo.IsSuperUser ) )
                {
                    intPortalId = int.Parse( Request.QueryString["pid"] );
                    ctlLogo.ShowUpLoad = false;
                    ctlBackground.ShowUpLoad = false;
                }
                else
                {
                    intPortalId = PortalId;
                    ctlLogo.ShowUpLoad = true;
                    ctlBackground.ShowUpLoad = true;
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdExpiryCalendar.NavigateUrl = Calendar.InvokePopupCal( txtExpiryDate );
                ClientAPI.AddButtonConfirm( cmdRestore, Localization.GetString( "RestoreCCSMessage", LocalResourceFile ) );

                // If this is the first visit to the page, populate the site data
                if( Page.IsPostBack == false )
                {
                    ClientAPI.AddButtonConfirm( cmdDelete, Localization.GetString( "DeleteMessage", LocalResourceFile ) );

                    PortalController objPortalController = new PortalController();
                    ListController ctlList = new ListController();
                    ListEntryInfoCollection colProcessor = ctlList.GetListEntryInfoCollection( "Processor" );

                    cboProcessor.DataSource = colProcessor;
                    cboProcessor.DataBind();
                    cboProcessor.Items.Insert( 0, new ListItem( "<" + Localization.GetString( "None_Specified" ) + ">", "" ) );

                    PortalInfo objPortal = objPortalController.GetPortal( intPortalId );

                    txtPortalName.Text = objPortal.PortalName;
                    ctlLogo.Url = objPortal.LogoFile;
                    ctlLogo.FileFilter = Globals.glbImageFileTypes;
                    txtDescription.Text = objPortal.Description;
                    txtKeyWords.Text = objPortal.KeyWords;
                    ctlBackground.Url = objPortal.BackgroundFile;
                    ctlBackground.FileFilter = Globals.glbImageFileTypes;
                    txtFooterText.Text = objPortal.FooterText;
                    optUserRegistration.SelectedIndex = objPortal.UserRegistration;
                    optBannerAdvertising.SelectedIndex = objPortal.BannerAdvertising;

                    cboSplashTabId.DataSource = Globals.GetPortalTabs( intPortalId, true, true, false, false, false );
                    cboSplashTabId.DataBind();
                    if( cboSplashTabId.Items.FindByValue( objPortal.SplashTabId.ToString() ) != null )
                    {
                        cboSplashTabId.Items.FindByValue( objPortal.SplashTabId.ToString() ).Selected = true;
                    }
                    cboHomeTabId.DataSource = Globals.GetPortalTabs( intPortalId, true, true, false, false, false );
                    cboHomeTabId.DataBind();
                    if( cboHomeTabId.Items.FindByValue( objPortal.HomeTabId.ToString() ) != null )
                    {
                        cboHomeTabId.Items.FindByValue( objPortal.HomeTabId.ToString() ).Selected = true;
                    }
                    cboLoginTabId.DataSource = Globals.GetPortalTabs( intPortalId, true, true, false, false, false );
                    cboLoginTabId.DataBind();
                    if( cboLoginTabId.Items.FindByValue( objPortal.LoginTabId.ToString() ) != null )
                    {
                        cboLoginTabId.Items.FindByValue( objPortal.LoginTabId.ToString() ).Selected = true;
                    }
                    cboUserTabId.DataSource = Globals.GetPortalTabs( intPortalId, true, true, false, false, false );
                    cboUserTabId.DataBind();
                    if( cboUserTabId.Items.FindByValue( objPortal.UserTabId.ToString() ) != null )
                    {
                        cboUserTabId.Items.FindByValue( objPortal.UserTabId.ToString() ).Selected = true;
                    }

                    ListEntryInfoCollection colList = ctlList.GetListEntryInfoCollection( "Currency" );

                    cboCurrency.DataSource = colList;
                    cboCurrency.DataBind();
                    if( Null.IsNull( objPortal.Currency ) || cboCurrency.Items.FindByValue( objPortal.Currency ) == null )
                    {
                        cboCurrency.Items.FindByValue( "USD" ).Selected = true;
                    }
                    else
                    {
                        cboCurrency.Items.FindByValue( objPortal.Currency ).Selected = true;
                    }
                    RoleController objRoleController = new RoleController();

                    ArrayList Arr = objRoleController.GetUserRolesByRoleName( intPortalId, objPortal.AdministratorRoleName );
                    int i;
                    for( i = 0; i <= Arr.Count - 1; i++ )
                    {
                        UserRoleInfo objUser = (UserRoleInfo)Arr[i];
                        cboAdministratorId.Items.Add( new ListItem( objUser.FullName, objUser.UserID.ToString() ) );
                    }
                    if( cboAdministratorId.Items.FindByValue( objPortal.AdministratorId.ToString() ) != null )
                    {
                        cboAdministratorId.Items.FindByValue( objPortal.AdministratorId.ToString() ).Selected = true;
                    }

                    if( ! Null.IsNull( objPortal.ExpiryDate ) )
                    {
                        txtExpiryDate.Text = objPortal.ExpiryDate.ToShortDateString();
                    }
                    txtHostFee.Text = objPortal.HostFee.ToString();
                    txtHostSpace.Text = objPortal.HostSpace.ToString();
                    txtPageQuota.Text = objPortal.PageQuota.ToString();
                    txtUserQuota.Text = objPortal.UserQuota.ToString();
                    if( objPortal.SiteLogHistory != 0 )
                    {
                        txtSiteLogHistory.Text = objPortal.SiteLogHistory.ToString();
                    }

                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    ArrayList arrDesktopModules = objDesktopModules.GetDesktopModules();

                    ArrayList arrPremiumModules = new ArrayList();                    
                    foreach( DesktopModuleInfo objDesktopModule in arrDesktopModules )
                    {                        
                        if( objDesktopModule.IsPremium )
                        {
                            arrPremiumModules.Add( objDesktopModule );
                        }
                    }

                    ArrayList arrPortalDesktopModules = objDesktopModules.GetPortalDesktopModules( intPortalId, Null.NullInteger );
                    foreach( PortalDesktopModuleInfo objPortalDesktopModule in arrPortalDesktopModules )
                    {
                        foreach( DesktopModuleInfo objDesktopModule in arrPremiumModules )
                        {                            
                            if( objDesktopModule.DesktopModuleID == objPortalDesktopModule.DesktopModuleID )
                            {
                                arrPremiumModules.Remove( objDesktopModule );
                                break;
                            }
                        }                                                
                    }

                    ctlDesktopModules.Available = arrPremiumModules;
                    ctlDesktopModules.Assigned = arrPortalDesktopModules;

                    if( !String.IsNullOrEmpty( objPortal.PaymentProcessor ) )
                    {
                        if( cboProcessor.Items.FindByText( objPortal.PaymentProcessor ) != null )
                        {
                            cboProcessor.Items.FindByText( objPortal.PaymentProcessor ).Selected = true;
                        }
                        else // default
                        {
                            if( cboProcessor.Items.FindByText( "PayPal" ) != null )
                            {
                                cboProcessor.Items.FindByText( "PayPal" ).Selected = true;
                            }
                        }
                    }
                    else
                    {
                        cboProcessor.Items.FindByValue( "" ).Selected = true;
                    }
                    txtUserId.Text = objPortal.ProcessorUserId;
                    txtPassword.Attributes.Add( "value", objPortal.ProcessorPassword );
                    txtHomeDirectory.Text = objPortal.HomeDirectory;

                    //Populate the default language combobox
                    Localization.LoadCultureDropDownList( cboDefaultLanguage, CultureDropDownTypes.NativeName, objPortal.DefaultLanguage );

                    //Populate the timezone combobox (look up timezone translations based on currently set culture)
                    Localization.LoadTimeZoneDropDownList( cboTimeZone, ( (PageBase)Page ).PageCulture.Name, Convert.ToString( objPortal.TimeZoneOffset ) );

                    SkinInfo objSkin;

                    ctlPortalSkin.Width = "275px";
                    ctlPortalSkin.SkinRoot = SkinInfo.RootSkin;
                    objSkin = SkinController.GetSkin( SkinInfo.RootSkin, PortalId, SkinType.Portal );
                    if( objSkin != null )
                    {
                        if( objSkin.PortalId == PortalId )
                        {
                            ctlPortalSkin.SkinSrc = objSkin.SkinSrc;
                        }
                    }
                    ctlPortalContainer.Width = "275px";
                    ctlPortalContainer.SkinRoot = SkinInfo.RootContainer;
                    objSkin = SkinController.GetSkin( SkinInfo.RootContainer, PortalId, SkinType.Portal );
                    if( objSkin != null )
                    {
                        if( objSkin.PortalId == PortalId )
                        {
                            ctlPortalContainer.SkinSrc = objSkin.SkinSrc;
                        }
                    }

                    ctlAdminSkin.Width = "275px";
                    ctlAdminSkin.SkinRoot = SkinInfo.RootSkin;
                    objSkin = SkinController.GetSkin( SkinInfo.RootSkin, PortalId, SkinType.Admin );
                    if( objSkin != null )
                    {
                        if( objSkin.PortalId == PortalId )
                        {
                            ctlAdminSkin.SkinSrc = objSkin.SkinSrc;
                        }
                    }
                    ctlAdminContainer.Width = "275px";
                    ctlAdminContainer.SkinRoot = SkinInfo.RootContainer;
                    objSkin = SkinController.GetSkin( SkinInfo.RootContainer, PortalId, SkinType.Admin );
                    if( objSkin != null )
                    {
                        if( objSkin.PortalId == PortalId )
                        {
                            ctlAdminContainer.SkinSrc = objSkin.SkinSrc;
                        }
                    }

                    LoadStyleSheet();

                    if( Convert.ToString( PortalSettings.HostSettings["SkinUpload"] ) == "G" && ! UserInfo.IsSuperUser )
                    {
                        lnkUploadSkin.Visible = false;
                        lnkUploadContainer.Visible = false;
                    }
                    else
                    {
                        ModuleInfo FileManagerModule = ( new ModuleController() ).GetModuleByDefinition( intPortalId, "File Manager" );
                        string[] parameters = new string[3];
                        parameters[0] = "mid=" + FileManagerModule.ModuleID;
                        parameters[1] = "ftype=" + UploadType.Skin;
                        parameters[2] = "rtab=" + TabId;
                        lnkUploadSkin.NavigateUrl = Globals.NavigateURL( FileManagerModule.TabID, "Edit", parameters );

                        parameters[1] = "ftype=" + UploadType.Container;
                        lnkUploadContainer.NavigateUrl = Globals.NavigateURL( FileManagerModule.TabID, "Edit", parameters );
                    }

                    if( Request.UrlReferrer != null )
                    {
                        if( Request.UrlReferrer.AbsoluteUri == Request.Url.AbsoluteUri )
                        {
                            ViewState["UrlReferrer"] = "";
                        }
                        else
                        {
                            ViewState["UrlReferrer"] = Convert.ToString( Request.UrlReferrer );
                        }
                    }
                    else
                    {
                        ViewState["UrlReferrer"] = "";
                    }
                }

                if( UserInfo.IsSuperUser )
                {
                    dshHost.Visible = true;
                    tblHost.Visible = true;
                    cmdDelete.Visible = true;
                    if( Convert.ToString( ViewState["UrlReferrer"] ) == "" )
                    {
                        cmdCancel.Visible = false;
                    }
                    else
                    {
                        cmdCancel.Visible = true;
                    }
                }
                else
                {
                    dshHost.Visible = false;
                    tblHost.Visible = false;
                    cmdDelete.Visible = false;
                    cmdCancel.Visible = false;
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
    public static void ModuleDataBind(DropDownList ddlModule, int PortalId, string LocalResourceFile, HttpServerUtility Server)
    {
        ddlModule.Items.Clear();
        ddlModule.Items.Add(Localization.GetString("selectModule", LocalResourceFile));

        DesktopModuleController mc = new DesktopModuleController();
        var dtmLst = DesktopModuleController.GetDesktopModules(PortalId).Values.Where(m => !m.IsAdmin && !m.FolderName.StartsWith("Admin"));
        foreach (DesktopModuleInfo dtm in dtmLst)
        {
            bool TemplateExist = false;
            for (int i = 1; i < 4; i++)
            {
                string[] pathLst = GetPathList(dtm.FolderName, i, PortalId);
                foreach (string pathitem in pathLst)
                {
                    if (Directory.Exists(Server.MapPath(pathitem)))
                    {
                        ddlModule.Items.Add(new ListItem(dtm.FriendlyName, dtm.FolderName));
                        TemplateExist = true;
                        break;
                    }
                }
                if (TemplateExist) break;
            }
        }
        ddlModule.Items.Add(new ListItem("Skins", "skins"));
        ddlModule.Items.Add(new ListItem("Containers", "containers"));
        ddlModule.Items.Add(new ListItem("Widgets", "widgets"));
    }
Exemple #18
0
        /// <summary>
        /// UpgradeApplication - This overload is used for general application upgrade operations.
        /// </summary>
        /// <remarks>
        ///	Since it is not version specific and is invoked whenever the application is
        ///	restarted, the operations must be re-executable.
        /// </remarks>
        private static string UpgradeApplication()
        {
            string strExceptions = "";

            try
            {
                // remove the system message module from the admin tab
                // System Messages are now managed through Localization
                if (CoreModuleExists("System Messages"))
                {
                    RemoveCoreModule("System Messages", "Admin", "Site Settings", false);
                }

                // add the log viewer module to the admin tab
                int moduleDefId;
                if (CoreModuleExists("Log Viewer") == false)
                {
                    moduleDefId = AddModuleDefinition("Log Viewer", "Allows you to view log entries for portal events.", "Log Viewer");
                    AddModuleControl(moduleDefId, "", "", "Admin/Logging/LogViewer.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddModuleControl(moduleDefId, "Edit", "Edit Log Settings", "Admin/Logging/EditLogTypes.ascx", "", SecurityAccessLevel.Host, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Log Viewer", "icon_viewstats_16px.gif", true, moduleDefId, "Log Viewer", "icon_viewstats_16px.gif");
                }

                if (CoreModuleExists("Authentication") == false)
                {
                    moduleDefId = AddModuleDefinition("Windows Authentication", "Allows you to manage authentication settings for sites using Windows Authentication.", "Windows Authentication");
                    AddModuleControl(moduleDefId, "", "", "Admin/Security/AuthenticationSettings.ascx", "", SecurityAccessLevel.Admin, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Authentication", "icon_authentication_16px.gif", true, moduleDefId, "Authentication", "icon_authentication_16px.gif");
                }

                // add the schedule module to the host tab
                TabInfo newPage;
                if (CoreModuleExists("Schedule") == false)
                {
                    moduleDefId = AddModuleDefinition("Schedule", "Allows you to schedule tasks to be run at specified intervals.", "Schedule");
                    AddModuleControl(moduleDefId, "", "", "Admin/Scheduling/ViewSchedule.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddModuleControl(moduleDefId, "Edit", "Edit Schedule", "Admin/Scheduling/EditSchedule.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "History", "Schedule History", "Admin/Scheduling/ViewScheduleHistory.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Status", "Schedule Status", "Admin/Scheduling/ViewScheduleStatus.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Schedule", "icon_scheduler_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Schedule", "icon_scheduler_16px.gif");
                }

                // add the skins module to the admin tab
                if (CoreModuleExists("Skins") == false)
                {
                    moduleDefId = AddModuleDefinition("Skins", "Allows you to manage your skins and containers.", "Skins");
                    AddModuleControl(moduleDefId, "", "", "Admin/Skins/EditSkins.ascx", "", SecurityAccessLevel.Admin, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Skins", "icon_skins_16px.gif", true, moduleDefId, "Skins", "icon_skins_16px.gif");
                }

                // add the language editor module to the host tab
                if (!CoreModuleExists("Languages"))
                {
                    moduleDefId = AddModuleDefinition("Languages", "The Super User can manage the suported languages installed on the system.", "Languages");
                    AddModuleControl(moduleDefId, "", "", "Admin/Localization/Languages.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "TimeZone", "TimeZone Editor", "Admin/Localization/TimeZoneEditor.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Language", "Language Editor", "Admin/Localization/LanguageEditor.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "FullEditor", "Language Editor", "Admin/Localization/LanguageEditorExt.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Verify", "Resource File Verifier", "Admin/Localization/ResourceVerifier.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Package", "Create Language Pack", "Admin/Localization/LanguagePack.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Languages", "icon_language_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Languages", "icon_language_16px.gif");

                    moduleDefId = AddModuleDefinition("Custom Locales", "Administrator can manage custom translations for portal.", "Custom Portal Locale");
                    AddModuleControl(moduleDefId, "", "", "Admin/Localization/LanguageEditor.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddModuleControl(moduleDefId, "FullEditor", "Language Editor", "Admin/Localization/LanguageEditorExt.ascx", "", SecurityAccessLevel.Admin, 0);

                    //Add the Module/Page to all configured portals
                    AddAdminPages("Languages", "icon_language_16px.gif", true, moduleDefId, "Languages", "icon_language_16px.gif");
                }

                // add the Search Admin module to the host tab
                if (CoreModuleExists("Search Admin") == false)
                {
                    moduleDefId = AddModuleDefinition("Search Admin", "The Search Admininstrator provides the ability to manage search settings.", "Search Admin");
                    AddModuleControl(moduleDefId, "", "", "Admin/Search/SearchAdmin.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Search Admin", "icon_search_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Search Admin", "icon_search_16px.gif");

                    //Add the Module/Page to all configured portals
                    //AddAdminPages("Search Admin", "icon_search_16px.gif", True, ModuleDefID, "Search Admin", "icon_search_16px.gif")
                }

                // add the Search Input module
                if (CoreModuleExists("Search Input") == false)
                {
                    moduleDefId = AddModuleDefinition("Search Input", "The Search Input module provides the ability to submit a search to a given search results module.", "Search Input", false, false);
                    AddModuleControl(moduleDefId, "", "", "DesktopModules/SearchInput/SearchInput.ascx", "", SecurityAccessLevel.Anonymous, 0);
                    AddModuleControl(moduleDefId, "Settings", "Search Input Settings", "DesktopModules/SearchInput/Settings.ascx", "", SecurityAccessLevel.Edit, 0);
                }

                // add the Search Results module
                if (CoreModuleExists("Search Results") == false)
                {
                    moduleDefId = AddModuleDefinition("Search Results", "The Search Reasults module provides the ability to display search results.", "Search Results", false, false);
                    AddModuleControl(moduleDefId, "", "", "DesktopModules/SearchResults/SearchResults.ascx", "", SecurityAccessLevel.Anonymous, 0);
                    AddModuleControl(moduleDefId, "Settings", "Search Results Settings", "DesktopModules/SearchResults/Settings.ascx", "", SecurityAccessLevel.Edit, 0);

                    //Add the Search Module/Page to all configured portals
                    AddSearchResults(moduleDefId);
                }

                // add the site wizard module to the admin tab 
                if (CoreModuleExists("Site Wizard") == false)
                {
                    moduleDefId = AddModuleDefinition("Site Wizard", "The Administrator can use this user-friendly wizard to set up the common features of the Portal/Site.", "Site Wizard");
                    AddModuleControl(moduleDefId, "", "", "Admin/Portal/Sitewizard.ascx", "", SecurityAccessLevel.Admin, 0);
                    AddAdminPages("Site Wizard", "icon_sitesettings_16px.gif", true, moduleDefId, "Site Wizard", "icon_sitesettings_16px.gif");
                }

                // add portal alias module
                if (CoreModuleExists("Portal Aliases") == false)
                {
                    moduleDefId = AddModuleDefinition("Portal Aliases", "Allows you to view portal aliases.", "Portal Aliases");
                    AddModuleControl(moduleDefId, "", "", "Admin/Portal/PortalAlias.ascx", "", SecurityAccessLevel.Host, 0);
                    AddModuleControl(moduleDefId, "Edit", "Portal Aliases", "Admin/Portal/EditPortalAlias.ascx", "", SecurityAccessLevel.Host, 0);

                    //Add the Module/Page to all configured portals (with InheritViewPermissions = False)
                    AddAdminPages("Site Settings", "icon_sitesettings_16px.gif", false, moduleDefId, "Portal Aliases", "icon_sitesettings_16px.gif", false);
                }

                //add Lists module and tab
                if (HostTabExists("Lists") == false)
                {
                    moduleDefId = AddModuleDefinition("Lists", "Allows you to edit common lists.", "Lists");
                    AddModuleControl(moduleDefId, "", "", "Admin/Lists/ListEditor.ascx", "", SecurityAccessLevel.Host, 0);

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Lists", "icon_lists_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Lists", "icon_lists_16px.gif");
                }

                // add the feedback settings control
                if (CoreModuleExists("Feedback"))
                {
                    moduleDefId = GetModuleDefinition("Feedback", "Feedback");
                    AddModuleControl(moduleDefId, "Settings", "Feedback Settings", "DesktopModules/Feedback/Settings.ascx", "", SecurityAccessLevel.Edit, 0);
                }

                if (HostTabExists("Superuser Accounts") == false)
                {
                    //add SuperUser Accounts module and tab
                    DesktopModuleController objDesktopModuleController = new DesktopModuleController();
                    DesktopModuleInfo objDesktopModuleInfo;
                    objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName("User Accounts");
                    ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();
                    moduleDefId = objModuleDefController.GetModuleDefinitionByName(objDesktopModuleInfo.DesktopModuleID, "User Accounts").ModuleDefID;

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Superuser Accounts", "icon_users_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Superuser Accounts", "icon_users_32px.gif");
                }

                //add Skins module and tab to Host menu
                if (HostTabExists("Skins") == false)
                {
                    DesktopModuleController objDesktopModuleController = new DesktopModuleController();
                    DesktopModuleInfo objDesktopModuleInfo;
                    objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName("Skins");
                    ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();
                    moduleDefId = objModuleDefController.GetModuleDefinitionByName(objDesktopModuleInfo.DesktopModuleID, "Skins").ModuleDefID;

                    //Create New Host Page (or get existing one)
                    newPage = AddHostPage("Skins", "icon_skins_16px.gif", true);

                    //Add Module To Page
                    AddModuleToPage(newPage, moduleDefId, "Skins", "");
                }

                //Add Search Skin Object
                AddModuleControl(Null.NullInteger, "SEARCH", Null.NullString, "Admin/Skins/Search.ascx", "", SecurityAccessLevel.SkinObject, Null.NullInteger);

                //Add TreeView Skin Object
                AddModuleControl(Null.NullInteger, "TREEVIEW", Null.NullString, "Admin/Skins/TreeViewMenu.ascx", "", SecurityAccessLevel.SkinObject, Null.NullInteger);

                //Add Private Assembly Packager
                moduleDefId = GetModuleDefinition("Module Definitions", "Module Definitions");
                AddModuleControl(moduleDefId, "Package", "Create Private Assembly", "Admin/ModuleDefinitions/PrivateAssembly.ascx", "icon_moduledefinitions_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);

                //Add Edit Role Groups
                moduleDefId = GetModuleDefinition("Security Roles", "Security Roles");
                AddModuleControl(moduleDefId, "EditGroup", "Edit Role Groups", "Admin/Security/EditGroups.ascx", "icon_securityroles_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(moduleDefId, "UserSettings", "Manage User Settings", "Admin/Users/UserSettings.ascx", "~/images/settings.gif", SecurityAccessLevel.Edit, Null.NullInteger);

                //Add User Accounts Controls
                moduleDefId = GetModuleDefinition("User Accounts", "User Accounts");
                AddModuleControl(moduleDefId, "ManageProfile", "Manage Profile Definition", "Admin/Users/ProfileDefinitions.ascx", "icon_users_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(moduleDefId, "EditProfileProperty", "Edit Profile Property Definition", "Admin/Users/EditProfileDefinition.ascx", "icon_users_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(moduleDefId, "UserSettings", "Manage User Settings", "Admin/Users/UserSettings.ascx", "~/images/settings.gif", SecurityAccessLevel.Edit, Null.NullInteger);
                AddModuleControl(Null.NullInteger, "Profile", "Profile", "Admin/Users/ManageUsers.ascx", "icon_users_32px.gif", SecurityAccessLevel.Anonymous, Null.NullInteger);
                AddModuleControl(Null.NullInteger, "SendPassword", "Send Password", "Admin/Security/SendPassword.ascx", "", SecurityAccessLevel.Anonymous, Null.NullInteger);
                AddModuleControl(Null.NullInteger, "ViewProfile", "View Profile", "Admin/Users/ViewProfile.ascx", "icon_users_32px.gif", SecurityAccessLevel.Anonymous, Null.NullInteger);

                //Update Child Portal subHost.aspx
                PortalAliasController objAliasController = new PortalAliasController();
                ArrayList arrAliases = objAliasController.GetPortalAliasArrayByPortalID(Null.NullInteger);

                foreach (PortalAliasInfo objAlias in arrAliases)
                {
                    //For the alias to be for a child it must be of the form ...../child
                    if (objAlias.HTTPAlias.LastIndexOf("/") != -1)
                    {
                        string childPath = Globals.ApplicationMapPath + "\\" + objAlias.HTTPAlias.Substring(objAlias.HTTPAlias.LastIndexOf("/") + 1);
                        if (Directory.Exists(childPath))
                        {
                            //Folder exists App/child so upgrade

                            //Rename existing file
                            File.Copy(childPath + "\\" + Globals.glbDefaultPage, childPath + "\\old_" + Globals.glbDefaultPage, true);

                            // create the subhost default.aspx file
                            File.Copy(Globals.HostMapPath + "subhost.aspx", childPath + "\\" + Globals.glbDefaultPage, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                strExceptions += "Error: " + ex.Message + "\r\n";
                try
                {
                    Exceptions.Exceptions.LogException(ex);
                }
                catch
                {
                    // ignore
                }
            }

            return strExceptions;
        }
        /// <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);
            }
        }
Exemple #20
0
        /// <summary>
        /// RemoveCoreModule removes a Core Module from the system
        /// </summary>
        /// <remarks>
        /// </remarks>
        ///	<param name="DesktopModuleName">The Friendly Name of the Module to Remove</param>
        ///	<param name="ParentTabName">The Name of the parent Tab/Page for this module</param>
        ///	<param name="TabName">The Name to tab that contains the Module</param>
        ///	<param name="TabRemove">A flag to determine whether to remove the Tab if it has no
        ///	other modules</param>
        private static void RemoveCoreModule(string DesktopModuleName, string ParentTabName, string TabName, bool TabRemove)
        {
            TabController objTabs = new TabController();
            ModuleController objModules = new ModuleController();
            int intIndex;
            int intModuleDefId = 0;
            int intDesktopModuleId;

            //Find and remove the Module from the Tab
            switch (ParentTabName)
            {
                case "Host":
                    //TODO - when we have a need to remove a Host Module
                    break;
                case "Admin":
                    PortalController objPortals = new PortalController();

                    ArrayList arrPortals = objPortals.GetPortals();                  

                    //Iterate through the Portals to remove the Module from the Tab
                    for (int intPortal = 0; intPortal < arrPortals.Count; intPortal++)
                    {
                        PortalInfo objPortal = (PortalInfo)(arrPortals[intPortal]);

                        int ParentId = objPortal.AdminTabId;
                        TabInfo objTab = objTabs.GetTabByName(TabName, objPortal.PortalID, ParentId);
                        int intCount = 0;

                        //Get the Modules on the Tab
                        foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(objTab.TabID))
                        {
                            ModuleInfo objModule = kvp.Value;
                            if (objModule.FriendlyName == DesktopModuleName)
                            {
                                //Delete the Module from the Modules list
                                objModules.DeleteModule(objModule.ModuleID);
                                intModuleDefId = objModule.ModuleDefID;
                            }
                            else
                            {
                                intCount += 1;
                            }
                        }

                        //If Tab has no modules optionally remove tab
                        if (intCount == 0 & TabRemove)
                        {
                            objTabs.DeleteTab(objTab.TabID, objTab.PortalID);
                        }
                    }
                    break;
            }

            //Delete all the Module Controls for this Definition
            ModuleControlController objModuleControls = new ModuleControlController();
            ArrayList arrModuleControls = objModuleControls.GetModuleControls(intModuleDefId);
            for (intIndex = 0; intIndex <= arrModuleControls.Count - 1; intIndex++)
            {
                ModuleControlInfo objModuleControl = (ModuleControlInfo)arrModuleControls[intIndex];
                objModuleControls.DeleteModuleControl(objModuleControl.ModuleControlID);
            }

            //Get the Module Definition
            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
            ModuleDefinitionInfo objModuleDefinition;
            objModuleDefinition = objModuleDefinitions.GetModuleDefinition(intModuleDefId);
            intDesktopModuleId = objModuleDefinition.DesktopModuleID;

            //Delete the Module Definition
            objModuleDefinitions.DeleteModuleDefinition(intModuleDefId);

            //Delete the Desktop Module Control
            DesktopModuleController objDesktopModules = new DesktopModuleController();
            objDesktopModules.DeleteDesktopModule(intDesktopModuleId);
        }
        /// <summary>Creates the custom permissions for the module.  Expected to be called once from <see cref="FeaturesController.UpgradeModule"/></summary>
        /// <remarks>based on <see href="http://www.codeproject.com/KB/aspnet/dnn_custom_permissions.aspx"/> </remarks>
        /// <returns>A status message for <see cref="IUpgradeable.UpgradeModule"/></returns>
        public static string CreateCustomPermissions()
        {
            var permissionController = new PermissionController();
            var existingPermissions = permissionController.GetPermissionByCodeAndKey(EngageEventsCustomPermissionsCode, ManageEventsCustomPermissionKey);
            if (existingPermissions != null && existingPermissions.Cast<PermissionInfo>().Any())
            {
                return "Engage: Events custom permissions were already created (presumably by DNN 5 manifest), no upgrade action taken";
            }

            var eventsDesktopModules = new DesktopModuleController().GetDesktopModuleByModuleName(Utility.DesktopModuleName);
            var moduleDefinition = new ModuleDefinitionController().GetModuleDefinitionByName(
                eventsDesktopModules.DesktopModuleID,
                Utility.ModuleDefinitionFriendlyName);

            permissionController.AddPermission(new PermissionInfo
                {
                    PermissionCode = EngageEventsCustomPermissionsCode,
                    PermissionKey = ManageEventsCustomPermissionKey,
                    PermissionName = "Manage Events",
                    ModuleDefID = moduleDefinition.ModuleDefID
                });
            permissionController.AddPermission(new PermissionInfo
                {
                    PermissionCode = EngageEventsCustomPermissionsCode,
                    PermissionKey = ManageCategoriesCustomPermissionKey,
                    PermissionName = "Manage Categories",
                    ModuleDefID = moduleDefinition.ModuleDefID
                });
            permissionController.AddPermission(new PermissionInfo
                {
                    PermissionCode = EngageEventsCustomPermissionsCode,
                    PermissionKey = ManageDisplayCustomPermissionKey,
                    PermissionName = "Manage Display",
                    ModuleDefID = moduleDefinition.ModuleDefID
                });
            permissionController.AddPermission(new PermissionInfo
                {
                    PermissionCode = EngageEventsCustomPermissionsCode,
                    PermissionKey = ViewResponsesCustomPermissionKey,
                    PermissionName = "View Responses",
                    ModuleDefID = moduleDefinition.ModuleDefID
                });

            return "Created custom permissions for category management in Engage: Events";
        }
        /// <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 ) );
                }
            }
        }
        public override void UpdatePackage()
        {
            bool bUpdateSupportedFeatures = Null.NullBoolean;
            PackageInfo _Package = PackageController.GetPackage(PackageID);

            //Update module settings
            if (desktopModuleForm.IsValid)
            {
                var desktopModule = desktopModuleForm.DataSource as DesktopModuleInfo;
                if (desktopModule != null && _Package != null)
                {
                    desktopModule.FriendlyName = _Package.FriendlyName;
                    desktopModule.Version = Globals.FormatVersion(_Package.Version);
                    if (string.IsNullOrEmpty(desktopModule.BusinessControllerClass))
                    {
                        desktopModule.SupportedFeatures = 0;
                    }
                    else
                    {
                        bUpdateSupportedFeatures = true;
                    }
                    DesktopModuleController.SaveDesktopModule(desktopModule, false, true);
                }

                if (bUpdateSupportedFeatures)
                {
                    DesktopModuleController controller = new DesktopModuleController();
                    controller.UpdateModuleInterfaces(ref desktopModule);
                }
            }
        }
Exemple #24
0
        /// <summary>
        /// AddModuleDefinition adds a new Core Module Definition to the system
        /// </summary>
        /// <remarks>
        ///	This overload allows the caller to determine whether the module has a controller
        /// class
        /// </remarks>
        ///	<param name="DesktopModuleName">The Friendly Name of the Module to Add</param>
        ///	<param name="Description">Description of the Module</param>
        ///	<param name="ModuleDefinitionName">The Module Definition Name</param>
        ///	<param name="Premium">A flag representing whether the module is a Premium module</param>
        ///	<param name="Admin">A flag representing whether the module is an Admin module</param>
        ///	<param name="Controller">The Controller Class string</param>
        ///	<param name="Version">The Module Version</param>
        ///	<returns>The Module Definition Id of the new Module</returns>
        /// <history>
        /// 	[cnurse]	10/14/2004	documented
        ///     [cnurse]    11/11/2004  removed addition of Module Control (now in AddMOduleControl)
        /// </history>
        private static int AddModuleDefinition(string DesktopModuleName, string Description, string ModuleDefinitionName, bool Premium, bool Admin, string Controller, string Version)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();

            // check if desktop module exists
            DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModuleByName(DesktopModuleName);
            if (objDesktopModule == null)
            {
                objDesktopModule = new DesktopModuleInfo();

                objDesktopModule.DesktopModuleID = Null.NullInteger;
                objDesktopModule.FriendlyName = DesktopModuleName;
                objDesktopModule.FolderName = DesktopModuleName;
                objDesktopModule.ModuleName = DesktopModuleName;
                objDesktopModule.Description = Description;
                objDesktopModule.Version = Version;
                objDesktopModule.IsPremium = Premium;
                objDesktopModule.IsAdmin = Admin;
                objDesktopModule.BusinessControllerClass = Controller;

                objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
            }

            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();

            // check if module definition exists
            ModuleDefinitionInfo objModuleDefinition = objModuleDefinitions.GetModuleDefinitionByName(objDesktopModule.DesktopModuleID, ModuleDefinitionName);
            if (objModuleDefinition == null)
            {
                objModuleDefinition = new ModuleDefinitionInfo();

                objModuleDefinition.ModuleDefID = Null.NullInteger;
                objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                objModuleDefinition.FriendlyName = ModuleDefinitionName;

                objModuleDefinition.ModuleDefID = objModuleDefinitions.AddModuleDefinition(objModuleDefinition);
            }

            return objModuleDefinition.ModuleDefID;
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The DeleteModule method deletes the Module from the data Store.
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/15/2008  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void DeleteModule()
        {
            try
            {
				//Attempt to get the Desktop Module
                DesktopModuleInfo tempDesktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID);
                if (tempDesktopModule != null)
                {
					//Remove CodeSubDirectory
                    if ((_desktopModule != null) && (!string.IsNullOrEmpty(_desktopModule.CodeSubDirectory)))
                    {
                        Config.RemoveCodeSubDirectory(_desktopModule.CodeSubDirectory);
                    }
                    var controller = new DesktopModuleController();
                    controller.DeleteDesktopModule(tempDesktopModule);

                    Log.AddInfo(string.Format(Util.MODULE_UnRegistered, tempDesktopModule.ModuleName));
                }
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
        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);
            }

        }
        protected override DesktopModuleInfo GetDesktopModule(PaFolder Folder)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();
            DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModuleByModuleName(Folder.ModuleName);

            return objDesktopModule;
        }
Exemple #28
0
        /// <summary>
        /// CoreModuleExists determines whether a Core Module exists on the system
        /// </summary>
        /// <remarks>
        /// </remarks>
        ///	<param name="DesktopModuleName">The Friendly Name of the Module</param>
        ///	<returns>True if the Module exists, otherwise False</returns>
        private static bool CoreModuleExists(string DesktopModuleName)
        {
            bool blnExists;

            DesktopModuleController objDesktopModules = new DesktopModuleController();

            DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModuleByName(DesktopModuleName);
            if (objDesktopModule != null)
            {
                blnExists = true;
            }
            else
            {
                blnExists = false;
            }

            return blnExists;
        }
Exemple #29
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RemoveCoreModule removes a Core Module from the system
        /// </summary>
        /// <remarks>
        /// </remarks>
        ///	<param name="desktopModuleName">The Friendly Name of the Module to Remove</param>
        ///	<param name="parentTabName">The Name of the parent Tab/Page for this module</param>
        ///	<param name="tabName">The Name to tab that contains the Module</param>
        ///	<param name="removeTab">A flag to determine whether to remove the Tab if it has no
        ///	other modules</param>
        /// <history>
        /// 	[cnurse]	10/14/2004	documented
        /// </history>
        /// -----------------------------------------------------------------------------
        private static void RemoveCoreModule(string desktopModuleName, string parentTabName, string tabName, bool removeTab)
        {
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "RemoveCoreModule:" + desktopModuleName);

            int moduleDefId = Null.NullInteger;
            int desktopModuleId = 0;

            //Find and remove the Module from the Tab
            switch (parentTabName)
            {
                case "Host":
                    var tab = TabController.Instance.GetTabByName("Host", Null.NullInteger, Null.NullInteger);

                    if (tab != null)
                    {
                        moduleDefId = RemoveModule(desktopModuleName, tabName, tab.TabID, removeTab);
                    }
                    break;
                case "Admin":
                    var portals = PortalController.Instance.GetPortals();

                    //Iterate through the Portals to remove the Module from the Tab
                    for (int intPortal = 0; intPortal <= portals.Count - 1; intPortal++)
                    {
                        var portal = (PortalInfo)portals[intPortal];
                        moduleDefId = RemoveModule(desktopModuleName, tabName, portal.AdminTabId, removeTab);
                    }
                    break;
            }

            DesktopModuleInfo desktopModule = null;
            if (moduleDefId == Null.NullInteger)
            {
                desktopModule = DesktopModuleController.GetDesktopModuleByModuleName(desktopModuleName, Null.NullInteger);
                desktopModuleId = desktopModule.DesktopModuleID;
            }
            else
            {
                //Get the Module Definition
                ModuleDefinitionInfo moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(moduleDefId);
                if (moduleDefinition != null)
                {
                    desktopModuleId = moduleDefinition.DesktopModuleID;
                    desktopModule = DesktopModuleController.GetDesktopModule(desktopModuleId, Null.NullInteger);
                }
            }

            if (desktopModule != null)
            {
                //Delete the Desktop Module
                var desktopModuleController = new DesktopModuleController();
                desktopModuleController.DeleteDesktopModule(desktopModuleId);

                //Delete the Package
                PackageController.Instance.DeleteExtensionPackage(PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == desktopModule.PackageID));
            }
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// DeleteDesktopModule deletes a Desktop Module
 /// </summary>
 /// <param name="moduleName">The Name of the Desktop Module to delete</param>
 /// <history>
 /// 	[cnurse]	05/14/2009   Documented
 /// </history>
 /// -----------------------------------------------------------------------------
 public static void DeleteDesktopModule(string moduleName)
 {
     DesktopModuleInfo desktopModule = GetDesktopModuleByModuleName(moduleName, Null.NullInteger);
     if (desktopModule != null)
     {
         var controller = new DesktopModuleController();
         controller.DeleteDesktopModule(desktopModule.DesktopModuleID);
         //Delete the Package
         PackageController.Instance.DeleteExtensionPackage(PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == desktopModule.PackageID));
     }
 }