protected override void OnPreRender(EventArgs e) { string script = @" function GenerateDefaultCode(type){ " + ControlsHelper.GetPostBackEventReference(this, "#").Replace("'#'", "type") + @" }"; ScriptHelper.RegisterStartupScript(this, typeof(string), "TransformationCodeGenerate", ScriptHelper.GetScript(script)); // Init transformation help link lnkHelp.NavigateUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_TRANSFORMATION_METHODS_LINK); lnkHelp.Target = "_target"; lnkHelp.Text = GetString("documenttype_edit_transformation.help"); pnlDirectives.Visible = IsAscx; txtCode.ReadOnly = !Enabled; tbWysiwyg.Enabled = Enabled; lblDirectives.Visible = IsAscx; // Check whether virtual objects are allowed if (!SettingsKeyInfoProvider.VirtualObjectsAllowed) { ShowWarning(GetString("VirtualPathProvider.NotRunning"), null, null); } base.OnPreRender(e); }
protected void Page_Load(object sender, EventArgs e) { product = SKUInfoProvider.GetSKUInfo(ProductID); // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); EditedObject = product; if (product != null) { // Check site id CheckEditedObjectSiteID(product.SKUSiteID); // Load product currency productCurrency = CurrencyInfoProvider.GetMainCurrency(product.SKUSiteID); // Display product price headProductPriceInfo.Text = string.Format(GetString("com_sku_volume_discount.skupricelabel"), CurrencyInfoProvider.GetFormattedPrice(product.SKUPrice, productCurrency)); } // Set unigrid properties SetUnigridProperties(); // Initialize the master page elements InitializeMasterPage(); }
protected void Page_Load(object sender, EventArgs e) { // Registration to chat webservice AbstractCMSPage cmsPage = Page as AbstractCMSPage; if (cmsPage != null) { ChatHelper.RegisterChatAJAXProxy(cmsPage); } // Script references insertion ChatHelper.RegisterChatManager(Page); ScriptHelper.RegisterJQueryUI(Page); ScriptHelper.RegisterScriptFile(Page, "jquery/jquery-a-tools.js"); ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/BBCodeParser.js"); ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatMessageSend_files/ChatMessageSend.js"); imgInformationDialog.ImageUrl = GetImageUrl("General/Labels/Information.png"); RoomID = ChatHelper.GetRoomIdFromQuery(RoomID, GroupID); // Register startup script ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatMessageSend_" + ClientID, BuildStartupScript(), true); // Set link to documentation and tooltip for canned responses lnkCannedRespHelp.NavigateUrl = UIContextHelper.GetDocumentationTopicUrl(CANNED_RESPONSES_HELP_TOPIC); lnkCannedRespHelp.ToolTip = ResHelper.GetString("chat.cannedresponses.helplabel"); }
protected void Page_Load(object sender, EventArgs e) { // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); //No need to check changes DocumentManager.RegisterSaveChangesScript = false; // Check UI personalization for product / product option separately if (OptionCategoryID > 0) { // Check elements in product options categories subtree CheckUIElementAccessHierarchical("CMS.Ecommerce", "ProductOptions.Options.TaxClasses"); } else { CheckUIElementAccessHierarchical("CMS.Ecommerce", "Products.TaxClasses"); } if (ProductID > 0) { sku = SKUInfoProvider.GetSKUInfo(ProductID); EditedObject = sku; if (sku != null) { // Check products site id CheckEditedObjectSiteID(sku.SKUSiteID); taxForm.ProductID = ProductID; taxForm.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged; if (sku.IsProductOption) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(sku.SKUOptionCategoryID); if (categoryInfo != null) { CreateBreadcrumbs(sku); if (categoryInfo.CategoryType != OptionCategoryTypeEnum.Products) { ShowError(GetString("com.taxesNotSupportedForOptionType")); taxForm.Visible = false; } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Product != null) { CheckEditedObjectSiteID(Product.SKUSiteID); } if (!URLHelper.IsPostback()) { // Show confirmation message after generation of variants on generation page was successful if (QueryHelper.GetBoolean("saved", false)) { ShowConfirmation(GetString("com.variants.generated")); } } // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); // Setup asynchronous control SetupControl(); // Init action selection InitBulkActionDropdownLists(); string warningMessage = VariantsCanBeGenerated(); if (string.IsNullOrEmpty(warningMessage)) { string url = "~/CMSModules/Ecommerce/Pages/Tools/Products/Variant_New.aspx"; url = URLHelper.AddParameterToUrl(url, "ProductID", ProductID.ToString()); url = URLHelper.AddParameterToUrl(url, "dialog", QueryHelper.GetString("dialog", "0")); // Allow user to generate variants CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction() { Text = GetString("com.products.newvariant"), RedirectUrl = ResolveUrl(url) }); } else { ShowWarning(warningMessage); } }
protected void Page_Load(object sender, EventArgs e) { // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); if (ProductID > 0) { sku = SKUInfoProvider.GetSKUInfo(ProductID); EditedObject = sku; if (sku != null) { // Check site ID CheckEditedObjectSiteID(sku.SKUSiteID); ucOptions.ProductID = ProductID; // Add new category button in HeaderAction CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction { Text = GetString("com.productoptions.select"), OnClientClick = ucOptions.GetAddCategoryJavaScript(), Enabled = ECommerceContext.IsUserAuthorizedToModifySKU(sku.IsGlobal) }); // New button is active in editing of global product only if global option categories are allowed and user has GlobalModifyPermission permission bool enabledButton = (sku.IsGlobal) ? ECommerceSettings.AllowGlobalProductOptions(CurrentSiteName) && ECommerceContext.IsUserAuthorizedToModifyOptionCategory(true) : ECommerceContext.IsUserAuthorizedToModifyOptionCategory(false); // Create new enabled/disabled category button in HeaderAction var dialogUrl = URLHelper.ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_New.aspx?ProductID=" + sku.SKUID + "&dialog=1"); dialogUrl = UIContextHelper.AppendDialogHash(dialogUrl); CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction { Text = GetString("com.productoptions.new"), Enabled = enabledButton, ButtonStyle = ButtonStyle.Default, OnClientClick = "modalDialog('" + dialogUrl + "','NewOptionCategoryDialog', 1000, 800);" }); } } }
/// <summary> /// Handles external data bound. /// Renders link to help page and enables/disables grid editing buttons. /// </summary> private object Control_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerCSafe()) { case "helptopiclink": { string linkUrl = (string)parameter; linkUrl = UIContextHelper.GetDocumentationTopicUrl(linkUrl); return(String.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", linkUrl, HTMLHelper.HTMLEncode(linkUrl))); } case "delete_modify": case "moveup_modify": case "movedown_modify": CMSGridActionButton button = (CMSGridActionButton)sender; button.Enabled = EditingEnabled; break; } return(parameter); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); iconHelp.Attributes["class"] = IconName + " " + IconCssClass; iconHelp.Attributes["title"] = Tooltip; if (!String.IsNullOrEmpty(TopicName)) { lnkHelp.NavigateUrl = UIContextHelper.GetDocumentationTopicUrl(TopicName); } // Render help name script if (!String.IsNullOrEmpty(HelpName)) { object options = new { helpName = HelpName, helpLinkId = lnkHelp.ClientID, helpHidden = String.IsNullOrEmpty(TopicName) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelp", options); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); if (IsProductOption) { // Check UI personalization for product option CheckUIElementAccessHierarchical("CMS.Ecommerce", "ProductOptions.Options.General"); } else { // Check UI personalization for product CheckUIElementAccessHierarchical("CMS.Ecommerce", "Products.General"); } }
protected void Page_Load(object sender, EventArgs e) { // Register script for pendingCallbacks repair ScriptHelper.FixPendingCallbacks(Page); // Handle export settings if (!RequestHelper.IsCallback() && !RequestHelper.IsPostBack()) { ExportSettings = GetNewSettings(); } if (!RequestHelper.IsCallback()) { // Display BETA warning lblBeta.Visible = CMSVersion.IsBetaVersion(); lblBeta.Text = string.Format(GetString("export.BETAwarning"), CMSVersion.GetFriendlySystemVersion(false)); bool notTargetPermissions = false; bool notTempPermissions = false; ctrlAsync.OnFinished += ctrlAsync_OnFinished; ctrlAsync.OnError += ctrlAsync_OnError; // Init steps if (wzdExport.ActiveStepIndex < 2) { configExport.Settings = ExportSettings; if (!RequestHelper.IsPostBack()) { configExport.SiteId = SiteId; } pnlExport.Settings = ExportSettings; // Ensure directories and check permissions try { DirectoryHelper.EnsureDiskPath(ExportSettings.TargetPath + "\\temp.file", ExportSettings.WebsitePath); notTargetPermissions = !DirectoryHelper.CheckPermissions(ExportSettings.TargetPath, true, true, false, false); } catch (UnauthorizedAccessException) { notTargetPermissions = true; } catch (IOExceptions.IOException ex) { pnlWrapper.Visible = false; SetErrorLabel(ex.Message); return; } try { DirectoryHelper.EnsureDiskPath(ExportSettings.TemporaryFilesPath + "\\temp.file", ExportSettings.WebsitePath); notTempPermissions = !DirectoryHelper.CheckPermissions(ExportSettings.TemporaryFilesPath, true, true, false, false); } catch (UnauthorizedAccessException) { notTempPermissions = true; } catch (IOExceptions.IOException ex) { pnlWrapper.Visible = false; SetErrorLabel(ex.Message); return; } } if (notTargetPermissions || notTempPermissions) { string folder = (notTargetPermissions) ? ExportSettings.TargetPath : ExportSettings.TemporaryFilesPath; pnlWrapper.Visible = false; SetErrorLabel(String.Format(GetString("ExportSite.ErrorPermissions"), folder, WindowsIdentity.GetCurrent().Name)); pnlPermissions.Visible = true; lnkPermissions.Target = "_blank"; lnkPermissions.Text = GetString("Install.ErrorPermissions"); lnkPermissions.NavigateUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_DISKPERMISSIONS_LINK); } else { // Try to delete temporary files from previous export if (!RequestHelper.IsPostBack()) { try { ExportProvider.DeleteTemporaryFiles(ExportSettings, false); } catch (Exception ex) { pnlWrapper.Visible = false; SetErrorLabel(GetString("ImportSite.ErrorDeletionTemporaryFiles") + ex.Message); return; } } PortalHelper.EnsureScriptManager(Page).EnablePageMethods = true; // Javascript functions string script = @"var exMessageText = ''; var exErrorText = ''; var exWarningText = ''; var exMachineName = '" + SystemContext.MachineName.ToLowerCSafe() + @"'; var getBusy = false; function GetExportState(cancel) { if (window.Activity) { window.Activity(); } if (getBusy) return; getBusy = true; setTimeout('getBusy = false;', 2000); var argument = cancel + ';' + exMessageText.length + ';' + exErrorText.length + ';' + exWarningText.length + ';' + exMachineName; " + Page.ClientScript.GetCallbackEventReference(this, "argument", "SetExportStateMssg", "argument", false) + @"; } function SetExportStateMssg(rValue, context) { getBusy = false; if (rValue!='') { var args = context.split(';'); var values = rValue.split('" + SiteExportSettings.SEPARATOR + @"'); var messageElement = document.getElementById('" + lblProgress.ClientID + @"'); var errorElement = document.getElementById('" + lblError.ClientID + @"'); var warningElement = document.getElementById('" + lblWarning.ClientID + @"'); var messageText = exMessageText; messageText = values[1] + messageText.substring(messageText.length - args[1]); if (messageText.length > exMessageText.length) { exMessageText = messageElement.innerHTML = messageText; } var errorText = exErrorText; errorText = values[2] + errorText.substring(errorText.length - args[2]); if (errorText.length > exErrorText.length) { exErrorText = errorElement.innerHTML = errorText; document.getElementById('" + pnlError.ClientID + @"').style.removeProperty('display'); } var warningText = exWarningText; warningText = values[3] + warningText.substring(warningText.length - args[3]); if (warningText.length > exWarningText.length) { exWarningText = warningElement.innerHTML = warningText; document.getElementById('" + pnlWarning.ClientID + @"').style.removeProperty('display'); } if ((values=='') || (values[0]=='F')) { StopExportStateTimer(); var actDiv = document.getElementById('actDiv'); if (actDiv != null) { actDiv.style.display = 'none'; } BTN_Enable('" + FinishButton.ClientID + @"'); try { BTN_Disable('" + CancelButton.ClientID + @"'); } catch(err) { } } } }"; // Register the script to perform get flags for showing buttons retrieval callback ScriptHelper.RegisterClientScriptBlock(this, GetType(), "GetSetExportState", ScriptHelper.GetScript(script)); // Add cancel button attribute CancelButton.Attributes.Add("onclick", "BTN_Disable('" + CancelButton.ClientID + "'); return CancelExport();"); wzdExport.NextButtonClick += wzdExport_NextButtonClick; wzdExport.PreviousButtonClick += wzdExport_PreviousButtonClick; wzdExport.FinishButtonClick += wzdExport_FinishButtonClick; if (!RequestHelper.IsPostBack()) { configExport.InitControl(); } } } }
protected void Page_Load(object sender, EventArgs e) { // Register script for pendingCallbacks repair ScriptHelper.FixPendingCallbacks(Page); // Handle Import settings if (!RequestHelper.IsCallback() && !RequestHelper.IsPostBack()) { // Initialize import settings ImportSettings = GetNewSettings(); } if (!RequestHelper.IsCallback()) { if (!VirtualPathHelper.UsingVirtualPathProvider) { SetWarningLabel(GetString("ImportSite.VirtualPathProviderNotRunning")); } ctrlAsync.OnFinished += ctrlAsync_OnFinished; ctrlAsync.OnError += ctrlAsync_OnError; bool notTempPermissions = false; if (wzdImport.ActiveStepIndex < 3) { stpConfigImport.Settings = ImportSettings; stpSiteDetails.Settings = ImportSettings; stpImport.Settings = ImportSettings; // Ensure directory try { DirectoryHelper.EnsureDiskPath(ImportSettings.TemporaryFilesPath + "\\temp.file", ImportSettings.WebsitePath); } catch (IOExceptions.IOException ex) { pnlWrapper.Visible = false; SetErrorLabel(ex.Message); return; } // Check permissions notTempPermissions = !DirectoryHelper.CheckPermissions(ImportSettings.TemporaryFilesPath, true, true, false, false); } if (notTempPermissions) { pnlWrapper.Visible = false; SetErrorLabel(LocalizationHelper.GetStringFormat("ImportSite.ErrorPermissions", ImportSettings.TemporaryFilesPath, WindowsIdentity.GetCurrent().Name)); pnlPermissions.Visible = true; lnkPermissions.Target = "_blank"; lnkPermissions.Text = GetString("Install.ErrorPermissions"); lnkPermissions.NavigateUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_DISKPERMISSIONS_LINK); } else { if (!RequestHelper.IsPostBack()) { // Delete temporary files try { // Delete only folder structure if there is not special folder bool onlyFolderStructure = !Directory.Exists(DirectoryHelper.CombinePath(ImportSettings.TemporaryFilesPath, ImportExportHelper.FILES_FOLDER)); ImportProvider.DeleteTemporaryFiles(ImportSettings, onlyFolderStructure); } catch (Exception ex) { pnlWrapper.Visible = false; SetErrorLabel(GetString("ImportSite.ErrorDeletionTemporaryFiles") + ex.Message); return; } } // Javascript functions string script = "var imMessageText = '';\n" + "var imErrorText = '';\n" + "var imWarningText = '';\n" + "var imMachineName = '" + SystemContext.MachineName.ToLowerCSafe() + "';\n" + "var getBusy = false;\n" + "function GetImportState(cancel)\n" + "{ if(window.Activity){window.Activity();} if (getBusy && !cancel) return; getBusy = true; setTimeout(\"getBusy = false;\", 2000); var argument = cancel + ';' + imMessageText.length + ';' + imErrorText.length + ';' + imWarningText.length + ';' + imMachineName; return " + Page.ClientScript.GetCallbackEventReference(this, "argument", "SetImportStateMssg", "argument", true) + " }\n"; script += "function SetImportStateMssg(rValue, context)\n" + "{\n" + " getBusy = false;\n" + " if(rValue != '')\n" + " {\n" + " var args = context.split(';');\n" + " var values = rValue.split('" + SiteExportSettings.SEPARATOR + "');\n" + " var messageElement = document.getElementById('" + lblProgress.ClientID + "');\n" + " var errorElement = document.getElementById('" + lblError.ClientID + "');\n" + " var warningElement = document.getElementById('" + lblWarning.ClientID + "');\n" + " var messageText = imMessageText;\n" + " messageText = values[1] + messageText.substring(messageText.length - args[1]);\n" + " if(messageText.length > imMessageText.length){ imMessageText = messageElement.innerHTML = messageText; }\n" + " var errorText = imErrorText;\n" + " errorText = values[2] + errorText.substring(errorText.length - args[2]);\n" + " if(errorText.length > imErrorText.length){ imErrorText = errorElement.innerHTML = errorText; document.getElementById('" + pnlError.ClientID + "').style.removeProperty('display'); }\n" + " var warningText = imWarningText;\n" + " warningText = values[3] + warningText.substring(warningText.length - args[3]);\n" + " if(warningText.length > imWarningText.length){ imWarningText = warningElement.innerHTML = warningText; document.getElementById('" + pnlWarning.ClientID + "').style.removeProperty('display'); }\n" + " if((values=='') || (values[0]=='F'))\n" + " {\n" + " StopImportStateTimer();\n" + " var actDiv = document.getElementById('actDiv'); \n" + " if (actDiv != null) { actDiv.style.display = 'none'; } \n" + " BTN_Disable('" + CancelButton.ClientID + "');\n" + " BTN_Enable('" + FinishButton.ClientID + "');\n" + " }\n" + " }\n" + "}\n"; // Register the script to perform get flags for showing buttons retrieval callback ScriptHelper.RegisterClientScriptBlock(this, GetType(), "GetSetImportState", ScriptHelper.GetScript(script)); // Add cancel button attribute CancelButton.Attributes.Add("onclick", "BTN_Disable('" + CancelButton.ClientID + "');" + "return CancelImport();"); wzdImport.NextButtonClick += wzdImport_NextButtonClick; wzdImport.PreviousButtonClick += wzdImport_PreviousButtonClick; wzdImport.FinishButtonClick += wzdImport_FinishButtonClick; if (!RequestHelper.IsPostBack()) { stpConfigImport.InitControl(); } } } }