protected void Page_Load(object sender, EventArgs e) { if (FileHelper.FileExists(controlPath)) { // Load the group selector ctrl = LoadUserControl(controlPath) as FormEngineUserControl; ctrl.ID = "groupSelector"; plcGroupSelector.Controls.Add(ctrl); UniSelector usGroups = ctrl.GetValue("CurrentSelector") as UniSelector; if (usGroups != null) { usGroups.ReturnColumnName = "GroupID"; } usGroups.UseUniSelectorAutocomplete = false; mSiteId = QueryHelper.GetInteger("siteid", 0); mNodeId = QueryHelper.GetInteger("nodeid", 0); mGroupId = QueryHelper.GetInteger("groupid", 0); if (!RequestHelper.IsPostBack()) { ctrl.Value = mGroupId; } ctrl.IsLiveSite = false; ctrl.SetValue("DisplayCurrentGroup", false); ctrl.SetValue("DisplayNoneValue", true); ctrl.SetValue("SiteID", mSiteId); ctrl.SetValue("CurrentSelector", usGroups); } }
protected void Page_Load(object sender, EventArgs e) { // Required field validator error messages initialization rfvAnswerText.ErrorMessage = GetString("Polls_Answer_Edit.AnswerTextError"); // Controls initializations lblAnswerText.Text = GetString("Polls_Answer_Edit.AnswerTextLabel"); lblVotes.Text = GetString("Polls_Answer_Edit.Votes"); // Set if it is live site txtAnswerText.IsLiveSite = IsLiveSite; // Load BizForm selector if BizForms module is available if (ModuleEntry.IsModuleLoaded(ModuleEntry.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.BIZFORM, CMSContext.CurrentSiteName)) { bizFormElem = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/BizForms/FormControls/SelectBizForm.ascx"); bizFormElem.ShortID = "bizFormElem"; bizFormElem.SetValue("ShowSiteFilter", false); plcBizFormSelector.Controls.Add(bizFormElem); bizFormElem.Visible = true; UniSelector uniSelector = bizFormElem.GetValue("UniSelector") as UniSelector; if (uniSelector != null) { uniSelector.OnSelectionChanged += new EventHandler(BizFormSelector_OnSelectionChanged); } } if (!RequestHelper.IsPostBack() && !IsLiveSite) { LoadData(); } }
protected void Page_Load(object sender, EventArgs e) { if (ModuleEntryManager.IsModuleLoaded(ModuleName.COMMUNITY)) { // Load the group selector ctrl = LoadUserControl(controlPath) as FormEngineUserControl; ctrl.ID = "groupSelector"; plcGroupSelector.Controls.Add(ctrl); UniSelector usGroups = ctrl.GetValue("CurrentSelector") as UniSelector; if (usGroups != null) { usGroups.ReturnColumnName = "GroupID"; } usGroups.UseUniSelectorAutocomplete = false; mSiteId = QueryHelper.GetInteger("siteid", 0); mNodeId = QueryHelper.GetInteger("nodeid", 0); mGroupId = QueryHelper.GetInteger("groupid", 0); if (!RequestHelper.IsPostBack()) { ctrl.Value = mGroupId; } ctrl.IsLiveSite = false; ctrl.SetValue("DisplayCurrentGroup", false); ctrl.SetValue("DisplayNoneValue", true); ctrl.SetValue("SiteID", mSiteId); ctrl.SetValue("CurrentSelector", usGroups); } }
/// <summary> /// Initializes group selector. /// </summary> private void InitializeGroupSelector() { if (groupsSelector != null) { return; } try { groupsSelector = LoadUserControl(controlPath) as FormEngineUserControl; if (groupsSelector == null) { return; } // Set up selector groupsSelector.ID = "dialogsGroupSelector"; groupsSelector.SetValue("DisplayCurrentGroup", false); groupsSelector.SetValue("SiteID", 0); groupsSelector.IsLiveSite = IsLiveSite; groupsSelector.Changed += groupSelector_Changed; // Get uniselector and set it up UniSelector us = groupsSelector.GetValue("CurrentSelector") as UniSelector; if (us != null) { us.ReturnColumnName = "GroupID"; } // Get DropDownList and set it up DropDownList drpGroups = groupsSelector.GetValue("CurrentDropDown") as DropDownList; if (drpGroups != null) { drpGroups.AutoPostBack = true; } // Add control to panel pnlGroupSelector.Controls.Add(groupsSelector); } catch (HttpException) { // Couldn't load the control plcGroupSelector.Visible = false; } }
/// <summary> /// Initializes library selector. /// </summary> public void LoadLibrarySelection() { int groupId = (groupsSelector != null ? ValidationHelper.GetInteger(groupsSelector.GetValue("GroupID"), -1) : 0); // Decide what type of libraries to display if (groupId == -1) { librarySelector.Where = String.Format("({0})", SqlHelperClass.NO_DATA_WHERE); SetLibrariesEmpty(); } else { librarySelector.Where = groupId == 0 ? GetGlobalLibrariesCondition() : GetGroupLibrariesCondition(); } librarySelector.GroupID = groupId; librarySelector.SiteID = SiteID; librarySelector.ReloadData(); }
/// <summary> /// Initializes library selector. /// </summary> public void LoadLibrarySelection() { SelectedGroupID = (groupsSelector != null ? ValidationHelper.GetInteger(groupsSelector.GetValue("GroupID"), -1) : 0); // Decide what type of libraries to display if (SelectedGroupID == -1) { librarySelector.Where = String.Format("({0})", SqlHelper.NO_DATA_WHERE); SetLibrariesEmpty(); } else { librarySelector.Where = GetDisplayedLibrariesCondition(); } librarySelector.GroupID = SelectedGroupID; librarySelector.SiteID = SiteID; librarySelector.ReloadData(); }
private void ucSelectCustomer_Changed(object sender, EventArgs e) { // Check permissions if (ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, true)) { // Load value form dynamic control string values = null; if (ucSelectCustomer != null) { values = ValidationHelper.GetString(ucSelectCustomer.GetValue("OnlineMarketingValue"), null); } if (!String.IsNullOrEmpty(values)) { // Store users one by one string[] customerIds = values.Split(';'); int currentSiteID = SiteContext.CurrentSiteID; foreach (string customerId in customerIds) { // Check if user ID is valid int customerIdInt = ValidationHelper.GetInteger(customerId, 0); if (customerIdInt <= 0) { continue; } // Only allow adding customers on the same site as contact or registered customers var customer = BaseAbstractInfoProvider.GetInfoById(PredefinedObjectType.CUSTOMER, customerIdInt); if ((customer == null) || ((customer.Generalized.ObjectSiteID != currentSiteID) && !customer.IsGlobal)) { continue; } // Add new relation int parentId = (ci.ContactMergedWithContactID == 0) ? ci.ContactID : ci.ContactMergedWithContactID; ContactMembershipInfoProvider.SetRelationship(customerIdInt, MemberTypeEnum.EcommerceCustomer, ci.ContactID, parentId, true); ci = ContactInfoProvider.GetContactInfo(contactId); } // When contact was merged then refresh complete page if ((ci != null) && (ci.ContactMergedWithContactID > 0)) { Page.Response.Redirect(RequestContext.URL.ToString(), true); } else { gridElem.ReloadData(); } } } }
private void ucSelectCustomer_Changed(object sender, EventArgs e) { // Check permissions if (ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, true)) { // Load value form dynamic control string values = null; if (ucSelectCustomer != null) { values = ValidationHelper.GetString(ucSelectCustomer.GetValue("OnlineMarketingValue"), null); } if (!String.IsNullOrEmpty(values)) { // Store users one by one string[] customerIds = values.Split(';'); foreach (string customerId in customerIds) { // Check if user ID is valid int customerIdInt = ValidationHelper.GetInteger(customerId, 0); if (customerIdInt <= 0) { continue; } // Add new relation int parentId = (ci.ContactMergedWithContactID == 0) ? ci.ContactID : ci.ContactMergedWithContactID; MembershipInfoProvider.SetRelationship(customerIdInt, MemberTypeEnum.EcommerceCustomer, ci.ContactID, parentId, true); ci = ContactInfoProvider.GetContactInfo(contactId); } // When contact was merged then refresh complete page if ((ci != null) && (ci.ContactMergedWithContactID > 0)) { Page.Response.Redirect(URLHelper.Url.ToString(), true); } else { gridElem.ReloadData(); } } } }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.CurrentSelector.ButtonImage = GetImageUrl("Objects/CMS_Role/add.png"); selectRole.CurrentSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.CurrentSelector.DialogButton.CssClass = "LongButton"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; selectRole.GlobalRoles = false; // Setup user selector selectUser.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.ButtonImage = GetImageUrl("Objects/CMS_User/add.png"); selectUser.UniSelector.AdditionalSearchColumns = "UserName, Email"; selectUser.UniSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "newsletteraddusers"; selectUser.UniSelector.DialogButton.CssClass = "LongButton"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.UniSelector.ButtonImage = GetImageUrl("Objects/Newsletter_Subscriber/add.png"); selectSubscriber.UniSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectSubscriber.ShowSiteFilter = false; selectSubscriber.UniSelector.DialogButton.CssClass = "LongButton"; selectSubscriber.IsLiveSite = false; selectSubscriber.UniSelector.RemoveMultipleCommas = true; // Setup contact group and contact selectors if (ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING) && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement)) { plcSelectCG.Controls.Clear(); // Check read permission for contact groups if (CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ReadContactGroups")) { // Load selector control and initialize it cgSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; cgSelector.ShortID = "scg"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += CGSelector_OnItemsSelected; selector.ResourcePrefix = "contactgroupsubscriber"; } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Check read permission for contacts if (CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ReadContacts")) { // Load selector control and initialize it cSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactSelector.ascx"); if (cSelector != null) { cSelector.ID = "slContact"; cSelector.ShortID = "sc"; // Set where condition to filter contacts with email addresses cSelector.SetValue("wherecondition", "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"); // Set site ID cSelector.SetValue("siteid", CMSContext.CurrentSiteID); // Get inner uniselector control UniSelector selector = (UniSelector)cSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += ContactSelector_OnItemsSelected; selector.SelectionMode = SelectionModeEnum.MultipleButton; selector.ResourcePrefix = "contactsubscriber"; selector.ButtonImage = GetImageUrl("/Objects/OM_Contact/add.png"); selector.DisplayNameFormat = "{%ContactFirstName%} {%ContactLastName%} ({%ContactEmail%})"; selector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; } // Insert selector to the header plcSelectCG.Controls.Add(cSelector); } } } // Initialize mass actions if (drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), SELECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.unsubscribelink"), UNSUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.renewsubscription"), SUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.approvesubscription"), APPROVE)); drpActions.Items.Add(new ListItem(GetString("newsletter.rejectsubscription"), REJECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.deletesubscription"), REMOVE)); } }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.CurrentSelector.ButtonImage = GetImageUrl("Objects/CMS_Role/add.png"); selectRole.ImageDialog.CssClass = "NewItemImage"; selectRole.LinkDialog.CssClass = "NewItemLink"; selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.DialogButton.CssClass = "LongButton"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; // Setup user selector selectUser.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.ButtonImage = GetImageUrl("Objects/CMS_User/add.png"); selectUser.ImageDialog.CssClass = "NewItemImage"; selectUser.LinkDialog.CssClass = "NewItemLink"; selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "addusers"; selectUser.DialogButton.CssClass = "LongButton"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.UniSelector.ButtonImage = GetImageUrl("Objects/Newsletter_Subscriber/add.png"); selectSubscriber.ImageDialog.CssClass = "NewItemImage"; selectSubscriber.LinkDialog.CssClass = "NewItemLink"; selectSubscriber.ShowSiteFilter = false; selectSubscriber.DialogButton.CssClass = "LongButton"; selectSubscriber.IsLiveSite = false; // Setup contact group selector if (ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING) && CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.ContactManagement", "ReadContactGroups") && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement)) { // Load selector control and initialize it plcSelectCG.Controls.Clear(); cgSelector = (FormEngineUserControl)Page.LoadControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += new EventHandler(selector_OnItemsSelected); selector.ResourcePrefix = "contactgroupsubscriber"; } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Initialize mass actions if (this.drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), "SELECT")); drpActions.Items.Add(new ListItem(GetString("general.approve"), "APPROVE")); drpActions.Items.Add(new ListItem(GetString("general.Reject"), "REJECT")); drpActions.Items.Add(new ListItem(GetString("general.remove"), "REMOVE")); } }
protected void Page_Load(object sender, EventArgs e) { // Check license if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "") { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.WebAnalytics); } // If deletion is in progress if (StatisticsInfoProvider.DataDeleterIsRunning) { timeRefresh.Enabled = true; ViewState["DeleterStarted"] = true; EnableControls(false); ReloadInfoPanel(); } // If deletion has just end - add close script else if (ValidationHelper.GetBoolean(ViewState["DeleterStarted"], false)) { ScriptHelper.RegisterStartupScript(this, typeof(string), "CloseScript", ScriptHelper.GetScript("window.close(); wopener.RefreshPage(); ")); } ucABTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectABTest.ascx") as FormEngineUserControl; ucMVTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectMVTest.ascx") as FormEngineUserControl; if (ucABTests != null) { ucABTests.ID = "abTestSelector"; pnlABTests.Controls.Add(ucABTests); } if (ucMVTests != null) { ucMVTests.ID = "mvtSelector"; pnlMVTests.Controls.Add(ucMVTests); } // Configure dynamic selectors if (!RequestHelper.IsPostBack() && (ucABTests != null) && (ucMVTests != null)) { string[,] fields = new string[2, 2]; fields[0, 0] = GetString("general.pleaseselect"); fields[0, 1] = "pleaseselect"; fields[1, 0] = "(" + GetString("general.all") + ")"; fields[1, 1] = ValidationHelper.GetString(ucABTests.GetValue("AllRecordValue"), String.Empty); ucABTests.SetValue("SpecialFields", fields); ucABTests.Value = "pleaseselect"; ucABTests.SetValue("AllowEmpty", false); ucABTests.SetValue("ReturnColumnName", "ABTestName"); ucMVTests.SetValue("SpecialFields", fields); ucMVTests.Value = "pleaseselect"; ucMVTests.SetValue("AllowEmpty", false); ucMVTests.SetValue("ReturnColumnName", "MVTestName"); usCampaigns.UniSelector.SpecialFields = fields; usCampaigns.Value = "pleaseselect"; } CurrentUserInfo user = CMSContext.CurrentUser; // Check permissions for CMS Desk -> Tools -> Web analytics tab if (!user.IsAuthorizedPerUIElement("CMS.Tools", "WebAnalytics")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Tools", "WebAnalytics"); } // Check 'Read' permission if (!user.IsAuthorizedPerResource("CMS.WebAnalytics", "Read")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "Read"); } string title = GetString("AnayticsManageData.ManageData"); this.Page.Title = title; this.CurrentMaster.Title.TitleText = title; this.CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Reporting/managedata.png"); // Confirmation message for deleting string deleteFromToMessage = ScriptHelper.GetString(GetString("webanal.deletefromtomsg")); deleteFromToMessage = deleteFromToMessage.Replace("##FROM##", "' + elemFromStr + '"); deleteFromToMessage = deleteFromToMessage.Replace("##TO##", "' + elemToStr + '"); string script = " var elemTo = document.getElementById('" + pickerTo.ClientID + "_txtDateTime'); " + " var elemFrom = document.getElementById('" + pickerFrom.ClientID + "_txtDateTime'); " + " var elemToStr = " + ScriptHelper.GetString(GetString("webanal.now")) + "; " + " var elemFromStr = " + ScriptHelper.GetString(GetString("webanal.beginning")) + "; " + " var deleteAll = 1; " + " if (elemTo.value != '') { deleteAll = 0; elemToStr = elemTo.value; }; " + " if (elemFrom.value != '') { deleteAll = 0; elemFromStr = elemFrom.value; }; " + " if (deleteAll == 1) { return confirm(" + ScriptHelper.GetString(GetString("webanal.deleteall")) + "); } " + " else { return confirm(" + deleteFromToMessage + "); }; "; btnDelete.OnClientClick = script + "; return false;"; statCodeName = QueryHelper.GetString("statCodeName", String.Empty); if (statCodeName == "abtest") { pnlABTestSelector.Visible = true; } if (statCodeName == "mvtest") { pnlMVTSelector.Visible = true; } if (statCodeName == "campaigns") { pnlCampaigns.Visible = true; } }
public void btnDelete_Click(object sender, EventArgs e) { // Check 'ManageData' permission if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "ManageData"); } if (statCodeName == String.Empty) { return; } DateTime fromDate = pickerFrom.SelectedDateTime; DateTime toDate = pickerTo.SelectedDateTime; if (!pickerFrom.IsValidRange() || !pickerTo.IsValidRange()) { lblError.Text = GetString("general.errorinvaliddatetimerange"); lblError.Visible = true; return; } if ((fromDate > toDate) && (toDate != DateTimeHelper.ZERO_TIME)) { lblError.Visible = true; lblError.Text = GetString("analt.invalidinterval"); return; } String where = String.Empty; // Manage A/B test selector if ((statCodeName == "abtest") && (ucABTests != null)) { string abTest = ValidationHelper.GetString(ucABTests.Value, String.Empty); if ((abTest == String.Empty) || (abTest == "pleaseselect")) { lblError.Visible = true; lblError.Text = GetString("abtest.pleaseselect"); return; } String codeName = (abTest == ValidationHelper.GetString(ucABTests.GetValue("AllRecordValue"), String.Empty)) ? "'abconversion;%'" : "'abconversion;" + SqlHelperClass.GetSafeQueryString(abTest) + ";%'"; where = "StatisticsCode LIKE " + codeName; } // Manage MVT test selector if ((statCodeName == "mvtest") && (ucMVTests != null)) { string mvTest = ValidationHelper.GetString(ucMVTests.Value, String.Empty); if ((mvTest == String.Empty) || (mvTest == "pleaseselect")) { lblError.Visible = true; lblError.Text = GetString("mvtest.pleaseselect"); return; } String codeName = (mvTest == ValidationHelper.GetString(ucMVTests.GetValue("AllRecordValue"), String.Empty)) ? "'mvtconversion;%'" : "'mvtconversion;" + SqlHelperClass.GetSafeQueryString(mvTest) + ";%'"; where = "StatisticsCode LIKE " + codeName; } // Manage campaigns if (statCodeName == "campaigns") { string campaign = ValidationHelper.GetString(usCampaigns.Value, String.Empty); if ((campaign == String.Empty) || (campaign == "pleaseselect")) { lblError.Visible = true; lblError.Text = GetString("campaigns.pleaseselect"); return; } if (campaign == usCampaigns.AllRecordValue) { where = "(StatisticsCode='campaign' OR StatisticsCode LIKE 'campconversion;%')"; } else { where = " ((StatisticsCode='campaign' AND StatisticsObjectName ='" + SqlHelperClass.GetSafeQueryString(campaign) + "') OR StatisticsCode LIKE 'campconversion;" + SqlHelperClass.GetSafeQueryString(campaign) + "')"; } } // Delete one campaign (set from url) if (statCodeName.StartsWith("singlecampaign")) { string[] arr = statCodeName.Split(';'); if (arr.Length == 2) { String campaign = arr[1]; where = "(StatisticsCode='campaign' AND StatisticsObjectName ='" + SqlHelperClass.GetSafeQueryString(campaign) + "') OR StatisticsCode LIKE 'campconversion;" + SqlHelperClass.GetSafeQueryString(campaign) + "'"; } } // Ingore multilingual suffix (multilingual stats use the same data as "base" stats) if (statCodeName.ToLower().EndsWith(MULTILINGUAL_SUFFIX)) { statCodeName = statCodeName.Remove(statCodeName.Length - MULTILINGUAL_SUFFIX.Length); } // Add where condition based on stat code name if (where == String.Empty) { where = "StatisticsCode LIKE '" + SqlHelperClass.GetSafeQueryString(statCodeName, false) + "'"; } // In case of any error - (this page don't allow deleting all statistics) if (where == String.Empty) { return; } // Stats for visitors needs special manipulation (it consist of two types // of statistics with different code names - new visitor and returning visitor) if (statCodeName.ToLower() != HitLogProvider.VISITORS_FIRST) { StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, CMSContext.CurrentSiteID, where); } else { where = "(StatisticsCode = '" + HitLogProvider.VISITORS_FIRST + "' OR StatisticsCode ='" + HitLogProvider.VISITORS_RETURNING + "')"; StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, CMSContext.CurrentSiteID, where); } // Manage async delete info timeRefresh.Enabled = true; EnableControls(false); ReloadInfoPanel(); ViewState.Add("DeleterStarted", 1); }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; selectRole.GlobalRoles = false; // Setup user selector selectUser.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.AdditionalSearchColumns = "UserName, Email"; selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "newsletteraddusers"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.ShowSiteFilter = false; selectSubscriber.IsLiveSite = false; selectSubscriber.UniSelector.RemoveMultipleCommas = true; // Setup contact group and contact selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.ONLINEMARKETING) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.ContactManagement)) { plcSelectCG.Controls.Clear(); // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContactGroups")) { // Load selector control and initialize it cgSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; cgSelector.ShortID = "scg"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += CGSelector_OnItemsSelected; selector.ResourcePrefix = "contactgroupsubscriber"; } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Check read permission for contacts if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContacts")) { // Load selector control and initialize it cSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactSelector.ascx"); if (cSelector != null) { cSelector.ID = "slContact"; cSelector.ShortID = "sc"; // Set where condition to filter contacts with email addresses cSelector.SetValue("wherecondition", "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"); // Set site ID cSelector.SetValue("siteid", SiteContext.CurrentSiteID); // Get inner uniselector control UniSelector selector = (UniSelector)cSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += ContactSelector_OnItemsSelected; selector.SelectionMode = SelectionModeEnum.MultipleButton; selector.ResourcePrefix = "contactsubscriber"; selector.DisplayNameFormat = "{%ContactFirstName%} {%ContactLastName%} ({%ContactEmail%})"; selector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; } // Insert selector to the header plcSelectCG.Controls.Add(cSelector); } } } // Setup persona selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.PERSONAS) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Personas)) { // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.PERSONAS, "Read")) { // Load selector control and initialize it personaSelector = (UniSelector)Page.LoadUserControl("~/CMSAdminControls/UI/Uniselector/Uniselector.ascx"); if (personaSelector != null) { personaSelector.ID = "personaSelector"; personaSelector.ShortID = "ps"; personaSelector.ObjectType = PredefinedObjectType.PERSONA; personaSelector.ReturnColumnName = "PersonaID"; personaSelector.WhereCondition = "PersonaSiteID = " + SiteContext.CurrentSiteID; personaSelector.SelectionMode = SelectionModeEnum.MultipleButton; personaSelector.DisplayNameFormat = "{%PersonaDisplayName%}"; personaSelector.ResourcePrefix = "personasubscriber"; personaSelector.IsLiveSite = false; // Bind an event handler on 'items selected' event personaSelector.OnItemsSelected += PersonaSelector_OnItemsSelected; // Add selector to the header plcSelectCG.Controls.Add(personaSelector); } } } // Initialize mass actions if (drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), SELECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.unsubscribelink"), UNSUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.renewsubscription"), SUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.approvesubscription"), APPROVE)); drpActions.Items.Add(new ListItem(GetString("newsletter.deletesubscription"), REMOVE)); } }
protected void Page_Load(object sender, EventArgs e) { // Check license if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "") { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.WebAnalytics); } ucABTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectABTest.ascx") as FormEngineUserControl; ucMVTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectMVTest.ascx") as FormEngineUserControl; if (ucABTests != null) { ucABTests.ID = "abTestSelector"; pnlABTests.Controls.Add(ucABTests); } if (ucMVTests != null) { ucMVTests.ID = "mvtSelector"; pnlMVTests.Controls.Add(ucMVTests); } if (!RequestHelper.IsPostBack() && (ucABTests != null) && (ucMVTests != null)) { string[,] fields = new string[2, 2]; fields[0, 0] = GetString("general.pleaseselect"); fields[0, 1] = "pleaseselect"; fields[1, 0] = "(" + GetString("general.all") + ")"; fields[1, 1] = ValidationHelper.GetString(ucABTests.GetValue("AllRecordValue"), String.Empty); ucABTests.SetValue("SpecialFields", fields); ucABTests.Value = "pleaseselect"; ucABTests.SetValue("AllowEmpty", false); ucABTests.SetValue("ReturnColumnName", "ABTestName"); ucMVTests.SetValue("SpecialFields", fields); ucMVTests.Value = "pleaseselect"; ucMVTests.SetValue("AllowEmpty", false); ucMVTests.SetValue("ReturnColumnName", "MVTestName"); usCampaigns.UniSelector.SpecialFields = fields; usCampaigns.Value = "pleaseselect"; } CurrentUserInfo user = CMSContext.CurrentUser; // Check permissions for CMS Desk -> Tools -> Web analytics tab if (!user.IsAuthorizedPerUIElement("CMS.Tools", "WebAnalytics")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Tools", "WebAnalytics"); } // Check 'Read' permission if (!user.IsAuthorizedPerResource("CMS.WebAnalytics", "Read")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "Read"); } string title = GetString("AnayticsManageData.ManageData"); this.Page.Title = title; this.CurrentMaster.Title.TitleText = title; this.CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Reporting/managedata.png"); // Confirmation message for deleting string deleteFromToMessage = ScriptHelper.GetString(GetString("webanal.deletefromtomsg")); deleteFromToMessage = deleteFromToMessage.Replace("##FROM##", "' + elemFromStr + '"); deleteFromToMessage = deleteFromToMessage.Replace("##TO##", "' + elemToStr + '"); string script = " var elemTo = document.getElementById('" + pickerTo.ClientID + "_txtDateTime'); " + " var elemFrom = document.getElementById('" + pickerFrom.ClientID + "_txtDateTime'); " + " var elemToStr = " + ScriptHelper.GetString(GetString("webanal.now")) + "; " + " var elemFromStr = " + ScriptHelper.GetString(GetString("webanal.beginning")) + "; " + " var deleteAll = 1; " + " if (elemTo.value != '') { deleteAll = 0; elemToStr = elemTo.value; }; " + " if (elemFrom.value != '') { deleteAll = 0; elemFromStr = elemFrom.value; }; " + " if (deleteAll == 1) { return confirm(" + ScriptHelper.GetString(GetString("webanal.deleteall")) + "); } " + " else { return confirm(" + deleteFromToMessage + "); }; "; btnDelete.OnClientClick = script + "; return false;"; statCodeName = QueryHelper.GetString("statCodeName", String.Empty); if (statCodeName == "abtest") { pnlABTestSelector.Visible = true; } if (statCodeName == "mvtest") { pnlMVTSelector.Visible = true; } if (statCodeName == "campaigns") { pnlCampaigns.Visible = true; } }
/// <summary> /// Initializes group selector. /// </summary> private void InitializeGroupSelector() { if (groupsSelector == null) { try { groupsSelector = LoadControl(controlPath) as FormEngineUserControl; // Set up selector groupsSelector.ID = "dialogsGroupSelector"; groupsSelector.SetValue("DisplayCurrentGroup", false); groupsSelector.SetValue("SiteID", 0); groupsSelector.IsLiveSite = IsLiveSite; groupsSelector.Changed += groupSelector_Changed; // Get uniselector and set it up UniSelector us = groupsSelector.GetValue("CurrentSelector") as UniSelector; if (us != null) { us.ReturnColumnName = "GroupID"; } // Get dropdownlist and set it up DropDownList drpGroups = groupsSelector.GetValue("CurrentDropDown") as DropDownList; if (drpGroups != null) { drpGroups.AutoPostBack = true; } // Add control to panel pnlGroupSelector.Controls.Add(groupsSelector); } catch(HttpException) { // Couldn't load the control plcGroupSelector.Visible = false; } } }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.CurrentSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addroles.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl("CMS.Roles", "Administration.Roles"))); selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; selectRole.GlobalRoles = false; // Setup user selector selectUser.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.AdditionalSearchColumns = "UserName, Email"; selectUser.UniSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addusers.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl("CMS.Users", "Administration.Users"))); selectUser.WhereCondition = new WhereCondition().WhereNotEmpty("Email").ToString(true); selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "newsletteraddusers"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.UniSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addsubscribers.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.NEWSLETTER, "Newsletter", "?tabname=AllSubscribers"))); selectSubscriber.ShowSiteFilter = false; selectSubscriber.IsLiveSite = false; selectSubscriber.UniSelector.RemoveMultipleCommas = true; // Setup contact group and contact selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.ONLINEMARKETING) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.ContactManagement)) { plcSelectCG.Controls.Clear(); // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContactGroups")) { // Load selector control and initialize it cgSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; cgSelector.ShortID = "scg"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += CGSelector_OnItemsSelected; selector.ResourcePrefix = "contactgroupsubscriber"; selector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addcontactgroups.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.ONLINEMARKETING, "ContactGroups"))); } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Check read permission for contacts if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContacts")) { // Load selector control and initialize it cSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactSelector.ascx"); if (cSelector != null) { cSelector.ID = "slContact"; cSelector.ShortID = "sc"; // Set where condition to filter contacts with email addresses cSelector.SetValue("wherecondition", "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"); // Set site ID cSelector.SetValue("siteid", SiteContext.CurrentSiteID); // Get inner uniselector control UniSelector selector = (UniSelector)cSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += ContactSelector_OnItemsSelected; selector.SelectionMode = SelectionModeEnum.MultipleButton; selector.ResourcePrefix = "contactsubscriber"; selector.DisplayNameFormat = "{%ContactFirstName%} {%ContactLastName%} ({%ContactEmail%})"; selector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; selector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addcontacts.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.ONLINEMARKETING, "ContactsFrameset", "?tabname=contacts"))); } // Insert selector to the header plcSelectCG.Controls.Add(cSelector); } } } // Setup persona selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.PERSONAS) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Personas)) { // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.PERSONAS, "Read")) { // Load selector control and initialize it personaSelector = (UniSelector)Page.LoadUserControl("~/CMSAdminControls/UI/Uniselector/Uniselector.ascx"); if (personaSelector != null) { personaSelector.ID = "personaSelector"; personaSelector.ShortID = "ps"; personaSelector.ObjectType = PredefinedObjectType.PERSONA; personaSelector.ReturnColumnName = "PersonaID"; personaSelector.WhereCondition = "PersonaSiteID = " + SiteContext.CurrentSiteID; personaSelector.SelectionMode = SelectionModeEnum.MultipleButton; personaSelector.DisplayNameFormat = "{%PersonaDisplayName%}"; personaSelector.ResourcePrefix = "personasubscriber"; personaSelector.IsLiveSite = false; personaSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addpersonas.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.PERSONAS, "Personas"))); // Bind an event handler on 'items selected' event personaSelector.OnItemsSelected += PersonaSelector_OnItemsSelected; // Add selector to the header plcSelectCG.Controls.Add(personaSelector); } } } // Initialize mass actions if (drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), SELECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.approvesubscription"), APPROVE)); drpActions.Items.Add(new ListItem(GetString("newsletter.deletesubscription"), REMOVE)); } }