/// <summary>
 /// Appends additional query parameters.
 /// </summary>
 protected void Control_OnTabCreated(object sender, TabCreatedEventArgs e)
 {
     if ((e.Tab != null) && !String.IsNullOrEmpty(deviceName))
     {
         e.Tab.RedirectUrl = URLHelper.AddParameterToUrl(e.Tab.RedirectUrl, "devicename", deviceName);
         e.Tab.RedirectUrl = ApplicationUrlHelper.AppendDialogHash(e.Tab.RedirectUrl);
     }
 }
    private static string GetRedirectUrl(int issueId)
    {
        var url = UIContextHelper.GetElementUrl(ModuleName.NEWSLETTER, "EditIssueProperties");

        url = URLHelper.AddParameterToUrl(url, "tabname", EmailBuilderHelper.EMAIL_BUILDER_UI_ELEMENT);
        url = URLHelper.AddParameterToUrl(url, "objectid", issueId.ToString());
        url = URLHelper.PropagateUrlParameters(url, "parentobjectid");
        url = ApplicationUrlHelper.AppendDialogHash(url);

        return(url);
    }
    /// <summary>
    /// Sets url for redirect after creating abtest.
    /// </summary>
    private void SetRedirectUrlAfterCreate()
    {
        string url = UIContextHelper.GetElementUrl("CMS.MVTest", "Detail");

        url = URLHelper.AddParameterToUrl(url, "objectID", "{%EditedObject.ID%}");
        url = URLHelper.AddParameterToUrl(url, "saved", "1");

        url = URLHelper.PropagateUrlParameters(url, "aliaspath", "nodeid", "displayTitle", "dialog");

        url = ApplicationUrlHelper.AppendDialogHash(url);

        form.RedirectUrlAfterCreate = url;
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Setup help
        object options = new
        {
            helpName = "lnkProductEditHelp",
            helpUrl  = DocumentationHelper.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.general.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 = UrlResolver.ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_New.aspx?ProductID=" + sku.SKUID + "&dialog=1");
                dialogUrl = ApplicationUrlHelper.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>
    /// Occurs when new transformation is saved.
    /// </summary>
    protected void ucTransf_OnSaved(object sender, EventArgs e)
    {
        //Transfer to transformation list
        var query = String.Format("?objectid={0}&classid={1}", ucTransf.TransInfo.TransformationID, ucTransf.DocumentTypeID);

        var url = UIContextHelper.GetElementUrl("CMS.DocumentEngine", "EditTransformation");

        url = URLHelper.AppendQuery(url, RequestContext.CurrentQueryString);
        url = URLHelper.AppendQuery(url, query);

        if (editOnlyCode)
        {
            // Add hash for dialog URL, dialog=1 is added by CurrentQueryString append.
            url = ApplicationUrlHelper.AppendDialogHash(url);
        }

        URLHelper.Redirect(url);
    }
示例#6
0
    private string GetRedirectUrl(IssueInfo issue)
    {
        var url = UIContextHelper.GetElementUrl(ModuleName.NEWSLETTER, "EditIssueProperties");

        url = URLHelper.AddParameterToUrl(url, "tabname", EmailBuilderHelper.EMAIL_BUILDER_UI_ELEMENT);

        if (IsDialog)
        {
            url = URLHelper.PropagateUrlParameters(url, "dialog", "returnhandler", "returntype");
        }

        url = URLHelper.PropagateUrlParameters(url, "isinautomation");
        url = URLHelper.AddParameterToUrl(url, "objectid", issue.IssueGUID.ToString());
        url = URLHelper.AddParameterToUrl(url, "parentobjectid", issue.IssueNewsletterID.ToString());
        url = ApplicationUrlHelper.AppendDialogHash(url);

        return(url);
    }
示例#7
0
    /// <summary>
    /// Handler for email properties save action.
    /// </summary>
    private void RightPanelSave(object sender, EmailBuilderEventArgs eventArgs)
    {
        if (eventArgs.FullRefresh)
        {
            mIsFullRefresh = true;

            ScriptHelper.RegisterStartupScript(Page, typeof(string), "RefreshParent", ScriptHelper.GetScript(REFRESH_PARENT_SCRIPT));
            return;
        }

        var issueNavigationUrl = EmailBuilderHelper.GetNavigationUrl(eventArgs.NewsletterID, eventArgs.IssueID, IsInAutomation, eventArgs.SelectedTabIndex, eventArgs.SelectedTabIndex == 1);

        if (IsDialog)
        {
            issueNavigationUrl = URLHelper.PropagateUrlParameters(issueNavigationUrl, "dialog", "returnhandler");
            issueNavigationUrl = ApplicationUrlHelper.AppendDialogHash(issueNavigationUrl);
        }

        URLHelper.Redirect(issueNavigationUrl);
    }
示例#8
0
    /// <summary>
    /// Actions handler.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        if (e.CommandName.ToLowerInvariant() == "save")
        {
            if (editElem.Save())
            {
                string url = UIContextHelper.GetElementUrl(ModuleName.NEWSLETTER, "EditIssueProperties");
                url = URLHelper.AddParameterToUrl(url, "tabname", "Newsletter.Issue.Content");
                url = URLHelper.AddParameterToUrl(url, "objectid", editElem.IssueID.ToString());
                url = URLHelper.PropagateUrlParameters(url, "parentobjectid");
                url = ApplicationUrlHelper.AppendDialogHash(url);
                URLHelper.Redirect(url);
            }
            else
            {
                MessagesPlaceHolder.ShowError(editElem.ErrorMessage);

                // Refresh content of editable regions in the issue body
                editElem.RefreshEditableRegions();
            }
        }
    }
    private void ProcessDialog(WebPartContainerInfo webPartContainer, bool closeOnSave)
    {
        WebPartContainerSiteInfoProvider.AddContainerToSite(webPartContainer, SiteContext.CurrentSite);

        ScriptHelper.RegisterWOpenerScript(this);
        string returnHandler = QueryHelper.GetControlClientId("returnhandler", String.Empty);
        string script        = $"if (wopener && wopener.{returnHandler}) {{ wopener.{returnHandler}('{webPartContainer.ContainerName}'); }}";

        // Redirects to edit window or simply closes the current window
        if (closeOnSave)
        {
            script += "CloseDialog();";
        }
        else
        {
            UIElementInfo ui = UIElementInfoProvider.GetUIElementInfo("cms.Design", "EditWebPartContainer");
            if (ui != null)
            {
                // Create base URL for element
                String url = UIContextHelper.GetElementUrl(ui, UIContext);

                // Append object ID
                url = URLHelper.AddParameterToUrl(url, "objectid", webPartContainer.ContainerID.ToString());

                // Append actual query string parameters
                url = URLHelper.AddParameterToUrl(url, "returnhandler", QueryHelper.GetString("returnhandler", String.Empty));
                url = URLHelper.AddParameterToUrl(url, "dialog", "1");
                url = URLHelper.AddParameterToUrl(url, "aliaspath", QueryHelper.GetString("aliaspath", String.Empty));
                url = URLHelper.AddParameterToUrl(url, "instanceguid", QueryHelper.GetString("instanceguid", String.Empty));

                // Append dialog hash
                url = ApplicationUrlHelper.AppendDialogHash(url);

                script += "window.location.replace('" + ResolveUrl(url) + "');";
            }
        }

        ScriptHelper.RegisterStartupScript(this, GetType(), "UpdateSelector", script, true);
    }
    private void grid_OnAction(string actionName, object actionArgument)
    {
        if (string.IsNullOrEmpty(actionName))
        {
            return;
        }

        int skuId = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName.ToLowerInvariant())
        {
        case "edit":
            // Show product tabs for type Products, otherwise show only general tab
        {
            var url = UIContextHelper.GetElementUrl(ModuleName.ECOMMERCE, "ProductOptions.Options.General");
            url = URLHelper.AddParameterToUrl(url, "displaytitle", "false");
            url = URLHelper.AddParameterToUrl(url, "productId", skuId.ToString());
            url = URLHelper.AddParameterToUrl(url, "categoryid", categoryId.ToString());
            url = URLHelper.AddParameterToUrl(url, "siteId", categoryObj.CategorySiteID.ToString());
            url = URLHelper.AddParameterToUrl(url, "objectid", skuId.ToString());
            // To be able to hide tax class tab for attribute and text option
            url = URLHelper.AddParameterToUrl(url, "parentobjectid", categoryId.ToString());

            // Add parent product id
            if (parentProductId > 0)
            {
                url += "&parentProductId=" + parentProductId;
            }

            if (QueryHelper.GetBoolean("isindialog", false))
            {
                url = URLHelper.AddParameterToUrl(url, "isindialog", "1");
                url = ApplicationUrlHelper.AppendDialogHash(url);
            }

            URLHelper.Redirect(url);
        }
        break;

        case "delete":
            // Check permissions
            CheckModifyPermission();

            // Check dependencies
            if (SKUInfoProvider.CheckDependencies(skuId))
            {
                // Show error message
                ShowError(EcommerceUIHelper.GetDependencyMessage(SKUInfoProvider.GetSKUInfo(skuId)));

                return;
            }

            // Check if same variant is defined by this option
            DataSet variants = VariantOptionInfoProvider.GetVariantOptions()
                               .TopN(1)
                               .Columns("VariantSKUID")
                               .WhereEquals("OptionSKUID", skuId);

            if (!DataHelper.DataSourceIsEmpty(variants))
            {
                // Option is used in some variant
                ShowError(GetString("com.option.usedinvariant"));

                return;
            }

            SKUInfoProvider.DeleteSKUInfo(skuId);
            ugOptions.ReloadData();

            break;
        }
    }
示例#11
0
    /// <summary>
    /// Sets buttons actions.
    /// </summary>
    protected void Initialize()
    {
        ScriptHelper.RegisterDialogScript(Page);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "GetSelectedItem" + ItemType, ScriptHelper.GetScript(@"
            function getSelectedItem_" + ItemType + @"() { 
				if (document.getElementById('"                 + brsItems.UniSelectorClientID + @"') != null) {
					return document.getElementById('"                     + brsItems.UniSelectorClientID + @"').value;
				}
				return 0;
			}

            function DeleteItem_" + ItemType + @"() {
				if ((document.getElementById('"                 + brsItems.UniSelectorClientID + @"') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + @"').value != '0')) {
					if (confirm("                     + ScriptHelper.GetLocalizedString("general.confirmdelete") + @")) {
						document.getElementById('"                         + hdnItemId.ClientID + @"').value = getSelectedItem_" + ItemType + @"(); 
						"                         + Page.ClientScript.GetPostBackEventReference(btnHdnDelete, null) + @" 
					}
				} else { 
					alert("                     + ScriptHelper.GetLocalizedString("Reporting_General.SelectObjectFirst") + @"); 
				}
			}

            function InserMacro_" + ItemType + @"() {
				if ((document.getElementById('"                 + brsItems.UniSelectorClientID + @"') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + @"').value != '0')) {
					PageMethods.GetReportItemName('"                     + ReportInfoProvider.ReportItemTypeToString(ItemType) + "',getSelectedItem_" + ItemType + "(),OnComplete_" + ItemType + @");
				} else { 
					alert("                     + ScriptHelper.GetLocalizedString("Reporting_General.SelectObjectFirst") + @"); 
				}
            }

			function OnComplete_"             + ItemType + @"(result, response, context) {
				InsertHTML('%%control:Report"                 + ItemType + "?" + Report.ReportName + @".' + result +'%%');
            }

            function CloneItem_" + ItemType + @"(id) {
				if ((document.getElementById('"                 + brsItems.UniSelectorClientID + @"') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + @"').value != '0')) { 
					modalDialog('"                     + UrlResolver.ResolveUrl("~/CMSModules/Objects/Dialogs/CloneObjectDialog.aspx?objectType=" + GetObjectType() + @"&objectId=' + id") + @", 'CloneObject', 750, 470);
				} else { 
					alert("                     + ScriptHelper.GetLocalizedString("Reporting_General.SelectObjectFirst") + @"); 
				}
            }"));


        const string MODAL_HEIGHT = "'85%'";
        const string MODAL_WIDTH  = "950";


        if (Report != null)
        {
            string baseUrl = URLHelper.AddParameterToUrl(ResolveUrl(EditUrl), "reportId", Report.ReportID.ToString());
            string fullUrl = ApplicationUrlHelper.AppendDialogHash(baseUrl);

            btnAdd.Actions.Add(new CMSButtonAction()
            {
                OnClientClick = "modalDialog('" + fullUrl + "','ReportItemEdit'," + MODAL_WIDTH + "," + MODAL_HEIGHT + ");return false;",
                Text          = GetString("general.new")
            });

            fullUrl = URLHelper.AddParameterToUrl(baseUrl, "preview", "true");
            fullUrl = ApplicationUrlHelper.AppendDialogHash(fullUrl);

            btnAdd.Actions.Add(new CMSButtonAction()
            {
                OnClientClick = "if (getSelectedItem_" + ItemType + "() != '0') { modalDialog('" + fullUrl + "&objectid='+ getSelectedItem_" + ItemType + "(),'ReportItemEdit'," + MODAL_WIDTH + "," + MODAL_HEIGHT + "); } else { alert(" + ScriptHelper.GetLocalizedString("Reporting_General.SelectObjectFirst") + ");} return false;",
                Text          = GetString("general.preview")
            });

            fullUrl = ApplicationUrlHelper.AppendDialogHash(baseUrl);

            btnAdd.Actions.Add(new CMSButtonAction()
            {
                OnClientClick = "if (getSelectedItem_" + ItemType + "() != '0') { modalDialog('" + fullUrl + "&objectid='+ getSelectedItem_" + ItemType + "(),'ReportItemEdit'," + MODAL_WIDTH + "," + MODAL_HEIGHT + "); } else { alert(" + ScriptHelper.GetLocalizedString("Reporting_General.SelectObjectFirst") + ");} return false;",
                Text          = GetString("general.edit")
            });

            btnAdd.Actions.Add(new CMSButtonAction()
            {
                OnClientClick = "DeleteItem_" + ItemType + "(); return false;",
                Text          = GetString("general.delete")
            });

            btnAdd.Actions.Add(new CMSButtonAction()
            {
                OnClientClick = "CloneItem_" + ItemType + @"(getSelectedItem_" + ItemType + "()); return false;",
                Text          = GetString("general.clone")
            });

            btnInsert.OnClientClick = "InserMacro_" + ItemType + "(); return false;";
        }
    }