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")); foreach (ListItem item in cboDesktopModules.Items) { item.Attributes.Add("title", item.Text); } 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; } }
private void LoadTabControls(TabInfo objTab) { int currentTabId; if (objTab == null) { currentTabId = -1; } else { currentTabId = objTab.TabID; } ArrayList arr; arr = Globals.GetPortalTabs(PortalSettings.DesktopTabs, currentTabId, true, true, false, true, true); cboTab.DataSource = arr; cboTab.DataBind(); // if editing a tab, load tab parent so parent link is not lost // parent tab might not be loaded in cbotab if user does not have edit rights on it if (!PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) && objTab != null) { if (cboTab.Items.FindByValue(objTab.ParentId.ToString()) == null) { TabController objtabs = new TabController(); TabInfo objparent = objtabs.GetTab(objTab.ParentId, objTab.PortalID, false); cboTab.Items.Add(new ListItem(objparent.TabName, objparent.TabID.ToString())); } } }
private ArrayList LoadPortalTabs() { ArrayList arrTabs = new ArrayList(); ArrayList arrPortalTabs = Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true); foreach (TabInfo objTab in arrPortalTabs) { if (PortalSecurity.IsInRoles(objTab.AuthorizedRoles)) { arrTabs.Add(objTab); } } return(arrTabs); }
//tasks /// <summary> /// Loads deleted tabs and modules into the lists /// </summary> /// <remarks> /// </remarks> /// <history> /// [VMasanas] 18/08/2004 /// [VMasanas] 20/08/2004 Update display information for deleted modules to: /// ModuleFriendlyName: ModuleTitle - Tab: TabName /// </history> private void BindData() { int intTab; ArrayList arrDeletedTabs = new ArrayList(); TabController objTabs = new TabController(); TabInfo objTab; ArrayList arrTabs = objTabs.GetTabs(PortalId); for (intTab = 0; intTab <= arrTabs.Count - 1; intTab++) { objTab = (TabInfo)arrTabs[intTab]; if (objTab.IsDeleted == true) { arrDeletedTabs.Add(objTab); } } ModuleController objModules = new ModuleController(); ModuleInfo objModule; int intModule; ArrayList arrDeletedModules = new ArrayList(); ArrayList arrModules = objModules.GetModules(PortalId); for (intModule = 0; intModule <= arrModules.Count - 1; intModule++) { objModule = (ModuleInfo)arrModules[intModule]; if (objModule.IsDeleted == true) { if (objModule.ModuleTitle == "") { objModule.ModuleTitle = objModule.FriendlyName; } arrDeletedModules.Add(objModule); } } lstTabs.DataSource = arrDeletedTabs; lstTabs.DataBind(); lstModules.DataSource = arrDeletedModules; lstModules.DataBind(); cboTab.DataSource = Globals.GetPortalTabs(PortalSettings.DesktopTabs, -1, false, true, false, false, true); cboTab.DataBind(); }
/// <summary> /// Deletes Tab /// </summary> /// <param name="tabId">ID of the parent tab</param> /// <remarks> /// Will delete tab /// </remarks> /// <history> /// [VMasanas] 30/09/2004 Created /// [VMasanas] 01/09/2005 A tab will be deleted only if all descendants can be deleted /// </history> private bool DeleteTab(int tabId) { bool bDeleted = true; if (tabId != PortalSettings.AdminTabId && tabId != PortalSettings.SplashTabId && tabId != PortalSettings.HomeTabId && tabId != PortalSettings.LoginTabId && tabId != PortalSettings.UserTabId) { TabController objTabs = new TabController(); ArrayList tabs = Globals.GetPortalTabs(PortalSettings.DesktopTabs, tabId, false, false, false, false, false); if (tabs.Count > 0) { TabInfo objTab = objTabs.GetTab(tabId, PortalId, false); if (objTab != null) { //delete child tabs if (DeleteChildTabs(objTab.TabID)) { objTab.IsDeleted = true; objTabs.UpdateTab(objTab); EventLogController objEventLog = new EventLogController(); objEventLog.AddLog(objTab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_SENT_TO_RECYCLE_BIN); } else { bDeleted = false; } } } else { bDeleted = false; } } else { bDeleted = false; } if (!bDeleted) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DeleteSpecialPage", this.LocalResourceFile), ModuleMessageType.RedError); } return(bDeleted); }
/// <summary> /// Gets all children tabs where user has edit access /// </summary> /// <returns>All the childen tabs where current user has edit permission</returns> /// <remarks> /// To get desired tabs it first selects children tabs (by using the taborder and level) /// and then filters only those where the user has access /// </remarks> private ArrayList GetEditableTabs() { ArrayList arr = new ArrayList(); int i = 0; bool Finished = false; while (i < PortalSettings.DesktopTabs.Count & !Finished) { TabInfo objTab = PortalSettings.DesktopTabs[i] as TabInfo; if (objTab != null) { if (objTab.TabOrder > PortalSettings.ActiveTab.TabOrder) { if (objTab.Level > PortalSettings.ActiveTab.Level) { // we are in a descendant arr.Add(PortalSettings.DesktopTabs[i]); } else { // exit condition Finished = true; } } } i += 1; } if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName)) { // shortcut for admins return(arr); } else { // filter tabs where user has access return(Globals.GetPortalTabs(arr, PortalSettings.ActiveTab.TabID, false, true, false, true, true)); } }
/// <summary> /// cmdUpdate_Click runs when the Update LinkButton is clicked. /// It saves the current Site Settings /// </summary> /// <history> /// [cnurse] 10/18/2004 documented /// [cnurse] 10/19/2004 modified to support custm module specific settings /// </history> protected void cmdUpdate_Click(object Sender, EventArgs e) { try { if (Page.IsValid) { ModuleController objModules = new ModuleController(); bool AllTabsChanged = false; // tab administrators can only manage their own tab if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false) { chkAllTabs.Enabled = false; chkDefault.Enabled = false; chkAllModules.Enabled = false; cboTab.Enabled = false; } // update module ModuleInfo objModule = objModules.GetModule(moduleId, TabId, false); objModule.ModuleID = moduleId; objModule.ModuleTitle = txtTitle.Text; objModule.Alignment = cboAlign.SelectedItem.Value; objModule.Color = txtColor.Text; objModule.Border = txtBorder.Text; objModule.IconFile = ctlIcon.Url; if (!String.IsNullOrEmpty(txtCacheTime.Text)) { objModule.CacheTime = int.Parse(txtCacheTime.Text); } else { objModule.CacheTime = 0; } objModule.TabID = TabId; if (objModule.AllTabs != chkAllTabs.Checked) { AllTabsChanged = true; } objModule.AllTabs = chkAllTabs.Checked; switch (int.Parse(cboVisibility.SelectedItem.Value)) { case 0: objModule.Visibility = VisibilityState.Maximized; break; case 1: objModule.Visibility = VisibilityState.Minimized; break; case 2: objModule.Visibility = VisibilityState.None; break; } objModule.IsDeleted = false; objModule.Header = txtHeader.Text; objModule.Footer = txtFooter.Text; if (!String.IsNullOrEmpty(txtStartDate.Text)) { objModule.StartDate = Convert.ToDateTime(txtStartDate.Text); } else { objModule.StartDate = Null.NullDate; } if (!String.IsNullOrEmpty(txtEndDate.Text)) { objModule.EndDate = Convert.ToDateTime(txtEndDate.Text); } else { objModule.EndDate = Null.NullDate; } objModule.ContainerSrc = ctlModuleContainer.SkinSrc; objModule.ModulePermissions = dgPermissions.Permissions; objModule.InheritViewPermissions = chkInheritPermissions.Checked; objModule.DisplayTitle = chkDisplayTitle.Checked; objModule.DisplayPrint = chkDisplayPrint.Checked; objModule.DisplaySyndicate = chkDisplaySyndicate.Checked; objModule.IsDefaultModule = chkDefault.Checked; objModule.AllModules = chkAllModules.Checked; objModules.UpdateModule(objModule); //Update Custom Settings if (ctlSpecific != null) { ctlSpecific.UpdateSettings(); } //These Module Copy/Move statements must be //at the end of the Update as the Controller code assumes all the //Updates to the Module have been carried out. //Check if the Module is to be Moved to a new Tab if (!chkAllTabs.Checked) { int newTabId = int.Parse(cboTab.SelectedItem.Value); if (TabId != newTabId) { objModules.MoveModule(moduleId, TabId, newTabId, ""); } } //'Check if Module is to be Added/Removed from all Tabs if (AllTabsChanged) { ArrayList arrTabs = Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true); if (chkAllTabs.Checked) { objModules.CopyModule(moduleId, TabId, arrTabs, true); } else { objModules.DeleteAllModules(moduleId, TabId, arrTabs, false, false); } } // Navigate back to admin page Response.Redirect(Globals.NavigateURL(), true); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <history> /// [cnurse] 10/18/2004 documented /// [cnurse] 10/19/2004 modified to support custm module specific settings /// [vmasanas] 11/28/2004 modified to support modules in admin tabs /// </history> protected void Page_Load(Object sender, EventArgs e) { try { // Verify that the current user has access to edit this module if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false && PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString()) == false) { Response.Redirect(Globals.NavigateURL("Access Denied"), true); } //this needs to execute always to the client script code is registred in InvokePopupCal cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate); cmdEndCalendar.NavigateUrl = Calendar.InvokePopupCal(txtEndDate); if (Page.IsPostBack == false) { ctlIcon.FileFilter = Globals.glbImageFileTypes; dgPermissions.TabId = PortalSettings.ActiveTab.TabID; dgPermissions.ModuleID = moduleId; ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); cboTab.DataSource = Globals.GetPortalTabs(PortalSettings.DesktopTabs, -1, false, true, false, false, true); cboTab.DataBind(); //if is and admin or host tab, then add current tab if (PortalSettings.ActiveTab.ParentId == PortalSettings.AdminTabId || PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId) { cboTab.Items.Insert(0, new ListItem(PortalSettings.ActiveTab.TabName, PortalSettings.ActiveTab.TabID.ToString())); } // tab administrators can only manage their own tab if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false) { chkAllTabs.Enabled = false; chkDefault.Enabled = false; chkAllModules.Enabled = false; cboTab.Enabled = false; } if (moduleId != -1) { BindData(); } else { cboVisibility.SelectedIndex = 0; // maximized chkAllTabs.Checked = false; cmdDelete.Visible = false; } //Set visibility of Specific Settings if (ctlSpecific != null) { //Get the module settings from the PortalSettings and pass the //two settings hashtables to the sub control to process ctlSpecific.LoadSettings(); dshSpecific.Visible = true; tblSpecific.Visible = true; } else { dshSpecific.Visible = false; tblSpecific.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/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); } }
private void ShowControls() { UrlController objUrls = new UrlController(); // set url type if (optType.SelectedItem == null) { if (!String.IsNullOrEmpty(_Url)) { string TrackingUrl = _Url; _UrlType = Globals.GetURLType(_Url).ToString("g").Substring(0, 1); if (_UrlType == "F") { FileController objFiles = new FileController(); if (_Url.ToLower().StartsWith("fileid=")) { TrackingUrl = _Url; FileInfo objFile = objFiles.GetFileById(int.Parse(_Url.Substring(7)), _objPortal.PortalID); if (objFile != null) { _Url = objFile.Folder + objFile.FileName; } } else { // to handle legacy scenarios before the introduction of the FileServerHandler TrackingUrl = "FileID=" + objFiles.ConvertFilePathToFileId(_Url, _objPortal.PortalID); } } if (_UrlType == "M") { if (_Url.ToLower().StartsWith("userid=")) { UserInfo objUser = UserController.GetUser(_objPortal.PortalID, int.Parse(_Url.Substring(7)), false); if (objUser != null) { _Url = objUser.Username; } } } UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(_objPortal.PortalID, TrackingUrl, ModuleID); if (objUrlTracking != null) { optType.Items.FindByValue(objUrlTracking.UrlType).Selected = true; chkNewWindow.Checked = objUrlTracking.NewWindow; chkTrack.Checked = objUrlTracking.TrackClicks; chkLog.Checked = objUrlTracking.LogActivity; } else // the url does not exist in the tracking table { optType.Items.FindByValue(_UrlType).Selected = true; chkNewWindow.Checked = false; chkTrack.Checked = true; chkLog.Checked = false; } } else { if (!String.IsNullOrEmpty(_UrlType)) { if (optType.Items.FindByValue(_UrlType) != null) { optType.Items.FindByValue(_UrlType).Selected = true; } else { optType.Items[0].Selected = true; } } else { optType.Items[0].Selected = true; } chkNewWindow.Checked = false; chkTrack.Checked = true; chkLog.Checked = false; } } // load listitems switch (optType.SelectedItem.Value) { case "N": // None URLRow.Visible = false; TabRow.Visible = false; FileRow.Visible = false; UserRow.Visible = false; break; case "U": // Url URLRow.Visible = true; TabRow.Visible = false; FileRow.Visible = false; UserRow.Visible = false; if (txtUrl.Text == "") { txtUrl.Text = _Url; } if (txtUrl.Text == "") { txtUrl.Text = "http://"; } txtUrl.Visible = true; cmdSelect.Visible = true; cboUrls.Items.Clear(); cboUrls.DataSource = objUrls.GetUrls(_objPortal.PortalID); cboUrls.DataBind(); if (cboUrls.Items.FindByValue(_Url) != null) { cboUrls.Items.FindByValue(_Url).Selected = true; } cboUrls.Visible = false; cmdAdd.Visible = false; cmdDelete.Visible = false; break; case "T": // tab URLRow.Visible = false; TabRow.Visible = true; FileRow.Visible = false; UserRow.Visible = false; cboTabs.Items.Clear(); cboTabs.DataSource = Globals.GetPortalTabs(_objPortal.PortalID, !_Required, true, false, false, false); cboTabs.DataBind(); if (cboTabs.Items.FindByValue(_Url) != null) { cboTabs.Items.FindByValue(_Url).Selected = true; } break; case "F": // file URLRow.Visible = false; TabRow.Visible = false; FileRow.Visible = true; UserRow.Visible = false; LoadFolders(); if (cboFolders.Items.Count == 0) { lblMessage.Text = Localization.GetString("NoPermission", this.LocalResourceFile); FileRow.Visible = false; return; } // select folder string FileName; string FolderPath; if (_Url != string.Empty) { FileName = _Url.Substring(_Url.LastIndexOf("/") + 1); FolderPath = _Url.Replace(FileName, ""); } else { FileName = _Url; FolderPath = string.Empty; } if (cboFolders.Items.FindByValue(FolderPath) != null) { cboFolders.Items.FindByValue(FolderPath).Selected = true; } else { cboFolders.Items[0].Selected = true; FolderPath = cboFolders.SelectedValue; } //cboFiles.DataSource = GetFileList(FileFilter, !_Required, cboFolders.SelectedItem.Value); cboFiles.DataSource = GetFileList(!_Required); cboFiles.DataBind(); if (cboFiles.Items.FindByText(FileName) != null) { cboFiles.Items.FindByText(FileName).Selected = true; } cboFiles.Visible = true; txtFile.Visible = false; string strWriteRoles = GetWriteRoles(FolderPath); cmdUpload.Visible = PortalSecurity.IsInRoles(strWriteRoles) && _ShowUpLoad; SetStorageLocationType(); txtUrl.Visible = false; cmdSave.Visible = false; cmdCancel.Visible = false; break; case "M": // membership users URLRow.Visible = false; TabRow.Visible = false; FileRow.Visible = false; UserRow.Visible = true; if (txtUser.Text == "") { txtUser.Text = _Url; } break; } }