protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (module != null) { txtID.Text = module.ModuleID.ToString(); txtModuleName.Text = module.ModuleName; txtModuleTitle.Text = module.ModuleTitle; txtModuleDescription.Text = module.ModuleDescription; txtModuleFolder.Text = module.ModuleFolder; DataTable dtControls = ModuleControlController.GetModuleControls(moduleId); dtgModuleControls.DataSource = dtControls; dtgModuleControls.DataBind(); } }
/// <summary> /// LoadDefinitions fetches the control data from the database /// </summary> /// <param name="ModuleDefId">The Module definition Id</param> /// <history> /// [cnurse] 9/28/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> private void LoadControls(int ModuleDefId) { ModuleControlController objModuleControls = new ModuleControlController(); ArrayList arrModuleControls = objModuleControls.GetModuleControls(ModuleDefId); if (DesktopModuleId == -2) { int intIndex; for (intIndex = arrModuleControls.Count - 1; intIndex >= 0; intIndex--) { ModuleControlInfo objModuleControl = (ModuleControlInfo)arrModuleControls[intIndex]; if (objModuleControl.ControlType != SecurityAccessLevel.SkinObject) { arrModuleControls.RemoveAt(intIndex); } } } grdControls.DataSource = arrModuleControls; grdControls.DataBind(); cmdAddControl.Visible = true; grdControls.Visible = true; }
/// <summary> /// BindData fetches the data from the database and updates the controls /// </summary> /// <history> /// [cnurse] 9/27/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> private void BindData() { lblVersion.Text = Globals.glbAppVersion; switch (Convert.ToString(Globals.HostSettings["CheckUpgrade"])) { case "": chkUpgrade.Checked = true; break; case "Y": chkUpgrade.Checked = true; break; case "N": chkUpgrade.Checked = false; break; } if (chkUpgrade.Checked) { hypUpgrade.ImageUrl = string.Format("{0}/update.aspx?version={1}", Globals.glbUpgradeUrl, lblVersion.Text.Replace(".", "")); hypUpgrade.NavigateUrl = string.Format("{0}/redirect.aspx?version={1}", Globals.glbUpgradeUrl, lblVersion.Text.Replace(".", "")); } else { hypUpgrade.Visible = false; } lblDataProvider.Text = ProviderConfiguration.GetProviderConfiguration("data").DefaultProvider; lblFramework.Text = Environment.Version.ToString(); lblIdentity.Text = WindowsIdentity.GetCurrent().Name; lblHostName.Text = Dns.GetHostName(); PortalController objPortals = new PortalController(); cboHostPortal.DataSource = objPortals.GetPortals(); cboHostPortal.DataBind(); if (Convert.ToString(Globals.HostSettings["HostPortalId"]) != "") { if (cboHostPortal.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostPortalId"])) != null) { cboHostPortal.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostPortalId"])).Selected = true; } } txtHostTitle.Text = Convert.ToString(Globals.HostSettings["HostTitle"]); txtHostURL.Text = Convert.ToString(Globals.HostSettings["HostURL"]); txtHostEmail.Text = Convert.ToString(Globals.HostSettings["HostEmail"]); //SkinController objSkins = new SkinController(); SkinInfo objSkin; ctlHostSkin.Width = "252px"; ctlHostSkin.SkinRoot = SkinInfo.RootSkin; objSkin = SkinController.GetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Portal); if (objSkin != null) { if (Null.IsNull(objSkin.PortalId)) { ctlHostSkin.SkinSrc = objSkin.SkinSrc; } } ctlHostContainer.Width = "252px"; ctlHostContainer.SkinRoot = SkinInfo.RootContainer; objSkin = SkinController.GetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Portal); if (objSkin != null) { if (Null.IsNull(objSkin.PortalId)) { ctlHostContainer.SkinSrc = objSkin.SkinSrc; } } ctlAdminSkin.Width = "252px"; ctlAdminSkin.SkinRoot = SkinInfo.RootSkin; objSkin = SkinController.GetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Admin); if (objSkin != null) { if (Null.IsNull(objSkin.PortalId)) { ctlAdminSkin.SkinSrc = objSkin.SkinSrc; } } ctlAdminContainer.Width = "252px"; ctlAdminContainer.SkinRoot = SkinInfo.RootContainer; objSkin = SkinController.GetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Admin); if (objSkin != null) { if (Null.IsNull(objSkin.PortalId)) { ctlAdminContainer.SkinSrc = objSkin.SkinSrc; } } ModuleControlController objModuleControls = new ModuleControlController(); ArrayList arrModuleControls = objModuleControls.GetModuleControls(Null.NullInteger); int intModuleControl; for (intModuleControl = 0; intModuleControl <= arrModuleControls.Count - 1; intModuleControl++) { ModuleControlInfo objModuleControl = (ModuleControlInfo)arrModuleControls[intModuleControl]; if (objModuleControl.ControlType == SecurityAccessLevel.ControlPanel) { cboControlPanel.Items.Add(new ListItem(objModuleControl.ControlKey.Replace("CONTROLPANEL:", ""), objModuleControl.ControlSrc)); } } if (Convert.ToString(Globals.HostSettings["ControlPanel"]) != "") { if (cboControlPanel.Items.FindByValue(Convert.ToString(Globals.HostSettings["ControlPanel"])) != null) { cboControlPanel.Items.FindByValue(Convert.ToString(Globals.HostSettings["ControlPanel"])).Selected = true; } } else { if (cboControlPanel.Items.FindByValue(Globals.glbDefaultControlPanel) != null) { cboControlPanel.Items.FindByValue(Globals.glbDefaultControlPanel).Selected = true; } } ListController ctlList = new ListController(); ListEntryInfoCollection colProcessor = ctlList.GetListEntryInfoCollection("Processor", ""); cboProcessor.DataSource = colProcessor; cboProcessor.DataBind(); cboProcessor.Items.Insert(0, new ListItem("<" + Localization.GetString("None_Specified") + ">", "")); if (cboProcessor.Items.FindByText(Globals.HostSettings["PaymentProcessor"].ToString()) != null) { cboProcessor.Items.FindByText(Globals.HostSettings["PaymentProcessor"].ToString()).Selected = true; } txtUserId.Text = Convert.ToString(Globals.HostSettings["ProcessorUserId"]); txtPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["ProcessorPassword"])); txtHostFee.Text = Convert.ToString(Globals.HostSettings["HostFee"]); ListEntryInfoCollection colCurrency = ctlList.GetListEntryInfoCollection("Currency", ""); cboHostCurrency.DataSource = colCurrency; cboHostCurrency.DataBind(); if (cboHostCurrency.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostCurrency"])) != null) { cboHostCurrency.Items.FindByValue(Globals.HostSettings["HostCurrency"].ToString()).Selected = true; } else { cboHostCurrency.Items.FindByValue("USD").Selected = true; } if (cboSchedulerMode.Items.FindByValue(Convert.ToString(Globals.HostSettings["SchedulerMode"])) != null) { cboSchedulerMode.Items.FindByValue(Globals.HostSettings["SchedulerMode"].ToString()).Selected = true; } else { cboSchedulerMode.Items.FindByValue("1").Selected = true; } txtHostSpace.Text = Convert.ToString(Globals.HostSettings["HostSpace"]); txtPageQuota.Text = Convert.ToString(Globals.HostSettings["PageQuota"]); txtUserQuota.Text = Convert.ToString(Globals.HostSettings["UserQuota"]); if (Convert.ToString(Globals.HostSettings["SiteLogStorage"]) == "") { optSiteLogStorage.Items.FindByValue("D").Selected = true; } else { optSiteLogStorage.Items.FindByValue(Convert.ToString(Globals.HostSettings["SiteLogStorage"])).Selected = true; } if (Convert.ToString(Globals.HostSettings["SiteLogBuffer"]) == "") { txtSiteLogBuffer.Text = "1"; } else { txtSiteLogBuffer.Text = Convert.ToString(Globals.HostSettings["SiteLogBuffer"]); } txtSiteLogHistory.Text = Convert.ToString(Globals.HostSettings["SiteLogHistory"]); if (Convert.ToString(Globals.HostSettings["PageStatePersister"]) == "") { cboPageState.Items.FindByValue("P").Selected = true; } else { cboPageState.Items.FindByValue(Convert.ToString(Globals.HostSettings["PageStatePersister"])).Selected = true; } if (Convert.ToString(Globals.HostSettings["ModuleCaching"]) == "") { cboCacheMethod.Items.FindByValue("M").Selected = true; } else { cboCacheMethod.Items.FindByValue(Convert.ToString(Globals.HostSettings["ModuleCaching"])).Selected = true; } if (cboPerformance.Items.FindByValue(Convert.ToString(Globals.HostSettings["PerformanceSetting"])) != null) { cboPerformance.Items.FindByValue(Globals.HostSettings["PerformanceSetting"].ToString()).Selected = true; } else { cboPerformance.Items.FindByValue("3").Selected = true; } if (cboCacheability.Items.FindByValue(Convert.ToString(Globals.HostSettings["AuthenticatedCacheability"])) != null) { cboCacheability.Items.FindByValue(Globals.HostSettings["AuthenticatedCacheability"].ToString()).Selected = true; } else { cboCacheability.Items.FindByValue("4").Selected = true; } if (cboCompression.Items.FindByValue(Convert.ToString(Globals.HostSettings["HttpCompression"])) != null) { cboCompression.Items.FindByValue(Globals.HostSettings["HttpCompression"].ToString()).Selected = true; } else { cboCompression.Items.FindByValue("0").Selected = true; } if (cboLevel.Items.FindByValue(Convert.ToString(Globals.HostSettings["HttpCompressionLevel"])) != null) { cboLevel.Items.FindByValue(Globals.HostSettings["HttpCompressionLevel"].ToString()).Selected = true; } else { cboLevel.Items.FindByValue("0").Selected = true; } if (Convert.ToString(Globals.HostSettings["WhitespaceFilter"]) == "Y") { chkWhitespace.Checked = true; } else { chkWhitespace.Checked = false; } string filePath = Globals.ApplicationMapPath + "\\Compression.config"; if (File.Exists(filePath)) { FileStream fileReader = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); XPathDocument doc = new XPathDocument(fileReader); foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedMimeTypes/mimeType")) { txtExcludedMimeTypes.Text += nav.Value.ToLower() + Environment.NewLine; } foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedPaths/path")) { txtExcludedPaths.Text += nav.Value.ToLower() + Environment.NewLine; } txtWhitespaceFilter.Text = doc.CreateNavigator().SelectSingleNode("compression/whitespace").Value; } txtDemoPeriod.Text = Convert.ToString(Globals.HostSettings["DemoPeriod"]); if (Convert.ToString(Globals.HostSettings["DemoSignup"]) == "Y") { chkDemoSignup.Checked = true; } else { chkDemoSignup.Checked = false; } if (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") == "Y") { chkCopyright.Checked = true; } else { chkCopyright.Checked = false; } if (Globals.HostSettings.ContainsKey("DisableUsersOnline")) { if (Globals.HostSettings["DisableUsersOnline"].ToString() == "Y") { chkUsersOnline.Checked = true; } else { chkUsersOnline.Checked = false; } } else { chkUsersOnline.Checked = false; } txtUsersOnlineTime.Text = Convert.ToString(Globals.HostSettings["UsersOnlineTime"]); txtAutoAccountUnlock.Text = Convert.ToString(Globals.HostSettings["AutoAccountUnlockDuration"]); txtProxyServer.Text = Convert.ToString(Globals.HostSettings["ProxyServer"]); txtProxyPort.Text = Convert.ToString(Globals.HostSettings["ProxyPort"]); txtProxyUsername.Text = Convert.ToString(Globals.HostSettings["ProxyUsername"]); txtProxyPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["ProxyPassword"])); txtSMTPServer.Text = Convert.ToString(Globals.HostSettings["SMTPServer"]); if (Convert.ToString(Globals.HostSettings["SMTPAuthentication"]) != "") { optSMTPAuthentication.Items.FindByValue(Globals.HostSettings["SMTPAuthentication"].ToString()).Selected = true; } else { optSMTPAuthentication.Items.FindByValue("0").Selected = true; } if (Convert.ToString(Globals.HostSettings["SMTPEnableSSL"]) == "Y") { chkSMTPEnableSSL.Checked = true; } else { chkSMTPEnableSSL.Checked = false; } txtSMTPUsername.Text = Convert.ToString(Globals.HostSettings["SMTPUsername"]); txtSMTPPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["SMTPPassword"])); txtFileExtensions.Text = Convert.ToString(Globals.HostSettings["FileExtensions"]); if (Globals.HostSettings.ContainsKey("UseCustomErrorMessages")) { if (Globals.HostSettings["UseCustomErrorMessages"].ToString() == "Y") { chkUseCustomErrorMessages.Checked = true; } else { chkUseCustomErrorMessages.Checked = false; } } else { chkUseCustomErrorMessages.Checked = false; } if (Globals.HostSettings.ContainsKey("UseFriendlyUrls")) { if (Globals.HostSettings["UseFriendlyUrls"].ToString() == "Y") { chkUseFriendlyUrls.Checked = true; } else { chkUseFriendlyUrls.Checked = false; } } else { chkUseFriendlyUrls.Checked = false; } rowFriendlyUrls.Visible = chkUseFriendlyUrls.Checked; if (Globals.HostSettings.ContainsKey("EventLogBuffer")) { if (Globals.HostSettings["EventLogBuffer"].ToString() == "Y") { chkLogBuffer.Checked = true; } else { chkLogBuffer.Checked = false; } } else { chkLogBuffer.Checked = false; } if (Convert.ToString(Globals.HostSettings["SkinUpload"]) != "") { optSkinUpload.Items.FindByValue(Globals.HostSettings["SkinUpload"].ToString()).Selected = true; } else { optSkinUpload.Items.FindByValue("G").Selected = true; } txtHelpURL.Text = Convert.ToString(Globals.HostSettings["HelpURL"]); if (Globals.HostSettings.ContainsKey("EnableModuleOnLineHelp")) { if (Globals.HostSettings["EnableModuleOnLineHelp"].ToString() == "Y") { chkEnableHelp.Checked = true; } else { chkEnableHelp.Checked = false; } } else { chkEnableHelp.Checked = true; } if (Globals.HostSettings.ContainsKey("EnableFileAutoSync")) { if (Globals.HostSettings["EnableFileAutoSync"].ToString() == "Y") { chkAutoSync.Checked = true; } else { chkAutoSync.Checked = false; } } else { chkAutoSync.Checked = false; } ViewState["SelectedSchedulerMode"] = cboSchedulerMode.SelectedItem.Value; ViewState["SelectedLogBufferEnabled"] = chkLogBuffer.Checked; ViewState["SelectedUsersOnlineEnabled"] = chkUsersOnline.Checked; // Get the name of the data provider ProviderConfiguration objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration("data"); // get list of script files string strProviderPath = PortalSettings.GetProviderPath(); ArrayList arrScriptFiles = new ArrayList(); string[] arrFiles = Directory.GetFiles(strProviderPath, "*." + objProviderConfiguration.DefaultProvider); foreach (string strFile in arrFiles) { arrScriptFiles.Add(Path.GetFileNameWithoutExtension(strFile)); } arrScriptFiles.Sort(); cboUpgrade.DataSource = arrScriptFiles; cboUpgrade.DataBind(); ModuleInfo FileManagerModule = (new ModuleController()).GetModuleByDefinition(Null.NullInteger, "File Manager"); string[] additionalParameters = new string[3]; additionalParameters[0] = "mid=" + FileManagerModule.ModuleID; additionalParameters[1] = "ftype=" + UploadType.Skin; additionalParameters[2] = "rtab=" + this.TabId; lnkUploadSkin.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", additionalParameters); additionalParameters[1] = "ftype=" + UploadType.Container; lnkUploadContainer.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", additionalParameters); }
/// <summary> /// SkinFileProcessor class constructor. /// </summary> /// <param name="SkinPath">File path to the portals upload directory.</param> /// <param name="SkinRoot">Specifies type of skin (Skins or Containers)</param> /// <param name="SkinName">Name of folder in which skin will reside (Zip file name)</param> /// <remarks> /// The constructor primes the file processor with path information and /// control data that should only be retrieved once. It checks for the /// existentce of a skin level attribute file and read it in, if found. /// It also sorts through the complete list of controls and creates /// a hashtable which contains only the skin objects and their source paths. /// These are recognized by their ControlKey's which are formatted like /// tokens ("[TOKEN]"). The hashtable is required for speed as it will be /// processed for each token found in the source file by the Control Parser. /// </remarks> public SkinFileProcessor(string SkinPath, string SkinRoot, string SkinName) { this.Message += SkinController.FormatMessage(INITIALIZE_PROCESSOR, SkinRoot + " :: " + SkinName, 0, false); // Save path information for future use m_SkinRoot = SkinRoot; m_SkinPath = SkinPath; m_SkinName = SkinName; // Check for and read skin package level attribute information file string FileName = this.SkinPath + this.SkinRoot + "\\" + this.SkinName + "\\" + SkinRoot.Substring(0, SkinRoot.Length - 1) + ".xml"; if (File.Exists(FileName)) { try { this.SkinAttributes.Load(FileName); this.Message += SkinController.FormatMessage(PACKAGE_LOAD, Path.GetFileName(FileName), 2, false); } catch (Exception ex) { // could not load XML file this.Message += SkinController.FormatMessage(string.Format(PACKAGE_LOAD_ERROR, ex.Message), Path.GetFileName(FileName), 2, true); } } // Retrieve a list of available controls ModuleControlController objModuleControls = new ModuleControlController(); ArrayList arrModuleControls = objModuleControls.GetModuleControls(Null.NullInteger); // Look at every control string Token; int i; ModuleControlInfo objModuleControl; for (i = 0; i <= arrModuleControls.Count - 1; i++) { objModuleControl = (ModuleControlInfo)arrModuleControls[i]; // If the control is a skin object, save the key and source in the hash table if (objModuleControl.ControlType == SecurityAccessLevel.SkinObject) { Token = objModuleControl.ControlKey.ToUpper(); // If the control is already in the hash table if (m_ControlList.ContainsKey(Token)) { // Record an error message and skip it this.Message += SkinController.FormatMessage(string.Format(DUPLICATE_ERROR, objModuleControl.ControlKey.ToString().ToUpper()), string.Format(DUPLICATE_DETAIL, ((string)m_ControlList[Token]), objModuleControl.ControlSrc.ToString()), 2, true); } else { // Add it this.Message += SkinController.FormatMessage(string.Format(LOAD_SKIN_TOKEN, objModuleControl.ControlKey.ToString().ToUpper()), objModuleControl.ControlSrc.ToString(), 2, false); m_ControlList.Add(Token, objModuleControl.ControlSrc); } } } // Instantiate the control parser with the list of skin objects m_ControlFactory = new ControlParser(m_ControlList); }