/// <summary> /// Setup control. /// </summary> private void SetupControl() { mCanRemoveAutomationProcesses = WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteContext.CurrentSiteName); if (!RequestHelper.IsPostBack() && (PageSize > 0)) { listElem.Pager.DefaultPageSize = PageSize; } listElem.ZeroRowsText = GetString("ma.pendingcontacts.nowaitingcontacts"); listElem.EditActionUrl = "Process_Detail.aspx?stateid={0}&siteid=" + SiteContext.CurrentSiteID; listElem.RememberStateByParam = String.Empty; listElem.OnExternalDataBound += listElem_OnExternalDataBound; // Register scripts for contact details dialog ScriptHelper.RegisterDialogScript(Page); ScriptHelper.RegisterWOpenerScript(Page); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ViewContactDetails", ScriptHelper.GetScript( "function Refresh() { \n " + "window.location.href = window.location.href;\n" + "}")); // If widget register action for view process in dialog if (IsWidget) { ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ViewPendingContactProcess", ScriptHelper.GetScript( "function viewPendingContactProcess(stateId) {" + " modalDialog('" + UrlResolver.ResolveUrl("~/CMSModules/ContactManagement/Pages/Tools/PendingContacts/Process_Detail.aspx") + "?dialog=1&stateId=' + stateId, 'ViewPendingContactProcess', '1024', '800');" + "}")); } }
/// <summary> /// External history binding. /// </summary> protected object gridState_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerCSafe()) { case "stepname": return(HTMLHelper.HTMLEncode(GetStep(parameter).StepDisplayName)); case "processname": return(HTMLHelper.HTMLEncode(GetProcess(parameter).WorkflowDisplayName)); case "status": return(AutomationHelper.GetProcessStatus((ProcessStatusEnum)ValidationHelper.GetInteger(parameter, 0))); case "delete": CMSGridActionButton btn = (CMSGridActionButton)sender; var confirmationMessage = string.Format(ResHelper.GetString("autoMenu.RemoveStateConfirmation"), HTMLHelper.HTMLEncode(TypeHelper.GetNiceObjectTypeName(PredefinedObjectType.CONTACT).ToLowerCSafe())); var confirmationScript = "if(!confirm(" + ScriptHelper.GetString(confirmationMessage) + ")) { return false; } "; // In OnClientClick is JS code to call Unigrid's OnAction, we need to add this code to the end of new JS code to preserve it btn.OnClientClick = confirmationScript + btn.OnClientClick; if (!WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(contactSiteId))) { btn.Enabled = false; } break; } return(parameter); }
protected object listElem_OnExternalDataBound(object sender, string sourceName, object parameter) { CMSGridActionButton btn; switch (sourceName.ToLowerInvariant()) { // Delete action case "delete": btn = (CMSGridActionButton)sender; btn.OnClientClick = "if(!confirm(" + ScriptHelper.GetString(String.Format(ResHelper.GetString("autoMenu.RemoveStateConfirmation"), HTMLHelper.HTMLEncode(TypeHelper.GetNiceObjectTypeName(ContactInfo.OBJECT_TYPE).ToLowerCSafe()))) + ")) { return false; }" + btn.OnClientClick; if (!WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteContext.CurrentSiteName)) { if (btn != null) { btn.Enabled = false; } } break; // Process status column case "statestatus": return(AutomationHelper.GetProcessStatus((ProcessStatusEnum)ValidationHelper.GetInteger(parameter, 0))); } return(null); }
/// <summary> /// External history binding. /// </summary> protected object gridState_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerCSafe()) { case "stepname": return(HTMLHelper.HTMLEncode(GetStep(parameter).StepDisplayName)); case "processname": return(HTMLHelper.HTMLEncode(GetProcess(parameter).WorkflowDisplayName)); case "status": return(AutomationHelper.GetProcessStatus((ProcessStatusEnum)ValidationHelper.GetInteger(parameter, 0))); case "delete": ImageButton btn = (ImageButton)sender; btn.OnClientClick = "if(!confirm(" + ScriptHelper.GetString(string.Format(ResHelper.GetString("autoMenu.RemoveStateConfirmation"), HTMLHelper.HTMLEncode(ResHelper.GetString(TypeHelper.GetObjectTypeResourceKey(PredefinedObjectType.CONTACT)).ToLowerCSafe()))) + ")) { return false; }"; if (!WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(contactSiteId))) { btn.Enabled = false; btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/DeleteDisabled.png")); } break; } return(parameter); }
protected object listElem_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerCSafe()) { // Set visibility for edit button case "edit": if (IsWidget) { ImageButton editbtn = sender as ImageButton; if (editbtn != null) { editbtn.Visible = false; } } break; // Set visibility for dialog edit button case "dialogedit": ImageButton editdialogbtn = sender as ImageButton; if (editdialogbtn != null) { editdialogbtn.Visible = IsWidget; } break; // Delete action case "delete": int siteId = SiteID; if (SiteID == UniSelector.US_GLOBAL_OR_SITE_RECORD) { DataRowView drv = (parameter as GridViewRow).DataItem as DataRowView; int contactSiteId = ValidationHelper.GetInteger(drv["StateSiteID"], 0); if (contactSiteId > 0) { siteId = contactSiteId; } } ImageButton btn = (ImageButton)sender; btn.OnClientClick = "if(!confirm(" + ScriptHelper.GetString(string.Format(ResHelper.GetString("autoMenu.RemoveStateConfirmation"), HTMLHelper.HTMLEncode(ResHelper.GetString(TypeHelper.GetObjectTypeResourceKey(PredefinedObjectType.CONTACT)).ToLowerCSafe()))) + ")) { return false; }"; if (!WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(siteId))) { if (btn != null) { btn.Enabled = false; btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/DeleteDisabled.png")); } } break; } return(null); }
protected object listElem_OnExternalDataBound(object sender, string sourceName, object parameter) { CMSGridActionButton btn; switch (sourceName.ToLowerCSafe()) { // Delete action case "delete": int siteId = SiteID; if (SiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD) { DataRowView drv = (parameter as GridViewRow).DataItem as DataRowView; int contactSiteId = ValidationHelper.GetInteger(drv["StateSiteID"], 0); if (contactSiteId > 0) { siteId = contactSiteId; } } btn = (CMSGridActionButton)sender; btn.OnClientClick = "if(!confirm(" + ScriptHelper.GetString(string.Format(ResHelper.GetString("autoMenu.RemoveStateConfirmation"), HTMLHelper.HTMLEncode(TypeHelper.GetNiceObjectTypeName(ContactInfo.OBJECT_TYPE).ToLowerCSafe()))) + ")) { return false; }" + btn.OnClientClick; if (!WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(siteId))) { if (btn != null) { btn.Enabled = false; } } break; case "view": btn = (CMSGridActionButton)sender; // Ensure accountID parameter value; var objectID = ValidationHelper.GetInteger(btn.CommandArgument, 0); // Contact detail URL string contactURL = UIContextHelper.GetElementDialogUrl(ModuleName.ONLINEMARKETING, "EditContact", objectID, "isSiteManager=" + ContactHelper.IsSiteManager); // Add modal dialog script to onClick action btn.OnClientClick = ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail"); break; // Process status column case "statestatus": return(AutomationHelper.GetProcessStatus((ProcessStatusEnum)ValidationHelper.GetInteger(parameter, 0))); } return(null); }
protected void listElem_OnAction(string actionName, object actionArgument) { switch (actionName) { case "delete": var stateID = ValidationHelper.GetInteger(actionArgument, 0); if (stateID > 0) { var stateInfo = AutomationStateInfoProvider.GetAutomationStateInfo(stateID); if ((stateInfo != null) && WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(stateInfo.StateSiteID))) { AutomationStateInfoProvider.DeleteAutomationStateInfo(stateInfo); } } break; } }
protected object listElem_OnExternalDataBound(object sender, string sourceName, object parameter) { CMSGridActionButton btn; switch (sourceName.ToLowerCSafe()) { // Delete action case "delete": btn = (CMSGridActionButton)sender; btn.OnClientClick = "if(!confirm(" + ScriptHelper.GetString(String.Format(ResHelper.GetString("autoMenu.RemoveStateConfirmation"), HTMLHelper.HTMLEncode(TypeHelper.GetNiceObjectTypeName(ContactInfo.OBJECT_TYPE).ToLowerCSafe()))) + ")) { return false; }" + btn.OnClientClick; if (!WorkflowStepInfoProvider.CanUserRemoveAutomationProcess(CurrentUser, SiteContext.CurrentSiteName)) { if (btn != null) { btn.Enabled = false; } } break; case "view": btn = (CMSGridActionButton)sender; // Ensure accountID parameter value; var objectID = ValidationHelper.GetInteger(btn.CommandArgument, 0); // Contact detail URL string contactURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", objectID); // Add modal dialog script to onClick action btn.OnClientClick = ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail"); break; // Process status column case "statestatus": return(AutomationHelper.GetProcessStatus((ProcessStatusEnum)ValidationHelper.GetInteger(parameter, 0))); } return(null); }