示例#1
0
    private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSGridActionButton btn;

        switch (sourceName.ToLowerCSafe())
        {
        case "edit":
            btn = ((CMSGridActionButton)sender);
            // Ensure accountID parameter value;
            var objectID = ValidationHelper.GetInteger(btn.CommandArgument, 0);
            // Account detail URL
            string accountURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditAccount", objectID);
            // Add modal dialog script to onClick action
            btn.OnClientClick = ScriptHelper.GetModalDialogScript(accountURL, "AccountDetail");
            break;

        case "remove":
            if (!ModifyAccountPermission)
            {
                btn         = (CMSGridActionButton)sender;
                btn.Enabled = false;
            }
            break;
        }

        return(null);
    }
示例#2
0
    /// <summary>
    /// Returns price detail link.
    /// </summary>
    protected string GetPriceDetailLink(object value)
    {
        var priceDetailElemHtml = "";

        if (ShoppingCartControl.EnableProductPriceDetail)
        {
            Guid cartItemGuid = ValidationHelper.GetGuid(value, Guid.Empty);
            if (cartItemGuid != Guid.Empty)
            {
                var query = "itemguid=" + cartItemGuid + GetCMSDeskShoppingCartSessionNameQuery();

                string adminUrl = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.ECOMMERCE, "order.productpricedetail", 0, query);

                var priceDetailButton = new CMSGridActionButton
                {
                    IconCssClass  = "icon-eye",
                    ToolTip       = GetString("shoppingcart.productpricedetail"),
                    OnClientClick = ScriptHelper.GetModalDialogScript(adminUrl, "ProductPriceDetail", 750, 570)
                };

                priceDetailElemHtml = priceDetailButton.GetRenderedHTML();
            }
        }

        return(priceDetailElemHtml);
    }
示例#3
0
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    /// <param name="resourceName">Resource name</param>
    /// <param name="elementName">Element name</param>
    /// <param name="transformation">Transformation object info</param>
    private String GetEditUrl(string resourceName, string elementName, TransformationInfo transformation)
    {
        var uiChild = UIElementInfoProvider.GetUIElementInfo(resourceName, elementName);

        if (uiChild != null)
        {
            string url   = String.Empty;
            string query = RequestContext.CurrentQueryString;

            if (!DialogMode)
            {
                url = UIContextHelper.GetElementUrl(uiChild, UIContext);
                url = URLHelper.AppendQuery(url, query);
            }
            else
            {
                url = ApplicationUrlHelper.GetElementDialogUrl(uiChild, 0, query);
            }


            return(URLHelper.AppendQuery(url, "objectid=" + transformation.TransformationID));
        }

        return(String.Empty);
    }
    /// <summary>
    /// Returns order item edit action HTML.
    /// </summary>
    protected string GetOrderItemEditAction(object value)
    {
        var  editOrderItemElemHtml = "";
        Guid itemGuid = ValidationHelper.GetGuid(value, Guid.Empty);

        if (itemGuid != Guid.Empty)
        {
            var item = ShoppingCartInfoProvider.GetShoppingCartItem(ShoppingCart, itemGuid);

            // Hide edit link for attribute product option
            if (item.IsAttributeOption)
            {
                return(null);
            }

            var query       = "itemguid=" + itemGuid + GetCMSDeskShoppingCartSessionNameQuery();
            var editItemUrl = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.ECOMMERCE, "order.OrderItemProperties", 0, query);

            var priceDetailButton = new CMSGridActionButton
            {
                IconCssClass  = "icon-edit",
                IconStyle     = GridIconStyle.Allow,
                ToolTip       = GetString("shoppingcart.editorderitem"),
                OnClientClick = ScriptHelper.GetModalDialogScript(editItemUrl, "OrderItemEdit", 720, 420)
            };

            editOrderItemElemHtml = priceDetailButton.GetRenderedHTML();
        }

        return(editOrderItemElemHtml);
    }
    /// <summary>
    /// UniGrid external databound.
    /// </summary>
    private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSGridActionButton btn;

        switch (sourceName.ToLowerCSafe())
        {
        // Display delete button
        case "remove":
            btn = sender as CMSGridActionButton;
            if (btn != null)
            {
                btn.Enabled = mAuthorizedToModifyContactGroups;
            }
            break;

        case "edit":
            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;
        }

        return(null);
    }
示例#6
0
    /// <summary>
    /// Page load event handler
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        pnlButtons.Visible = ShowTemplateButtons;
        btnClear.Visible   = DisplayClearButton;

        var template = PageTemplateInfo;

        if (template != null)
        {
            int templateId = template.PageTemplateId;

            if (Enabled)
            {
                // Edit button
                string url = ApplicationUrlHelper.GetElementDialogUrl("cms.design", "PageTemplate.EditPageTemplate", templateId);

                btnEditTemplateProperties.OnClientClick = String.Format("modalDialog('{0}', 'Template edit', '95%', '95%'); return false;", url);
            }
        }
        else
        {
            pnlButtons.Visible = false;
        }

        SetButtonsOnClick();

        if (RequestHelper.IsPostBack() && (hdnSelected.Value == ""))
        {
            hdnSelected.Value = Request.Form[hdnSelected.UniqueID];
        }
    }
示例#7
0
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    /// <param name="resourceName">Resource name</param>
    /// <param name="elementName">Element name</param>
    /// <param name="transformation">Transformation object info</param>
    private String GetEditUrl(string resourceName, string elementName, TransformationInfo transformation)
    {
        var uiChild = UIElementInfoProvider.GetUIElementInfo(resourceName, elementName);

        if (uiChild != null)
        {
            string url   = String.Empty;
            string query = RequestContext.CurrentQueryString;
            // Remove parentobjectid parameter to prevent from duplicating (URL generated by UIContextHelper.GetElementUrl already contains it).
            query = URLHelper.RemoveUrlParameter(query, "parentobjectid");

            if (!DialogMode)
            {
                url = UIContextHelper.GetElementUrl(uiChild, UIContext);
                url = URLHelper.AppendQuery(url, query);
                // Remove hash parameter as it's useless in non-dialog mode.
                url = URLHelper.RemoveParameterFromUrl(url, "hash");
            }
            else
            {
                url = ApplicationUrlHelper.GetElementDialogUrl(uiChild, 0, query);
            }


            return(URLHelper.AppendQuery(url, "objectid=" + transformation.TransformationID));
        }

        return(String.Empty);
    }
示例#8
0
    /// <summary>
    /// Gets a clickable click links counter based on the values from datasource.
    /// </summary>
    /// <param name="clicks">Number of unique clicks</param>
    /// <param name="issueId">Issue ID</param>
    private string GetUniqueClicks(int clicks, int issueId)
    {
        if (clicks > 0)
        {
            var url = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.NEWSLETTER, "Newsletter.Issue.Reports.Clicks", issueId);
            return(string.Format(@"<a href=""#"" onclick=""modalDialog('{0}', 'NewsletterTrackedLinks', '1000px', '700px'); return false;"">{1}</a>", url, clicks));
        }

        return("0");
    }
示例#9
0
 private void InitPlainTextButton()
 {
     headerActions.ActionsList.Add(new HeaderAction
     {
         Text          = GetString("newsletterissue.plaintext"),
         Tooltip       = GetString("newsletterissue.plaintext"),
         OnClientClick = $"if (modalDialog) {{modalDialog('{ApplicationUrlHelper.GetElementDialogUrl(ModuleName.NEWSLETTER, "Newsletter.Issue.PlainText", Issue.IssueID)}', 'PlainText', '95%', '760');}} return false;",
         ButtonStyle   = ButtonStyle.Default
     });
 }
    /// <summary>
    /// Page load event handler
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        pnlButtons.Visible = ShowTemplateButtons;
        btnClear.Visible   = DisplayClearButton;

        var template = PageTemplateInfo;

        if (template != null)
        {
            int templateId = template.PageTemplateId;

            // Hide Clone as AdHoc button for page templates when is used for UIElement edit page and UIElement does not exists
            var uiElement = Form?.EditedObject as UIElementInfo;
            plcUIClone.Visible = uiElement != null ? (template.IsReusable && UIElementInfoProvider.GetUIElementInfo(uiElement.ElementID) != null) : template.IsReusable;

            if (Enabled)
            {
                // Add root category filter
                String root = !String.IsNullOrEmpty(RootCategoryName) ? "&startingpath=" + RootCategoryName : "";

                // Set buttons
                btnSave.OnClientClick = String.Format(
                    "modalDialog('{0}?selectorid={1}{2}&templateId={3}&siteid={4}', 'SaveNewTemplate', 700, 400); return false;",
                    ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/SaveNewPageTemplate.aspx"),
                    ClientID,
                    root,
                    templateId,
                    SiteContext.CurrentSiteID
                    );

                // Edit button
                string url = ApplicationUrlHelper.GetElementDialogUrl("cms.design", "PageTemplate.EditPageTemplate", templateId);

                btnEditTemplateProperties.OnClientClick = String.Format("modalDialog('{0}', 'Template edit', '95%', '95%'); return false;", url);

                btnClone.OnClientClick = String.Format(
                    "if (confirm({0})) {1};return false;",
                    ScriptHelper.GetString(GetString("pageselector.cloneasadhoc")),
                    Page.ClientScript.GetPostBackEventReference(btnFullPostback, null)
                    );
            }
        }
        else
        {
            pnlButtons.Visible = false;
        }

        SetButtonsOnClick();

        if (RequestHelper.IsPostBack() && (hdnSelected.Value == ""))
        {
            hdnSelected.Value = Request.Form[hdnSelected.UniqueID];
        }
    }
    private string SetUpEditLink(object sender, string sourceName, object parameter)
    {
        var    button     = (CMSGridActionButton)sender;
        int    contactID  = button.CommandArgument.ToInteger(0);
        string contactURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", contactID);

        ScriptHelper.RegisterDialogScript(Page);

        button.OnClientClick = ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail");
        return(null);
    }
示例#12
0
    private string GetDemographicsUrl()
    {
        WindowHelper.Add(Identifier, listContacts.UniGrid.CompleteWhereCondition);

        var additionalQuery = QueryHelper.BuildQuery(
            "retrieverIdentifier", DEMOGRAPHICS_IDENTIFIER,
            "persistent", "true",
            "overwriteBreadcrumbs", "false",
            "params", Identifier);

        return(ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "ContactDemographics", 0, additionalQuery));
    }
 protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
 {
     switch (sourceName.ToLowerInvariant())
     {
     case "edit":
         CMSGridActionButton btn = ((CMSGridActionButton)sender);
         string contactURL       = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", btn.CommandArgument.ToInteger(0));
         // Add modal dialog script to onClick action
         btn.OnClientClick = ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail");
         break;
     }
     return(parameter);
 }
示例#14
0
    protected object listElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSGridActionButton btn;

        switch (sourceName.ToLowerCSafe())
        {
        // Set visibility for edit button
        case "edit":
            if (IsWidget)
            {
                btn = sender as CMSGridActionButton;
                if (btn != null)
                {
                    btn.Visible = false;
                }
            }
            break;

        // Set visibility for dialog edit button
        case "dialogedit":
            btn = sender as CMSGridActionButton;
            if (btn != null)
            {
                btn.Visible = IsWidget;
            }
            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;

        // 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 (!mCanRemoveAutomationProcesses)
            {
                btn.Enabled = false;
            }
            break;
        }

        return(null);
    }
示例#15
0
    private void RegisterDeleteDataScripts()
    {
        ScriptHelper.RegisterDialogScript(this);
        var dialogUrl = ApplicationUrlHelper.GetElementDialogUrl(DataProtectionModule.MODULE_NAME, ERASURE_CONFIGURATION_DIALOG_ELEMENT_NAME, additionalQuery: "subjectIdentifiers=" + mDataSubjectIdentifiersFilter);
        var script    = $@"
            function SelectDataToDelete()
            {{
                modalDialog('{dialogUrl}', 'SelectDataToDelete', '660', '590'); 
            }}";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ShowDialog", script, true);

        btnDeleteData.OnClientClick = "SelectDataToDelete();return false;";
    }
示例#16
0
    /// <summary>
    /// Gets a clickable opened emails counter based on the values from datasource.
    /// </summary>
    /// <param name="rowView">A <see cref="DataRowView" /> that represents one row from UniGrid's source</param>
    private string GetOpenedEmails(DataRowView rowView)
    {
        // Get issue ID
        int issueId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueID"), 0);

        // Get opened emails count from issue record
        int openedEmails = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueOpenedEmails"), 0);

        if (openedEmails > 0)
        {
            var url = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.NEWSLETTER, "Newsletter.Issue.Reports.Opens", issueId);
            return(string.Format(@"<a href=""#"" onclick=""modalDialog('{0}', 'NewsletterOpenedEmails', '1000px', '700px'); return false;"">{1}</a>", url, openedEmails));
        }

        return("0");
    }
    /// <summary>
    /// Modify contact button.
    /// </summary>
    private object ModifyContactButton(object sender, object parameter)
    {
        var button    = ((CMSGridActionButton)sender);
        int contactID = ValidationHelper.GetInteger(((DataRowView)((GridViewRow)parameter).DataItem).Row["SessionContactID"], 0);

        if ((contactID > 0) && OnlineMarketingEnabled)
        {
            string contactURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", contactID);
            button.OnClientClick = ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail");
        }
        else
        {
            button.Visible = false;
        }
        return("");
    }
示例#18
0
    /// <summary>
    /// UniGrid data bound.
    /// </summary>
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSAccessibleButton btn;

        DataRowView drv = parameter as DataRowView;

        switch (sourceName.ToLowerCSafe())
        {
        // Display delete button
        case "delete":
            btn = (CMSGridActionButton)sender;
            btn.OnClientClick = string.Format("dialogParams_{0} = '{1}';{2};return false;",
                                              ClientID,
                                              btn.CommandArgument,
                                              Page.ClientScript.GetCallbackEventReference(this, "dialogParams_" + ClientID, "Delete", null));

            // Display delete button only for users with appropriate permission
            btn.Enabled = modifyPermission;
            break;

        case "primarycontactname":
            string name = ValidationHelper.GetString(drv["PrimaryContactFullName"], "");
            if (!string.IsNullOrEmpty(name.Trim()))
            {
                string contactDetailsDialogURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", ValidationHelper.GetInteger(drv["AccountPrimaryContactID"], 0));

                var placeholder = new PlaceHolder();
                placeholder.Controls.Add(new Label
                {
                    Text     = HTMLHelper.HTMLEncode(name),
                    CssClass = "contactmanagement-accountlist-primarycontact"
                });

                placeholder.Controls.Add(new CMSGridActionButton
                {
                    IconCssClass  = "icon-edit",
                    OnClientClick = ScriptHelper.GetModalDialogScript(contactDetailsDialogURL, "ContactDetail"),
                    ToolTip       = GetString("om.contact.viewdetail")
                });

                return(placeholder);
            }
            return(null);
        }
        return(null);
    }
示例#19
0
    /// <summary>
    /// Gets a clickable click links counter based on the values from datasource.
    /// </summary>
    /// <param name="rowView">A <see cref="DataRowView" /> that represents one row from UniGrid's source</param>
    private string GetUniqueClicks(DataRowView rowView)
    {
        var issueSentEmails = DataHelper.GetIntValue(rowView.Row, "IssueSentEmails");
        if (issueSentEmails == 0)
        {
            return string.Empty;
        }

        var issueId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueID"), 0);
        var clicks = IssueHelper.GetIssueTotalUniqueClicks(issueId);

        if (clicks <= 0)
        {
            return ZERO;
        }

        var url = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.NEWSLETTER, "Newsletter.Issue.Reports.Clicks", issueId);
        return $@"<a href=""#"" onclick=""modalDialog('{url}', 'NewsletterTrackedLinks', '1000px', '700px'); return false;"">{clicks}</a>";
    }
    /// <summary>
    /// Unigrid external databoud event handler.
    /// </summary>
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSGridActionButton btn;

        switch (sourceName.ToLowerCSafe())
        {
        case "edit":
            btn = ((CMSGridActionButton)sender);
            // Ensure accountID parameter value;
            var objectID = ValidationHelper.GetInteger(btn.CommandArgument, 0);
            // Account detail URL
            string accountURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditAccount", objectID);
            // Add modal dialog script to onClick action
            btn.OnClientClick = ScriptHelper.GetModalDialogScript(accountURL, "AccountDetail");
            break;

        case "selectrole":
            btn = (CMSGridActionButton)sender;
            if (mModifyAccountContact)
            {
                btn.OnClientClick = string.Format("dialogParams_{0} = '{1}';{2};return false;",
                                                  ClientID,
                                                  btn.CommandArgument,
                                                  Page.ClientScript.GetCallbackEventReference(this, "dialogParams_" + ClientID, "SelectRole", null));
            }
            else
            {
                btn.Enabled = false;
            }
            break;

        case "remove":
            if (!mModifyAccountContact)
            {
                btn         = (CMSGridActionButton)sender;
                btn.Enabled = false;
            }
            break;
        }
        return(null);
    }
示例#21
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        CurrentMaster.PanelContent.AddCssClass("dialog-content");

        // Filter templates for current layout
        gridTemplates.WhereCondition       = "PageTemplateLayoutID = " + QueryHelper.GetInteger("layoutid", 0);
        gridTemplates.ZeroRowsText         = GetString("layout.notemplates");
        gridTemplates.FilteredZeroRowsText = GetString("layout.notemplates");

        // Register edit script
        String url    = ApplicationUrlHelper.GetElementDialogUrl("cms.design", "PageTemplate.EditPageTemplate");
        string script = @"
function EditPageTemplate(id){
     modalDialog('" + url + @"&objectid=' + id, 'TemplateSelection', 1024, 768);
}";

        ScriptHelper.RegisterDialogScript(this.Page);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "EditPageTemplate", ScriptHelper.GetScript(script));
    }
    /// <summary>
    /// Uni-grid external data bound event handler.
    /// </summary>
    private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSGridActionButton btn = sender as CMSGridActionButton;

        if (btn != null)
        {
            switch (sourceName.ToLowerCSafe())
            {
            case "edit":
                string contactURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", btn.CommandArgument.ToInteger(0));
                // Add modal dialog script to onClick action
                btn.OnClientClick = ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail");
                break;

            case "selectrole":
                if (!modifyAccountContact)
                {
                    btn.Enabled = false;
                }
                else
                {
                    btn.OnClientClick = string.Format("dialogParams_{0} = '{1}';{2};return false;",
                                                      ClientID,
                                                      btn.CommandArgument,
                                                      Page.ClientScript.GetCallbackEventReference(this, "dialogParams_" + ClientID, "SelectRole", null));
                }
                break;

            case "remove":
                if (!modifyAccountContact)
                {
                    btn.Enabled = false;
                }
                break;
            }
        }

        return(null);
    }
示例#23
0
    /// <summary>
    /// Gets a clickable opened emails counter based on the values from datasource.
    /// </summary>
    /// <param name="rowView">A <see cref="DataRowView" /> that represents one row from UniGrid's source</param>
    private string GetOpenedEmails(DataRowView rowView)
    {
        var issueSentEmails = DataHelper.GetIntValue(rowView.Row, "IssueSentEmails");
        if (issueSentEmails == 0)
        {
            return string.Empty;
        }

        // Get issue ID
        var issueId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueID"), 0);

        // Get opened emails count from issue record
        var openedEmails = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue(rowView, "IssueOpenedEmails"), 0);

        if (openedEmails <= 0)
        {
            return ZERO;
        }

        var url = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.NEWSLETTER, "Newsletter.Issue.Reports.Opens", issueId);
        return $@"<a href=""#"" onclick=""modalDialog('{url}', 'NewsletterOpenedEmails', '1000px', '700px'); return false;"">{openedEmails}</a>";
    }
    /// <summary>
    /// Returns SKU edit action HTML.
    /// </summary>
    protected string GetSKUEditAction(object skuId, object skuSiteId, object skuParentSkuId, object isProductOption)
    {
        var editSKUElemHtml = "";

        if (!ValidationHelper.GetBoolean(isProductOption, false) && ShoppingCartControl.IsInternalOrder)
        {
            // Do not render product detail link, when not authorized
            if (!CanReadProducts)
            {
                return(editSKUElemHtml);
            }

            // Show variants tab for product variant, otherwise general tab
            int    parentSkuId    = ValidationHelper.GetInteger(skuParentSkuId, 0);
            string productIdParam = (parentSkuId == 0) ? skuId.ToString() : parentSkuId.ToString();
            string tabParam       = (parentSkuId == 0) ? "Products.General" : "Products.Variants";

            var query = URLHelper.AddParameterToUrl("", "productid", productIdParam);
            query = URLHelper.AddParameterToUrl(query, "tabName", tabParam);
            query = URLHelper.AddParameterToUrl(query, "siteid", skuSiteId.ToString());
            query = URLHelper.AddParameterToUrl(query, "dialog", "1");
            var url = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.ECOMMERCE, "Products.Properties", additionalQuery: query);

            // Different tooltip for product than for product variant
            string tooltip = (parentSkuId == 0) ? GetString("shoppingcart.editproduct") : GetString("shoppingcart.editproductvariant");

            var priceDetailButton = new CMSGridActionButton
            {
                IconCssClass  = "icon-box",
                ToolTip       = tooltip,
                OnClientClick = ScriptHelper.GetModalDialogScript(url, "SKUEdit", "95%", "95%"),
            };

            editSKUElemHtml = priceDetailButton.GetRenderedHTML();
        }

        return(editSKUElemHtml);
    }
    /// <summary>
    /// Returns price detail link.
    /// </summary>
    protected string GetPriceDetailLink(object value)
    {
        var priceDetailElemHtml = "";

        if (ShoppingCartControl.EnableProductPriceDetail)
        {
            Guid cartItemGuid = ValidationHelper.GetGuid(value, Guid.Empty);
            if (cartItemGuid != Guid.Empty)
            {
                var query = "itemguid=" + cartItemGuid + GetCMSDeskShoppingCartSessionNameQuery();

                if (IsLiveSite)
                {
                    string liveSiteUrl = UrlResolver.ResolveUrl("~/CMSModules/Ecommerce/CMSPages/ShoppingCartSKUPriceDetail.aspx?" + query);

                    priceDetailElemHtml = string.Format("<img src=\"{0}\" onclick=\"{1}\" alt=\"{2}\" class=\"ProductPriceDetailImage\" style=\"cursor:pointer;\" />",
                                                        GetImageUrl("Design/Controls/UniGrid/Actions/detail.png"),
                                                        ScriptHelper.GetModalDialogScript(liveSiteUrl, "ProductPriceDetail", 750, 570),
                                                        GetString("shoppingcart.productpricedetail"));
                }
                else
                {
                    string adminUrl = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.ECOMMERCE, "order.productpricedetail", 0, query);

                    var priceDetailButton = new CMSGridActionButton
                    {
                        IconCssClass  = "icon-eye",
                        ToolTip       = GetString("shoppingcart.productpricedetail"),
                        OnClientClick = ScriptHelper.GetModalDialogScript(adminUrl, "ProductPriceDetail", 750, 570)
                    };

                    priceDetailElemHtml = priceDetailButton.GetRenderedHTML();
                }
            }
        }

        return(priceDetailElemHtml);
    }
示例#26
0
    /// <summary>
    /// On external databound.
    /// </summary>
    /// <param name="sender">Sender</param>
    /// <param name="sourceName">Source name</param>
    /// <param name="parameter">Parameter</param>
    private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSGridActionButton btn;
        ContactInfo         ci;

        switch (sourceName.ToLowerCSafe())
        {
        case "edit":
            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;

        case "view":
            btn = (CMSGridActionButton)sender;
            btn.OnClientClick = "ViewScoreDetail(" + btn.CommandArgument + "); return false;";
            break;

        case "#statusdisplayname":
            ci = ContactInfo.Provider.Get(ValidationHelper.GetInteger(parameter, 0));
            if (ci != null)
            {
                ContactStatusInfo statusInfo = ContactStatusInfo.Provider.Get(ci.ContactStatusID);
                if (statusInfo != null)
                {
                    return(HTMLHelper.HTMLEncode(statusInfo.ContactStatusDisplayName));
                }
            }
            return(String.Empty);
        }

        return(null);
    }
    private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerInvariant())
        {
        case "edit":
            var btn = ((CMSGridActionButton)sender);
            // Ensure accountID parameter value;
            var objectID = ValidationHelper.GetInteger(btn.CommandArgument, 0);
            // Account detail URL
            string accountURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditAccount", objectID);
            // Add modal dialog script to onClick action
            btn.OnClientClick = ScriptHelper.GetModalDialogScript(accountURL, "AccountDetail");
            break;

        case "primary":
            DataRowView drv       = (DataRowView)parameter;
            int         contactId = ValidationHelper.GetInteger(drv["AccountPrimaryContactID"], 0);
            string      fullName  = ValidationHelper.GetString(drv["PrimaryContactFullName"], null);

            string contactURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", contactId);
            // Add modal dialog script to onClick action
            var script = ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail");
            return("<a href=\"#\" onclick=\"" + script + "\">" + HTMLHelper.HTMLEncode(fullName) + "</a>");

        case "website":
            string url = ValidationHelper.GetString(parameter, null);
            if (url != null)
            {
                return("<a target=\"_blank\" href=\"" + HTMLHelper.HTMLEncode(url) + "\" \">" + HTMLHelper.HTMLEncode(url) + "</a>");
            }

            return(GetString("general.na"));
        }

        return(parameter);
    }
示例#28
0
    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);
    }
示例#29
0
    /// <summary>
    /// Loads data of specific activity.
    /// </summary>
    protected void LoadData()
    {
        if (activityId <= 0)
        {
            return;
        }

        // Load and check if object exists
        ActivityInfo ai = ActivityInfo.Provider.Get(activityId);

        EditedObject = ai;

        ActivityTypeInfo ati = ActivityTypeInfo.Provider.Get(ai.ActivityType);

        plcActivityValue.Visible = (ati == null) || ati.ActivityTypeIsCustom || (ati.ActivityTypeName == PredefinedActivityType.PAGE_VISIT) && !String.IsNullOrEmpty(ai.ActivityValue);

        string dispName = (ati != null ? ati.ActivityTypeDisplayName : GetString("general.na"));

        lblTypeVal.Text    = String.Format("{0}", HTMLHelper.HTMLEncode(dispName));
        lblContactVal.Text = HTMLHelper.HTMLEncode(ContactInfoProvider.GetContactFullName(ai.ActivityContactID));

        // Init contact detail link
        string contactURL = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.CONTACTMANAGEMENT, "EditContact", ai.ActivityContactID);

        btnContact.Attributes.Add("onClick", ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail"));
        btnContact.ToolTip = GetString("general.edit");

        lblDateVal.Text = (ai.ActivityCreated == DateTimeHelper.ZERO_TIME ? GetString("general.na") : HTMLHelper.HTMLEncode(ai.ActivityCreated.ToString()));

        // Get site display name
        string siteName = SiteInfoProvider.GetSiteName(ai.ActivitySiteID);

        if (String.IsNullOrEmpty(siteName))
        {
            siteName = GetString("general.na");
        }
        else
        {
            // Retrieve site info and its display name
            SiteInfo si = SiteInfo.Provider.Get(siteName);
            if (si != null)
            {
                siteName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(si.DisplayName));
            }
            else
            {
                siteName = GetString("general.na");
            }
        }
        lblSiteVal.Text = siteName;

        string url = ai.ActivityURL;

        plcCampaign.Visible = !String.IsNullOrEmpty(ai.ActivityCampaign);
        lblCampaignVal.Text = HTMLHelper.HTMLEncode(ai.ActivityCampaign);
        lblValue.Text       = HTMLHelper.HTMLEncode(String.IsNullOrEmpty(ai.ActivityValue) ? GetString("general.na") : ai.ActivityValue);

        // Init textboxes only for the first time
        if (!RequestHelper.IsPostBack())
        {
            txtComment.Value = ai.ActivityComment;
            txtTitle.Text    = ai.ActivityTitle;
            txtURLRef.Text   = ai.ActivityURLReferrer;
            if (ai.ActivityType != PredefinedActivityType.NEWSLETTER_CLICKTHROUGH)
            {
                txtURL.Text = url;
            }
        }

        cDetails.ActivityID = activityId;

        // Init link button URL
        if (ai.ActivitySiteID > 0)
        {
            SiteInfo si = SiteInfo.Provider.Get(ai.ActivitySiteID);
            if (si != null)
            {
                // Hide view button if URL is blank
                string activityUrl = ai.ActivityURL;
                if ((activityUrl != null) && !String.IsNullOrEmpty(activityUrl.Trim()))
                {
                    string appUrl = URLHelper.GetApplicationUrl(si.DomainName);
                    url                 = URLHelper.GetAbsoluteUrl(activityUrl, appUrl, appUrl, "");
                    url                 = URLHelper.AddParameterToUrl(url, URLHelper.SYSTEM_QUERY_PARAMETER, "1");
                    btnView.ToolTip     = GetString("general.view");
                    btnView.NavigateUrl = url;
                    btnView.Visible     = true;
                }
                else
                {
                    btnView.Visible = false;
                }
            }
        }
    }
示例#30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Use UI culture for strings
        string culture = MembershipContext.AuthenticatedUser.PreferredUICultureCode;

        // Register dialog script
        ScriptHelper.RegisterDialogScript(Page);

        // Prepare script to display versions dialog
        StringBuilder script = new StringBuilder();

        script.Append(
            @"
function ShowVersionsDialog(objectType, objectId, objectName) {
  modalDialog('", ResolveUrl("~/CMSModules/Objects/Dialogs/ObjectVersionDialog.aspx"), @"' + '?objecttype=' + objectType + '&objectid=' + objectId + '&objectname=' + objectName,'VersionsDialog','800','600');
}"
            );

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ShowVersionDialog", ScriptHelper.GetScript(script.ToString()));

        // Check if template is ASPX one and initialize PageTemplateInfo variable
        bool isAspx = false;

        PageTemplateInfo pti = null;

        if (mPagePlaceholder != null)
        {
            pi = mPagePlaceholder.PageInfo;
        }

        if (pi != null)
        {
            pti = pi.UsedPageTemplateInfo;
            if (pti != null)
            {
                isAspx = pti.IsAspx;
            }
        }

        bool documentExists = ((pi != null) && (pi.DocumentID > 0));

        if ((mPagePlaceholder != null) && (mPagePlaceholder.ViewMode == ViewModeEnum.DesignDisabled))
        {
            // Hide edit layout and edit template if design mode is disabled
            iLayout.Visible   = false;
            iTemplate.Visible = false;
        }
        else
        {
            if ((mPagePlaceholder != null) && (mPagePlaceholder.LayoutTemplate == null))
            {
                // Edit layout
                iLayout.Text = ResHelper.GetString("PlaceholderMenu.IconLayout", culture);
                iLayout.Attributes.Add("onclick", "EditLayout();");

                if ((pti != null) && (pti.LayoutID > 0))
                {
                    LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(pti.LayoutID);

                    // Display layout versions sub-menu
                    if ((li != null) && ObjectVersionManager.DisplayVersionsTab(li))
                    {
                        menuLayout.Visible           = true;
                        iLayout.Text                 = ResHelper.GetString("PlaceholderMenu.IconLayoutMore", culture);
                        lblSharedLayoutVersions.Text = ResHelper.GetString("PlaceholderMenu.SharedLayoutVersions", culture);
                        pnlSharedLayout.Attributes.Add("onclick", GetVersionsDialog(li.TypeInfo.ObjectType, li.LayoutId));
                    }
                }
            }
            else
            {
                iLayout.Visible = false;
            }

            if (documentExists)
            {
                // Template properties
                iTemplate.Text = ResHelper.GetString("PlaceholderMenu.IconTemplate", culture);

                int    templateID = (pti != null) ? pti.PageTemplateId : 0;
                String aliasPath  = (pi != null) ? pi.NodeAliasPath : "";

                String url = ApplicationUrlHelper.GetElementDialogUrl("cms.design", "PageTemplate.EditPageTemplate", templateID, String.Format("aliaspath={0}", aliasPath));
                iTemplate.Attributes.Add("onclick", String.Format("modalDialog('{0}', 'edittemplate', '95%', '95%');", url));

                if (pti != null)
                {
                    // Display template versions sub-menu
                    if (ObjectVersionManager.DisplayVersionsTab(pti))
                    {
                        menuTemplate.Visible     = true;
                        iTemplate.Text           = ResHelper.GetString("PlaceholderMenu.IconTemplateMore", culture);
                        lblTemplateVersions.Text = ResHelper.GetString("PlaceholderMenu.TemplateVersions", culture);
                        pnlTemplateVersions.Attributes.Add("onclick", GetVersionsDialog(pti.TypeInfo.ObjectType, pti.PageTemplateId));
                    }
                }
            }
        }

        if (pti != null)
        {
            if ((!isAspx) && documentExists && pti.IsReusable)
            {
                if (!SynchronizationHelper.UseCheckinCheckout || CurrentPageInfo.UsedPageTemplateInfo.Generalized.IsCheckedOutByUser(MembershipContext.AuthenticatedUser))
                {
                    iClone.Text          = ResHelper.GetString("PlaceholderMenu.IconClone", culture);
                    iClone.OnClientClick = "CloneTemplate(GetContextMenuParameter('pagePlaceholderMenu'));";
                }
            }
            else
            {
                iSaveAsNew.Text = ResHelper.GetString("PageProperties.Save", culture);

                int templateId = pi.UsedPageTemplateInfo.PageTemplateId;
                iSaveAsNew.OnClientClick = String.Format(
                    "modalDialog('{0}?refresh=1&templateId={1}&siteid={2}', 'SaveNewTemplate', 720, 430); return false;",
                    ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/SaveNewPageTemplate.aspx"),
                    templateId,
                    SiteContext.CurrentSiteID);
            }
        }

        iRefresh.Text = ResHelper.GetString("PlaceholderMenu.IconRefresh", culture);
        iRefresh.Attributes.Add("onclick", "RefreshPage();");
    }