protected void OnModuleActionClick(object sender, ActionEventArgs e) { switch (e.Action.CommandArgument) { case "Delete": try { var objVendors = new VendorController(); if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { objVendors.DeleteVendors(); } else { objVendors.DeleteVendors(PortalId); } Response.Redirect(Globals.NavigateURL(), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } break; } }
private bool CheckExpired() { bool blnExpired = false; if (PortalSettings.ExpiryDate != Null.NullDate) { if (Convert.ToDateTime(PortalSettings.ExpiryDate) < DateTime.Now && !Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { blnExpired = true; } } return(blnExpired); }
public string NavigateUrl(int tabID, string controlKey, string pageName, bool pageRedirect, params string[] additionalParameters) { var isSuperTab = Globals.IsHostTab(tabID); var settings = PortalController.GetCurrentPortalSettings(); var language = Globals.GetCultureCode(tabID, isSuperTab, settings); var url = Globals.NavigateURL(tabID, isSuperTab, settings, controlKey, language, pageName, additionalParameters); // Making URLs call popups if (PortalSettings != null && PortalSettings.EnablePopUps) { if (!UIUtilities.IsLegacyUI(ModuleId, controlKey, PortalId) && (url.Contains("ctl"))) { url = UrlUtils.PopUpUrl(url, null, PortalSettings, false, pageRedirect); } } return(url); }
void cmdDeleteUnAuthorized_Click(object sender, EventArgs e) { try { var objVendors = new VendorController(); if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { objVendors.DeleteVendors(); } else { objVendors.DeleteVendors(PortalId); } Response.Redirect(Globals.NavigateURL(), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.optType.SelectedIndexChanged += this.optType_SelectedIndexChanged; this.cmdAdd.Click += this.cmdAdd_Click; this.cmdDelete.Click += this.cmdDelete_Click; this.cmdSelect.Click += this.cmdSelect_Click; this.ErrorRow.Visible = false; try { if ((this.Request.QueryString["pid"] != null) && (Globals.IsHostTab(this.PortalSettings.ActiveTab.TabID) || UserController.Instance.GetCurrentUserInfo().IsSuperUser)) { this._objPortal = PortalController.Instance.GetPortal(int.Parse(this.Request.QueryString["pid"])); } else { this._objPortal = PortalController.Instance.GetPortal(this.PortalSettings.PortalId); } if (this.ViewState["IsUrlControlLoaded"] == null) { // If Not Page.IsPostBack Then // let's make at least an initialization // The type radio button must be initialized // The url must be initialized no matter its value this._doRenderTypes = true; this._doChangeURL = true; ClientAPI.AddButtonConfirm(this.cmdDelete, Localization.GetString("DeleteItem")); // The following line was mover to the pre-render event to ensure render for the first time // ViewState("IsUrlControlLoaded") = "Loaded" } } catch (Exception exc) // Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
private void SetDataSource() { CreateLetterSearch(); bool isUnauthorized = false; if (_searchFilter == Localization.GetString("All")) { _searchFilter = ""; } else if (_searchFilter == Localization.GetString("Unauthorized")) { _searchFilter = ""; isUnauthorized = true; } //Get the list of vendors from the database var totalRecords = 0; var vendorController = new VendorController(); int portal = Globals.IsHostTab(PortalSettings.ActiveTab.TabID) ? Null.NullInteger : PortalId; if (String.IsNullOrEmpty(_searchFilter)) { grdVendors.DataSource = vendorController.GetVendors(portal, isUnauthorized, grdVendors.CurrentPageIndex, grdVendors.PageSize, ref totalRecords); grdVendors.VirtualItemCount = totalRecords; } else { if (_searchField == "email") { grdVendors.DataSource = vendorController.GetVendorsByEmail(_searchFilter, portal, grdVendors.CurrentPageIndex, grdVendors.PageSize, ref totalRecords); grdVendors.VirtualItemCount = totalRecords; } else { grdVendors.DataSource = vendorController.GetVendorsByName(_searchFilter, portal, grdVendors.CurrentPageIndex, grdVendors.PageSize, ref totalRecords); grdVendors.VirtualItemCount = totalRecords; } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { cancelHyperLink.NavigateUrl = ReturnURL; if (_moduleId != -1) { ctlAudit.Entity = Module; } if (Page.IsPostBack == false) { ctlIcon.FileFilter = Globals.glbImageFileTypes; dgPermissions.TabId = PortalSettings.ActiveTab.TabID; dgPermissions.ModuleID = _moduleId; var tabsByModule = TabController.Instance.GetTabsByModuleID(_moduleId); tabsByModule.Remove(TabId); dgOnTabs.DataSource = tabsByModule.Values; dgOnTabs.DataBind(); cboTab.DataSource = TabController.GetPortalTabs(PortalId, -1, false, Null.NullString, true, false, true, false, true); cboTab.DataBind(); //if tab is a host tab, then add current tab if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { cboTab.InsertItem(0, PortalSettings.ActiveTab.LocalizedTabName, PortalSettings.ActiveTab.TabID.ToString()); } if (Module != null) { if (cboTab.FindItemByValue(Module.TabID.ToString()) == null) { var objTab = TabController.Instance.GetTab(Module.TabID, Module.PortalID, false); cboTab.AddItem(objTab.LocalizedTabName, objTab.TabID.ToString()); } } //only Portal Administrators can manage the visibility on all Tabs var isAdmin = PermissionProvider.Instance().IsPortalEditor(); rowAllTabs.Visible = isAdmin; chkAllModules.Enabled = isAdmin; if (HideCancelButton) { cancelHyperLink.Visible = false; } //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkNewTabs.Enabled = false; chkDefault.Enabled = false; chkAllowIndex.Enabled = false; cboTab.Enabled = false; } if (_moduleId != -1) { BindData(); cmdDelete.Visible = (ModulePermissionController.CanDeleteModule(Module) || TabPermissionController.CanAddContentToPage()) && !HideDeleteButton; } else { isShareableCheckBox.Checked = true; isShareableViewOnlyCheckBox.Checked = true; isShareableRow.Visible = true; cboVisibility.SelectedIndex = 0; //maximized chkAllTabs.Checked = false; cmdDelete.Visible = false; } if (Module != null) { cmdUpdate.Visible = ModulePermissionController.HasModulePermission(Module.ModulePermissions, "EDIT,MANAGE") || TabPermissionController.CanAddContentToPage(); permissionsRow.Visible = ModulePermissionController.CanAdminModule(Module) || TabPermissionController.CanAddContentToPage(); } //Set visibility of Specific Settings if (SettingsControl == null == false) { //Get the module settings from the PortalSettings and pass the //two settings hashtables to the sub control to process SettingsControl.LoadSettings(); specificSettingsTab.Visible = true; fsSpecific.Visible = true; } else { specificSettingsTab.Visible = false; fsSpecific.Visible = false; } if (Module != null) { termsSelector.PortalId = Module.PortalID; termsSelector.Terms = Module.Terms; } termsSelector.DataBind(); } if (Module != null) { cultureLanguageLabel.Language = Module.CultureCode; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update button is clicked. /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/17/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void OnUpdateClick(object sender, EventArgs e) { try { if (Page.IsValid) { int portalID; if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { portalID = -1; } else { portalID = PortalId; } var objVendors = new VendorController(); var objVendor = new VendorInfo { PortalId = portalID, VendorId = VendorID, VendorName = txtVendorName.Text, Unit = addresssVendor.Unit, Street = addresssVendor.Street, City = addresssVendor.City, Region = addresssVendor.Region, Country = addresssVendor.Country, PostalCode = addresssVendor.Postal, Telephone = addresssVendor.Telephone, Fax = addresssVendor.Fax, Cell = addresssVendor.Cell, Email = txtEmail.Text, Website = txtWebsite.Text, FirstName = txtFirstName.Text, LastName = txtLastName.Text, UserName = UserInfo.UserID.ToString(), LogoFile = ctlLogo.Url, KeyWords = txtKeyWords.Text, Authorized = chkAuthorized.Checked }; if (VendorID == -1) { try { VendorID = objVendors.AddVendor(objVendor); } catch { AddModuleMessage("ErrorAddVendor", ModuleMessage.ModuleMessageType.RedError); return; } } else { VendorInfo vendorCheck = objVendors.GetVendor(VendorID, portalID); if (vendorCheck != null) { objVendors.UpdateVendor(objVendor); } else { Response.Redirect(Globals.NavigateURL()); } } if (cmdUpdate.Text == "Signup") { var custom = new ArrayList(); custom.Add(DateTime.Now.ToString()); custom.Add(txtVendorName.Text); custom.Add(txtFirstName.Text); custom.Add(txtLastName.Text); custom.Add(addresssVendor.Unit); custom.Add(addresssVendor.Street); custom.Add(addresssVendor.City); custom.Add(addresssVendor.Region); custom.Add(addresssVendor.Country); custom.Add(addresssVendor.Postal); custom.Add(addresssVendor.Telephone); custom.Add(addresssVendor.Fax); custom.Add(addresssVendor.Cell); custom.Add(txtEmail.Text); custom.Add(txtWebsite.Text); //send email to Admin Mail.SendEmail(PortalSettings.Email, PortalSettings.Email, Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_ADMINISTRATOR_SUBJECT"), Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_ADMINISTRATOR_BODY", Localization.GlobalResourceFile, custom)); //send email to vendor custom.Clear(); custom.Add(txtFirstName.Text); custom.Add(txtLastName.Text); custom.Add(txtVendorName.Text); Mail.SendEmail(PortalSettings.Email, txtEmail.Text, Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_SUBJECT"), Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_BODY", Localization.GlobalResourceFile, custom)); ReturnUrl(txtVendorName.Text.Substring(0, 1)); } else { ReturnUrl(Convert.ToString(ViewState["filter"])); } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/17/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdCancel.Click += OnCancelClick; cmdDelete.Click += OnDeleteClick; cmdUpdate.Click += OnUpdateClick; try { var objTabs = new TabController(); var blnBanner = false; var blnSignup = false; if ((Request.QueryString["VendorID"] != null)) { VendorID = Int32.Parse(Request.QueryString["VendorID"]); } if (Request.QueryString["ctl"] != null && VendorID == -1) { blnSignup = true; } if (Request.QueryString["banner"] != null) { blnBanner = true; } if (Page.IsPostBack == false) { ctlLogo.FileFilter = Globals.glbImageFileTypes; addresssVendor.ModuleId = ModuleId; addresssVendor.StartTabIndex = 4; var objVendors = new VendorController(); if (VendorID != -1) { VendorInfo objVendor; if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID) && UserInfo.IsSuperUser) { //Get Host Vendor objVendor = objVendors.GetVendor(VendorID, Null.NullInteger); } else { //Get Portal Vendor objVendor = objVendors.GetVendor(VendorID, PortalId); } if (objVendor != null) { txtVendorName.Text = objVendor.VendorName; txtFirstName.Text = objVendor.FirstName; txtLastName.Text = objVendor.LastName; ctlLogo.Url = objVendor.LogoFile; addresssVendor.Unit = objVendor.Unit; addresssVendor.Street = objVendor.Street; addresssVendor.City = objVendor.City; addresssVendor.Region = objVendor.Region; addresssVendor.Country = objVendor.Country; addresssVendor.Postal = objVendor.PostalCode; addresssVendor.Telephone = objVendor.Telephone; addresssVendor.Fax = objVendor.Fax; addresssVendor.Cell = objVendor.Cell; txtEmail.Text = objVendor.Email; txtWebsite.Text = objVendor.Website; chkAuthorized.Checked = objVendor.Authorized; txtKeyWords.Text = objVendor.KeyWords; ctlAudit.CreatedByUser = objVendor.CreatedByUser; ctlAudit.CreatedDate = objVendor.CreatedDate.ToString(); } //use dispatch method to load modules var banners = ControlUtilities.LoadControl <Banners>(this, TemplateSourceDirectory.Remove(0, Globals.ApplicationPath.Length) + "/Banners.ascx"); banners.ID = "/Banners.ascx"; banners.VendorID = VendorID; banners.ModuleConfiguration = ModuleConfiguration; divBanners.Controls.Add(banners); var affiliates = ControlUtilities.LoadControl <Affiliates>(this, TemplateSourceDirectory.Remove(0, Globals.ApplicationPath.Length) + "/Affiliates.ascx"); affiliates.ID = "/Affiliates.ascx"; affiliates.VendorID = VendorID; affiliates.ModuleConfiguration = ModuleConfiguration; divAffiliates.Controls.Add(affiliates); } else { chkAuthorized.Checked = true; ctlAudit.Visible = false; cmdDelete.Visible = false; pnlBanners.Visible = false; pnlAffiliates.Visible = false; } if (blnSignup || blnBanner) { rowVendor1.Visible = false; rowVendor2.Visible = false; pnlVendor.Visible = false; cmdDelete.Visible = false; ctlAudit.Visible = false; if (blnBanner) { cmdUpdate.Visible = false; } else { cmdUpdate.Text = "Signup"; } } else { TabInfo objTab; if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { objTab = objTabs.GetTabByName("Vendors", Null.NullInteger); } else { objTab = objTabs.GetTabByName("Vendors", PortalId); } if (objTab != null) { ViewState["filter"] = Request.QueryString["filter"]; } } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <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 override void OnLoad(EventArgs e) { base.OnLoad(e); chkAllTabs.CheckedChanged += OnAllTabsCheckChanged; chkInheritPermissions.CheckedChanged += OnInheritPermissionsChanged; chkWebSlice.CheckedChanged += OnWebSliceCheckChanged; cboCacheProvider.TextChanged += OnCacheProviderIndexChanged; cmdDelete.Click += OnDeleteClick; cmdUpdate.Click += OnUpdateClick; dgOnTabs.NeedDataSource += OnPagesGridNeedDataSource; try { cancelHyperLink.NavigateUrl = Globals.NavigateURL(); if (_moduleId != -1) { ctlAudit.Entity = Module; } if (Page.IsPostBack == false) { ctlIcon.FileFilter = Globals.glbImageFileTypes; dgPermissions.TabId = PortalSettings.ActiveTab.TabID; dgPermissions.ModuleID = _moduleId; cboTab.DataSource = TabController.GetPortalTabs(PortalId, -1, false, Null.NullString, true, false, true, false, true); cboTab.DataBind(); //if tab is a host tab, then add current tab if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { cboTab.Items.Insert(0, new ListItem(PortalSettings.ActiveTab.LocalizedTabName, PortalSettings.ActiveTab.TabID.ToString())); } if (Module != null) { //parent tab might not be loaded in cbotab if user does not have edit rights on it if (cboTab.Items.FindByValue(Module.TabID.ToString()) == null) { var objtabs = new TabController(); var objTab = objtabs.GetTab(Module.TabID, Module.PortalID, false); cboTab.Items.Add(new ListItem(objTab.LocalizedTabName, objTab.TabID.ToString())); } } //only Portal Administrators can manage the visibility on all Tabs rowAllTabs.Visible = PortalSecurity.IsInRole("Administrators"); //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkNewTabs.Enabled = false; chkDefault.Enabled = false; chkAllModules.Enabled = false; chkSearchOnce.Enabled = false; cboTab.Enabled = false; } if (_moduleId != -1) { BindData(); cmdDelete.Visible = ModulePermissionController.CanDeleteModule(Module) || TabPermissionController.CanAddContentToPage(); } else { cboVisibility.SelectedIndex = 0; //maximized chkAllTabs.Checked = false; chkSearchOnce.Checked = false; cmdDelete.Visible = false; } cmdUpdate.Visible = ModulePermissionController.HasModulePermission(Module.ModulePermissions, "EDIT,MANAGE") || TabPermissionController.CanAddContentToPage(); permissionsRow.Visible = ModulePermissionController.CanAdminModule(Module) || TabPermissionController.CanAddContentToPage(); //Set visibility of Specific Settings if (SettingsControl == null == false) { //Get the module settings from the PortalSettings and pass the //two settings hashtables to the sub control to process SettingsControl.LoadSettings(); specificSettingsTab.Visible = true; fsSpecific.Visible = true; } else { specificSettingsTab.Visible = false; fsSpecific.Visible = false; } termsSelector.PortalId = Module.PortalID; termsSelector.Terms = Module.Terms; termsSelector.DataBind(); } cultureLanguageLabel.Language = Module.CultureCode; } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void BindData(string searchText, string searchField) { CreateLetterSearch(); //Localize the Headers Localization.LocalizeDataGrid(ref grdVendors, LocalResourceFile); if (searchText == Localization.GetString("All")) { strFilter = ""; } else if (searchText == Localization.GetString("Unauthorized")) { strFilter = ""; } else { strFilter = searchText; } //Get the list of vendors from the database var PageSize = Convert.ToInt32(ddlRecordsPerPage.SelectedItem.Value); var TotalRecords = 0; var objVendors = new VendorController(); int Portal = Globals.IsHostTab(PortalSettings.ActiveTab.TabID) ? Null.NullInteger : PortalId; if (String.IsNullOrEmpty(strFilter)) { if (searchText == Localization.GetString("Unauthorized")) { grdVendors.DataSource = objVendors.GetVendors(Portal, true, CurrentPage - 1, PageSize, ref TotalRecords); } else { grdVendors.DataSource = objVendors.GetVendors(Portal, false, CurrentPage - 1, PageSize, ref TotalRecords); } } else { if (searchField == "email") { grdVendors.DataSource = objVendors.GetVendorsByEmail(strFilter, Portal, CurrentPage - 1, PageSize, ref TotalRecords); } else { grdVendors.DataSource = objVendors.GetVendorsByName(strFilter, Portal, CurrentPage - 1, PageSize, ref TotalRecords); } } grdVendors.DataBind(); ctlPagingControl.TotalRecords = TotalRecords; ctlPagingControl.PageSize = PageSize; ctlPagingControl.CurrentPage = CurrentPage; string strQuerystring = ""; if (ddlRecordsPerPage.SelectedIndex != 0) { strQuerystring = "PageRecords=" + ddlRecordsPerPage.SelectedValue; } if (!String.IsNullOrEmpty(strFilter)) { strQuerystring += "&filter=" + strFilter; } ctlPagingControl.QuerystringParams = strQuerystring; ctlPagingControl.TabID = TabId; }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/8/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdDelete.Click += DeletePortal; cmdRestore.Click += OnRestoreClick; cmdSave.Click += OnSaveClick; cmdUpdate.Click += UpdatePortal; cmdVerification.Click += OnVerifyClick; ctlDesktopModules.AddAllButtonClick += OnAddAllModulesClick; ctlDesktopModules.AddButtonClick += OnAddModuleClick; ctlDesktopModules.RemoveAllButtonClick += OnRemoveAllModulesClick; ctlDesktopModules.RemoveButtonClick += OnRemoveModuleClick; try { if ((Request.QueryString["pid"] != null) && (Globals.IsHostTab(PortalSettings.ActiveTab.TabID) || UserInfo.IsSuperUser)) { _portalId = Int32.Parse(Request.QueryString["pid"]); ctlLogo.ShowUpLoad = false; ctlBackground.ShowUpLoad = false; ctlFavIcon.ShowUpLoad = false; cancelHyperLink.Visible = true; cancelHyperLink.NavigateUrl = Globals.NavigateURL(); } else { _portalId = PortalId; ctlLogo.ShowUpLoad = true; ctlBackground.ShowUpLoad = true; ctlFavIcon.ShowUpLoad = true; cancelHyperLink.Visible = false; } ////this needs to execute always to the client script code is registred in InvokePopupCal //cmdExpiryCalendar.NavigateUrl = Calendar.InvokePopupCal(txtExpiryDate); BindDesktopModules(); //If this is the first visit to the page, populate the site data if (Page.IsPostBack == false) { BindPortal(_portalId, SelectedCultureCode); } if (UserInfo.IsSuperUser) { hostSections.Visible = true; cmdDelete.Visible = (_portalId != PortalId); } else { hostSections.Visible = false; cmdDelete.Visible = false; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }