/// <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 lblPageFunctions.Text = Localization.GetString("PageFunctions", this.LocalResourceFile); optModuleType.Items.FindByValue("0").Selected = true; lblCommonTasks.Text = Localization.GetString("CommonTasks", this.LocalResourceFile); imgAddTabIcon.AlternateText = Localization.GetString("AddTab.AlternateText", this.LocalResourceFile); cmdAddTab.Text = Localization.GetString("AddTab", this.LocalResourceFile); imgEditTabIcon.AlternateText = Localization.GetString("EditTab.AlternateText", this.LocalResourceFile); cmdEditTab.Text = Localization.GetString("EditTab", this.LocalResourceFile); imgDeleteTabIcon.AlternateText = Localization.GetString("DeleteTab.AlternateText", this.LocalResourceFile); cmdDeleteTab.Text = Localization.GetString("DeleteTab", this.LocalResourceFile); imgCopyTabIcon.AlternateText = Localization.GetString("CopyTab.AlternateText", this.LocalResourceFile); cmdCopyTab.Text = Localization.GetString("CopyTab", this.LocalResourceFile); imgPreviewTabIcon.AlternateText = Localization.GetString("PreviewTab.AlternateText", this.LocalResourceFile); cmdPreviewTab.Text = Localization.GetString("PreviewTab", this.LocalResourceFile); if (IsPreview) { imgPreviewTabIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_unpreviewtab.gif"; } lblModule.Text = Localization.GetString("Module", this.LocalResourceFile); lblPane.Text = Localization.GetString("Pane", this.LocalResourceFile); lblTitle.Text = Localization.GetString("Title", this.LocalResourceFile); lblAlign.Text = Localization.GetString("Align", this.LocalResourceFile); imgAddModuleIcon.AlternateText = Localization.GetString("AddModule.AlternateText", this.LocalResourceFile); cmdAddModule.Text = Localization.GetString("AddModule", this.LocalResourceFile); cmdInstallFeatures.Text = Localization.GetString("InstallFeatures", this.LocalResourceFile); imgRolesIcon.AlternateText = Localization.GetString("Roles.AlternateText", this.LocalResourceFile); cmdRoles.Text = Localization.GetString("Roles", this.LocalResourceFile); imgSiteIcon.AlternateText = Localization.GetString("Site.AlternateText", this.LocalResourceFile); cmdSite.Text = Localization.GetString("Site", this.LocalResourceFile); imgUsersIcon.AlternateText = Localization.GetString("Users.AlternateText", this.LocalResourceFile); cmdUsers.Text = Localization.GetString("Users", this.LocalResourceFile); imgFilesIcon.AlternateText = Localization.GetString("Files.AlternateText", this.LocalResourceFile); cmdFiles.Text = Localization.GetString("Files", this.LocalResourceFile); imgHelpIcon.AlternateText = Localization.GetString("Help.AlternateText", this.LocalResourceFile); cmdHelp.Text = Localization.GetString("Help", this.LocalResourceFile); if (PortalSettings.ActiveTab.IsAdminTab) { imgEditTabIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_edittab_bw.gif"; cmdEditTab.Enabled = false; cmdEditTabIcon.Enabled = false; imgDeleteTabIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_deletetab_bw.gif"; cmdDeleteTab.Enabled = false; cmdDeleteTabIcon.Enabled = false; imgCopyTabIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_copytab_bw.gif"; cmdCopyTab.Enabled = false; cmdCopyTabIcon.Enabled = false; } else { ClientAPI.AddButtonConfirm(cmdDeleteTab, Localization.GetString("DeleteTabConfirm", this.LocalResourceFile)); ClientAPI.AddButtonConfirm(cmdDeleteTabIcon, Localization.GetString("DeleteTabConfirm", this.LocalResourceFile)); } if (Globals.IsAdminControl()) { cmdAddModule.Enabled = false; imgAddModuleIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_addmodule_bw.gif"; cmdAddModuleIcon.Enabled = false; } if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) == false) { imgSiteIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_site_bw.gif"; cmdSite.Enabled = false; cmdSiteIcon.Enabled = false; imgUsersIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_users_bw.gif"; cmdUsers.Enabled = false; cmdUsersIcon.Enabled = false; imgRolesIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_roles_bw.gif"; cmdRoles.Enabled = false; cmdRolesIcon.Enabled = false; imgFilesIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_files_bw.gif"; cmdFiles.Enabled = false; cmdFilesIcon.Enabled = false; } UserInfo objUser = UserController.GetCurrentUserInfo(); if (objUser != null) { if (!objUser.IsSuperUser) { rowInstallModule.Visible = false; } } BindData(); if (PortalSettings.ActiveTab.IsAdminTab == false & Globals.IsAdminControl() == false) { for (int intItem = 0; intItem < PortalSettings.ActiveTab.Panes.Count; intItem++) { cboPanes.Items.Add(Convert.ToString(PortalSettings.ActiveTab.Panes[intItem])); } } else { cboPanes.Items.Add(Globals.glbDefaultPane); } if (cboPanes.Items.FindByValue(Globals.glbDefaultPane) != null) { cboPanes.Items.FindByValue(Globals.glbDefaultPane).Selected = true; } if (cboPermission.Items.Count > 0) { cboPermission.SelectedIndex = 0; // view } if (cboAlign.Items.Count > 0) { cboAlign.SelectedIndex = 0; // left } if (cboPosition.Items.Count > 0) { cboPosition.SelectedIndex = 1; // bottom } if (Convert.ToString(PortalSettings.HostSettings["HelpURL"]) != "") { cmdHelp.NavigateUrl = Globals.FormatHelpUrl(Convert.ToString(PortalSettings.HostSettings["HelpURL"]), PortalSettings, ""); cmdHelpIcon.NavigateUrl = cmdHelp.NavigateUrl; cmdHelp.Enabled = true; cmdHelpIcon.Enabled = true; } else { cmdHelp.Enabled = false; cmdHelpIcon.Enabled = false; } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// DataBind binds the data to the controls /// </summary> public override void DataBind() { if (Page.IsPostBack == false) { string confirmString = Localization.GetString("DeleteItem"); if (IsUser) { confirmString = Localization.GetString("ConfirmUnRegister", LocalResourceFile); } ClientAPI.AddButtonConfirm(cmdDelete, confirmString); chkRandom.Checked = false; } cmdDelete.Visible = false; cmdRemove.Visible = false; cmdRestore.Visible = false; if (!AddUser) { var deletePermitted = (User.UserID != PortalSettings.AdministratorId) && !(IsUser && User.IsSuperUser); if ((deletePermitted)) { if ((User.IsDeleted)) { cmdRemove.Visible = true; cmdRestore.Visible = true; } else { cmdDelete.Visible = true; } } } cmdUpdate.Text = Localization.GetString(IsUser ? "Register" : "CreateUser", LocalResourceFile); cmdDelete.Text = Localization.GetString(IsUser ? "UnRegister" : "Delete", LocalResourceFile); if (AddUser) { pnlAddUser.Visible = true; if (IsRegister) { AuthorizeNotify.Visible = false; randomRow.Visible = false; if (ShowPassword) { questionRow.Visible = MembershipProviderConfig.RequiresQuestionAndAnswer; answerRow.Visible = MembershipProviderConfig.RequiresQuestionAndAnswer; lblPasswordHelp.Text = Localization.GetString("PasswordHelpUser", LocalResourceFile); } } else { lblPasswordHelp.Text = Localization.GetString("PasswordHelpAdmin", LocalResourceFile); } txtConfirm.Attributes.Add("value", txtConfirm.Text); txtPassword.Attributes.Add("value", txtPassword.Text); } bool disableUsername = PortalController.GetPortalSettingAsBoolean("Registration_UseEmailAsUserName", PortalId, false); //only show username row once UseEmailAsUserName is disabled in site settings if (disableUsername) { userNameReadOnly.Visible = false; userName.Visible = false; } else { userNameReadOnly.Visible = !AddUser; userName.Visible = AddUser; } if (CanUpdateUsername() && !disableUsername) { renameUserName.Visible = true; userName.Visible = false; userNameReadOnly.Visible = false; ArrayList portals = PortalController.GetPortalsByUser(User.UserID); if (portals.Count > 1) { numSites.Text = String.Format(Localization.GetString("UpdateUserName", LocalResourceFile), portals.Count.ToString()); cboSites.Visible = true; cboSites.DataSource = portals; cboSites.DataTextField = "PortalName"; cboSites.DataBind(); renameUserPortals.Visible = true; } } if (!string.IsNullOrEmpty(PortalSettings.Registration.UserNameValidator)) { userName.ValidationExpression = PortalSettings.Registration.UserNameValidator; } if (!string.IsNullOrEmpty(PortalSettings.Registration.EmailValidator)) { email.ValidationExpression = PortalSettings.Registration.EmailValidator; } if (!string.IsNullOrEmpty(PortalSettings.Registration.DisplayNameFormat)) { if (AddUser) { displayNameReadOnly.Visible = false; displayName.Visible = false; } else { displayNameReadOnly.Visible = true; displayName.Visible = false; } firstName.Visible = true; lastName.Visible = true; } else { displayNameReadOnly.Visible = false; displayName.Visible = true; firstName.Visible = false; lastName.Visible = false; } userForm.DataSource = User; if (!Page.IsPostBack) { userForm.DataBind(); renameUserName.Value = User.Username; } }
protected override void OnLoad(EventArgs e) { ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); BindLanguage(); }
protected void Page_Load(Object sender, EventArgs e) { try { if (Page.IsPostBack == false) { ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); LoadSkins(); LoadContainers(); if (Request.QueryString["action"] != null) { string strType = Request.QueryString["Type"]; string strRoot = Request.QueryString["Root"]; string strName = Request.QueryString["Name"]; string strSrc = "[" + strType + "]" + strRoot + "/" + strName + "/" + Request.QueryString["Src"]; switch (Request.QueryString["action"]) { case "apply": if (strRoot == SkinInfo.RootSkin) { if (chkPortal.Checked) { SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal, strSrc); } if (chkAdmin.Checked) { SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Admin, strSrc); } } if (strRoot == SkinInfo.RootContainer) { if (chkPortal.Checked) { SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal, strSrc); } if (chkAdmin.Checked) { SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Admin, strSrc); } } DataCache.ClearPortalCache(PortalId, true); Response.Redirect(Request.RawUrl.Replace("&action=apply", "")); break; case "delete": File.Delete(Request.MapPath(SkinController.FormatSkinSrc(strSrc, PortalSettings))); LoadSkins(); LoadContainers(); break; } } } if (PortalSettings.ActiveTab.IsSuperTab) { typeRow.Visible = false; } else { typeRow.Visible = true; } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Loads suported locales and shows default values /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> /// <remarks> /// </remarks> /// <history> /// [vmasanas] 04/10/2004 Created /// [vmasanas] 25/03/2006 Modified to support new host resources and incremental saving /// </history> /// ----------------------------------------------------------------------------- protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if (!Page.IsPostBack) { ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); // init tree LoadRootNodes(); Locale language = LocaleController.Instance.GetLocale(Locale); languageLabel.Language = language.Code; if (UserInfo.IsSuperUser) { string mode = Request.QueryString["mode"]; if (!string.IsNullOrEmpty(mode) && (rbMode.Items.FindByValue(mode) != null)) { rbMode.SelectedValue = mode; } else { rbMode.SelectedValue = "Host"; } } else { rbMode.SelectedValue = "Portal"; rowMode.Visible = false; } string PersonalHighlight = Convert.ToString(Personalization.GetProfile("LanguageEditor", "HighLight" + PortalId)); string highlight = Request.QueryString["highlight"]; if (!string.IsNullOrEmpty(highlight) && highlight.ToLower() == "true") { chkHighlight.Checked = true; } else { if (!string.IsNullOrEmpty(PersonalHighlight)) { chkHighlight.Checked = Convert.ToBoolean(PersonalHighlight); } } if (!string.IsNullOrEmpty(Request.QueryString["resourcefile"])) { SelectedResourceFile = Server.MapPath("~/" + Globals.QueryStringDecode(Request.QueryString["resourcefile"])); } else { SelectedResourceFile = Server.MapPath(Localization.GlobalResourceFile); } if (!string.IsNullOrEmpty(Request.QueryString["message"])) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString(Request.QueryString["message"], LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess); } BindGrid(!IsPostBack); } //Module failed to load } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/21/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; cmdCopy.Click += OnCopyClick; cmdDelete.Click += OnDeleteClick; cmdEmail.Click += OnEmailClick; cmdUpdate.Click += OnUpdateClick; DNNTxtBannerGroup.PopulateOnDemand += PopulateBannersOnDemand; try { if ((Request.QueryString["VendorId"] != null)) { VendorId = Int32.Parse(Request.QueryString["VendorId"]); } if ((Request.QueryString["BannerId"] != null)) { BannerId = Int32.Parse(Request.QueryString["BannerId"]); } if (Page.IsPostBack == false) { ctlImage.FileFilter = Globals.glbImageFileTypes; ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); var objBannerTypes = new BannerTypeController(); //Get the banner types from the database cboBannerType.DataSource = objBannerTypes.GetBannerTypes(); cboBannerType.DataBind(); var objBanners = new BannerController(); if (BannerId != Null.NullInteger) { //Obtain a single row of banner information BannerInfo banner = objBanners.GetBanner(BannerId); if (banner != null) { txtBannerName.Text = banner.BannerName; cboBannerType.Items.FindByValue(banner.BannerTypeId.ToString()).Selected = true; DNNTxtBannerGroup.Text = banner.GroupName; ctlImage.Url = banner.ImageFile; if (banner.Width != 0) { txtWidth.Text = banner.Width.ToString(); } if (banner.Height != 0) { txtHeight.Text = banner.Height.ToString(); } txtDescription.Text = banner.Description; if (!String.IsNullOrEmpty(banner.URL)) { ctlURL.Url = banner.URL; } txtImpressions.Text = banner.Impressions.ToString(); txtCPM.Text = banner.CPM.ToString(); StartDatePicker.SelectedDate = Null.IsNull(banner.StartDate) ? (DateTime?)null : banner.StartDate; EndDatePicker.SelectedDate = Null.IsNull(banner.EndDate) ? (DateTime?)null : banner.EndDate; optCriteria.Items.FindByValue(banner.Criteria.ToString()).Selected = true; ctlAudit.CreatedByUser = banner.CreatedByUser; ctlAudit.CreatedDate = banner.CreatedDate.ToString(); var arrBanners = new ArrayList(); arrBanners.Add(banner); bannersRow.Visible = true; lstBanners.DataSource = arrBanners; lstBanners.DataBind(); } else //security violation attempt to access item not related to this Module { Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } } else { txtImpressions.Text = "0"; txtCPM.Text = "0"; optCriteria.Items.FindByValue("1").Selected = true; cmdDelete.Visible = false; cmdCopy.Visible = false; cmdEmail.Visible = false; ctlAudit.Visible = false; } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Adds a confirmation dialog to the delete button. /// </summary> /// <param name="e"></param> /// <remarks></remarks> private static void AddConfirmActiontoDeleteButton(DataListItemEventArgs e) { var cmdDelete = (ImageButton)e.Item.FindControl("cmdDelete"); ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); }
/// <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 { dshModule.Text = Localization.GetString("ModuleSettings", this.LocalResourceFile) + " (" + ModuleConfiguration.FriendlyName + ")"; // 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/17/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Load(Object sender, EventArgs e) { try { TabController objTabs = new TabController(); bool blnBanner = false; bool blnSignup = false; if ((Request.QueryString["VendorID"] != null)) { VendorID = int.Parse(Request.QueryString["VendorID"]); } if (Request.QueryString["ctl"] != null && VendorID == -1) { blnSignup = true; } if (Request.QueryString["banner"] != null) { blnBanner = true; } if (Page.IsPostBack == false) { ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); VendorController objVendors = new VendorController(); if (VendorID != -1) { VendorInfo objVendor; if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId && 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; chkAuthorized.Checked = objVendor.Authorized; } // use dispatch method to load modules Banners objBanners; objBanners = (Banners)this.LoadControl("~" + this.TemplateSourceDirectory.Remove(0, Globals.ApplicationPath.Length) + "/Banners.ascx"); objBanners.ID = "/Banners.ascx"; objBanners.VendorID = this.VendorID; objBanners.ModuleConfiguration = ModuleConfiguration; divBanners.Controls.Add(objBanners); } else { chkAuthorized.Checked = true; cmdDelete.Visible = false; pnlBanners.Visible = false; } if (blnSignup || blnBanner) { rowVendor2.Visible = false; cmdDelete.Visible = false; if (blnBanner) { cmdUpdate.Visible = false; } else { cmdUpdate.Text = "Signup"; } } else { TabInfo objTab; if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId) { 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] 9/10/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["RoleID"] != null)) { RoleID = int.Parse(Request.QueryString["RoleID"]); } if (Page.IsPostBack == false) { ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); RoleController objUser = new RoleController(); ListController ctlList = new ListController(); ListEntryInfoCollection colFrequencies = ctlList.GetListEntryInfoCollection("Frequency", ""); cboBillingFrequency.DataSource = colFrequencies; cboBillingFrequency.DataBind(); cboBillingFrequency.Items.FindByValue("N").Selected = true; cboTrialFrequency.DataSource = colFrequencies; cboTrialFrequency.DataBind(); cboTrialFrequency.Items.FindByValue("N").Selected = true; BindGroups(); ctlIcon.FileFilter = Globals.glbImageFileTypes; if (RoleID != -1) { lblRoleName.Visible = true; txtRoleName.Visible = false; valRoleName.Enabled = false; RoleInfo objRoleInfo = objUser.GetRole(RoleID, PortalSettings.PortalId); if (objRoleInfo != null) { lblRoleName.Text = objRoleInfo.RoleName; txtDescription.Text = objRoleInfo.Description; if (cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()) != null) { cboRoleGroups.ClearSelection(); cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()).Selected = true; } if (string.Format("{0:#,##0.00}", objRoleInfo.ServiceFee) != "0.00") { txtServiceFee.Text = string.Format("{0:#,##0.00}", objRoleInfo.ServiceFee); txtBillingPeriod.Text = objRoleInfo.BillingPeriod.ToString(); if (cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency) != null) { cboBillingFrequency.ClearSelection(); cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency).Selected = true; } } if (objRoleInfo.TrialFrequency != "N") { txtTrialFee.Text = string.Format("{0:#,##0.00}", objRoleInfo.TrialFee); txtTrialPeriod.Text = objRoleInfo.TrialPeriod.ToString(); if (cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency) != null) { cboTrialFrequency.ClearSelection(); cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency).Selected = true; } } chkIsPublic.Checked = objRoleInfo.IsPublic; chkAutoAssignment.Checked = objRoleInfo.AutoAssignment; txtRSVPCode.Text = objRoleInfo.RSVPCode; ctlIcon.Url = objRoleInfo.IconFile; } else // security violation attempt to access item not related to this Module { Response.Redirect(Globals.NavigateURL("Security Roles")); } if (RoleID == PortalSettings.AdministratorRoleId || RoleID == PortalSettings.RegisteredRoleId) { cmdDelete.Visible = false; cmdUpdate.Visible = false; ActivateControls(false); } if (RoleID == PortalSettings.RegisteredRoleId) { cmdManage.Visible = false; } } else { cmdDelete.Visible = false; cmdManage.Visible = false; lblRoleName.Visible = false; txtRoleName.Visible = true; } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); ClientAPI.AddButtonConfirm(delocalizeModuleButton, Localization.GetString("BindConfirm", LocalResourceFile)); }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <history> /// [cnurse] 9/17/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Load(Object sender, EventArgs e) { try { TabController objTabs = new TabController(); bool blnBanner = false; bool blnSignup = false; if ((Request.QueryString["VendorID"] != null)) { VendorID = int.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; ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); ClassificationController objClassifications = new ClassificationController(); ArrayList Arr = objClassifications.GetVendorClassifications(VendorID); int i; for (i = 0; i <= Arr.Count - 1; i++) { ListItem lstItem = new ListItem(); ClassificationInfo objClassification = (ClassificationInfo)Arr[i]; lstItem.Text = objClassification.ClassificationName; lstItem.Value = objClassification.ClassificationId.ToString(); lstItem.Selected = objClassification.IsAssociated; lstClassifications.Items.Add(lstItem); } VendorController objVendors = new VendorController(); if (VendorID != -1) { VendorInfo objVendor; if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId && 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 Banners objBanners; objBanners = (Banners)this.LoadControl("~" + this.TemplateSourceDirectory.Remove(0, Globals.ApplicationPath.Length) + "/Banners.ascx"); objBanners.ID = "/Banners.ascx"; objBanners.VendorID = this.VendorID; objBanners.ModuleConfiguration = ModuleConfiguration; divBanners.Controls.Add(objBanners); Affiliates objAffiliates; objAffiliates = (Affiliates)this.LoadControl("~" + this.TemplateSourceDirectory.Remove(0, Globals.ApplicationPath.Length) + "/Affiliates.ascx"); objAffiliates.ID = "/Affiliates.ascx"; objAffiliates.VendorID = this.VendorID; objAffiliates.ModuleConfiguration = ModuleConfiguration; divAffiliates.Controls.Add(objAffiliates); } else { chkAuthorized.Checked = true; pnlAudit.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; pnlAudit.Visible = false; if (blnBanner) { cmdUpdate.Visible = false; } else { cmdUpdate.Text = "Signup"; } } else { TabInfo objTab; if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId) { 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> /// <history> /// [cnurse] 9/13/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Load(Object sender, EventArgs e) { try { // Verify if portal has a customized registration page if (!Null.IsNull(PortalSettings.UserTabId) && Globals.IsAdminControl()) { // user page exists and trying to access this control directly with url param -> not allowed Response.Redirect(Globals.NavigateURL(PortalSettings.UserTabId)); } // Verify that the current user has access to this page if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration && Request.IsAuthenticated == false) { Response.Redirect(Globals.NavigateURL("Access Denied"), true); } if ((Request.QueryString["Services"] != null)) { Services = int.Parse(Request.QueryString["Services"]); } // free subscriptions if ((Request.QueryString["RoleID"] != null)) { RoleID = int.Parse(Request.QueryString["RoleID"]); RoleController objRoles = new RoleController(); RoleInfo objRole = objRoles.GetRole(RoleID, PortalSettings.PortalId); if (objRole.IsPublic && objRole.ServiceFee == 0.0) { objRoles.UpdateUserRole(PortalId, UserInfo.UserID, RoleID, Convert.ToBoolean((Request.QueryString["cancel"] != null) ? true : false)); if (PortalSettings.UserTabId != -1) { // user defined tab Response.Redirect(Globals.NavigateURL(PortalSettings.UserTabId), true); } else { // admin tab Response.Redirect(Globals.NavigateURL("Register"), true); } } else { // EVENTLOGGER } } // If this is the first visit to the page, bind the role data to the datalist if (Page.IsPostBack == false) { //Localize the Headers Localization.LocalizeDataGrid(ref grdServices, this.LocalResourceFile); ClientAPI.AddButtonConfirm(cmdUnregister, Localization.GetString("CancelConfirm", this.LocalResourceFile)); BindData(); try { Globals.SetFormFocus(userControl); } catch { //control not there or error setting focus } // Store URL Referrer to return to portal if (Request.UrlReferrer != null) { ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer); } else { ViewState["UrlReferrer"] = ""; } } lblRegistration.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_REGISTRATION_INSTRUCTIONS"); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <Summary> /// InstantiateIn instantiates the template (implementation of ITemplate) /// </Summary> /// <Param name="container">The parent container (DataGridItem)</Param> public virtual void InstantiateIn(Control container) { switch (ItemType) { case ListItemType.Item: if (EditMode == ImageCommandColumnEditMode.URL) { //Add a Hyperlink HyperLink hypLink = new HyperLink(); hypLink.ToolTip = Text; if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { Image img = new Image(); if (DesignMode) { img.ImageUrl = ImageURL.Replace("~/", "../../"); } else { img.ImageUrl = ImageURL; } hypLink.Controls.Add(img); img.ToolTip = Text; } else { hypLink.Text = Text; } hypLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(hypLink); } else { //Add Image Button if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { ImageButton colIcon = new ImageButton(); if (DesignMode) { colIcon.ImageUrl = ImageURL.Replace("~/", "../../"); } else { colIcon.ImageUrl = ImageURL; } colIcon.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colIcon, OnClickJS); } colIcon.CommandName = CommandName; colIcon.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colIcon); } //Add Link Button if (!String.IsNullOrEmpty(Text) && !ShowImage) { LinkButton colLink = new LinkButton(); colLink.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colLink, OnClickJS); } colLink.CommandName = CommandName; colLink.Text = Text; colLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colLink); } } break; case ListItemType.AlternatingItem: if (EditMode == ImageCommandColumnEditMode.URL) { //Add a Hyperlink HyperLink hypLink = new HyperLink(); hypLink.ToolTip = Text; if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { Image img = new Image(); if (DesignMode) { img.ImageUrl = ImageURL.Replace("~/", "../../"); } else { img.ImageUrl = ImageURL; } hypLink.Controls.Add(img); img.ToolTip = Text; } else { hypLink.Text = Text; } hypLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(hypLink); } else { //Add Image Button if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { ImageButton colIcon = new ImageButton(); if (DesignMode) { colIcon.ImageUrl = ImageURL.Replace("~/", "../../"); } else { colIcon.ImageUrl = ImageURL; } colIcon.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colIcon, OnClickJS); } colIcon.CommandName = CommandName; colIcon.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colIcon); } //Add Link Button if (!String.IsNullOrEmpty(Text) && !ShowImage) { LinkButton colLink = new LinkButton(); colLink.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colLink, OnClickJS); } colLink.CommandName = CommandName; colLink.Text = Text; colLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colLink); } } break; case ListItemType.SelectedItem: if (EditMode == ImageCommandColumnEditMode.URL) { //Add a Hyperlink HyperLink hypLink = new HyperLink(); hypLink.ToolTip = Text; if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { Image img = new Image(); if (DesignMode) { img.ImageUrl = ImageURL.Replace("~/", "../../"); } else { img.ImageUrl = ImageURL; } hypLink.Controls.Add(img); img.ToolTip = Text; } else { hypLink.Text = Text; } hypLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(hypLink); } else { //Add Image Button if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { ImageButton colIcon = new ImageButton(); if (DesignMode) { colIcon.ImageUrl = ImageURL.Replace("~/", "../../"); } else { colIcon.ImageUrl = ImageURL; } colIcon.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colIcon, OnClickJS); } colIcon.CommandName = CommandName; colIcon.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colIcon); } //Add Link Button if (!String.IsNullOrEmpty(Text) && !ShowImage) { LinkButton colLink = new LinkButton(); colLink.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colLink, OnClickJS); } colLink.CommandName = CommandName; colLink.Text = Text; colLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colLink); } } break; case ListItemType.EditItem: if (EditMode == ImageCommandColumnEditMode.URL) { //Add a Hyperlink HyperLink hypLink = new HyperLink(); hypLink.ToolTip = Text; if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { Image img = new Image(); if (DesignMode) { img.ImageUrl = ImageURL.Replace("~/", "../../"); } else { img.ImageUrl = ImageURL; } hypLink.Controls.Add(img); img.ToolTip = Text; } else { hypLink.Text = Text; } hypLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(hypLink); } else { //Add Image Button if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { ImageButton colIcon = new ImageButton(); if (DesignMode) { colIcon.ImageUrl = ImageURL.Replace("~/", "../../"); } else { colIcon.ImageUrl = ImageURL; } colIcon.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colIcon, OnClickJS); } colIcon.CommandName = CommandName; colIcon.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colIcon); } //Add Link Button if (!String.IsNullOrEmpty(Text) && !ShowImage) { LinkButton colLink = new LinkButton(); colLink.ToolTip = Text; if (!String.IsNullOrEmpty(OnClickJS)) { ClientAPI.AddButtonConfirm(colLink, OnClickJS); } colLink.CommandName = CommandName; colLink.Text = Text; colLink.DataBinding += new EventHandler(Item_DataBinding); container.Controls.Add(colLink); } } break; case ListItemType.Footer: container.Controls.Add(new LiteralControl(Text)); break; case ListItemType.Header: container.Controls.Add(new LiteralControl(Text)); break; } }
/// ----------------------------------------------------------------------------- /// <summary> /// InstantiateIn instantiates the template (implementation of ITemplate). /// </summary> /// <remarks> /// </remarks> /// <param name="container">The parent container (DataGridItem).</param> /// ----------------------------------------------------------------------------- public void InstantiateIn(Control container) { switch (this.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: case ListItemType.SelectedItem: case ListItemType.EditItem: if (this.EditMode == ImageCommandColumnEditMode.URL) { var hypLink = new HyperLink(); hypLink.ToolTip = this.Text; if (!string.IsNullOrEmpty(this.ImageURL) && this.ShowImage) { var img = new Image(); if (this.DesignMode) { img.ImageUrl = this.ImageURL.Replace("~/", "../../"); } else { img.ImageUrl = this.ImageURL; } hypLink.Controls.Add(img); img.ToolTip = this.Text; } else { hypLink.Text = this.Text; } hypLink.DataBinding += this.Item_DataBinding; container.Controls.Add(hypLink); } else { if (!string.IsNullOrEmpty(this.ImageURL) && this.ShowImage) { var colIcon = new ImageButton(); if (this.DesignMode) { colIcon.ImageUrl = this.ImageURL.Replace("~/", "../../"); } else { colIcon.ImageUrl = this.ImageURL; } colIcon.ToolTip = this.Text; if (!string.IsNullOrEmpty(this.OnClickJS)) { ClientAPI.AddButtonConfirm(colIcon, this.OnClickJS); } colIcon.CommandName = this.CommandName; colIcon.DataBinding += this.Item_DataBinding; container.Controls.Add(colIcon); } if (!string.IsNullOrEmpty(this.Text) && !this.ShowImage) { var colLink = new LinkButton(); colLink.ToolTip = this.Text; if (!string.IsNullOrEmpty(this.OnClickJS)) { ClientAPI.AddButtonConfirm(colLink, this.OnClickJS); } colLink.CommandName = this.CommandName; colLink.Text = this.Text; colLink.DataBinding += this.Item_DataBinding; container.Controls.Add(colLink); } } break; case ListItemType.Footer: case ListItemType.Header: container.Controls.Add(new LiteralControl(this.Text)); break; } }
private void Page_Load(object sender, EventArgs e) { try { this.LocalizeCollapsePanels(); // because we're in the Edit options turn off caching ClientAPI.AddButtonConfirm(this.cmdDelete, Localization.GetString("DeleteConfirm", this.LocalResourceFile)); var cv = (Category)this.VersionInfoObject; if (!this.Page.IsPostBack) { this.rblDisplayOnCurrentPage.Items.Add( new ListItem(Localization.GetString("CurrentPage", this.LocalResourceFile), true.ToString(CultureInfo.InvariantCulture))); this.rblDisplayOnCurrentPage.Items.Add( new ListItem(Localization.GetString("SpecificPage", this.LocalResourceFile), false.ToString(CultureInfo.InvariantCulture))); this.txtSortOrder.Text = cv.SortOrder.ToString(CultureInfo.CurrentCulture); this.txtCategoryId.Text = cv.ItemId.ToString(CultureInfo.CurrentCulture); this.cmdDelete.Visible = false; // check if new or edit if (this.VersionInfoObject.IsNew) { this.txtCategoryId.Visible = false; this.lblCategoryId.Visible = false; if (this.ParentId != -1) { Category parent = Category.GetCategory(this.ParentId, this.PortalId); this.parentCategoryRelationships.AddToSelectedItems(parent); } } this.trCategoryId.Visible = this.ShowItemIds; // check if the DisplayTabId should be set. // chkDisplayOnCurrentPage ItemVersionSetting cpSetting = ItemVersionSetting.GetItemVersionSetting( this.VersionInfoObject.ItemVersionId, "CategorySettings", "DisplayOnCurrentPage", this.PortalId); if (cpSetting != null) { this.rblDisplayOnCurrentPage.SelectedValue = this.VersionInfoObject.DisplayOnCurrentPage().ToString(CultureInfo.InvariantCulture); if (this.VersionInfoObject.DisplayOnCurrentPage()) { this.chkForceDisplayTab.Checked = false; this.chkForceDisplayTab.Visible = false; this.lblForceDisplayTab.Visible = false; this.ddlDisplayTabId.Enabled = false; } else { this.chkForceDisplayTab.Visible = true; this.lblForceDisplayTab.Visible = true; this.ddlDisplayTabId.Enabled = true; } } else if (this.VersionInfoObject.DisplayTabId < 0) { this.rblDisplayOnCurrentPage.SelectedValue = false.ToString(CultureInfo.InvariantCulture); this.chkForceDisplayTab.Checked = false; this.chkForceDisplayTab.Visible = true; this.lblForceDisplayTab.Visible = true; this.ddlDisplayTabId.Enabled = true; } else { this.rblDisplayOnCurrentPage.SelectedValue = false.ToString(CultureInfo.InvariantCulture); this.chkForceDisplayTab.Visible = true; this.lblForceDisplayTab.Visible = true; this.ddlDisplayTabId.Enabled = true; } this.chkForceDisplayTab.Checked = this.VersionInfoObject.ForceDisplayOnPage(); this.LoadCommentForumsDropDown(); this.LoadCategoryDisplayTabDropDown(); this.LoadChildDisplayTabDropDown(); ItemVersionSetting useApprovals = ItemVersionSetting.GetItemVersionSetting( this.VersionInfoObject.ItemVersionId, "chkUseApprovals", "Checked", this.PortalId); this.chkUseApprovals.Checked = useApprovals == null || Convert.ToBoolean(useApprovals.PropertyValue, CultureInfo.InvariantCulture); this.chkUseApprovals.Visible = this.IsAdmin && this.UseApprovals; this.phApproval.Visible = this.UseApprovals && this.chkUseApprovals.Checked; this.lblNotUsingApprovals.Visible = !this.UseApprovals || !this.chkUseApprovals.Checked; // itemversionsetting for external RSS feed // provide the ability to define an external RSS feed for a category. ItemVersionSetting rssSetting = ItemVersionSetting.GetItemVersionSetting( this.VersionInfoObject.ItemVersionId, "CategorySettings", "RssUrl", this.PortalId); if (rssSetting != null) { this.txtRssUrl.Text = rssSetting.PropertyValue; } } else { cv.SortOrder = Convert.ToInt32(this.txtSortOrder.Text, CultureInfo.InvariantCulture); this.VersionInfoObject.DisplayTabId = Convert.ToInt32(this.ddlDisplayTabId.SelectedValue, CultureInfo.InvariantCulture); cv.ChildDisplayTabId = Convert.ToInt32(this.ddlChildDisplayTabId.SelectedValue, CultureInfo.InvariantCulture); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected void RptArticleListOnItemDataBound(object sender, RepeaterItemEventArgs e) { //configure the Tags var articleTags = e.Item.FindControl("tagsControl") as Tags; var lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton; var lnkEdit = e.Item.FindControl("lnkEdit") as LinkButton; var pnlAdminControls = e.Item.FindControl("pnlAdminControls") as Panel; var pnlOtherControls = e.Item.FindControl("pnlOtherControls") as Panel; var curArticle = (Article)e.Item.DataItem; if (articleTags != null && ShowCategories) { articleTags.ShowCategories = true; articleTags.ShowTags = false; var mc = new ModuleController(); //look to see if the Content List module, for displaying tag results, is found var mi = mc.GetModuleByDefinition(PortalId, "Content List"); if (mi != null) { articleTags.NavigateUrlFormatString = Globals.NavigateURL(mi.TabID, String.Empty, "Tag={0}"); articleTags.ContentItem = Util.GetContentController().GetContentItem(curArticle.ContentItemId); } articleTags.DataBind(); if (pnlOtherControls != null) { pnlOtherControls.Visible = true; } } else { if (pnlOtherControls != null) { pnlOtherControls.Visible = false; } } if (articleTags != null && articleTags.ContentItem != null) { if (articleTags.ContentItem.Terms.Count < 1) { if (pnlOtherControls != null) { pnlOtherControls.Visible = false; } } } else { if (pnlOtherControls != null) { pnlOtherControls.Visible = false; } } if (IsEditable && lnkDelete != null && lnkEdit != null) { if (pnlAdminControls != null) { pnlAdminControls.Visible = true; } lnkDelete.Visible = lnkDelete.Enabled = lnkEdit.Visible = lnkEdit.Enabled = true; ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile)); lnkDelete.CommandArgument = curArticle.ArticleId.ToString(); lnkEdit.CommandArgument = curArticle.ArticleId.ToString(); } else { if (pnlAdminControls != null) { pnlAdminControls.Visible = false; } } //handle paging list if (curArticle.TotalRecords > PageSize) { BuildPageList(ArticleController.GetArticles(ModuleId, 1, 1)[0].TotalRecords); } }
/// <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); } }
protected void rptItemListOnItemDataBound(object sender, RepeaterItemEventArgs e) { if (!_hasItems) { if (e.Item.ItemType == ListItemType.Header) { HtmlGenericControl noRecordsDiv = (e.Item.FindControl("NoRecords") as HtmlGenericControl); if (noRecordsDiv != null) { noRecordsDiv.Visible = true; } } } if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { var lnkEdit = e.Item.FindControl("lnkEdit") as HyperLink; var lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton; var pnlFeatures = e.Item.FindControl("pnlFeatures") as Panel; var pnlAdminControls = e.Item.FindControl("pnlAdmin") as Panel; var lblPrice = e.Item.FindControl("lblPrice") as Label; try { var t = (RestaurantMenuItem)e.Item.DataItem; var pic = e.Item.FindControl("imgItemPic") as Image; FileInfo fi = (FileInfo)FileManager.Instance.GetFile(t.PictureFileId); if (fi != null) { pic.ImageUrl = "/" + _currentPortal.HomeDirectory + "/" + fi.RelativePath; } string culSetting = (string)Settings["culture"]; if (string.IsNullOrEmpty(culSetting)) { culSetting = "en-US"; } var culture = new CultureInfo(culSetting); lblPrice.Text = t.Price.ToString("c", culture); if (t.IsVegetarian) { pnlFeatures.Controls.Add(new Image { ImageUrl = base.ControlPath + "resources/images/nomeat.jpg" }); } if (t.IsDailySpecial) { pnlFeatures.Controls.Add(new Image { ImageUrl = base.ControlPath + "resources/images/recommended.png" }); } if (IsEditable && lnkDelete != null && lnkEdit != null && pnlAdminControls != null) { pnlAdminControls.Visible = true; lnkDelete.CommandArgument = t.MenuItemId.ToString(); lnkDelete.Enabled = lnkDelete.Visible = lnkEdit.Enabled = lnkEdit.Visible = true; lnkEdit.NavigateUrl = EditUrl(string.Empty, string.Empty, "Edit", "tid=" + t.MenuItemId); ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile)); } else { pnlAdminControls.Visible = false; } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { if (ArticleId > 0) { var curArticle = ArticleController.GetArticle(ArticleId); //display article info on the view control if (curArticle != null) { plArticleTitle.Controls.Add(new LiteralControl(curArticle.Title)); //display the author name pnlAuthorInfo.Controls.Add(new LiteralControl(string.Format(Localization.GetString("AuthorInfo", LocalResourceFile), curArticle.CreatedByUser))); plArticleBody.Controls.Add(new LiteralControl(Server.HtmlDecode(curArticle.Body))); //display categories in the TagsControl tagsControl.ShowCategories = true; tagsControl.ShowTags = false; var mc = new ModuleController(); //look to see if the Content List module, for displaying tag results, is found var mi = mc.GetModuleByDefinition(PortalId, "Content List"); if (mi != null) { tagsControl.NavigateUrlFormatString = Globals.NavigateURL(mi.TabID, String.Empty, "Tag={0}"); tagsControl.ContentItem = Util.GetContentController().GetContentItem(curArticle.ContentItemId); } tagsControl.DataBind(); if (tagsControl.ContentItem == null || tagsControl.ContentItem.Terms.Count < 1) { ArticleTags.Visible = false; } //change the page title, description, and add categories to keywords var tp = (CDefault)Page; tp.Title = curArticle.Title; //we need to strip HTML from the description tp.Description = DotNetNuke.Common.Utilities.HtmlUtils.StripTags(Server.HtmlDecode(curArticle.Description), false); var listOfTerms = curArticle.Terms.ToDelimittedString(","); tp.KeyWords += "," + listOfTerms; if (!IsEditable) { ArticleAdmin.Visible = false; } else { ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile)); } } else { //no article found ArticleTags.Visible = ArticleAdmin.Visible = false; plArticleTitle.Controls.Add(new LiteralControl(Localization.GetString("noArticle.Text", LocalResourceFile))); } } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// DataBind binds the data to the controls /// </summary> /// <history> /// [cnurse] 03/01/2006 Created /// </history> /// ----------------------------------------------------------------------------- public override void DataBind() { if (Page.IsPostBack == false) { string confirmString = Localization.GetString("DeleteItem"); if (IsUser) { confirmString = Localization.GetString("ConfirmUnRegister", LocalResourceFile); } ClientAPI.AddButtonConfirm(cmdDelete, confirmString); chkRandom.Checked = false; } cmdDelete.Visible = false; cmdRemove.Visible = false; cmdRestore.Visible = false; if (!AddUser) { var deletePermitted = (User.UserID != PortalSettings.AdministratorId) && !(IsUser && User.IsSuperUser); if ((deletePermitted)) { if ((User.IsDeleted)) { cmdRemove.Visible = true; cmdRestore.Visible = true; } else { cmdDelete.Visible = true; } } } cmdUpdate.Text = Localization.GetString(IsUser ? "Register" : "CreateUser", LocalResourceFile); cmdDelete.Text = Localization.GetString(IsUser ? "UnRegister" : "Delete", LocalResourceFile); if (AddUser) { pnlAddUser.Visible = true; if (IsRegister) { AuthorizeNotify.Visible = false; randomRow.Visible = false; if (ShowPassword) { questionRow.Visible = MembershipProviderConfig.RequiresQuestionAndAnswer; answerRow.Visible = MembershipProviderConfig.RequiresQuestionAndAnswer; lblPasswordHelp.Text = Localization.GetString("PasswordHelpUser", LocalResourceFile); } } else { lblPasswordHelp.Text = Localization.GetString("PasswordHelpAdmin", LocalResourceFile); } txtConfirm.Attributes.Add("value", txtConfirm.Text); txtPassword.Attributes.Add("value", txtPassword.Text); } userNameReadOnly.Visible = !AddUser; userName.Visible = AddUser; var userNameSetting = GetSetting(UserPortalID, "Security_UserNameValidation"); if ((userNameSetting != null) && (!string.IsNullOrEmpty(Convert.ToString(userNameSetting)))) { userName.ValidationExpression = Convert.ToString(userNameSetting); } var setting = GetSetting(UserPortalID, "Security_EmailValidation"); if ((setting != null) && (!string.IsNullOrEmpty(Convert.ToString(setting)))) { email.ValidationExpression = Convert.ToString(setting); } foreach (ProfilePropertyDefinition def in User.Profile.ProfileProperties) { if (def.PropertyName == "FirstName") { firstName.ValidationExpression = def.ValidationExpression; } if (def.PropertyName == "LastName") { lastName.ValidationExpression = def.ValidationExpression; } } setting = GetSetting(UserPortalID, "Security_DisplayNameFormat"); if ((setting != null) && (!string.IsNullOrEmpty(Convert.ToString(setting)))) { if (AddUser) { displayNameReadOnly.Visible = false; displayName.Visible = false; } else { displayNameReadOnly.Visible = true; displayName.Visible = false; } } else { displayNameReadOnly.Visible = false; displayName.Visible = true; } userForm.DataSource = User; if (!Page.IsPostBack) { userForm.DataBind(); } }
/// <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); } }
/// <summary> /// Loads top level entry list /// </summary> private void BindListInfo() { lblListName.Text = ListName; lblListParent.Text = ParentKey; rowListParent.Visible = (!string.IsNullOrEmpty(ParentKey)); chkEnableSortOrder.Checked = EnableSortOrder; if (!SystemList && ShowDelete) { cmdDeleteList.Visible = true; ClientAPI.AddButtonConfirm(cmdDeleteList, Localization.GetString("DeleteItem")); } else { cmdDeleteList.Visible = false; } switch (Mode) { case "ListEntries": EnableView(true); break; case "EditEntry": EnableView(false); EnableEdit(false); break; case "AddEntry": EnableView(false); EnableEdit(false); if (SelectedList != null) { txtParentKey.Text = SelectedList.ParentKey; } else { rowEnableSortOrder.Visible = true; } txtEntryName.Text = ListName; rowListName.Visible = false; txtEntryValue.Text = ""; txtEntryText.Text = ""; cmdSaveEntry.CommandName = "SaveEntry"; break; case "AddList": EnableView(false); EnableEdit(true); rowListName.Visible = true; txtParentKey.Text = ""; txtEntryName.Text = ""; txtEntryValue.Text = ""; txtEntryText.Text = ""; txtEntryName.ReadOnly = false; cmdSaveEntry.CommandName = "SaveList"; var ctlLists = new ListController(); ddlSelectList.Enabled = true; ddlSelectList.DataSource = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID); ddlSelectList.DataTextField = "DisplayName"; ddlSelectList.DataValueField = "Key"; ddlSelectList.DataBind(); //ddlSelectList.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), "")); ddlSelectList.InsertItem(0, Localization.GetString("None_Specified"), ""); //Reset dropdownlist ddlSelectParent.ClearSelection(); ddlSelectParent.Enabled = false; break; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); cboSource.SelectedIndexChanged += cboSource_SelectedIndexChanged; cboSourceFolder.SelectedIndexChanged += cboSourceFolder_SelectedIndexChanged; cmdCancel.Click += cmdCancel_Click; cmdDelete.Click += cmdDelete_Click; cmdUpdate.Click += cmdUpdate_Click; try { if (!Page.IsPostBack) { lblModule.Text = DesktopModule.FriendlyName; var objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(ModuleDefId); if (objModuleDefinition != null) { lblDefinition.Text = objModuleDefinition.FriendlyName; } ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); BindSourceFolders(); BindControlList(); if (!Null.IsNull(ModuleControlId)) { if (ModuleControl != null) { txtKey.Text = ModuleControl.ControlKey; txtTitle.Text = ModuleControl.ControlTitle; if (!string.IsNullOrEmpty(cboSource.SelectedValue)) { LoadIcons(); } else { txtSource.Text = ModuleControl.ControlSrc; } if (cboType.FindItemByValue(Convert.ToInt32(ModuleControl.ControlType).ToString()) != null) { cboType.FindItemByValue(Convert.ToInt32(ModuleControl.ControlType).ToString()).Selected = true; } if (!Null.IsNull(ModuleControl.ViewOrder)) { txtViewOrder.Text = ModuleControl.ViewOrder.ToString(); } if (cboIcon.FindItemByValue(ModuleControl.IconFile.ToLower()) != null) { cboIcon.FindItemByValue(ModuleControl.IconFile.ToLower()).Selected = true; } if (!Null.IsNull(ModuleControl.HelpURL)) { txtHelpURL.Text = ModuleControl.HelpURL; } if (ModuleControl.SupportsPartialRendering) { chkSupportsPartialRendering.Checked = true; } supportsModalPopUpsCheckBox.Checked = ModuleControl.SupportsPopUps; } } else { if (cboType.Enabled) { cboType.FindItemByValue("0").Selected = true; } else { cboType.FindItemByValue("-2").Selected = true; } } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
void Page_Load(object sender, EventArgs e) { try { if (ModuleContext.PortalSettings.UserId == -1 && Settings.ForceCaptchaForAnonymous && Settings.PreferReCaptcha) { cmdUpdate.Attributes["disabled"] = "disabled"; cmdUpdate.CssClass += " disabled"; DotNetNuke.Framework.CDefault page = (DotNetNuke.Framework.CDefault) this.Page; StringBuilder sb = new StringBuilder(); sb.AppendLine(@"<script type=""text/javascript"">"); sb.AppendLine("var onSubmit = function(token) {"); sb.AppendLine("$('#" + cmdUpdate.ClientID + "').removeAttr('disabled');"); sb.AppendLine("$('#" + cmdUpdate.ClientID + "').removeClass('disabled');"); sb.AppendLine("};"); sb.AppendLine("var onloadCallback = function() {"); sb.AppendLine("grecaptcha.render('" + gRecaptcha.ClientID + "', {"); sb.AppendLine("'sitekey' : '" + Settings.ReCaptchaSiteKey + "',"); sb.AppendLine("'callback' : onSubmit"); sb.AppendLine("});"); sb.AppendLine("};"); sb.AppendLine("</script>"); page.Header.Controls.Add(new LiteralControl(sb.ToString())); string languageCode = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; page.Header.Controls.Add(new LiteralControl(@"<script src=""https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=" + languageCode + @""" async defer ></script>")); } if (Page.IsPostBack == false) { EnsureActionButton(); ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem", LocalResourceFile)); } if (!IsNewRow) { if (!Page.IsPostBack) { //Clear all default values foreach (var edit in _editControls.Values) { edit.Value = ""; } } foreach (DataRow field in Data.Tables[DataSetTableName.Fields].Rows) { var dataTypeName = field[FieldsTableColumn.Type].AsString(); var dataType = DataType.ByName(dataTypeName); var value = CurrentRow[field[FieldsTableColumn.Title].ToString()].ToString(); if (!dataType.IsSeparator) { if (!Page.IsPostBack) { _editControls[field[FieldsTableColumn.Title].ToString()].Value = value; } if (field[FieldsTableColumn.Type].ToString() == "CreatedBy") { CheckPermission(value); } } } } else //New Entry { //Default Values already have been set in BuildEditForms cmdDelete.Visible = false; CheckPermission(); if (!Page.IsPostBack && Request.QueryString["OnSubmit"].AsInt() == ModuleContext.ModuleId) { ShowUponSubmit(); } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); CheckPermission(false); } }
/// <summary> /// Page_Load runs when the control is loaded. /// </summary> /// <returns></returns> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/28/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["desktopmoduleid"] != null)) { DesktopModuleId = int.Parse(Request.QueryString["desktopmoduleid"]); if (DesktopModuleId == -2) { DesktopModuleId = Null.NullInteger; } } else { DesktopModuleId = Null.NullInteger; } if ((Request.QueryString["moduledefid"] != null)) { ModuleDefId = int.Parse(Request.QueryString["moduledefid"]); } else { ModuleDefId = Null.NullInteger; } if ((Request.QueryString["modulecontrolid"] != null)) { ModuleControlId = int.Parse(Request.QueryString["modulecontrolid"]); } else { ModuleControlId = Null.NullInteger; } if (Page.IsPostBack == false) { DesktopModuleController objDesktopModules = new DesktopModuleController(); DesktopModuleInfo objDesktopModule; objDesktopModule = objDesktopModules.GetDesktopModule(DesktopModuleId); if (objDesktopModule != null) { txtModule.Text = objDesktopModule.FriendlyName; } else { txtModule.Text = Localization.GetString("SkinObjects"); txtTitle.Enabled = false; cboType.Enabled = false; txtViewOrder.Enabled = false; cboIcon.Enabled = false; } ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController(); ModuleDefinitionInfo objModuleDefinition; objModuleDefinition = objModuleDefinitions.GetModuleDefinition(ModuleDefId); if (objModuleDefinition != null) { txtDefinition.Text = objModuleDefinition.FriendlyName; } ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); ModuleControlController objModuleControls = new ModuleControlController(); ModuleControlInfo objModuleControl; objModuleControl = objModuleControls.GetModuleControl(ModuleControlId); // Added to populate cboSource with desktop module or skin controls // Issue #586 BindControlList("DesktopModules", true); BindControlList("Admin/Skins", false); if (objDesktopModule == null) // Add Container Controls { BindControlList("Admin/Containers", false); } if (!Null.IsNull(ModuleControlId)) { if (objModuleControl != null) { txtKey.Text = objModuleControl.ControlKey; txtTitle.Text = objModuleControl.ControlTitle; if (cboSource.Items.FindByValue(objModuleControl.ControlSrc.ToString().ToLower()) != null) { cboSource.Items.FindByValue(objModuleControl.ControlSrc.ToString().ToLower()).Selected = true; LoadIcons(); } if (cboType.Items.FindByValue(Convert.ToInt32(objModuleControl.ControlType).ToString()) != null) { cboType.Items.FindByValue(Convert.ToInt32(objModuleControl.ControlType).ToString()).Selected = true; } if (!Null.IsNull(objModuleControl.ViewOrder)) { txtViewOrder.Text = objModuleControl.ViewOrder.ToString(); } if (cboIcon.Items.FindByValue(objModuleControl.IconFile.ToLower()) != null) { cboIcon.Items.FindByValue(objModuleControl.IconFile.ToLower()).Selected = true; } if (!Null.IsNull(objModuleControl.HelpURL)) { txtHelpURL.Text = objModuleControl.HelpURL; } } } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); cboSource.SelectedIndexChanged += cboSource_SelectedIndexChanged; cmdCancel.Click += cmdCancel_Click; cmdDelete.Click += cmdDelete_Click; cmdUpdate.Click += cmdUpdate_Click; try { ModuleDefId = (Request.QueryString["moduledefid"] != null) ? Int32.Parse(Request.QueryString["moduledefid"]) : Null.NullInteger; ModuleControlId = (Request.QueryString["modulecontrolid"] != null) ? Int32.Parse(Request.QueryString["modulecontrolid"]) : Null.NullInteger; if (Page.IsPostBack == false) { lblModule.Text = DesktopModule.FriendlyName; var objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(ModuleDefId); if (objModuleDefinition != null) { lblDefinition.Text = objModuleDefinition.FriendlyName; } ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); var moduleControl = ModuleControlController.GetModuleControl(ModuleControlId); BindControlList("DesktopModules", true); BindControlList("Admin/Skins", false); //cboSource.Items.Insert(0, new ListItem("<" + Localization.GetString("None_Specified") + ">", "")); cboSource.InsertItem(0, "<" + Localization.GetString("None_Specified") + ">", ""); if (!Null.IsNull(ModuleControlId)) { if (moduleControl != null) { txtKey.Text = moduleControl.ControlKey; txtTitle.Text = moduleControl.ControlTitle; if (cboSource.FindItemByValue(moduleControl.ControlSrc.ToLower()) != null) { cboSource.FindItemByValue(moduleControl.ControlSrc.ToLower()).Selected = true; LoadIcons(); } else { txtSource.Text = moduleControl.ControlSrc; } if (cboType.FindItemByValue(Convert.ToInt32(moduleControl.ControlType).ToString()) != null) { cboType.FindItemByValue(Convert.ToInt32(moduleControl.ControlType).ToString()).Selected = true; } if (!Null.IsNull(moduleControl.ViewOrder)) { txtViewOrder.Text = moduleControl.ViewOrder.ToString(); } if (cboIcon.FindItemByValue(moduleControl.IconFile.ToLower()) != null) { cboIcon.FindItemByValue(moduleControl.IconFile.ToLower()).Selected = true; } if (!Null.IsNull(moduleControl.HelpURL)) { txtHelpURL.Text = moduleControl.HelpURL; } if (moduleControl.SupportsPartialRendering) { chkSupportsPartialRendering.Checked = true; } supportsModalPopUpsCheckBox.Checked = moduleControl.SupportsPopUps; } } else { if (cboType.Enabled) { cboType.FindItemByValue("0").Selected = true; } else { cboType.FindItemByValue("-2").Selected = true; } } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); imgAddModule.Click += imgAddModule_Click; optMode.SelectedIndexChanged += optMode_SelectedIndexChanged; optModuleType.SelectedIndexChanged += optModuleType_SelectedIndexChanged; cboTabs.SelectedIndexChanged += cboTabs_SelectedIndexChanged; cmdVisibility.Click += cmdVisibility_Click; cboPanes.SelectedIndexChanged += cboPanes_SelectedIndexChanged; cboPosition.SelectedIndexChanged += cboPosition_SelectedIndexChanged; imgAdmin.Click += imgAdmin_Click; cmdAdmin.Click += cmdAdmin_Click; imgHost.Click += imgHost_Click; cmdHost.Click += cmdHost_Click; cmdAddModule.Click += AddModule_Click; cmdAddTab.Click += PageFunctions_Click; cmdAddTabIcon.Click += PageFunctions_Click; cmdEditTab.Click += PageFunctions_Click; cmdEditTabIcon.Click += PageFunctions_Click; cmdDeleteTab.Click += PageFunctions_Click; cmdDeleteTabIcon.Click += PageFunctions_Click; cmdCopyTab.Click += PageFunctions_Click; cmdCopyTabIcon.Click += PageFunctions_Click; cmdExportTab.Click += PageFunctions_Click; cmdExportTabIcon.Click += PageFunctions_Click; cmdImportTab.Click += PageFunctions_Click; cmdImportTabIcon.Click += PageFunctions_Click; cmdExtensions.Click += CommonTasks_Click; cmdExtensionsIcon.Click += CommonTasks_Click; cmdFiles.Click += CommonTasks_Click; cmdFilesIcon.Click += CommonTasks_Click; cmdRoles.Click += CommonTasks_Click; cmdRolesIcon.Click += CommonTasks_Click; cmdSite.Click += CommonTasks_Click; cmdSiteIcon.Click += CommonTasks_Click; cmdUsers.Click += CommonTasks_Click; cmdUsersIcon.Click += CommonTasks_Click; try { if (IsPageAdmin()) { tblControlPanel.Visible = true; cmdVisibility.Visible = true; rowControlPanel.Visible = true; Localize(); if (Globals.IsAdminControl()) { cmdAddModule.Enabled = false; } if (!Page.IsPostBack) { optModuleType.Items.FindByValue("0").Selected = true; if (!TabPermissionController.CanAddPage()) { DisableAction(imgAddTabIcon, "iconbar_addtab_bw.gif", cmdAddTabIcon, cmdAddTab); } if (!TabPermissionController.CanManagePage()) { DisableAction(imgEditTabIcon, "iconbar_edittab_bw.gif", cmdEditTabIcon, cmdEditTab); } if (!TabPermissionController.CanDeletePage() || TabController.IsSpecialTab(TabController.CurrentPage.TabID, PortalSettings)) { DisableAction(imgDeleteTabIcon, "iconbar_deletetab_bw.gif", cmdDeleteTabIcon, cmdDeleteTab); } else { ClientAPI.AddButtonConfirm(cmdDeleteTab, Localization.GetString("DeleteTabConfirm", LocalResourceFile)); ClientAPI.AddButtonConfirm(cmdDeleteTabIcon, Localization.GetString("DeleteTabConfirm", LocalResourceFile)); } if (!TabPermissionController.CanCopyPage()) { DisableAction(imgCopyTabIcon, "iconbar_copytab_bw.gif", cmdCopyTabIcon, cmdCopyTab); } if (!TabPermissionController.CanExportPage()) { DisableAction(imgExportTabIcon, "iconbar_exporttab_bw.gif", cmdExportTabIcon, cmdExportTab); } if (!TabPermissionController.CanImportPage()) { DisableAction(imgImportTabIcon, "iconbar_importtab_bw.gif", cmdImportTabIcon, cmdImportTab); } if (!TabPermissionController.CanAddContentToPage()) { pnlModules.Visible = false; } if (!GetModulePermission(PortalSettings.PortalId, "Site Settings")) { DisableAction(imgSiteIcon, "iconbar_site_bw.gif", cmdSiteIcon, cmdSite); } if (GetModulePermission(PortalSettings.PortalId, "User Accounts") == false) { DisableAction(imgUsersIcon, "iconbar_users_bw.gif", cmdUsersIcon, cmdUsers); } if (GetModulePermission(PortalSettings.PortalId, "Security Roles") == false) { DisableAction(imgRolesIcon, "iconbar_roles_bw.gif", cmdRolesIcon, cmdRoles); } if (GetModulePermission(PortalSettings.PortalId, "Digital Asset Management") == false) { DisableAction(imgFilesIcon, "iconbar_files_bw.gif", cmdFilesIcon, cmdFiles); } if (GetModulePermission(PortalSettings.PortalId, "Extensions") == false) { DisableAction(imgExtensionsIcon, "iconbar_extensions_bw.gif", cmdExtensionsIcon, cmdExtensions); } UserInfo objUser = UserController.GetCurrentUserInfo(); if (objUser != null) { if (objUser.IsSuperUser) { hypMessage.ImageUrl = Upgrade.UpgradeIndicator(DotNetNukeContext.Current.Application.Version, Request.IsLocal, Request.IsSecureConnection); if (!String.IsNullOrEmpty(hypMessage.ImageUrl)) { hypMessage.ToolTip = Localization.GetString("hypUpgrade.Text", LocalResourceFile); hypMessage.NavigateUrl = Upgrade.UpgradeRedirect(); } cmdHost.Visible = true; } else //branding { if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) && Host.DisplayCopyright) { hypMessage.ImageUrl = "~/images/branding/iconbar_logo.png"; hypMessage.ToolTip = DotNetNukeContext.Current.Application.Description; hypMessage.NavigateUrl = Localization.GetString("hypMessageUrl.Text", LocalResourceFile); } else { hypMessage.Visible = false; } cmdHost.Visible = false; cmdAdmin.Visible = GetModulePermission(PortalSettings.PortalId, "Console"); } imgHost.Visible = cmdHost.Visible; imgAdmin.Visible = cmdAdmin.Visible; } BindData(); int intItem; for (intItem = 0; intItem <= PortalSettings.ActiveTab.Panes.Count - 1; intItem++) { cboPanes.Items.Add(Convert.ToString(PortalSettings.ActiveTab.Panes[intItem])); } if (cboPanes.Items.FindByValue(Globals.glbDefaultPane) != null) { cboPanes.Items.FindByValue(Globals.glbDefaultPane).Selected = true; } if (cboPermission.Items.Count > 0) { cboPermission.SelectedIndex = 0; //view } LoadPositions(); if (!string.IsNullOrEmpty(Host.HelpURL)) { var version = Globals.FormatVersion(DotNetNukeContext.Current.Application.Version, false); cmdHelp.NavigateUrl = Globals.FormatHelpUrl(Host.HelpURL, PortalSettings, version); cmdHelpIcon.NavigateUrl = cmdHelp.NavigateUrl; cmdHelp.Enabled = true; cmdHelpIcon.Enabled = true; } else { cmdHelp.Enabled = false; cmdHelpIcon.Enabled = false; } SetMode(false); SetVisibility(false); } //Register jQuery jQuery.RequestRegistration(); } else if (IsModuleAdmin()) { tblControlPanel.Visible = true; cmdVisibility.Visible = false; rowControlPanel.Visible = false; if (!Page.IsPostBack) { SetMode(false); SetVisibility(false); } } else { tblControlPanel.Visible = false; } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// InstantiateIn instantiates the template (implementation of ITemplate) /// </summary> /// <remarks> /// </remarks> /// <param name="container">The parent container (DataGridItem)</param> public void InstantiateIn(Control container) { switch (ItemType) { case GridItemType.Item: case GridItemType.AlternatingItem: case GridItemType.SelectedItem: case GridItemType.EditItem: if (EditMode == ImageCommandColumnEditMode.URL) { var hypLink = new HyperLink { ToolTip = Text }; if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { var img = new Image { ImageUrl = DesignMode ? ImageURL.Replace("~/", "../../") : ImageURL }; hypLink.Controls.Add(img); img.ToolTip = Text; } else { hypLink.Text = Text; } hypLink.DataBinding += ItemDataBinding; container.Controls.Add(hypLink); } else { if (!String.IsNullOrEmpty(ImageURL) && ShowImage) { var colIcon = new ImageButton { ImageUrl = DesignMode ? ImageURL.Replace("~/", "../../") : ImageURL, ToolTip = Text }; if (!String.IsNullOrEmpty(OnClickJs)) { ClientAPI.AddButtonConfirm(colIcon, OnClickJs); } colIcon.CommandName = CommandName; colIcon.DataBinding += ItemDataBinding; container.Controls.Add(colIcon); } if (!String.IsNullOrEmpty(Text) && !ShowImage) { var colLink = new LinkButton { ToolTip = Text }; if (!String.IsNullOrEmpty(OnClickJs)) { ClientAPI.AddButtonConfirm(colLink, OnClickJs); } colLink.CommandName = CommandName; colLink.Text = Text; colLink.DataBinding += ItemDataBinding; container.Controls.Add(colLink); } } break; case GridItemType.Footer: case GridItemType.Header: container.Controls.Add(new LiteralControl(Text)); break; } }
/// ----------------------------------------------------------------------------- /// ''' <summary> /// ''' Page_Load runs when the control is loaded /// ''' </summary> /// ''' <remarks> /// ''' </remarks> /// ''' <history> /// ''' [cnurse] 9/23/2004 Updated to reflect design changes for Help, 508 support /// ''' and localisation /// ''' </history> /// ''' ----------------------------------------------------------------------------- private void Page_Load(System.Object sender, System.EventArgs e) { try { // Determine ItemId of Link to Update if (Request.QueryString["ItemId"] != null) { int.TryParse(Request.QueryString["ItemId"], out itemId); } // If the page is being requested the first time, determine if an // link itemId value is specified, and if so populate page // contents with the link details if (Page.IsPostBack == false) { // Deprecated, implemented below but kept here for some time just for reference // tblGetContent.Visible = System.Security.SecurityManager.IsGranted(new System.Net.WebPermission(System.Net.NetworkAccess.Connect, "http://www.dotnetnuke.com")); var permissionSet = new PermissionSet(System.Security.Permissions.PermissionState.None); permissionSet.AddPermission(new System.Net.WebPermission(System.Net.NetworkAccess.Connect, "http://www.dotnetnuke.com")); tblGetContent.Visible = permissionSet.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet); var roles = RoleController.Instance.GetRoles(this.PortalId); ddlViewOrderLinks.DataSource = LinkController.GetLinks(this.ModuleId); ddlViewOrderLinks.DataTextField = "Title"; ddlViewOrderLinks.DataValueField = "ViewOrder"; ddlViewOrderLinks.DataBind(); cblGrantRoles.DataSource = roles; cblGrantRoles.DataTextField = "RoleName"; cblGrantRoles.DataValueField = "RoleID"; cblGrantRoles.DataBind(); ClientAPI.AddButtonConfirm(cmdDelete, Services.Localization.Localization.GetString("DeleteItem")); if (itemId != -1) { // Obtain a single row of link information var objLink = LinkController.GetLink(itemId, ModuleId); if (objLink != null) { ddlViewOrderLinks.Items.Remove(ddlViewOrderLinks.Items.FindByText(objLink.Title)); if (ddlViewOrderLinks.Items.Count > 0) { ddlViewOrderLinks.SelectedValue = LinkController.GetLinkByHigherViewOrder(objLink.ViewOrder, this.ModuleId).ToString(); if (int.Parse(ddlViewOrderLinks.SelectedValue) < objLink.ViewOrder) { ddlViewOrder.SelectedValue = "A"; } else { ddlViewOrder.SelectedValue = "B"; } } txtTitle.Text = objLink.Title.ToString(); ctlURL.Url = objLink.Url; // Probably no longer needed //ctlURL.ShowDatabase = true; //ctlURL.ShowSecure = true; // chkGetContent.Checked = objLink.RefreshContent string urlType = LinkController.ConvertUrlType(DotNetNuke.Common.Globals.GetURLType(objLink.Url)); if (urlType != "U") { tblGetContent.Visible = false; } txtDescription.Text = objLink.Description.ToString(); // If (Common.Utilities.Null.IsNull(objLink.ViewOrder) = False) Then // txtViewOrder.Text = Convert.ToString(objLink.ViewOrder) // End If ddlGetContentInterval.SelectedValue = objLink.RefreshInterval.ToString(); ctlAudit.CreatedByUser = objLink.CreatedByUser.ToString(); ctlAudit.CreatedDate = objLink.CreatedDate.ToString(); ctlTracking.URL = objLink.Url; ctlTracking.ModuleID = ModuleId; foreach (ListItem cb in cblGrantRoles.Items) { cb.Selected = objLink.GrantRoles.Contains(";" + cb.Value + ";"); } } else { Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), true); } } else { cmdDelete.Visible = false; ctlAudit.Visible = false; ctlTracking.Visible = false; } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }