Beispiel #1
0
    protected override void OnInit(EventArgs e)
    {
        // Register script for closing product section editing UI
        string script = "function CancelSectionEdit() { if(GetSelectedMode() == 'sectionedit'){ SetMode('edit',true);}}";

        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "beforenodeselection", ScriptHelper.GetScript(script));

        UIContext[UIContextDataItemName.SELECTEDCULTURE] = Culture;

        // Pass the parameters
        menu.Values.Add(new UILayoutValue("ShowModeMenu", false));

        tree.Values.AddRange(new[] {
            new UILayoutValue("NodeID", NodeID),
            new UILayoutValue("ExpandNodeID", ExpandNodeID),
            new UILayoutValue("Culture", Culture),
            new UILayoutValue("StartingAliasPath", Page.ProductsStartingPath),
            new UILayoutValue("AllowGlobalObjects", Page.AllowGlobalObjects),
            new UILayoutValue("AllowProductsWithoutDocuments", ECommerceSettings.AllowProductsWithoutDocuments(SiteContext.CurrentSiteName)),
            new UILayoutValue("DisplayProductsInSectionsTree", ECommerceSettings.DisplayProductsInSectionsTree(SiteContext.CurrentSiteName)),
            new UILayoutValue("IsProductTree", true),
            new UILayoutValue("BeforeSelectNodeScript", "CancelSectionEdit();")
        });

        // Show pane only for multilingual site
        language.Visible = SiteContext.CurrentSite.HasMultipleCultures;
    }
Beispiel #2
0
    /// <summary>
    /// Initializes the product edit control.
    /// </summary>
    private void InitProductEdit()
    {
        CurrentMaster.PanelContent.CssClass = null;

        plcProductEdit.Visible        = true;
        productEditElem.ProductSaved += (sender, args) =>
        {
            if (IsContent)
            {
                // If not EditLive view mode, switch to form mode to keep editing the form
                if (CMSContext.ViewMode != ViewModeEnum.EditLive)
                {
                    CMSContext.ViewMode = ViewModeEnum.EditForm;
                }
            }
            else
            {
                UIContext.ProductTab = ProductTabEnum.General;
            }

            bool refreshEcommerceTree = (ECommerceSettings.ProductsTree(CMSContext.CurrentSiteName) == ProductsTreeModeEnum.Sections) &&
                                        (ECommerceSettings.DisplayProductsInSectionsTree(CMSContext.CurrentSiteName));

            if (productEditElem.Product is TreeNode && (IsContent || refreshEcommerceTree))
            {
                var node = (TreeNode)productEditElem.Product;
                if (productEditElem.ProductSavedCreateAnother)
                {
                    ScriptHelper.RefreshTree(this, node.NodeParentID, node.NodeParentID);
                    ScriptHelper.RegisterStartupScript(Page, typeof(string), "Refresh", ScriptHelper.GetScript("CreateAnother();"));
                }
                else
                {
                    ScriptHelper.RefreshTree(this, node.NodeParentID, node.NodeID);
                }
            }
            else
            {
                if (productEditElem.ProductSavedCreateAnother)
                {
                    RedirectToNewProduct();
                }
                else
                {
                    RedirectToSavedProduct(productEditElem.Product);
                }
            }
        };
    }
Beispiel #3
0
    private void OnProductSaved(object sender, EventArgs args)
    {
        if (!IsProductsUI)
        {
            // If not EditLive view mode, switch to form mode to keep editing the form
            if (PortalContext.ViewMode != ViewModeEnum.EditLive)
            {
                PortalContext.ViewMode = ViewModeEnum.EditForm;
            }
        }

        bool refreshEcommerceTree = (ECommerceSettings.ProductsTree(SiteContext.CurrentSiteName) == ProductsTreeModeEnum.Sections) && (ECommerceSettings.DisplayProductsInSectionsTree(SiteContext.CurrentSiteName));

        if ((productEditElem.Product is TreeNode) && (!IsProductsUI || refreshEcommerceTree))
        {
            var node = (TreeNode)productEditElem.Product;
            if (productEditElem.ProductSavedCreateAnother)
            {
                ScriptHelper.RefreshTree(this, node.NodeParentID, node.NodeParentID);
                ScriptHelper.RegisterStartupScript(Page, typeof(string), "Refresh", ScriptHelper.GetScript("CreateAnother();"));
            }
            else
            {
                ScriptHelper.RefreshTree(this, node.NodeParentID, node.NodeID);
            }
        }
        else if (productEditElem.ProductSavedCreateAnother)
        {
            RedirectToNewProduct();
        }
        else
        {
            RedirectToSavedProduct(productEditElem.Product);
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        showProductsInTree = ECommerceSettings.DisplayProductsInSectionsTree(CurrentSiteName);

        if (NodeID > 0)
        {
            // Init document list
            docList.Node                           = DocumentHelper.GetDocument(NodeID, CultureCode, true, Tree);
            docList.Grid.GridName                  = "~/CMSModules/Ecommerce/Pages/Tools/Products/Product_List_Documents.xml";
            docList.AdditionalColumns              = "SKUID, DocumentSKUName, NodeParentID, NodeID, NodeSKUID, SKUName, SKUNumber, SKUPrice, SKUAvailableItems, SKUEnabled, SKUSiteID, SKUPublicStatusID, SKUInternalStatusID, SKUReorderAt";
            docList.WhereCodition                  = GetDocumentWhereCondition();
            docList.OrderBy                        = ShowSections ? "CASE WHEN NodeSKUID IS NULL THEN 0 ELSE 1 END, DocumentName" : "DocumentName";
            docList.OnExternalAdditionalDataBound += gridData_OnExternalDataBound;
            docList.OnDocumentFlagsCreating       += docList_OnDocumentFlagsCreating;
            docList.Grid.OnAction                 += gridData_OnAction;
            docList.Grid.RememberStateByParam      = "";
            docList.SelectLanguageJSFunction       = "EditProductInCulture";

            docList.DeleteReturnUrl    = "~/CMSModules/Content/CMSDesk/Delete.aspx?multiple=true";
            docList.PublishReturnUrl   = "~/CMSModules/Content/CMSDesk/PublishArchive.aspx?multiple=true";
            docList.ArchiveReturnUrl   = "~/CMSModules/Content/CMSDesk/PublishArchive.aspx?multiple=true";
            docList.TranslateReturnUrl = "~/CMSModules/Translations/Pages/TranslateDocuments.aspx";

            if (!string.IsNullOrEmpty(ProductsStartingPath))
            {
                docList.CopyMoveLinkStartingPath = ProductsStartingPath;
            }

            string languageSelectionScript = "function EditProductInCulture(nodeId, culture, translated, url) {parent.RefreshTree(nodeId, nodeId); window.location.href = 'Product_Edit_Frameset.aspx?nodeid='+nodeId+'&culture='+culture;}";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "EditProductInCulture", ScriptHelper.GetScript(languageSelectionScript));

            plcSKUListing.Visible = false;

            // Stop processing SKU table
            gridData.StopProcessing = true;

            EditedObject = docList.Node;

            // Set title
            string title = docList.Node.IsRoot() ? GetString("com.sku.productslist") : docList.Node.GetDocumentName();
            SetTitle("Objects/Ecommerce_SKU/object.png", HTMLHelper.HTMLEncode(title), "product_list", "helpTopic");
        }
        else
        {
            // Init Unigrid
            gridData.OnAction            += gridData_OnAction;
            gridData.OnExternalDataBound += gridData_OnExternalDataBound;

            // Stop processing product document listing
            docList.StopProcessing     = true;
            plcDocumentListing.Visible = false;

            // Set title according display tree setting
            if (DisplayTreeInProducts)
            {
                SetTitle("Objects/Ecommerce_SKU/object.png", GetString("com.sku.unassignedlist"), "stand_alone_SKUs_list", "helpTopic");
            }
            else
            {
                SetTitle("Objects/Ecommerce_SKU/object.png", GetString("com.sku.productslist"), "SKUs_list", "helpTopic");
            }
        }

        // Show warning when exchange rate from global main currency is missing
        if (AllowGlobalObjects && ExchangeTableInfoProvider.IsExchangeRateFromGlobalMainCurrencyMissing(CMSContext.CurrentSiteID))
        {
            ShowWarning(GetString("com.NeedExchangeRateFromGlobal"), null, null);
        }
    }