/// <summary> /// Performs actions necessary to show the popup dialog. /// </summary> /// <param name="dialogControl">New dialog control</param> /// <param name="modalPopup">Modal control</param> /// <param name="mode">Dialog mode</param> private void ShowPopup(Control dialogControl, ModalPopupDialog modalPopup, string mode) { // Set new identifiers CurrentModalID = modalPopup.ID; CurrentDialogID = dialogControl.ID; if ((CurrentModal != null) && (CurrentDialog != null)) { // Enable dialog control's viewstate and visibility CurrentDialog.EnableViewState = true; CurrentDialog.Visible = true; // Init title and icon ucTitle.TitleText = GetString("newslettervariant." + mode); plcAddVariant.Visible = mode.EqualsCSafe("addvariant", StringComparison.InvariantCultureIgnoreCase); btnOKAdd.Visible = plcAddVariant.Visible; plcProperties.Visible = mode.EqualsCSafe("properties", StringComparison.InvariantCultureIgnoreCase); btnOKProperties.Visible = plcProperties.Visible; plcRemoveVariant.Visible = mode.EqualsCSafe("removevariant", StringComparison.InvariantCultureIgnoreCase); btnOKRemove.Visible = plcRemoveVariant.Visible; // Show modal popup CurrentModal.Show(); } }
/// <summary> /// Performs actions necessary to show the popup dialog. /// </summary> /// <param name="dialogControl">New dialog control</param> /// <param name="modalPopup">Modal control</param> /// <param name="mode">Dialog mode</param> private void ShowPopup(Control dialogControl, ModalPopupDialog modalPopup, string mode) { // Set new identifiers CurrentModalID = modalPopup.ID; CurrentDialogID = dialogControl.ID; if ((CurrentModal != null) && (CurrentDialog != null)) { // Enable dialog control's viewstate and visibility CurrentDialog.EnableViewState = true; CurrentDialog.Visible = true; // Init title and icon ucTitle.TitleText = GetString("newslettervariant." + mode); string imgPath = null; string helpTopicName = null; switch (mode) { case "addvariant": imgPath = "CMSModules/CMS_Newsletter/variantadd24.png"; helpTopicName = "newsletterab_addvariant"; break; case "properties": imgPath = "CMSModules/CMS_Newsletter/variantedit24.png"; txtPropertyName.Text = hdnParameter.Value; break; case "removevariant": imgPath = "CMSModules/CMS_Newsletter/variantdelete24.png"; break; } ucTitle.TitleImage = GetImageUrl(imgPath, IsLiveSite); if (!string.IsNullOrEmpty(helpTopicName)) { ucTitle.HelpTopicName = helpTopicName; } plcAddVariant.Visible = mode.EqualsCSafe("addvariant", StringComparison.InvariantCultureIgnoreCase); btnOKAdd.Visible = plcAddVariant.Visible; plcProperties.Visible = mode.EqualsCSafe("properties", StringComparison.InvariantCultureIgnoreCase); btnOKProperties.Visible = plcProperties.Visible; plcRemoveVariant.Visible = mode.EqualsCSafe("removevariant", StringComparison.InvariantCultureIgnoreCase); btnOKRemove.Visible = plcRemoveVariant.Visible; // Show modal popup CurrentModal.Show(); } }
/// <summary> /// Performs actions necessary to hide popup dialog. /// </summary> private void HideCurrentPopup() { if ((CurrentModal != null) && (CurrentDialog != null)) { // Hide modal dialog CurrentModal.Hide(); // Reset dialog control's viewstate and visibility CurrentDialog.EnableViewState = false; CurrentDialog.Visible = false; } // Reset identifiers CurrentModalID = null; CurrentDialogID = null; }
/// <summary> /// Performs actions necessary to show the popup dialog. /// </summary> /// <param name="dialogControl">New dialog control</param> /// <param name="modalPopup">Modal control</param> private void ShowPopup(Control dialogControl, ModalPopupDialog modalPopup) { // Set new identifiers CurrentModalID = modalPopup.ID; CurrentDialogID = dialogControl.ID; if ((CurrentModal != null) && (CurrentDialog != null)) { // Enable dialog control's viewstate and visibility CurrentDialog.EnableViewState = true; CurrentDialog.Visible = true; // Show modal popup CurrentModal.Show(); } }
protected void Page_PreRender(object sender, EventArgs e) { SetupControl(); if (!StopProcessing) { var fixHeight = false; if (Visible && pnlUpdate.Visible && !ShouldCloseDialog()) { if (RequestHelper.IsPostBack() && (CurrentModal != null)) { // Show popup after postback CurrentModal.Show(); fixHeight = true; } } pnlAdvancedExport.EnableViewState = (CurrentDialog == pnlAdvancedExport); // Setup the javascript module object config = new { id = ClientID, uniqueId = UniqueID, unigridId = UniGrid.ClientID, hdnParamId = hdnParameter.ClientID, btnFullPostbackUniqueId = btnFullPostback.UniqueID, chlColumnsId = chlColumns.ClientID, hdnDefaultSelectionId = hdnDefaultSelection.ClientID, revRecordsId = revRecords.ClientID, cvColumnsId = cvColumns.ClientID, mdlAdvancedExportId = mdlAdvancedExport.ClientID, fixHeight, alertMessage }; ScriptHelper.EnsurePostbackMethods(this); ScriptHelper.RegisterJQueryDialog(Page); ScriptHelper.RegisterModule(this, "CMS/AdvancedExport", config); } }
protected void Page_PreRender(object sender, EventArgs e) { if (!StopProcessing) { ScriptHelper.RegisterJQueryDialog(Page); // Register control scripts StringBuilder dialogScript = new StringBuilder(); dialogScript.Append(@" function ShowVariantDialog_", ClientID, @"(format, param) { document.getElementById('", hdnParameter.ClientID, @"').value = param;", ControlsHelper.GetPostBackEventReference(this, "##PARAM##").Replace("'##PARAM##'", "format"), @"; }"); dialogScript.Append(@" function DisableList_", ClientID, @"(val) { ShowHideErr('", lblError.ClientID, @"', 0); ShowHideErr('", lblError2.ClientID, @"', 0); elem = document.getElementById('", lstTemplate.ClientID, @"'); if (elem) { elem.disabled = val; } }"); dialogScript.Append(@" function ShowHideErr(elemId, show) { errlabel = document.getElementById(elemId); if (errlabel) { if (show==1) { errlabel.style.display='inline'; } else { errlabel.style.display='none'; } } } function ValidateInput_", ClientID, @"(val) { ShowHideErr('", lblError.ClientID, @"', 0); ShowHideErr('", lblError2.ClientID, @"', 0); elem = document.getElementById(val); if (elem.value.trim() == '') { ShowHideErr('", lblError.ClientID, @"', 1); return true; } lb = document.getElementById('", lstTemplate.ClientID, @"'); if (lb && lb.disabled != true) { hdn = document.getElementById('", hdnSelected.ClientID, @"'); if (hdn) { hdn.value=lb.selectedIndex; if (hdn.value == '' || hdn.value < 0) { ShowHideErr('", lblError2.ClientID, @"', 1); return true; } } } }"); ScriptHelper.RegisterStartupScript(pnlUpdate, typeof(string), "variantDlgScript_" + ClientID, ScriptHelper.GetScript(dialogScript.ToString())); if (Visible && pnlUpdate.Visible) { if (RequestHelper.IsPostBack() && (CurrentModal != null)) { // Show popup after postback CurrentModal.Show(); } } } }
protected void Page_PreRender(object sender, EventArgs e) { SetupControl(); if (!StopProcessing) { ScriptHelper.RegisterJQueryDialog(Page); // Register control scripts StringBuilder exportScript = new StringBuilder(); exportScript.Append(@" function UG_Export_", UniGrid.ClientID, @"(format, param) { document.getElementById('", hdnParameter.ClientID, @"').value = format; if(format == 'advancedexport') {", ControlsHelper.GetPostBackEventReference(this, "##PARAM##").Replace("'##PARAM##'", "format"), @"; } else {", ControlsHelper.GetPostBackEventReference(btnFullPostback, "", false, false), @"; } }"); ScriptHelper.RegisterStartupScript(pnlUpdate, typeof(string), "exportScript_" + ClientID, ScriptHelper.GetScript(exportScript.ToString())); if (Visible && pnlUpdate.Visible && !ShouldCloseDialog()) { if (RequestHelper.IsPostBack() && (CurrentModal != null)) { // Register scripts shared across multiple advanced export controls StringBuilder sharedExportScript = new StringBuilder(); sharedExportScript.Append(@" function ", SET_CHECKED_PREFIX, @"(id, checked) { $cmsj('#' + id + ' :checkbox').attr('checked', checked); return false; } "); StringBuilder modalSupportScripts = new StringBuilder(); // Register script for default column selection modalSupportScripts.Append(@" function ", DEFAULT_SELECTION_PREFIX, chlColumns.ClientID, @"() { var checkBoxes = $cmsj(""input[type='checkbox']"",'#", chlColumns.ClientID, @"'); var defSelStr = document.getElementById('", hdnDefaultSelection.ClientID, @"').value; var defaultSelection = defSelStr.split(','); for (var i = 0; i < checkBoxes.length; i++) { var indexOfChk = $cmsj.inArray(i.toString(), defaultSelection); $cmsj(checkBoxes[i]).attr('checked', (indexOfChk > -1)); } return false; }"); // Register script for keeping correct dialog dimensions modalSupportScripts.Append(@" var numVal = 'none'; var colVal = 'none'; function ", FIX_DIALOG_HEIGHT_PREFIX, ClientID, @"() { var numberValidator = document.getElementById('", revRecords.ClientID, @"'); var columnValidator = document.getElementById('", cvColumns.ClientID, @"'); if((numberValidator != 'undefined') && (columnValidator != 'undefined') && (numberValidator != null) && (columnValidator != null)) { var process = false; if(numVal != numberValidator.style.display) { process = true; } numVal = numberValidator.style.display; if(colVal != columnValidator.style.display) { process = true; } colVal = columnValidator.style.display; if(process) { resizableDialog = true; keepDialogAccesible('", mdlAdvancedExport.ClientID, @"'); } } setTimeout('", FIX_DIALOG_HEIGHT_PREFIX, ClientID, @"()',500); }"); // Register column selection validation script modalSupportScripts.Append(@" function ", VALIDATE_EXPORT_PREFIX, ClientID, @"(source, arguments) { var checked = $cmsj(""input[type='checkbox']:checked"",'#", chlColumns.ClientID, @"'); arguments.IsValid = (checked.length > 0); } "); ScriptHelper.RegisterStartupScript(pnlUpdate, typeof(string), "sharedExportScript", ScriptHelper.GetScript(sharedExportScript.ToString())); ScriptHelper.RegisterStartupScript(pnlUpdate, typeof(string), "modalSupportScripts_" + ClientID, ScriptHelper.GetScript(modalSupportScripts.ToString())); ScriptHelper.RegisterStartupScript(this, typeof(string), "fixDialogHeight" + ClientID, ScriptHelper.GetScript("setTimeout('" + FIX_DIALOG_HEIGHT_PREFIX + ClientID + "()',500);")); // Show popup after postback CurrentModal.Show(); } } pnlAdvancedExport.EnableViewState = (CurrentDialog == pnlAdvancedExport); } }
protected override void OnPreRender(EventArgs e) { bool errorOccurred = !string.IsNullOrEmpty(lblError.Text); if (StopProcessing) { Visible = false; } else { // AllowSave property needs to be accessed to initialize the security properties in context of updated document instance - CM-815 bool initSecurity = propertiesElem.AllowSave; // Render the styles link if live site mode if (PortalContext.ViewMode.IsLiveSite()) { CSSHelper.RegisterDesignMode(Page); } pnlUpdate.Visible = !errorOccurred; btnLocalizeSaveClose.Visible = localizeElem.Visible && localizeElem.AllowSave; // Ensure correct dialog buttons if ((CurrentModal != null) && (((CurrentModal == mdlProperties) && (propertiesElem.Node != null)) || ((CurrentModal == mdlLocalize) && (localizeElem.Node != null)))) { bool properties = (CurrentModal == mdlProperties); // Get workflow information WorkflowInfo wi = DocumentManager.Workflow; if (wi != null) { if (!wi.WorkflowAutoPublishChanges) { if (!properties) { btnLocalizeSaveClose.Visible = false; } } } } } // Set up the captions btnClose1.ResourceString = btnLocalizeSaveClose.Visible ? "general.cancel" : "general.close"; btnClose2.ResourceString = "general.close"; if (Visible && pnlUpdate.Visible) { if (RequestHelper.IsPostBack() && (CurrentModal != null)) { // Show popup after postback CurrentModal.Show(); } } lblError.Visible = errorOccurred && (PortalContext.IsDesignMode(PortalContext.ViewMode)); // Set viewstate pnlLocalizePopup.EnableViewState = (CurrentDialog == pnlLocalizePopup); pnlCopyPopup.EnableViewState = (CurrentDialog == pnlCopyPopup); pnlDeletePopup.EnableViewState = (CurrentDialog == pnlDeletePopup); pnlPermissionsPopup.EnableViewState = (CurrentDialog == pnlPermissionsPopup); pnlVersionsPopup.EnableViewState = (CurrentDialog == pnlVersionsPopup); pnlPropertiesPopup.EnableViewState = (CurrentDialog == pnlPropertiesPopup); }