/// <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 ); } }
/// <summary> /// Page_Load runs when the control is loaded. /// </summary> /// <history> /// [cnurse] 9/28/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// [vmasanas] 31/10/2004 Populate Premium list when we are adding /// </history> protected void Page_Load( Object sender, EventArgs e ) { try { DesktopModuleController objDesktopModules = new DesktopModuleController(); if( ( Request.QueryString["desktopmoduleid"] != null ) ) { DesktopModuleId = int.Parse( Request.QueryString["desktopmoduleid"] ); } else { DesktopModuleId = Null.NullInteger; } if( Page.IsPostBack == false ) { //Localize Grid Localization.LocalizeDataGrid(ref grdControls, this.LocalResourceFile); ClientAPI.AddButtonConfirm( cmdDelete, Localization.GetString( "DeleteItem" ) ); ClientAPI.AddButtonConfirm( cmdDeleteDefinition, Localization.GetString( "DeleteItem" ) ); if( Null.IsNull( DesktopModuleId ) ) { //Enable ReadOnly Controls for Add Mode only tabManifest.Visible = true; BindManifestList( "DesktopModules", true ); cboManifest.Items.Insert( 0, new ListItem( "<" + Localization.GetString( "None_Specified" ) + ">", "" ) ); txtModuleName.Enabled = true; txtFolderName.Enabled = true; txtVersion.Enabled = true; txtVersion.Text = "01.00.00"; txtBusinessClass.Enabled = true; txtCompatibleVersions.Enabled = true; cmdDelete.Visible = false; chkDelete.Visible = false; tabDefinitions.Visible = false; tabCache.Visible = false; tabControls.Visible = false; } else { DesktopModuleInfo objDesktopModule; if( DesktopModuleId == - 2 ) { objDesktopModule = new DesktopModuleInfo(); objDesktopModule.ModuleName = Localization.GetString( "SkinObjects" ); objDesktopModule.FolderName = Localization.GetString( "SkinObjects" ); objDesktopModule.FriendlyName = Localization.GetString( "SkinObjects" ); objDesktopModule.Description = Localization.GetString( "SkinObjectsDescription" ); objDesktopModule.IsPremium = false; objDesktopModule.Version = ""; cmdUpdate.Visible = false; cmdDelete.Visible = false; chkDelete.Visible = false; tabDefinitions.Visible = false; tabCache.Visible = false; txtDescription.Enabled = false; chkPremium.Enabled = false; LoadControls( Null.NullInteger ); } else { if (Request.IsLocal) { txtModuleName.Enabled = true; txtFolderName.Enabled = true; txtVersion.Enabled = true; txtBusinessClass.Enabled = true; txtCompatibleVersions.Enabled = true; chkDelete.Checked = false; } else { chkDelete.Checked = true; } objDesktopModule = objDesktopModules.GetDesktopModule( DesktopModuleId ); LoadDefinitions(); } tabManifest.Visible = false; if( objDesktopModule != null ) { txtModuleName.Text = objDesktopModule.ModuleName; txtFolderName.Text = objDesktopModule.FolderName; txtFriendlyName.Text = objDesktopModule.FriendlyName; txtDescription.Text = objDesktopModule.Description; txtVersion.Text = objDesktopModule.Version; txtCompatibleVersions.Text = objDesktopModule.CompatibleVersions; txtBusinessClass.Text = objDesktopModule.BusinessControllerClass; chkUpgradeable.Checked = objDesktopModule.IsUpgradeable; chkPortable.Checked = objDesktopModule.IsPortable; chkSearchable.Checked = objDesktopModule.IsSearchable; chkPremium.Checked = objDesktopModule.IsPremium; } } PortalController objPortals = new PortalController(); ArrayList arrPortals = objPortals.GetPortals(); ArrayList arrPortalDesktopModules = objDesktopModules.GetPortalDesktopModules( Null.NullInteger, DesktopModuleId ); foreach( PortalDesktopModuleInfo objPortalDesktopModule in arrPortalDesktopModules ) { foreach( PortalInfo objPortal in arrPortals ) { if( objPortal.PortalID == objPortalDesktopModule.PortalID ) { arrPortals.Remove( objPortal ); break; } } } ctlPortals.Available = arrPortals; ctlPortals.Assigned = arrPortalDesktopModules; ctlPortals.Visible = chkPremium.Checked; } } catch( Exception exc ) //Module failed to load { Exceptions.ProcessModuleLoadException( this, exc ); } }