Пример #1
0
    private void DrawProductTypesTable()
    {
        _ProductType = new Ektron.Cms.Commerce.ProductType(_ContentApi.RequestInformationRef);

        List<ProductTypeData> prod_type_list = new List<ProductTypeData>();
        Criteria<ProductTypeProperty> criteria = new Criteria<ProductTypeProperty>();
        criteria.PagingInfo.RecordsPerPage = 1000;
        prod_type_list = _ProductType.GetList(criteria);

        List<ProductTypeData> active_prod_list = new List<ProductTypeData>();
        active_prod_list = _ProductType.GetFolderProductTypeList(_FolderData.Id);
        Collection addNew = new Collection();
        int k = 0;
        int row_id = 0;

        bool smartFormsRequired = true;
        bool isEnabled = IsInheritingXmlMultiConfig();

        System.Text.StringBuilder str = new System.Text.StringBuilder();
        str.Append(DrawProductTypesBreaker(isEnabled));
        str.Append("<div class=\"ektronTopSpace\"></div>");

        str.Append("<div class=\"\">");
        str.Append(DrawProductTypesHeader());

        Collection ActiveXmlIdList = new Collection();
        for (k = 0; k <= active_prod_list.Count - 1; k++)
        {
            if (!ActiveXmlIdList.Contains(active_prod_list[k].Id.ToString()))
            {
                ActiveXmlIdList.Add(active_prod_list[k].Id, active_prod_list[k].Id.ToString(), null, null);
            }
        }
        if (_FolderData.XmlConfiguration != null)
        {
            for (int j = 0; j <= (_FolderData.XmlConfiguration.Length - 1); j++)
            {
                if (!ActiveXmlIdList.Contains(_FolderData.XmlConfiguration[j].Id.ToString()))
                {
                    ActiveXmlIdList.Add(_FolderData.TemplateId, _FolderData.TemplateId.ToString(), null, null);
                }
            }
        }

        for (k = 0; k <= prod_type_list.Count - 1; k++)
        {
            if (ActiveXmlIdList.Contains(prod_type_list[k].Id.ToString()))
            {
                str.Append(DrawProductTypesEntry(row_id, (string)(prod_type_list[k].Title), prod_type_list[k].Id, Utilities.IsDefaultXmlConfig(prod_type_list[k].Id, active_prod_list.ToArray())));
                row_id++;
            }
            else
            {
                Collection cRow = new Collection();
                cRow.Add(prod_type_list[k].Title, "xml_name", null, null);
                cRow.Add(prod_type_list[k].Id, "xml_id", null, null);
                addNew.Add(cRow, null, null, null);
            }
        }

        if (!smartFormsRequired)
        {
            str.Append(DrawProductTypesEntry(row_id, _MessageHelper.GetMessage("lbl Blank HTML"), 0, Utilities.IsHTMLDefault(active_prod_list.ToArray())));
        }

        str.Append(DrawContentTypesFooter());
        str.Append("</div>");

        if (row_id % 2 == 0)
        {
            str.Append("<input type=\"hidden\" name=\"isEven\" id=\"isEven\" value=\"1\" />");
        }
        else
        {
            str.Append("<input type=\"hidden\" name=\"isEven\" id=\"isEven\" value=\"0\" />");
        }
        ltr_vf_smartforms.Text = str.ToString();
    }
Пример #2
0
    private void DrawProductTypesTable()
    {
        _ProductType = new Ektron.Cms.Commerce.ProductType(_ContentApi.RequestInformationRef);

        List<Ektron.Cms.Commerce.ProductTypeData> prod_type_list = new List<Ektron.Cms.Commerce.ProductTypeData>();
        Criteria<ProductTypeProperty> criteria = new Criteria<ProductTypeProperty>();

        criteria.PagingInfo = new PagingInfo(10000);
        prod_type_list = _ProductType.GetList(criteria);

        List<Ektron.Cms.Commerce.ProductTypeData> active_prod_list = new List<Ektron.Cms.Commerce.ProductTypeData>();
        active_prod_list = _ProductType.GetFolderProductTypeList(_FolderData.Id);
        Collection addNew = new Collection();
        int k = 0;
        int row_id = 0;

        bool smartFormsRequired = true;

        //bool broken = false;
        //if (active_prod_list.Count > 0)
        //{
        //    broken = true;
        //}

        bool isParentCatalog = System.Convert.ToBoolean(_ContentApi.EkContentRef.GetFolderType(_FolderData.ParentId) == Ektron.Cms.Common.EkEnumeration.FolderType.Catalog);
        bool isInheriting = System.Convert.ToBoolean(isParentCatalog && IsInheritingXmlMultiConfig()); // folder_data.XmlInherited
        bool isEnabled = System.Convert.ToBoolean(!isInheriting);

        System.Text.StringBuilder str = new System.Text.StringBuilder();
        str.Append(DrawProductTypesBreaker(isInheriting, isParentCatalog));
        str.Append("<div class=\"ektronTopSpace\"></div>");

        str.Append(DrawProductTypesHeader());
        Collection ActiveXmlIdList = new Collection();
        for (k = 0; k <= active_prod_list.Count - 1; k++)
        {
            if (!ActiveXmlIdList.Contains(active_prod_list[k].Id.ToString()))
            {
                ActiveXmlIdList.Add(active_prod_list[k].Id, active_prod_list[k].Id.ToString(), null, null);
            }
        }
        if (_FolderData.XmlConfiguration != null)
        {
            for (int j = 0; j <= (_FolderData.XmlConfiguration.Length - 1); j++)
            {
                if (!ActiveXmlIdList.Contains(_FolderData.XmlConfiguration[j].Id.ToString()))
                {
                    ActiveXmlIdList.Add(_FolderData.TemplateId, _FolderData.TemplateId.ToString(), null, null);
                }
            }
        }

        for (k = 0; k <= prod_type_list.Count - 1; k++)
        {
            if (ActiveXmlIdList.Contains(prod_type_list[k].Id.ToString()))
            {
                str.Append(DrawProductTypesEntry(row_id, prod_type_list[k].Title, prod_type_list[k].Id, Utilities.IsDefaultXmlConfig(prod_type_list[k].Id, active_prod_list.ToArray()), isEnabled));
                row_id++;
            }
            else
            {
                Collection cRow = new Collection();
                cRow.Add(prod_type_list[k].Title, "xml_name", null, null);
                cRow.Add(prod_type_list[k].Id, "xml_id", null, null);
                addNew.Add(cRow, null, null, null);
            }
        }

        if (!smartFormsRequired)
        {
            str.Append(DrawProductTypesEntry(row_id, _MessageHelper.GetMessage("lbl Blank HTML"), 0, Utilities.IsHTMLDefault(active_prod_list.ToArray()), isEnabled));
        }

        str.Append("</tbody></table>");
        str.Append("<table width=\"100%\"><tbody>");
        str.Append("<tr><td width=\"90%\">");
        str.Append("<br /><select name=\"addContentType\" id=\"addContentType\" " + (isEnabled || _FolderData.Id == 0 ? "" : " disabled ") + ">");

        str.Append("<option value=\"-1\">" + "[" + _MessageHelper.GetMessage("lbl select prod type") + "]" + "</option>");

        foreach (Collection row in addNew)
        {
            str.Append("<option value=\"" + row["xml_id"] + "\">" + row["xml_name"] + "</option>");
        }

        str.Append("</select>");
        str.Append("<span class=\'hiddenWhenInheriting\' style=\'display:" + (isEnabled ? "inline; padding: .25em;" : "none;") + "\' ><a href=\"#\" onclick=\"PreviewSelectedProductType(\'" + _ContentApi.SitePath + "\', 800,600);return false;\"><img src=\"" + _ContentApi.AppPath + "images/UI/Icons/preview.png" + "\" alt=" + _MessageHelper.GetMessage("lbl Preview Smart Form") + " title=" + _MessageHelper.GetMessage("lbl Preview Smart Form") + "></a></span>");
        str.Append("<span class=\'hiddenWhenInheriting\' style=\'display:" + (isEnabled ? "inline; padding: .25em;" : "none;") + "\' ><a href=\"#\" onclick=\"ActivateContentType(true);\"><img src=\"" + _ContentApi.AppPath + "images/ui/icons/Add.png" + "\" title=" + _MessageHelper.GetMessage("lbl add link") + " alt=" + _MessageHelper.GetMessage("lbl add link") + "/></a></span></td></tr>");
        str.Append(DrawContentTypesFooter());
        if (row_id % 2 == 0)
        {
            str.Append("<input type=\"hidden\" name=\"isEven\" id=\"isEven\" value=\"1\" />");
        }
        else
        {
            str.Append("<input type=\"hidden\" name=\"isEven\" id=\"isEven\" value=\"0\" />");
        }
        if (_FolderData.Id == 0)
        {
            isEnabled = true;
        }
        str.Append("<div style=\'display:none;\'>");
        if (smartFormsRequired && isEnabled)
        {
            str.Append("<input type=\"checkbox\" id=\"requireSmartForms\" name=\"requireSmartForms\" onClick=\"ToggleRequireSmartForms()\" checked=\"checked\" />");
        }
        else if (!smartFormsRequired && isEnabled)
        {
            str.Append("<input type=\"checkbox\" id=\"requireSmartForms\" name=\"requireSmartForms\" onClick=\"ToggleRequireSmartForms()\" />");
        }
        else if (smartFormsRequired && !isEnabled)
        {
            str.Append("<input type=\"checkbox\" id=\"requireSmartForms\" name=\"requireSmartForms\" onClick=\"ToggleRequireSmartForms()\" checked=\"checked\" disabled=\"disabled\" />");
        }
        else
        {
            str.Append("<input type=\"checkbox\" id=\"requireSmartForms\" name=\"requireSmartForms\" onClick=\"ToggleRequireSmartForms()\" disabled=\"disabled\" />");
        }

        str.Append(_MessageHelper.GetMessage("lbl Require Smart Forms"));
        str.Append("</div>");
        ltr_vf_types.Text = str.ToString();
    }