Example #1
0
    protected string GenerateRootTreeHtml(string controlId, int languageID, List<long> rootTaxonomyIds)
    {
        if (rootTaxonomyIds.Count == 0)
            return "";

        Taxonomy taxonomyAPI = new Taxonomy();
        TaxonomyRequest taxonomyRequest = new TaxonomyRequest();
        taxonomyRequest.TaxonomyId = 0;
        taxonomyRequest.TaxonomyLanguage = languageID;

        StringBuilder sb = new StringBuilder();
        sb.Append("<ul>");

        TaxonomyData taxonomyData = taxonomyAPI.LoadTaxonomy(ref taxonomyRequest);
        if (taxonomyData != null)
        {
            foreach (TaxonomyData childTaxonomyData in taxonomyData.Taxonomy)
            {
                if (rootTaxonomyIds.Contains(childTaxonomyData.TaxonomyId))
                {
                    sb.Append(GenerateCategoryHtml(controlId, languageID, childTaxonomyData.TaxonomyId));
                }
            }
        }

        sb.Append("</ul>");

        return sb.ToString();
    }
        public IActionResult CreateTaxonomy(TaxonomyRequest taxonomyRequest)
        {
            //add validation
            try
            {
                if (string.IsNullOrEmpty(AccessToken))
                {
                    return(BadRequest("no access_token cookie found in the request"));
                }
                var response = _taxonomyUseCase.ExecuteCreate(taxonomyRequest);
                if (response != null)
                {
                    return(Created(new Uri($"/{response.Id}", UriKind.Relative), response));
                }
            }
            catch (UseCaseException e)
            {
                return(BadRequest(e));
            }

            // Validations
            return(BadRequest(
                       new ErrorResponse($"Invalid request. ")
            {
                Status = "Bad request", Errors = new List <string> {
                    "Unable to create taxonomy."
                }
            }));
        }
Example #3
0
        public static TaxonomyData createTaxonomyTree(long TaxonomyId)
        {
            TaxonomyRequest taxonomyRequest = new TaxonomyRequest();
            Ektron.Cms.API.Content.Taxonomy tax1 = new Taxonomy();
            //  Ektron.Cms.TaxonomyData taxData = new TaxonomyData();
            try
            {
                taxonomyRequest.TaxonomyId = TaxonomyId;
                //   taxonomyRequest.Page = Page;
                taxonomyRequest.TaxonomyLanguage = 1033;
                // taxonomyRequest.PageSize = contentApi.RequestInformationRef.PagingSize;
                taxonomyRequest.Depth = -1;
                taxonomyRequest.ReadCount = true;
                taxonomyRequest.TaxonomyType = 0; //0 = content; 1 = user; 2 = group;
                taxonomyRequest.IncludeItems = false;
                //    taxonomyRequest.SortOrder = "last_edit_date";
                //   taxonomyRequest.SortDirection = "desc";
                taxData = tax1.LoadTaxonomy(ref taxonomyRequest);
                TaxonomyBaseData[] taxonomyDataArray = new CommonApi().EkContentRef.ReadAllSubCategories(taxonomyRequest);

            }
            catch (Exception)
            {
            }
            return taxData;
        }
 public IActionResult PatchTaxonomy([FromRoute] int id, TaxonomyRequest taxonomyRequest)
 {
     try
     {
         var response = _taxonomyUseCase.ExecutePatch(id, taxonomyRequest);
         if (response != null)
         {
             return(Ok(response));
         }
     }
     catch (InvalidOperationException e)
     {
         LoggingHandler.LogError(e.Message);
         LoggingHandler.LogError(e.StackTrace);
         return(BadRequest(
                    new ErrorResponse($"Error updating taxonomy")
         {
             Status = "Bad request", Errors = new List <string> {
                 $"An error occurred attempting to update taxonomy {id}: {e.Message}"
             }
         }));
     }
     return(BadRequest(
                new ErrorResponse($"Invalid request. ")
     {
         Status = "Bad request", Errors = new List <string> {
             "Unable to update taxonomy."
         }
     }));
 }
Example #5
0
        protected string GetTaxonomyJson(long id, bool newlyAddedFlag)
        {
            // format: {"Id":"123",
            //          "Name":"Some Product",
            //          "Path":"\\CMS400Demo\\Furniture",
            //          "Type":"product",
            //          "SubType":"product",
            //          "TypeCode":"0",
            //          "MarkedForDelete":"false",
            //          "NewlyAdded":"false"}

            TaxonomyRequest tr = new TaxonomyRequest();
            tr.PageSize = 0;
            tr.TaxonomyId = id;
            tr.TaxonomyLanguage = Convert.ToInt32(Request.QueryString["languageId"]);
            tr.TaxonomyType = EkEnumeration.TaxonomyType.Content;
            TaxonomyData td = m_refContentApi.ReadTaxonomy(ref tr);
            if (td != null)
            {
                return "{\"Id\":\"" + id.ToString()
                    + "\",\"Name\":\"" + td.Name  + "\""
                    + ",\"Path\":\"" + td.Path.Replace("\\", "\\\\") + "\""
                    + ",\"Type\":\"Taxonomy\",\"SubType\":\"\",\"TypeCode\":\"2\",\"MarkedForDelete\":\"false\",\"NewlyAdded\":\"" + newlyAddedFlag.ToString().ToLower() + "\"}";
            }
            return String.Empty;
        }
 public static Taxonomy ToEntity(this TaxonomyRequest request)
 {
     return(new Taxonomy()
     {
         Description = request.Description,
         Weight = request.Weight,
         Vocabulary = request.VocabularyId == 1 ? "category" : "demographic"
     });
 }
 public static TaxonomyDomain ToDomain(this TaxonomyRequest request)
 {
     return(new TaxonomyDomain()
     {
         Description = request.Description,
         Vocabulary = request.VocabularyId == 1 ? "category" : "demographic",
         Weight = request.Weight
     });
 }
Example #8
0
        public TaxonomyResponse ExecutePatch(int id, TaxonomyRequest requestParams)
        {
            if (!requestParams.IsValid())
            {
                throw new InvalidOperationException("vocabulary_id must be provided and can only be 1 or 2.");
            }
            var gatewayResponse = _taxonomyGateway.PatchTaxonomy(id, requestParams.ToEntity());

            return(gatewayResponse == null ? null : gatewayResponse.ToResponse());
        }
Example #9
0
    protected string GenerateCategoryHtml(string controlId, int languageID, long taxonomyId)
    {
        StringBuilder sb = new StringBuilder();

        Taxonomy taxonomyAPI = new Taxonomy();
        TaxonomyRequest taxonomyRequest = new TaxonomyRequest();
        taxonomyRequest.TaxonomyId = taxonomyId;
        taxonomyRequest.TaxonomyLanguage = languageID;

        TaxonomyData taxonomyData = taxonomyAPI.LoadTaxonomy(ref taxonomyRequest);

        SiteAPI siteAPI = new SiteAPI();

        sb.Append("<li id=\"ekTaxonomy");
        sb.Append(controlId);
        sb.Append("_");
        sb.Append(taxonomyId.ToString());
        sb.Append("\">");
        if (taxonomyData.Taxonomy.Length > 0)
        {
            sb.Append("<a href=\"#\" onclick=\"toggleTree('");
            sb.Append(controlId);
            sb.Append("', ");
            sb.Append(taxonomyId.ToString());
            sb.Append(");\"><img id=\"ekIMG");
            sb.Append(controlId);
            sb.Append("_");
            sb.Append(taxonomyId.ToString());
            sb.Append("\" src=\"");
            sb.Append(siteAPI.SitePath);
            sb.Append("Workarea/images/ui/icons/tree/taxonomyCollapsed.png\" border=\"0\"></img></a>");
        }
        else
        {
            sb.Append("<img  src=\"");
            sb.Append(siteAPI.SitePath);
            sb.Append("Workarea/images/ui/icons/tree/taxonomy.png\"></img>");
        }
        sb.Append("<input type=\"checkbox\" id=\"");
        sb.Append("ekCheck");
        sb.Append(controlId);
        sb.Append("_");
        sb.Append(taxonomyId.ToString());
        sb.Append("\" onclick=\"selectCategory(this);\">");
        sb.Append(taxonomyData.TaxonomyName);

        return sb.ToString();
    }
Example #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_refMsg = m_refSiteApi.EkMsgRef;
        ContentAPI capi = new ContentAPI();
        Ektron.Cms.API.Content.Taxonomy tax = new Ektron.Cms.API.Content.Taxonomy();
        TaxonomyRequest tr = new TaxonomyRequest();
        tr.IncludeItems = false;
        tr.Depth = 1;
        tr.Page = Page;
        tr.TaxonomyId = 0;
        tr.TaxonomyLanguage = capi.RequestInformationRef.ContentLanguage;
        tr.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Content;
        tr.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Content;
        TaxonomyBaseData[] td = capi.EkContentRef.ReadAllSubCategories(tr);
        taxonomies.DataSource = td;
        taxonomies.DataBind();

        // Register JS
        JS.RegisterJSInclude(this, JS.ManagedScript.EktronJS);
        JS.RegisterJSInclude(this, JS.ManagedScript.EktronTreeviewJS);
    }
Example #11
0
    public string Handler_RemoveItems()
    {
        StringBuilder sbRet = new StringBuilder();
            ContentAPI apiContent = new ContentAPI();
            string sItemList = "";
            int iRet = 0;
            string sKey = "";
            long iNode = 0;
            try
            {
                sItemList = Request.QueryString["itemlist"];
                sKey = EkFunctions.HtmlEncode(Request.QueryString["key"]);

                try
                {
                    string[] aValues;
                    aValues = sItemList.Split(',');
                    if ((aValues != null)&& aValues.Length > 0)
                    {
                        for (int i = 0; i <= (aValues.Length - 1); i++)
                        {
                            if (aValues[i].ToLower().IndexOf(sKey + "_i") == 0)
                            {
                                TaxonomyRequest tReq = new TaxonomyRequest();
                                string[] aVal = (aValues[i]).Split('_');
                                int iType = 0;

                                iNode = long.Parse(Request.QueryString["node"]);
                                tReq.TaxonomyIdList = aVal[1].Substring(1);
                                iType = int.Parse(aVal[2]);
                                switch (iType)
                                {
                                    case 7:
                                        break;

                                    default: // 1 - content
                                        tReq.TaxonomyItemType = (EkEnumeration.TaxonomyItemType)(Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content);
                                        break;
                                }
                                tReq.TaxonomyId = iNode;
                                tReq.TaxonomyLanguage = apiContent.ContentLanguage;
                                apiContent.RemoveTaxonomyItem(tReq);
                            }
                            else if (aValues[i].ToLower().IndexOf(sKey + "_f") == 0)
                            {
                                TaxonomyRequest tReq = new TaxonomyRequest();
                                iNode = int.Parse(aValues[i].Substring(((sKey + "_f").Length) + 1 - 1));
                                tReq.TaxonomyId = iNode;
                                tReq.TaxonomyLanguage = apiContent.ContentLanguage;
                                if (iNode > 0)
                                {
                                    apiContent.DeleteTaxonomy(tReq);
                                }
                            }
                        }
                    }
                    iRet = 0;
                }
                catch (Exception ex)
                {
                    EkException.ThrowException(ex);
                }
                sbRet.Append("  <method>RemoveItems</method>").Append(Environment.NewLine);
                sbRet.Append("  <result>").Append(iRet).Append("</result>").Append(Environment.NewLine);
                sbRet.Append("  <key>").Append(sKey).Append("</key>").Append(Environment.NewLine);
                return sbRet.ToString();
            }
            catch (Exception)
            {

            }
            return sbRet.ToString();
    }
Example #12
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refApi.EkMsgRef;
        AppImgPath = m_refApi.AppImgPath;
        m_strPageAction = Request.QueryString["action"];
        object refAPI = m_refApi as object;
        Utilities.SetLanguage(m_refApi);
        TaxonomyLanguage = m_refApi.ContentLanguage;
        if ((TaxonomyLanguage == -1))
        {
            TaxonomyLanguage = m_refApi.DefaultContentLanguage;
        }
        if ((Request.QueryString["taxonomyid"] != null))
        {
            TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            hdnTaxonomyId.Value = TaxonomyId.ToString();
        }
        if ((Request.QueryString["parentid"] != null))
        {
            TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
        }
        m_refContent = m_refApi.EkContentRef;
        if ((Request.QueryString["reorder"] != null))
        {
            m_strReorderAction = Convert.ToString(Request.QueryString["reorder"]);
        }
        if ((Request.QueryString["view"] != null))
        {
            _ViewItem = Request.QueryString["view"];
        }
        if ((Page.IsPostBack))
        {
            if ((m_strPageAction == "edit"))
            {
                taxonomy_data.TaxonomyLanguage = TaxonomyLanguage;
                taxonomy_data.TaxonomyParentId = TaxonomyParentId;
                taxonomy_data.TaxonomyId = TaxonomyId;
                taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID];
                taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID];
                // taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID];
                //  taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID];
                //if (tr_enableDisable.Visible == true)
                //{
                //    if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID]))
                //    {
                //        taxonomy_data.Visible = true;
                //    }
                //    else
                //    {
                //        taxonomy_data.Visible = false;
                //    }
                //}
                //else
                //{
                //    taxonomy_data.Visible = Convert.ToBoolean(Request.Form[visibility.UniqueID]);
                //}
                //if ((Request.Form[inherittemplate.UniqueID] != null))
                //{
                //    taxonomy_data.TemplateInherited = true;
                //}
                //if ((Request.Form[taxonomytemplate.UniqueID] != null))
                //{
                //    taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]);
                //}
                //else
                //{
                //    taxonomy_data.TemplateId = 0;
                //}

                try
                {
                    m_refContent.UpdateTaxonomy(taxonomy_data);
                }
                catch (Exception ex)
                {
                    Utilities.ShowError(ex.Message);
                }
                //if (((Request.Form[chkApplyDisplayAllLanguages.UniqueID] != null)) && (Request.Form[chkApplyDisplayAllLanguages.UniqueID].ToString().ToLower() == "on"))
                //{
                //    m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, taxonomy_data.Visible);
                //}
                //else
                //{
                //    m_refContent.UpdateTaxonomyVisible(TaxonomyId, TaxonomyLanguage, taxonomy_data.Visible);
                //}
                if ((TaxonomyParentId == 0))
                {
                    string strConfig = string.Empty;
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID])))
                    //{
                    //    strConfig = "0";
                    //}
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID])))
                    //{
                    //    if ((string.IsNullOrEmpty(strConfig)))
                    //    {
                    //        strConfig = "1";
                    //    }
                    //    else
                    //    {
                    //        strConfig = strConfig + ",1";
                    //    }
                    //}
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID])))
                    //{
                    //    if ((string.IsNullOrEmpty(strConfig)))
                    //    {
                    //        strConfig = "2";
                    //    }
                    //    else
                    //    {
                    //        strConfig = strConfig + ",2";
                    //    }
                    //}
                    //if ((!(string.IsNullOrEmpty(strConfig))))
                    //{
                    //    m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig);
                    //}
                }
                UpdateCustomProperties();

                if ((Request.QueryString["iframe"] == "true"))
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    if ((Request.QueryString["backaction"] != null && Convert.ToString(Request.QueryString["backaction"]).ToLower() == "viewtree"))
                    {
                        Response.Redirect("LocaleTaxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage, true);
                    }
                    else if (Request.QueryString["view"] != null)
                    {
                        Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" +Convert.ToString(Request.QueryString["view"]) + "&taxonomyid=" + TaxonomyId + "&rf=1", true);
                    }
                    else
                    {
                        Response.Redirect("LocaleTaxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1", true);
                    }
                }
            }
            else
            {
                if ((!string.IsNullOrEmpty(Request.Form[LinkOrder.UniqueID])))
                {
                    taxonomy_request = new TaxonomyRequest();
                    taxonomy_request.TaxonomyId = TaxonomyId;
                    taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
                    taxonomy_request.TaxonomyIdList = Request.Form[LinkOrder.UniqueID];
                    if (!string.IsNullOrEmpty(Request.Form[chkOrderAllLang.UniqueID]))
                    {
                        if ((m_strReorderAction == "category"))
                        {
                            m_refContent.ReOrderAllLanguageCategories(taxonomy_request);
                        }
                    }
                    else
                    {
                        if ((m_strReorderAction == "category"))
                        {
                            m_refContent.ReOrderCategories(taxonomy_request);
                        }
                        else
                        {
                            m_refContent.ReOrderTaxonomyItems(taxonomy_request);
                        }
                    }
                }
                if ((Request.QueryString["iframe"] == "true"))
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    Response.Redirect("LocaleTaxonomy.aspx?action=view&type="+ Request.QueryString["type"]+"&taxonomyid=" + TaxonomyId + "&rf=1", true);
                }
            }
        }
        else
        {
            //ltr_sitepath.Text = m_refApi.SitePath;
            taxonomy_request = new TaxonomyRequest();
            taxonomy_request.TaxonomyId = TaxonomyId;
            taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;

            if ((m_strPageAction == "edit"))
            {
                taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);

                taxonomydescription.Text = taxonomy_data.TaxonomyDescription;
                taxonomytitle.Text = taxonomy_data.TaxonomyName;
                //  taxonomy_image.Text = taxonomy_data.TaxonomyImage;
                // taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage;
                //   categoryLink.Text = taxonomy_data.CategoryUrl;
                visibility.Value = taxonomy_data.Visible.ToString();
                if ((Request.QueryString["taxonomyid"] != null))
                {
                    TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
                }

                if (TaxonomyParentId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage);
                }
                else if (TaxonomyId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                }

                // ' why in the world would you disable the visible flag if it's not synchronized???
                //If Not m_bSynchronized Then
                //tr_enableDisable.Visible = False
                //End If

                //if (taxonomy_data.Visible == true)
                //{
                //    chkEnableDisable.Checked = true;
                //}
                //else
                //{
                //    chkEnableDisable.Checked = false;
                //}
                //if (!string.IsNullOrEmpty(taxonomy_data.TaxonomyImage))
                //{
                //    taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0 ? taxonomy_data.TaxonomyImage : m_refApi.SitePath + taxonomy_data.TaxonomyImage);
                //}
                //else
                //{
                //    taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif";
                //}
                //language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage);
                ////if ((taxonomy_data.TaxonomyParentId == 0))
                //{
                //    inherittemplate.Visible = false;
                //    lblInherited.Text = "No";
                //    inherittemplate.Checked = taxonomy_data.TemplateInherited;
                //}
                //else
                //{
                //    inherittemplate.Visible = true;
                //    lblInherited.Text = "";
                //    inherittemplate.Checked = taxonomy_data.TemplateInherited;
                //    if ((taxonomy_data.TemplateInherited))
                //    {
                //        taxonomytemplate.Enabled = false;
                //    }
                //}
                //TemplateData[] templates = null;
                //templates = m_refApi.GetAllTemplates("TemplateFileName");
                //taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("-select template-", "0"));
                //if ((templates != null && templates.Length > 0))
                //{
                //    for (int i = 0; i <= templates.Length - 1; i++)
                //    {
                //        taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString()));
                //        if ((taxonomy_data.TemplateId == templates[i].Id))
                //        {
                //            taxonomytemplate.SelectedIndex = i + 1;
                //        }
                //    }
                //}
                if (((language_data != null) && (m_refApi.EnableMultilingual == 1)))
                {
                    lblLanguage.Text = "[" + language_data.Name + "]";
                }
                m_strCurrentBreadcrumb = taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > ");
                if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb)))
                {
                    m_strCurrentBreadcrumb = "Root";
                }
                //admin inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                if ((TaxonomyParentId == 0))
                {
                    //tr_config.Visible = true;
                    //List<Int32> config_list = m_refApi.EkContentRef.GetAllConfigIdListByTaxonomy(TaxonomyId, TaxonomyLanguage);
                    //for (int i = 0; i <= config_list.Count - 1; i++)
                    //{
                    //    if ((config_list[i] == 0))
                    //    {
                    //        chkConfigContent.Checked = true;
                    //    }
                    //    else if ((config_list[i] == 1))
                    //    {
                    //        chkConfigUser.Checked = true;
                    //    }
                    //    else if ((config_list[i] == 2))
                    //    {
                    //        chkConfigGroup.Checked = true;
                    //    }
                    //}
                }
                else
                {
                    //  tr_config.Visible = false;
                }
                LoadCustomPropertyList();
            }
            else
            {
                if ((m_strReorderAction == "category"))
                {
                    taxonomy_request.PageSize = 99999999;
                    // pagesize of 0 used to mean "all"
                    taxonomy_arr = m_refContent.ReadAllSubCategories(taxonomy_request);
                    if ((taxonomy_arr != null))
                    {
                        TotalItems = taxonomy_arr.Length;
                    }
                    else
                    {
                        TotalItems = 0;
                    }
                    if ((TotalItems > 1))
                    {
                        td_msg.Text = m_refMsg.GetMessage("generic first msg");
                        OrderList.DataSource = taxonomy_arr;
                        OrderList.DataTextField = "TaxonomyName";
                        OrderList.DataValueField = "TaxonomyId";
                        OrderList.DataBind();
                        OrderList.SelectionMode = ListSelectionMode.Multiple;
                        OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                        if ((TotalItems > 20))
                        {
                            OrderList.Rows = 20;
                        }
                        else
                        {
                            OrderList.Rows = TotalItems;
                        }
                        OrderList.Width = 300;
                        if ((TotalItems > 0))
                        {
                            loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                        }
                        for (int i = 0; i <= taxonomy_arr.Length - 1; i++)
                        {
                            if ((string.IsNullOrEmpty(LinkOrder.Value)))
                            {
                                LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId);
                            }
                            else
                            {
                                LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId) + ",";
                            }
                        }
                    }
                    else
                    {
                        LoadNoItem();
                    }
                }
                else
                {
                    AllLangForm.Visible = false;
                    // the all languages checkbox is only valid for categories
                    taxonomy_request.PageSize = 99999999;
                    taxonomy_request.IncludeItems = true;
                    taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);
                    tr_ordering.Visible = true;
                    //Not showing for items
                    if ((taxonomy_data.TaxonomyItems != null))
                    {
                        TotalItems = taxonomy_data.TaxonomyItems.Length;
                        if ((TotalItems > 1))
                        {
                            td_msg.Text = m_refMsg.GetMessage("generic first msg");
                            OrderList.DataSource = taxonomy_data.TaxonomyItems;
                            OrderList.DataTextField = "TaxonomyItemTitle";
                            OrderList.DataValueField = "TaxonomyItemId";
                            OrderList.DataBind();
                            OrderList.SelectionMode = ListSelectionMode.Multiple;
                            OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                            if ((TotalItems > 20))
                            {
                                OrderList.Rows = 20;
                            }
                            else
                            {
                                OrderList.Rows = TotalItems;
                            }
                            OrderList.Width = 300;
                            if ((TotalItems > 0))
                            {
                                loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                            }
                            foreach (TaxonomyItemData taxonomy_item in taxonomy_data.TaxonomyItems)
                            {
                                if ((string.IsNullOrEmpty(LinkOrder.Value)))
                                {
                                    LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId);
                                }
                                else
                                {
                                    LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId) + ",";
                                }
                            }
                        }
                        else
                        {
                            LoadNoItem();
                        }
                    }
                }
            }
            TaxonomyToolBar();
        }
    }
Example #13
0
    private string GetTaxonomyTree(string controlId, int languageID, long taxonomyId)
    {
        TaxonomyRequest taxonomyRequest = new TaxonomyRequest();
        taxonomyRequest.TaxonomyId = taxonomyId;
        taxonomyRequest.TaxonomyLanguage = languageID;

        TaxonomyData taxonomyData = taxonomyAPI.LoadTaxonomy(ref taxonomyRequest);

        StringBuilder sb = new StringBuilder();
        sb.Append("<li id=\"ekTaxonomy");
        sb.Append(controlId);
        sb.Append("_");
        sb.Append(taxonomyData.TaxonomyId.ToString());
        sb.Append("\">");
        if (taxonomyData.Taxonomy.Length > 0)
        {
            sb.Append("<a href=\"#\" onclick=\"toggleTree('");
            sb.Append(controlId);
            sb.Append("', ");
            sb.Append(taxonomyId.ToString());
            sb.Append(");\"><img id=\"ekIMG");
            sb.Append(controlId);
            sb.Append("_");
            sb.Append(taxonomyId.ToString());
            sb.Append("\" src=\"");
            sb.Append(siteAPI.SitePath);
            sb.Append("Workarea/images/ui/icons/tree/taxonomyCollapsed.png\" border=\"0\"></img></a>");
        }
        else
        {
            sb.Append("<img  src=\"");
            sb.Append(siteAPI.SitePath);
            sb.Append("Workarea/images/ui/icons/tree/taxonomy.png\"></img>");
        }
        sb.Append("<input type=\"checkbox\" id=\"");
        sb.Append("ekCheck");
        sb.Append(controlId);
        sb.Append("_");
        sb.Append(taxonomyId.ToString());
        sb.Append("\" onclick=\"selectCategory(this);\">");
        sb.Append(taxonomyData.TaxonomyName);

        if (taxonomyData.Taxonomy.Length > 0)
        {
            sb.Append("<div id=\"ekDiv");
            sb.Append(controlId);
            sb.Append("_");
            sb.Append(taxonomyId.ToString());
            sb.Append("\" style=\"display: none;\">");
            sb.Append("<ul>");
            foreach (TaxonomyData childTaxonomyData in taxonomyData.Taxonomy)
            {
                sb.Append(GetTaxonomyTree(controlId, languageID, childTaxonomyData.TaxonomyId));
            }
            sb.Append("</ul>");
            sb.Append("</div>");
        }

        sb.Append("</li>");

        return sb.ToString();
    }
Example #14
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refApi.EkMsgRef;
        AppImgPath = m_refApi.AppImgPath;
        m_strPageAction = Request.QueryString["action"];
        object refAPI = m_refApi as object;
        Utilities.SetLanguage(m_refApi);
        TaxonomyLanguage = m_refApi.ContentLanguage;
        if (TaxonomyLanguage == -1)
        {
            TaxonomyLanguage = m_refApi.DefaultContentLanguage;
        }
        if (Request.QueryString["taxonomyid"] != null)
        {
            TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            hdnTaxonomyId.Value = TaxonomyId.ToString();
        }
        if (Request.QueryString["parentid"] != null)
        {
            TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
        }
        m_refContent = m_refApi.EkContentRef;
        if (Request.QueryString["reorder"] != null)
        {
            m_strReorderAction = Convert.ToString(Request.QueryString["reorder"]);
        }
        chkApplyDisplayAllLanguages.Text = m_refMsg.GetMessage("lbl apply display taxonomy languages");
        chkConfigContent.Text = chkConfigContent.ToolTip = m_refMsg.GetMessage("content text");
        chkConfigUser.Text = chkConfigUser.ToolTip = m_refMsg.GetMessage("generic user");
        chkConfigGroup.Text = chkConfigGroup.ToolTip = m_refMsg.GetMessage("lbl group");
        if (Page.IsPostBack)
        {
            if (m_strPageAction == "edit")
            {
                taxonomy_data.TaxonomyLanguage = TaxonomyLanguage;
                taxonomy_data.TaxonomyParentId = TaxonomyParentId;
                taxonomy_data.TaxonomyId = TaxonomyId;
                taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID];
                taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID];
                taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID];
                taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID];
                if (tr_enableDisable.Visible == true)
                {
                    if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID]))
                    {
                        taxonomy_data.Visible = true;
                    }
                    else
                    {
                        taxonomy_data.Visible = false;
                    }
                }
                else
                {
                    taxonomy_data.Visible = Convert.ToBoolean(Request.Form[visibility.UniqueID]);
                }
                if (Request.Form[inherittemplate.UniqueID] != null)
                {
                    taxonomy_data.TemplateInherited = true;
                }
                if (Request.Form[taxonomytemplate.UniqueID] != null)
                {
                    taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]);
                }
                else
                {
                    taxonomy_data.TemplateId = 0;
                }

                try
                {
                    m_refContent.UpdateTaxonomy(taxonomy_data);
                }
                catch (Exception ex)
                {
                    Utilities.ShowError(ex.Message);
                }
                if ((!(Request.Form[chkApplyDisplayAllLanguages.UniqueID] == null)) && (Request.Form[chkApplyDisplayAllLanguages.UniqueID].ToString().ToLower() == "on"))
                {
                    m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, taxonomy_data.Visible);
                }
                m_refContent.UpdateTaxonomySynchronization(TaxonomyId, GetCheckBoxValue(chkTaxSynch));
                //else
                //{
                //    m_refContent.UpdateTaxonomyVisible(TaxonomyId, TaxonomyLanguage, taxonomy_data.Visible);
                //}
                if (TaxonomyParentId == 0)
                {
                    string strConfig = string.Empty;
                    if (!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID]))
                    {
                        strConfig = "0";
                    }
                    if (!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID]))
                    {
                        if (string.IsNullOrEmpty(strConfig))
                        {
                            strConfig = "1";
                        }
                        else
                        {
                            strConfig = strConfig + ",1";
                        }
                    }
                    if (!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID]))
                    {
                        if (string.IsNullOrEmpty(strConfig))
                        {
                            strConfig = "2";
                        }
                        else
                        {
                            strConfig = strConfig + ",2";
                        }
                    }
                    if (!(string.IsNullOrEmpty(strConfig)))
                    {
                        m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig);
                    }
                }
                UpdateCustomProperties();

                if (Request.QueryString["iframe"] == "true")
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    if ((Request.QueryString["backaction"] != null) && Convert.ToString(Request.QueryString["backaction"]).ToLower() == "viewtree")
                    {
                        Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true);
                    }
                    else
                    {
                        Response.Redirect("taxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1", true);
                    }
                }
            }
            else
            {
                if (Request.Form[LinkOrder.UniqueID] != "")
                {
                    taxonomy_request = new TaxonomyRequest();
                    taxonomy_request.TaxonomyId = TaxonomyId;
                    taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
                    taxonomy_request.TaxonomyIdList = Request.Form[LinkOrder.UniqueID];
                    if (!string.IsNullOrEmpty(Request.Form[chkOrderAllLang.UniqueID]))
                    {
                        if (m_strReorderAction == "category")
                        {
                            m_refContent.ReOrderAllLanguageCategories(taxonomy_request);
                        }
                        else if (m_strReorderAction == "users")
                        {

                                taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                            m_refContent.ReOrderTaxonomyItems(taxonomy_request);
                        }
                    }
                    else
                    {
                        if (m_strReorderAction == "category")
                        {
                            m_refContent.ReOrderCategories(taxonomy_request);
                        }
                        else
                        {
                            if (m_strReorderAction == "users")
                            {
                                taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                            }
                            m_refContent.ReOrderTaxonomyItems(taxonomy_request);
                        }
                    }
                }
                if (Request.QueryString["iframe"] == "true")
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    if(m_strReorderAction == "category")
                        Response.Redirect("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId + "&rf=1&reloadtrees=Tax", true);
                    else
                        Response.Redirect("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId + "&rf=1", true);
                }
            }
        }
        else
        {
            ltr_sitepath.Text = m_refApi.SitePath;
            taxonomy_request = new TaxonomyRequest();
            taxonomy_request.TaxonomyId = TaxonomyId;
            taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;

            if (m_strPageAction == "edit")
            {
                taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);

                taxonomydescription.Text = taxonomy_data.TaxonomyDescription;
                taxonomydescription.ToolTip = taxonomydescription.Text;
                taxonomytitle.Text = taxonomy_data.TaxonomyName;
                taxonomytitle.ToolTip = taxonomytitle.Text;
                taxonomy_image.Text = taxonomy_data.TaxonomyImage;
                taxonomy_image.ToolTip = taxonomy_image.Text;
                taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage;
                categoryLink.Text = taxonomy_data.CategoryUrl;
                visibility.Value = taxonomy_data.Visible.ToString();
                if (Request.QueryString["taxonomyid"] != null)
                {
                    TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
                }

                if (TaxonomyParentId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage);
                    if (TaxonomyId > 0)
                        chkTaxSynch.Checked = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                }
                else if (TaxonomyId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                    chkTaxSynch.Checked = m_bSynchronized;
                }
                if (taxonomy_data.Visible == true)
                {
                    chkEnableDisable.Checked = true;
                }
                else
                {
                    chkEnableDisable.Checked = false;
                }
                if (taxonomy_data.TaxonomyImage != "")
                {
                    taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0) ? taxonomy_data.TaxonomyImage : m_refApi.SitePath + taxonomy_data.TaxonomyImage;
                }
                else
                {
                    taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif";
                }
                language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage);
                if (taxonomy_data.TaxonomyParentId == 0)
                {
                    inherittemplate.Visible = false;
                    lblInherited.Text = "No";
                    lblInherited.ToolTip = lblInherited.Text;
                    inherittemplate.Checked = taxonomy_data.TemplateInherited;
                }
                else
                {
                    inherittemplate.Visible = true;
                    lblInherited.Text = "";
                    inherittemplate.Checked = taxonomy_data.TemplateInherited;
                    if (taxonomy_data.TemplateInherited)
                    {
                        taxonomytemplate.Enabled = false;
                    }
                }
                TemplateData[] templates = null;
                templates = m_refApi.GetAllTemplates("TemplateFileName");
                taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("- " + m_refMsg.GetMessage("generic select template") + " -", "0"));
                if ((templates != null) && templates.Length > 0)
                {
                    for (int i = 0; i <= templates.Length - 1; i++)
                    {
                        taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString()));
                        if (taxonomy_data.TemplateId == templates[i].Id)
                        {
                            taxonomytemplate.SelectedIndex = i + 1;
                        }
                    }
                }
                if ((language_data != null) && (m_refApi.EnableMultilingual == 1))
                {
                    lblLanguage.Text = "[" + language_data.Name + "]";
                    lblLanguage.ToolTip = lblLanguage.Text;
                }
                m_strCurrentBreadcrumb = (string)(taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "));
                if (m_strCurrentBreadcrumb == "")
                {
                    m_strCurrentBreadcrumb = "Root";
                }
                inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                if (TaxonomyParentId == 0)
                {
                    tr_config.Visible = true;
                    List<int> config_list = m_refApi.EkContentRef.GetAllConfigIdListByTaxonomy(TaxonomyId, TaxonomyLanguage);
                    for (int i = 0; i <= config_list.Count - 1; i++)
                    {
                        if (config_list[i] == 0)
                        {
                            chkConfigContent.Checked = true;
                        }
                        else if (config_list[i] == 1)
                        {
                            chkConfigUser.Checked = true;
                        }
                        else if (config_list[i] == 2)
                        {
                            chkConfigGroup.Checked = true;
                        }
                    }
                }
                else
                {
                    tr_config.Visible = false;
                }

                LoadCustomPropertyList();

            }
            else
            {
                if (m_strReorderAction == "category")
                {
                    taxonomy_request.PageSize = 99999999; // pagesize of 0 used to mean "all"
                    taxonomy_arr = m_refContent.ReadAllSubCategories(taxonomy_request);
                    if (taxonomy_arr != null)
                    {
                        TotalItems = taxonomy_arr.Length;
                    }
                    else
                    {
                        TotalItems = 0;
                    }
                    if (TotalItems > 1)
                    {
                        td_msg.Text = m_refMsg.GetMessage("generic first msg");
                        OrderList.DataSource = taxonomy_arr;
                        OrderList.DataTextField = "TaxonomyName";
                        OrderList.DataValueField = "TaxonomyId";
                        OrderList.DataBind();
                        OrderList.SelectionMode = ListSelectionMode.Multiple;
                        OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                        if (TotalItems > 20)
                        {
                            OrderList.Rows = 20;
                        }
                        else
                        {
                            OrderList.Rows = TotalItems;
                        }
                        OrderList.Width = 300;
                        if (TotalItems > 0)
                        {
                            loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                        }
                        for (int i = 0; i <= taxonomy_arr.Length - 1; i++)
                        {
                            if (LinkOrder.Value == "")
                            {
                                LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId);
                            }
                            else
                            {
                                LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId) + ",";
                            }
                        }
                    }
                    else
                    {
                        LoadNoItem();
                    }
                }
                else if (m_strReorderAction == "users")
                {
                    DirectoryUserRequest uReq = new DirectoryUserRequest();
                    DirectoryAdvancedUserData uDirectory = new DirectoryAdvancedUserData();
                    uReq.GetItems = true;
                    uReq.DirectoryId = TaxonomyId;
                    uReq.DirectoryLanguage = TaxonomyLanguage;
                    uReq.PageSize = 99999;
                    uReq.CurrentPage = 1;
                    uDirectory = this.m_refContent.LoadDirectory(ref uReq);
                    TotalItems = uDirectory.DirectoryItems.Count();
                    if (TotalItems > 1)
                    {
                        td_msg.Text = m_refMsg.GetMessage("generic first msg");
                        OrderList.DataSource = uDirectory.DirectoryItems;
                        OrderList.DataTextField = "Username";
                        OrderList.DataValueField = "Id";
                        OrderList.DataBind();
                        OrderList.SelectionMode = ListSelectionMode.Multiple;
                        OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                        if (TotalItems > 20)
                        {
                            OrderList.Rows = 20;
                        }
                        else
                        {
                            OrderList.Rows = TotalItems;
                        }
                        OrderList.Width = 300;
                        if (TotalItems > 0)
                        {
                            loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                        }
                        for (int i = 0; i <= TotalItems - 1; i++)
                        {
                            if (LinkOrder.Value == "")
                            {
                                LinkOrder.Value = Convert.ToString(uDirectory.DirectoryItems[i].Id);
                            }
                            else
                            {
                                LinkOrder.Value = Convert.ToString(uDirectory.DirectoryItems[i].Id) + ",";
                            }
                        }
                    }
                    else
                    {
                        LoadNoItem();
                    }
                }
                else
                {
                    AllLangForm.Visible = false; // the all languages checkbox is only valid for categories
                    taxonomy_request.PageSize = 99999999;
                    taxonomy_request.IncludeItems = true;
                    taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);
                    tr_ordering.Visible = true; //Not showing for items
                    if (taxonomy_data.TaxonomyItems != null)
                    {
                        TotalItems = taxonomy_data.TaxonomyItems.Length;
                        if (TotalItems > 1)
                        {
                            td_msg.Text = m_refMsg.GetMessage("generic first msg");
                            OrderList.DataSource = taxonomy_data.TaxonomyItems;
                            OrderList.DataTextField = "TaxonomyItemTitle";
                            OrderList.DataValueField = "TaxonomyItemId";
                            OrderList.DataBind();
                            OrderList.SelectionMode = ListSelectionMode.Multiple;
                            OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                            if (TotalItems > 20)
                            {
                                OrderList.Rows = 20;
                            }
                            else
                            {
                                OrderList.Rows = TotalItems;
                            }
                            OrderList.Width = 300;
                            if (TotalItems > 0)
                            {
                                loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                            }
                            foreach (TaxonomyItemData taxonomy_item in taxonomy_data.TaxonomyItems)
                            {
                                if (LinkOrder.Value == "")
                                {
                                    LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId);
                                }
                                else
                                {
                                    LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId) + ",";
                                }
                            }
                        }
                        else
                        {
                            LoadNoItem();
                        }
                    }
                }
            }
            TaxonomyToolBar();
        }
    }
Example #15
0
    protected string GenerateTreeHtml(string controlId, int languageID, long taxonomyId)
    {
        string taxonomyHtml;
        StringBuilder sb = new StringBuilder();
        ContentAPI contentAPI = new Ektron.Cms.ContentAPI();

        TaxonomyRequest taxonomyRequest = new TaxonomyRequest();
        taxonomyRequest.TaxonomyId = taxonomyId;
        taxonomyRequest.TaxonomyLanguage = languageID;

        Taxonomy taxonomyAPI = new Taxonomy();
        TaxonomyData taxonomyData = taxonomyAPI.LoadTaxonomy(ref taxonomyRequest);

        if (taxonomyData.Taxonomy.Length == 0)
            return "";

        sb.Append("<ul>");

        foreach (TaxonomyData childTaxonomyData in taxonomyData.Taxonomy)
        {
            taxonomyHtml = GenerateCategoryHtml(controlId, languageID, childTaxonomyData.TaxonomyId);
            sb.Append(taxonomyHtml);
        }
        sb.Append("</ul>");
        return sb.ToString();
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = this.m_refContentApi.EkMsgRef;
        AppImgPath = this.m_refContentApi.AppImgPath;
        AppPath = this.m_refContentApi.AppPath;
        m_strPageAction = Request.QueryString["action"];
        object refApi = m_refContentApi as object;
        Utilities.SetLanguage(m_refContentApi);
        TaxonomyLanguage = this.m_refContentApi.ContentLanguage;
        if ((TaxonomyLanguage == -1))
        {
            TaxonomyLanguage = m_refContentApi.DefaultContentLanguage;
        }
        if ((Request.QueryString["view"] != null))
        {
            _ViewItem = Request.QueryString["view"];
        }
        if ((Request.QueryString["taxonomyid"] != null))
        {
            TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
        }

        if ((Request.QueryString["parentid"] != null))
        {
            this.TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
        }

        if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "author")
        {
            this.m_ObjectType = EkEnumeration.CMSObjectTypes.User;
            this.m_UserType = EkEnumeration.UserTypes.AuthorType;
        }

        else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "member")
        {
            this.m_ObjectType = EkEnumeration.CMSObjectTypes.User;
            this.m_UserType = EkEnumeration.UserTypes.MemberShipType;
        }

        else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "cgroup")
        {
            this.m_ObjectType = EkEnumeration.CMSObjectTypes.CommunityGroup;
        }

        else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "locales")
        {
            this.m_LocaleObjectType = EkEnumeration.TaxonomyItemType.Locale;
        }

        else if ((m_strPageAction == "addfolder"))
        {
            localization_folder_chkRecursive_div.Visible = true;
            this.m_ObjectType = EkEnumeration.CMSObjectTypes.Folder;
        }

        if ((Request.QueryString["contFetchType"] != null) && !string.IsNullOrEmpty(Request.QueryString["contFetchType"].ToLower()))
        {
            contentFetchType = Request.QueryString["contFetchType"];
        }

        this.m_refContent = this.m_refContentApi.EkContentRef;
        FormsIcon = "<img src=\"" + this.m_refContentApi.AppPath + "images/UI/Icons/contentForm.png\" alt=\"Form\">";
        ContentIcon = "<img src=\"" + this.m_refContentApi.AppPath + "images/UI/Icons/contentHtml.png\" alt=\"Content\">";
        pageIcon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/layout.png\" alt=\"Page\">";
        if (this.m_UserType == EkEnumeration.UserTypes.AuthorType)
        {
            UserIcon = "<img src=\"" + this.m_refContentApi.AppPath + "Images/ui/icons/user.png\" alt=\"Content\">";
        }
        else
        {
            UserIcon = "<img src=\"" + this.m_refContentApi.AppPath + "Images/ui/icons/userMembership.png\" alt=\"Content\">";
        }
        if ((Page.IsPostBack && (!string.IsNullOrEmpty(Request.Form[isPostData.UniqueID])) && (m_ObjectType == EkEnumeration.CMSObjectTypes.Content | (m_ObjectType == EkEnumeration.CMSObjectTypes.User & !string.IsNullOrEmpty(Request.Form["itemlist"])) | (m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup & !string.IsNullOrEmpty(Request.Form["itemlist"]) | (m_ObjectType == EkEnumeration.CMSObjectTypes.Folder & !string.IsNullOrEmpty(Request.Form["itemlist"])) | (m_ObjectType == EkEnumeration.CMSObjectTypes.TaxonomyNode & !string.IsNullOrEmpty(Request.Form["itemlist"]))))))
        {
            if ((this.m_strPageAction == "additem"))
            {
                TaxonomyRequest item_request = new TaxonomyRequest();
                item_request.TaxonomyId = TaxonomyId;
                item_request.TaxonomyIdList = Validate(Request.Form["itemlist"]);
                if (m_ObjectType == EkEnumeration.CMSObjectTypes.User)
                {
                    item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                }
                else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup)
                {
                    item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Group;
                }
                else if (this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale)
                {
                    item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Locale;
                }
                item_request.TaxonomyLanguage = TaxonomyLanguage;
                m_refContent.AddTaxonomyItem(item_request);
            }
            else if (this.m_strPageAction == "addfolder")
            {
                TaxonomyRequest item_request = new TaxonomyRequest();
                item_request.TaxonomyId = this.TaxonomyId;
                item_request.TaxonomyLanguage = this.TaxonomyLanguage;

                item_request.TaxonomyIdList = this.Validate(Request.Form["newFolderDescendantsCSV"]);
                if (!String.IsNullOrEmpty(item_request.TaxonomyIdList))
                {
                    item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.FolderDescendants;
                    this.m_refContent.AddTaxonomyItem(item_request);
                }

                item_request.TaxonomyIdList = this.Validate(Request.Form["newFolderChildrenCSV"]);
                if (!String.IsNullOrEmpty(item_request.TaxonomyIdList))
                {
                    item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.FolderChildren;
                    this.m_refContent.AddTaxonomyItem(item_request);
                }
            }
            if ((Request.QueryString["iframe"] == "true"))
            {
                Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
            }
            else
            {
                if ((Request.QueryString["type"] != null))
                {
                    if (this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale)
                    {
                        Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" + this.m_LocaleObjectType + "&taxonomyid=" + this.TaxonomyId);
                    }
                    else
                    {
                        if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup)
                        {
                            Response.Redirect("LocaleTaxonomy.aspx?action=view&view=cGroup&taxonomyid=" + TaxonomyId);
                        }
                        else
                        {
                            Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" + Convert.ToString(this.m_ObjectType).ToLower() + "&taxonomyid=" + TaxonomyId);
                        }

                    }

                }
                else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.Folder)
                {
                    Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" + Convert.ToString(this.m_ObjectType).ToLower() + "&taxonomyid=" + TaxonomyId);
                }
                else
                {
                    Response.Redirect("LocaleTaxonomy.aspx?action=view&taxonomyid=" + TaxonomyId);
                }

            }
        }
        else
        {
            this.FolderId = Convert.ToInt64(Request.QueryString["folderid"]);

            folder_data_col = this.m_refContent.GetFolderInfoWithPath(FolderId);
            FolderName = this.folder_data_col["FolderName"].ToString();
            FolderParentId = Convert.ToInt64(this.folder_data_col["ParentID"].ToString());
            FolderPath = this.folder_data_col["Path"].ToString();

            folder_request_col = new Collection();
            folder_request_col.Add(this.FolderId, "ParentID", null, null);
            folder_request_col.Add("name", "OrderBy", null, null);
            folder_data_col = this.m_refContent.GetAllViewableChildFoldersv2_0(folder_request_col);

            if ((m_strPageAction != "additem"))
            {
                if (!string.IsNullOrEmpty(Request.QueryString[EkConstants.ContentTypeUrlParam]))
                {
                    if (Information.IsNumeric(Request.QueryString[EkConstants.ContentTypeUrlParam]))
                    {
                        this.SelectedContentType = Convert.ToInt32(Request.QueryString[EkConstants.ContentTypeUrlParam]);
                        this.m_refContentApi.SetCookieValue(EkConstants.ContentTypeUrlParam.ToString(), SelectedContentType.ToString());
                    }
                }
                else if (!string.IsNullOrEmpty(Ektron.Cms.CommonApi.GetEcmCookie()[(EkConstants.ContentTypeUrlParam)]))
                {
                    if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[(EkConstants.ContentTypeUrlParam)]))
                    {
                        this.SelectedContentType = Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()[(EkConstants.ContentTypeUrlParam)]);
                    }
                }
                asset_data = this.m_refContent.GetAssetSuperTypes();
            }
            this.RegisterResources();
            this.TaxonomyToolBar();
            if ((!Page.IsPostBack || m_ObjectType == EkEnumeration.CMSObjectTypes.User || this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup))
            {
                //// avoid redisplay when clicking next/prev buttons
                this.DisplayPage();
            }
        }
    }
Example #17
0
    private void Display_Taxonomy()
    {
        EditTaxonomyHtml.Text = "<p class=\"info\">" + this.m_refMsg.GetMessage("lbl select categories entry") + "</p><div id=\"TreeOutput\"></div>";
        lit_add_string.Text = m_refMsg.GetMessage("generic add title");

        TaxonomyBaseData[] taxonomy_cat_arr = null;
        m_refContentApi.RequestInformationRef.ContentLanguage = ContentLanguage;
        m_refContentApi.ContentLanguage = ContentLanguage;

        TaxonomyRequest taxonomy_request = new TaxonomyRequest();
        TaxonomyBaseData[] taxonomy_data_arr = null;

        {
            List<long> recursiveTaxonomyList = new List<long>();
            foreach (long taxonomyId in this.TaxonomySelectIdList)
            {
                taxonomy_cat_arr = m_refContentApi.EkContentRef.GetTaxonomyRecursiveToParent(taxonomyId, m_refContentApi.ContentLanguage, 0);
                if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
                    foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                        if (!this.TaxonomySelectIdList.Contains(taxonomy_cat.Id))
                            recursiveTaxonomyList.Add(taxonomy_cat.Id);
            }
            this.TaxonomySelectIdList.AddRange(recursiveTaxonomyList);
            taxonomyselectedtree.Value = Util_GetCommaSeperatedList(this.TaxonomySelectIdList);
            TaxonomyTreeIdList = (string)taxonomyselectedtree.Value;
            if (TaxonomyTreeIdList.Trim().Length > 0)
            {
                TaxonomyTreeParentIdList = m_refContentApi.EkContentRef.ReadDisableNodeList(m_iID);
            }
        }
        taxonomy_request.TaxonomyId = blogId;
        taxonomy_request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
        taxonomy_data_arr = m_refContentApi.EkContentRef.GetAllFolderTaxonomy(blogId);

        m_intTaxFolderId = blogId;

        //set CatalogEntry_Taxonomy_A_Js vars - see RegisterJS() and CatalogEntry.Taxonomy.A.aspx under CatalogEntry/js
        this._JSTaxonomyFunctions_TaxonomyTreeIdList = EkFunctions.UrlEncode(TaxonomyTreeIdList);
        this._JSTaxonomyFunctions_TaxonomyTreeParentIdList = EkFunctions.UrlEncode(TaxonomyTreeParentIdList);
        this._JSTaxonomyFunctions_TaxonomyOverrideId = TaxonomyOverrideId.ToString();
        this._JSTaxonomyFunctions_TaxonomyFolderId = blogId.ToString();
    }
Example #18
0
    private void PopulateGridData()
    {
        if (TaxonomyItemList.Columns.Count == 0)
            {
                TaxonomyItemList.Columns.Add(m_refstyle.CreateBoundField("ITEM1", "", "info", HorizontalAlign.NotSet, HorizontalAlign.NotSet, Unit.Percentage(0), Unit.Percentage(0), false, false));
            }

            string iframe = "";
            if ((Request.QueryString["iframe"] != null)&& Request.QueryString["iframe"] != "")
            {
                iframe = "&iframe=true";
            }
            DataTable dt = new DataTable();
            DataRow dr;
            dt.Columns.Add(new DataColumn("ITEM1", typeof(string)));

            dr = dt.NewRow();
            if ((m_strPageAction == "additem") && this.m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User)
            {
                dr[0] = m_refMsg.GetMessage("lbl select users") + "<br/>";
            }
            else if ((m_strPageAction == "additem") && this.m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup)
            {
                dr[0] = m_refMsg.GetMessage("lbl select cgroups") + "<br/>";
            }
            else if (m_strPageAction == "additem")
            {
                dr[0] = m_refMsg.GetMessage("assigntaxonomyitemlabel") + "<br/>";
            }
            else
            {
                dr[0] = m_refMsg.GetMessage("assigntaxonomyfolderlabel") + "<br/>";
            }
            dt.Rows.Add(dr);

            if (this.m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content)
            {
                dr = dt.NewRow();
                dr[0] = m_refMsg.GetMessage("generic Path") + FolderPath;
                dt.Rows.Add(dr);

                dr = dt.NewRow();
                if (FolderId != 0)
                {
                    dr[0] = "<a href=\"taxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + FolderParentId + "&parentid=" + FolderParentId + iframe;
                    dr[0] = dr[0] + "&title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\"><img src=\"" + m_refContentApi.AppPath + "images/ui/icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" align=\"absbottom\">..</a>";
                }
                dt.Rows.Add(dr);

                if (folder_data_col != null)
                {
                    foreach (Collection folder in folder_data_col)
                    {
                        dr = dt.NewRow();
                        dr[0] = "<a href=\"taxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + folder["id"] + "&parentid=" + FolderParentId + iframe;
                        dr[0] += "&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\"><img src=\"";
                        switch ((EkEnumeration.FolderType)Convert.ToInt32(folder["FolderType"]))
                        {
                            case EkEnumeration.FolderType.Catalog:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderGreen.png";
                                break;
                            case EkEnumeration.FolderType.Community:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderCommunity.png";
                                break;
                            case EkEnumeration.FolderType.Blog:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBlog.png";
                                break;
                            case EkEnumeration.FolderType.DiscussionBoard:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png";
                                break;
                            case EkEnumeration.FolderType.DiscussionForum:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png";
                                break;
                            case EkEnumeration.FolderType.Calendar:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderCalendar.png";
                                break;
                            case EkEnumeration.FolderType.Domain:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/foldersite.png";
                                break;
                            default:
                                dr[0] += m_refContentApi.AppPath + "images/ui/icons/folder.png";
                                break;
                        }
                        dr[0] += "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" align=\"absbottom\"></a> ";
                        dr[0] += "<a href=\"taxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + folder["id"] + "&parentid=" + FolderParentId + iframe + ("&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text")) + "\">" + folder["Name"] + "</a>";
                        dt.Rows.Add(dr);
                    }
                }
                if (m_strPageAction == "additem")
                {
                    ContentData[] taxonomy_unassigneditem_arr;
                    TaxonomyRequest request = new TaxonomyRequest();
                    request.TaxonomyId = TaxonomyId;
                    request.TaxonomyLanguage = TaxonomyLanguage;
                    request.FolderId = FolderId;
                    if (contentFetchType.ToLower() == "activecontent")
                    {
                        request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.ActiveContent;
                    }
                    else if (contentFetchType.ToLower() == "library")
                    {
                        request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Library;
                    }
                    else if (contentFetchType.ToLower() == "archivedcontent")
                    {
                        request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.ArchivedContent;
                    }
                    else
                    {
                        request.TaxonomyItemType = 0;
                    }

                    // get total #pages first because the API doesn't return it (lame slow way to do this)-:
                    request.PageSize = 99999999;
                    request.CurrentPage = 1;
                    taxonomy_unassigneditem_arr = m_refContent.ReadAllUnAssignedTaxonomyItems(request);
                    m_intTotalPages = System.Convert.ToInt32(Math.Truncate(System.Convert.ToDecimal((taxonomy_unassigneditem_arr.Length + (m_refContentApi.RequestInformationRef.PagingSize - 1)) / m_refContentApi.RequestInformationRef.PagingSize)));

                    // get the real page data set
                    request.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
                    request.CurrentPage = m_intCurrentPage;
                    taxonomy_unassigneditem_arr = m_refContent.ReadAllUnAssignedTaxonomyItems(request);

                    if (request.TaxonomyItemType == Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Library)
                    {
                        LibraryData library_dat;

                        foreach (ContentData taxonomy_item in taxonomy_unassigneditem_arr)
                        {
                            if (taxonomy_item.Type == 7)
                            {
                                dr = dt.NewRow();
                                library_dat = m_refContentApi.GetLibraryItemByContentID(taxonomy_item.Id);
                                string extension = "";
                                extension = System.IO.Path.GetExtension(library_dat.FileName);
                                switch (extension.ToLower())
                                {
                                    case ".doc":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/word.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".ppt":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/powerpoint.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".pdf":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/acrobat.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".xls":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/excel.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".jpg":
                                    case ".jpeg":
                                    case ".png":
                                    case ".gif":
                                    case ".bmp":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/image.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    default: // other files
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;

                                }
                                dt.Rows.Add(dr);
                            }
                        }

                    }
                    else
                    {
                        foreach (ContentData taxonomy_item in taxonomy_unassigneditem_arr)
                        {
                            dr = dt.NewRow();

                            if (taxonomy_item.Type == 1 || taxonomy_item.Type == 2)
                            {
                                dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;" + GetTypeIcon(taxonomy_item.Type, taxonomy_item.SubType) + "&nbsp;" + taxonomy_item.Title;
                            }
                            else if (taxonomy_item.Type == 3)
                            {
                                dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/contentArchived.png" + "\"&nbsp;border=\"0\"  alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                            }
                            else if (taxonomy_item.Type == 1111)
                            {
                                dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/asteriskOrange.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                            }
                            else if (taxonomy_item.Type == 1112)
                            {
                                dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/tree/folderBlog.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                            }

                            else if (taxonomy_item.Type == 3333)
                            {
                                dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/brick.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                            }
                            else if (taxonomy_item.AssetData.ImageUrl == "" && (taxonomy_item.Type != 1 && taxonomy_item.Type != 2 && taxonomy_item.Type != 3 && taxonomy_item.Type != 1111 && taxonomy_item.Type != 1112 && taxonomy_item.Type != 3333))
                            {
                                dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                            }
                            else
                            {
                                //Bad Approach however no other way untill AssetManagement/Images/ are updated with version 8 images or DMS points to workarea images
                                if (taxonomy_item.AssetData.ImageUrl == "")
                                {
                                    dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                }
                                else
                                {
                                    if ((string)(Path.GetFileName(taxonomy_item.AssetData.ImageUrl).ToLower()) == "ms-word.gif")
                                    {
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/word.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                    }
                                    else if ((string)(Path.GetFileName(taxonomy_item.AssetData.ImageUrl).ToLower()) == "ms-excel.gif")
                                    {
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/excel.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                    }
                                    else if ((string)(Path.GetFileName(taxonomy_item.AssetData.ImageUrl).ToLower()) == "ms-powerpoint.gif")
                                    {
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/powerpoint.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                    }
                                    else if ((string)(Path.GetFileName(taxonomy_item.AssetData.ImageUrl).ToLower()) == "adobe-pdf.gif")
                                    {
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/acrobat.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                    }
                                    else if ((string)(Path.GetFileName(taxonomy_item.AssetData.ImageUrl).ToLower()) == "image.gif")
                                    {
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/image.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                    }
                                    else
                                    {
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + taxonomy_item.AssetData.ImageUrl + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                    }
                                }
                            }
                            dt.Rows.Add(dr);
                        }
                    }
                }
            }
            else if (this.m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup)
            {
                CollectSearchText();
                dr = dt.NewRow();
                dr[0] = "<input type=text size=25 id=\"txtSearch\" name=\"txtSearch\" value=\"" + m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">";
                dr[0] += "<input type=button value=\"Search\" id=\"btnSearch\" name=\"btnSearch\"  class=\"ektronWorkareaSearch\" onclick=\"searchuser();\" title=\"Search Users\">";
                dt.Rows.Add(dr);
                GetAssignedCommunityGroups();
                GetCommunityGroups();
                if (cgroup_list != null)
                {
                    for (int j = 0; j <= (cgroup_list.Length - 1); j++)
                    {

                        dr = dt.NewRow();
                        if (DoesGroupExistInList(cgroup_list[j].GroupId))
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;" + GetTypeIcon(Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User.GetHashCode(), Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\" id=\"itemlistNoId\" name=\"itemlistNoId\" value=\"" + cgroup_list[j].GroupId + "\"/>" + cgroup_list[j].GroupName;
                        }
                        else
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;" + GetTypeIcon(Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User.GetHashCode(), Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + cgroup_list[j].GroupId + "\"/>" + cgroup_list[j].GroupName;
                        }

                        dt.Rows.Add(dr);
                    }
                }
            }
            else if (this.m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User)
            {
                CollectSearchText();
                dr = dt.NewRow();
                dr[0] = "<input type=text size=25 id=\"txtSearch\" name=\"txtSearch\" value=\"" + m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">";
                dr[0] += "<select id=\"searchlist\" name=\"searchlist\">";
                dr[0] += "<option value=-1" + IsSelected("-1") + ">All</option>";
                dr[0] += "<option value=\"last_name\"" + IsSelected("last_name") + ">Last Name</option>";
                dr[0] += "<option value=\"first_name\"" + IsSelected("first_name") + ">First Name</option>";
                dr[0] += "<option value=\"user_name\"" + IsSelected("user_name") + ">User Name</option>";
                dr[0] += "</select><input type=button value=\"Search\" id=\"btnSearch\" name=\"btnSearch\" class=\"ektronWorkareaSearch\"  onclick=\"searchuser();\" title=\"Search Users\">";
                dt.Rows.Add(dr);
                GetUsers();
                if (user_list != null)
                {
                    for (int j = 0; j <= (user_list.Length - 1); j++)
                    {
                        dr = dt.NewRow();
                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;" + GetTypeIcon(Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User.GetHashCode(), Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + user_list[j].Id + "\"/>" + ((user_list[j].DisplayName != "") ? (user_list[j].DisplayName) : (user_list[j].Username));
                        dt.Rows.Add(dr);
                    }
                }
            }
            DataView dv = new DataView(dt);
            TaxonomyItemList.DataSource = dv;
            TaxonomyItemList.DataBind();
    }
Example #19
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        try
            {
                m_refMsg = m_refApi.EkMsgRef;
                AppImgPath = m_refApi.AppImgPath;
                AppPath = m_refApi.AppPath;
                ltr_sitepath.Text = m_refApi.SitePath;
                m_strPageAction = Request.QueryString["action"];
                Utilities.SetLanguage(m_refApi);
                TaxonomyLanguage = m_refApi.ContentLanguage;
                if (TaxonomyLanguage == -1)
                {
                    TaxonomyLanguage = m_refApi.DefaultContentLanguage;
                }
                if (Request.QueryString["taxonomyid"] != null)
                {
                    TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
                }
                if (Request.QueryString["parentid"] != null)
                {
                    TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
                    if (TaxonomyParentId > 0)
                    {
                        TitleLabel = "categorytitle";
                        DescriptionLabel = "categorydescription";
                    }
                }
                if (Request.QueryString["iframe"] == "true")
                {
                    styles.Visible = true;
                }

                chkConfigContent.Text = chkConfigContent.ToolTip = m_refMsg.GetMessage("content text");
                chkConfigUser.Text = chkConfigUser.ToolTip = m_refMsg.GetMessage("generic user");
                chkConfigGroup.Text = chkConfigGroup.ToolTip = m_refMsg.GetMessage("lbl group");

                if (Page.IsPostBack)
                {
                    TaxonomyData taxonomy_data = new TaxonomyData();
                    taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID];
                    taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID];
                    taxonomy_data.TaxonomyLanguage = TaxonomyLanguage;
                    taxonomy_data.TaxonomyParentId = TaxonomyParentId;
                    taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID];
                    taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID];
                    if (tr_enableDisable.Visible == true)
                    {
                        if (! string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID]))
                        {
                            taxonomy_data.Visible = true;
                        }
                        else
                        {
                            taxonomy_data.Visible = false;
                        }
                    }
                    else
                    {
                        taxonomy_data.Visible = true;
                    }

                    if (Request.Form[inherittemplate.UniqueID] != null)
                    {
                        taxonomy_data.TemplateInherited = true;
                    }
                    if (Request.Form[taxonomytemplate.UniqueID] != null)
                    {
                        taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]);
                    }
                    else
                    {
                        taxonomy_data.TemplateId = 0;
                    }

                    //If (TaxonomyId <> 0) Then
                    //  taxonomy_data.TaxonomyId = TaxonomyId
                    //End If
                    m_refContent = m_refApi.EkContentRef;
                    TaxonomyId = m_refContent.CreateTaxonomy(taxonomy_data);
                    if (Request.Form[alllanguages.UniqueID] == "false")
                    {
                        m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, false);
                    }
                    m_refContent.UpdateTaxonomySynchronization(TaxonomyId, GetCheckBoxValue(chkTaxSynch));
                    // chkCreateLang
                    if (TaxonomyParentId == 0)
                    {
                        string strConfig = string.Empty;
                        if (! string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID]))
                        {
                            strConfig = "0";
                        }
                        if (! string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID]))
                        {
                            if (string.IsNullOrEmpty(strConfig))
                            {
                                strConfig = "1";
                            }
                            else
                            {
                                strConfig = strConfig + ",1";
                            }
                        }
                        if (! string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID]))
                        {
                            if (string.IsNullOrEmpty(strConfig))
                            {
                                strConfig = "2";
                            }
                            else
                            {
                                strConfig = strConfig + ",2";
                            }
                        }
                        if (!(string.IsNullOrEmpty(strConfig)))
                        {
                            m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig);
                        }
                    }
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    //+++++++++ Adding MetaData Information '+++++++++
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    AddCustomProperties();
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    //+++++++++ Adding Other Langs (If Applicable) +++
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    if (!GetCheckBoxValue(chkTaxSynch) && GetCheckBoxValue(chkCreateLang))
                    {   // Figure out which ones were created.
                        IList<LanguageData> result_language = null;
                        TaxonomyLanguageRequest taxonomy_language_request = new TaxonomyLanguageRequest();
                        taxonomy_language_request.TaxonomyId = TaxonomyId;
                        taxonomy_language_request.IsTranslated = false; // langs that we still need
                        result_language = m_refContent.LoadLanguageForTaxonomy(taxonomy_language_request);
                        if (result_language != null)
                        {
                            foreach(LanguageData lang in result_language)
                            {
                                UsingLanguage(m_refContent.RequestInformation, lang.Id, delegate
                                {
                                    taxonomy_data.TaxonomyId = TaxonomyId;
                                    taxonomy_data.LanguageId = lang.Id;
                                    m_refContent.CreateTaxonomy(taxonomy_data);
                                });
                            }
                        }
                    }

                    if (Request.QueryString["iframe"] == "true")
                    {
                        Packages.EktronCoreJS.Register(this);
                        closeWindow = "Ektron.ready(function(){parent.CloseChildPage();});";
                    }
                    else
                    {
                        //this should jump back to taxonomy that was added
                        //Response.Redirect("taxonomy.aspx?rf=1", True)
                        Response.Redirect("taxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1&reloadtrees=Tax", true);
                    }
                }
                else
                {
                    m_refContent = m_refApi.EkContentRef;
                    TaxonomyRequest req = new TaxonomyRequest();
                    req.TaxonomyId = TaxonomyParentId;
                    req.TaxonomyLanguage = TaxonomyLanguage;

                    if (TaxonomyParentId > 0)
                    {
                        m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage);
                    }
                    else if (TaxonomyId > 0)
                    {
                        m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                    }
                    chkTaxSynch.Checked = m_bSynchronized;
                    chkTaxSynch.Attributes.Add("onclick",
                        string.Format("ToggleTaxSynch(this, '{0}');", chkCreateLang.ClientID)
                        );
                    if (m_bSynchronized)
                    {
                        fs_taxsynccreate.Attributes.Add("style", "display:none;");
                    }
                    if (! m_bSynchronized)
                    {
                        tr_enableDisable.Visible = false;
                    }
                    TaxonomyBaseData data = m_refContent.ReadTaxonomy(ref req);
                    if (data == null)
                    {
                        EkException.ThrowException(new Exception("Invalid taxonomy ID: " + TaxonomyId + " parent: " + TaxonomyParentId));
                    }
                    language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage);
                    if ((language_data != null) && (m_refApi.EnableMultilingual == 1))
                    {
                        lblLanguage.Text = "[" + language_data.Name + "]";
                    }
                    taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif";
                    m_strCurrentBreadcrumb = (string) (data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "));
                    if (m_strCurrentBreadcrumb == "")
                    {
                        m_strCurrentBreadcrumb = "Root";
                    }
                    if (TaxonomyParentId == 0)
                    {
                        inherittemplate.Visible = false;
                        lblInherited.Text = "No";
                        lblInherited.ToolTip = lblInherited.Text;
                    }
                    else
                    {
                        inherittemplate.Checked = true;
                        taxonomytemplate.Enabled = false;
                        inherittemplate.Visible = true;
                        lblInherited.Text = "";
                    }
                    TemplateData[] templates = null;
                    templates = m_refApi.GetAllTemplates("TemplateFileName");
                    taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("- " + m_refMsg.GetMessage("generic select template") + " -", "0"));
                    if ((templates != null)&& templates.Length > 0)
                    {
                        for (int i = 0; i <= templates.Length - 1; i++)
                        {
                            taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString()));
                        }
                    }

                    inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                    inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                    if (TaxonomyParentId == 0)
                    {
                        tr_config.Visible = true;
                    }
                    else
                    {
                        tr_config.Visible = false;
                    }
                    chkConfigContent.Checked = true;
                    LoadCustomPropertyList();
                    TaxonomyToolBar();
                }
            }
            catch (System.Threading.ThreadAbortException)
            {
                //Do nothing
            }
            catch (Exception ex)
            {
                Response.Redirect((string) ("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage), false);
            }
    }
Example #20
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            m_refMsg = m_refApi.EkMsgRef;
            AppImgPath = m_refApi.AppImgPath;
            AppPath = m_refApi.AppPath;
            m_strPageAction = Request.QueryString["action"];
            Utilities.SetLanguage(m_refApi);
            TaxonomyLanguage = m_refApi.ContentLanguage;
            if ((TaxonomyLanguage == -1))
            {
                TaxonomyLanguage = m_refApi.DefaultContentLanguage;
            }
            if ((Request.QueryString["taxonomyid"] != null))
            {
                TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            }
            if ((Request.QueryString["parentid"] != null))
            {
                TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
                if ((TaxonomyParentId > 0))
                {
                    TitleLabel = "categorytitle";
                    DescriptionLabel = "categorydescription";
                }
            }

            if ((Page.IsPostBack))
            {
                TaxonomyData taxonomy_data = new TaxonomyData();
                taxonomy_data.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Locale;
                taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID];
                taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID];
                taxonomy_data.TaxonomyLanguage = TaxonomyLanguage;
                taxonomy_data.TaxonomyParentId = TaxonomyParentId;
               // taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID];
               // taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID];
                //if (tr_enableDisable.Visible == true)
                //{
                //    if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID]))
                //    {
                //        taxonomy_data.Visible = true;
                //    }
                //    else
                //    {
                //        taxonomy_data.Visible = false;
                //    }
                //}
                //else
                //{
                //    taxonomy_data.Visible = true;
                //}

                //if ((Request.Form[inherittemplate.UniqueID] != null))
                //{
                //    taxonomy_data.TemplateInherited = true;
                //}
                //if ((Request.Form[taxonomytemplate.UniqueID] != null))
                //{
                //    taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]);
                //}
                //else
                //{
                //    taxonomy_data.TemplateId = 0;
                //}

                //If (TaxonomyId <> 0) Then
                //  taxonomy_data.TaxonomyId = TaxonomyId
                //End If
                m_refContent = m_refApi.EkContentRef;
                TaxonomyId = m_refContent.CreateTaxonomy(taxonomy_data);
                //add the default language by Default.
                TaxonomyRequest item_request = new TaxonomyRequest();
                item_request.TaxonomyId = TaxonomyId;
                item_request.TaxonomyIdList =Convert.ToString(TaxonomyLanguage);
                item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Locale;
                item_request.TaxonomyLanguage = TaxonomyLanguage;
                m_refContent.AddTaxonomyItem(item_request);
                if (Request.Form[alllanguages.UniqueID] == "false")
                {
                    m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, false);
                }
                if ((TaxonomyParentId == 0))
                {
                    string strConfig = string.Empty;
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID])))
                    //{
                    //    strConfig = "0";
                    //}
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID])))
                    //{
                    //    if ((string.IsNullOrEmpty(strConfig)))
                    //    {
                    //        strConfig = "1";
                    //    }
                    //    else
                    //    {
                    //        strConfig = strConfig + ",1";
                    //    }
                    //}
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID])))
                    //{
                    //    if ((string.IsNullOrEmpty(strConfig)))
                    //    {
                    //        strConfig = "2";
                    //    }
                    //    else
                    //    {
                    //        strConfig = strConfig + ",2";
                    //    }
                    //}
                    if ((!(string.IsNullOrEmpty(strConfig))))
                    {
                        m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig);
                    }
                }
                //++++++++++++++++++++++++++++++++++++++++++++++++
                //+++++++++ Adding MetaData Information '+++++++++
                //++++++++++++++++++++++++++++++++++++++++++++++++
                //Commeneted as per Doug suggestion
                //AddCustomProperties();

                if ((Request.QueryString["iframe"] == "true"))
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    //this should jump back to taxonomy that was added
                    //Response.Redirect("taxonomy.aspx?rf=1", True)
                    Response.Redirect("LocaleTaxonomy.aspx?action=view&view=locale&taxonomyid=" + TaxonomyId + "&rf=1", true);
                }
            }
            else
            {
                m_refContent = m_refApi.EkContentRef;
                TaxonomyRequest req = new TaxonomyRequest();
                req.TaxonomyId = TaxonomyParentId;
                req.TaxonomyLanguage = TaxonomyLanguage;

                if (TaxonomyParentId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage);
                }
                else if (TaxonomyId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                }
                //if (!m_bSynchronized)
                //{
                //    tr_enableDisable.Visible = false;
                //}
                TaxonomyBaseData data = m_refContent.ReadTaxonomy(ref req);
                if ((data == null))
                {
                    EkException.ThrowException(new Exception("Invalid taxonomy ID: " + TaxonomyId + " parent: " + TaxonomyParentId));
                }
                language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage);
                if (((language_data != null) && (m_refApi.EnableMultilingual == 1)))
                {
                    lblLanguage.Text = "[" + language_data.Name + "]";
                }
              //  taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif";
                m_strCurrentBreadcrumb = data.TaxonomyPath.Remove(0, 1).Replace("\\", " > ");
                if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb)))
                {
                    m_strCurrentBreadcrumb = "Root";
                }
                //if ((TaxonomyParentId == 0))
                //{
                //    inherittemplate.Visible = false;
                //    lblInherited.Text = "No";
                //}
                //else
                //{
                //    inherittemplate.Checked = true;
                //    taxonomytemplate.Enabled = false;
                //    inherittemplate.Visible = true;
                //    lblInherited.Text = "";
                //}
             //   TemplateData[] templates = null;
               // templates = m_refApi.GetAllTemplates("TemplateFileName");
                //taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("-select template-", "0"));
                //if ((templates != null && templates.Length > 0))
                //{
                //    for (int i = 0; i <= templates.Length - 1; i++)
                //    {
                //        taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString()));
                //    }
                //}

               // inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
               // inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                //if ((TaxonomyParentId == 0))
                //{
                //    tr_config.Visible = true;
                //}
                //else
                //{
                //    tr_config.Visible = false;
                //}
               // chkConfigContent.Checked = true;
                //LoadCustomPropertyList();
                TaxonomyToolBar();
            }
        }
        catch (System.Threading.ThreadAbortException)
        {
            //Do nothing
        }
        catch (Exception ex)
        {
            Response.Redirect(AppPath + "reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage, false);
        }
    }
    private void SetTaxonomy(long contentid, long ifolderid)
    {
        EditTaxonomyHtml.Text = "<table class=\"ektrongrid\"><tr><td class=\"info\" style=\"text-align: left !important;\">" + this.m_refMsg.GetMessage("select categories content") + "</td></tr><tr><td id=\"TreeOutput\"></td></tr></table>";
        TaxonomyBaseData[] taxonomy_cat_arr = null;
        m_refContentApi.RequestInformationRef.ContentLanguage = LangID;
        m_refContentApi.ContentLanguage = LangID;
        if (contentid == 0)
        {

        }
        TaxonomyRequest taxonomy_request = new TaxonomyRequest();
        TaxonomyBaseData[] taxonomy_data_arr = null;
        if (this.Mode == CurrentMode.Add)
        {
            if ((Request.QueryString["SelTaxonomyId"] != null) && Request.QueryString["SelTaxonomyId"] != "")
            {
                TaxonomySelectId = Convert.ToInt64(Request.QueryString["SelTaxonomyId"]);
            }
            if (TaxonomySelectId > 0)
            {
                taxonomyselectedtree.Value = TaxonomySelectId.ToString();
                TaxonomyTreeIdList = AntiXss.UrlEncode((string)taxonomyselectedtree.Value);
                taxonomy_cat_arr = m_refContentApi.EkContentRef.GetTaxonomyRecursiveToParent(TaxonomySelectId, m_refContentApi.ContentLanguage, 0);
                if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
                {
                    foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                    {
                        if (TaxonomyTreeParentIdList == "")
                        {
                            TaxonomyTreeParentIdList = Convert.ToString(taxonomy_cat.TaxonomyId);
                        }
                        else
                        {
                            TaxonomyTreeParentIdList = TaxonomyTreeParentIdList + "," + Convert.ToString(taxonomy_cat.TaxonomyId);
                        }
                    }
                }
            }
        }
        else
        {
            taxonomy_cat_arr = m_refContentApi.EkContentRef.ReadAllAssignedCategory(contentid);
            if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
            {
                foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                {
                    if (taxonomyselectedtree.Value == "")
                    {
                        taxonomyselectedtree.Value = Convert.ToString(taxonomy_cat.TaxonomyId);
                    }
                    else
                    {
                        taxonomyselectedtree.Value = taxonomyselectedtree.Value + "," + Convert.ToString(taxonomy_cat.TaxonomyId);
                    }
                }
            }
            TaxonomyTreeIdList = AntiXss.UrlEncode((string)taxonomyselectedtree.Value);
            if (TaxonomyTreeIdList.Trim().Length > 0)
            {
                TaxonomyTreeParentIdList = m_refContentApi.EkContentRef.ReadDisableNodeList(contentid);
            }
        }

        taxonomy_request.TaxonomyId = ifolderid;
        taxonomy_request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
        taxonomy_data_arr = m_refContentApi.EkContentRef.GetAllFolderTaxonomy(ifolderid);

        if ((taxonomy_data_arr == null || taxonomy_data_arr.Length == 0) && (TaxonomyOverrideId == 0))
        {
            EditTaxonomyHtml.Text = "";
            base.Tabs.RemoveAt(1);
        }

        m_intTaxFolderId = ifolderid;
        //If (Request.QueryString("TaxonomyId") IsNot Nothing AndAlso Request.QueryString("TaxonomyId") <> "") Then
        //    TaxonomyOverrideId = Convert.ToInt32(Request.QueryString("TaxonomyId"))
        //End If
        js_taxon.Text = Environment.NewLine;
        js_taxon.Text += "var taxonomytreearr=\"" + TaxonomyTreeIdList + "\".split(\",\");" + Environment.NewLine;
        js_taxon.Text += "var taxonomytreedisablearr=\"" + TaxonomyTreeParentIdList + "\".split(\",\");" + Environment.NewLine;
        js_taxon.Text += "var __TaxonomyOverrideId=\"" + TaxonomyOverrideId + "\".split(\",\");" + Environment.NewLine;
        js_taxon.Text += "var m_fullScreenView=false;var __EkFolderId = " + ifolderid + ";" + Environment.NewLine;
    }
Example #22
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refCommon.EkMsgRef;
        AppImgPath = m_refCommon.AppImgPath;
        m_strPageAction = Request.QueryString["action"];
        Utilities.SetLanguage(m_refCommon);
        TaxonomyLanguage = m_refCommon.ContentLanguage;
        TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
        taxonomy_request = new TaxonomyRequest();
        taxonomy_request.TaxonomyId = TaxonomyId;
        taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
        m_refContent = m_refCommon.EkContentRef;
        Util_RegisterResources();
        Util_SetServerJSVariables();

        litEnable.Text = m_refMsg.GetMessage("js:Confirm enable taxonomy all languages");
        litDisable.Text = m_refMsg.GetMessage("js:Confirm disable taxonomy all languages");
        if (Page.IsPostBack)
        {
            if (Request.Form["submittedaction"] == "delete")
            {
                m_refContent.DeleteTaxonomy(taxonomy_request);
                Response.Redirect((string)("taxonomy.aspx?LangType=" + TaxonomyLanguage), true);
            }
            else if (Request.Form["submittedaction"] == "deletenode")
            {
                long CurrentDeleteId = TaxonomyId;
                if ((Request.Form["LastClickedOn"] != null) && Request.Form["LastClickedOn"] != "")
                {
                    CurrentDeleteId = Convert.ToInt64(Request.Form["LastClickedOn"]);
                }
                taxonomy_request.TaxonomyId = CurrentDeleteId;
                m_refContent.DeleteTaxonomy(taxonomy_request);
                if (CurrentDeleteId == TaxonomyId)
                {
                    Response.Redirect((string)("taxonomy.aspx?taxonomyid=" + TaxonomyId), true);
                }
                else
                {
                    Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true);
                }
            }
            else if (Request.Form["submittedaction"] == "enable")
            {
                long CurrentEnableId = TaxonomyId;
                if ((Request.Form["LastClickedOn"] != null) && Request.Form["LastClickedOn"] != "")
                {
                    CurrentEnableId = Convert.ToInt64(Request.Form["LastClickedOn"]);
                }
                if (Request.Form[alllanguages.UniqueID] == "true")
                {
                    m_refContent.UpdateTaxonomyVisible(CurrentEnableId, -1, true);
                }
                else
                {
                    m_refContent.UpdateTaxonomyVisible(CurrentEnableId, TaxonomyLanguage, true);
                }
                Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true);
            }
            else if (Request.Form["submittedaction"] == "disable")
            {
                long CurrentDisableId = TaxonomyId;
                if ((Request.Form["LastClickedOn"] != null) && Request.Form["LastClickedOn"] != "")
                {
                    CurrentDisableId = Convert.ToInt64(Request.Form["LastClickedOn"]);
                }
                if (Request.Form[alllanguages.UniqueID] == "true")
                {
                    m_refContent.UpdateTaxonomyVisible(CurrentDisableId, -1, false);
                }
                else
                {
                    m_refContent.UpdateTaxonomyVisible(CurrentDisableId, TaxonomyLanguage, false);
                }
                Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true);
            }
        }
        else
        {
            taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);
            if (taxonomy_data != null)
            {
                TaxonomyParentId = taxonomy_data.TaxonomyParentId;
                m_strTaxonomyName = taxonomy_data.TaxonomyName;
            }
            AncestorTaxonomyId = TaxonomyId;
            m_selectedTaxonomyList = Convert.ToString(TaxonomyId);
            TaxonomyToolBar();
        }
    }
Example #23
0
    private void PopulateCategory(string Action)
    {
        LibraryData library_data;
        FolderData fold_data;

        m_intTaxFolderId = _FolderId;
        _EkContent = _ContentApi.EkContentRef;
        _CurrentUserID = _ContentApi.UserId;

        _PermissionData = _ContentApi.LoadPermissions(_FolderId, "content", 0);
        library_data = _ContentApi.GetLibraryItemByID(_Id, _FolderId);
        fold_data = _ContentApi.GetFolderById(_FolderId);
        if (_Type == "images" || _Type == "files")
        {
            if (fold_data.CategoryRequired == true && _EkContent.GetAllFolderTaxonomy(_FolderId).Length > 0)
            {
                jsCategoryrequired.Text = "true";
            }
        }

        if (_PermissionData.IsAdmin || _EkContent.IsARoleMember(Convert.ToInt64( Ektron.Cms.Common.EkEnumeration.CmsRoleIds.TaxonomyAdministrator),_CurrentUserID,false))
        {
            TaxonomyRoleExists = true;
        }
        TaxonomyBaseData[] taxonomy_cat_arr = null;
        if (Action != "add")
        {
            taxonomy_cat_arr = _EkContent.ReadAllAssignedCategory(library_data.ContentId);
            if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
            {
                foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                {
                    if (taxonomyselectedtree.Value == "")
                    {
                        taxonomyselectedtree.Value = Convert.ToString(taxonomy_cat.TaxonomyId);
                    }
                    else
                    {
                        taxonomyselectedtree.Value = taxonomyselectedtree.Value + "," + Convert.ToString(taxonomy_cat.TaxonomyId);
                    }
                }
            }
            TaxonomyTreeIdList = (string)taxonomyselectedtree.Value;
            if (TaxonomyTreeIdList.Trim().Length > 0)
            {
                TaxonomyTreeParentIdList = _EkContent.ReadDisableNodeList(library_data.ContentId);
            }
        }
        else
        {
            if (TaxonomySelectId > 0)
            {
                taxonomyselectedtree.Value = Convert.ToString( TaxonomySelectId);
                TaxonomyTreeIdList = (string)taxonomyselectedtree.Value;
                taxonomy_cat_arr = _EkContent.GetTaxonomyRecursiveToParent(TaxonomySelectId, _EkContent.RequestInformation.ContentLanguage, 0);
                if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
                {
                    foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                    {
                        if (TaxonomyTreeParentIdList == "")
                        {
                            TaxonomyTreeParentIdList = Convert.ToString(taxonomy_cat.TaxonomyId);
                        }
                        else
                        {
                            TaxonomyTreeParentIdList = TaxonomyTreeParentIdList + "," + Convert.ToString(taxonomy_cat.TaxonomyId);
                        }
                    }
                }
            }
        }

        TaxonomyRequest taxonomy_request = new TaxonomyRequest();
        TaxonomyBaseData[] taxonomy_data_arr = null;
        Utilities.SetLanguage(_ContentApi);
        taxonomy_request.TaxonomyId = _FolderId;
        taxonomy_request.TaxonomyLanguage = _ContentApi.ContentLanguage;
        taxonomy_data_arr = _EkContent.GetAllFolderTaxonomy(_FolderId);
        foreach (TaxonomyBaseData tax_node in taxonomy_data_arr)
        {
            _SelectedTaxonomyList = _SelectedTaxonomyList + tax_node.TaxonomyId;
            _SelectedTaxonomyList += ",";
        }
        //Hiding the Category tab if no taxonomy is applied for the folder or if user requires the category tab to be hidden
        bool HideCategoryTab = false;
        if (!string.IsNullOrEmpty(Request.QueryString["HideCategoryTab"] ))
        {
            HideCategoryTab = Convert.ToBoolean(Request.QueryString["HideCategoryTab"]);
        }
        if (HideCategoryTab || (taxonomy_data_arr == null || taxonomy_data_arr.Length == 0) && (TaxonomyOverrideId == 0))
        {
            //TODO: Ross - Not sure why, but the tab was set to non-visible in either case...odd!!
            //if (Action == "add" || _Operation == "overwrite")
            //{
                //TODO: Ross - Don't have "add" tabs yet
                phAddCategoryTab.Visible = false;
                phCategory.Visible = false;
                phCategory2.Visible = false;
            //}
        }
    }
Example #24
0
    private void DrawFolderTaxonomyTable()
    {
        string categorydatatemplate = "<input type=\"radio\" id=\"taxlist\" name=\"taxlist\" value=\"{0}\" {1} {2}/>{3}";
        StringBuilder categorydata = new StringBuilder();
        TaxonomyRequest catrequest = new TaxonomyRequest();
        string catdisabled = "";

        if (_FolderData == null)
        {
            _FolderData = this.m_refContentApi.GetFolderById(m_iID, true);
        }

        catrequest.TaxonomyId = 0;
        catrequest.TaxonomyLanguage = ContentLanguage;
        catrequest.SortOrder = "taxonomy_name";
        if ((_FolderData.FolderTaxonomy != null) && _FolderData.FolderTaxonomy.Length > 0)
        {
            for (int i = 0; i <= _FolderData.FolderTaxonomy.Length - 1; i++)
            {
                if (_SelectedTaxonomyList.Length > 0)
                {
                    _SelectedTaxonomyList = _SelectedTaxonomyList + "," + _FolderData.FolderTaxonomy[i].TaxonomyId;
                }
                else
                {
                    _SelectedTaxonomyList = _FolderData.FolderTaxonomy[i].TaxonomyId.ToString();
                }
            }
        }
        _CurrentCategoryChecked = Convert.ToInt32(_FolderData.CategoryRequired);
        current_category_required.Value = _CurrentCategoryChecked.ToString();
        inherit_taxonomy_from.Value = _FolderData.TaxonomyInheritedFrom.ToString();
        TaxonomyBaseData[] TaxArr = m_refContentApi.EkContentRef.ReadAllSubCategories(catrequest);
        string DisabledMsg = "";
        if (!_IsTaxonomyUiEnabled)
        {
            DisabledMsg = " disabled ";
            catdisabled = " disabled ";
        }
        bool parent_has_configuration = false;
        if ((TaxArr != null) && TaxArr.Length > 0)
        {
            categorydata.Append("<table class=\"ektronGrid ektronBorder\" width=\"100%\">");
            categorydata.Append("<tr class=\"row\"><td>");
            categorydata.Append(string.Format(categorydatatemplate, "", IsChecked(System.Convert.ToBoolean(_SelectedTaxonomyList.Length == 0)), DisabledMsg, "None"));
            categorydata.Append("<br/>");
            int i = 0;
            while (i < TaxArr.Length)
            {
                _CheckTaxId = TaxArr[i].TaxonomyId;
                if (_FolderData.FolderTaxonomy != null)
                {
                    parent_has_configuration = Array.Exists(_FolderData.FolderTaxonomy, new Predicate<TaxonomyBaseData>(TaxonomyExists));
                }
                else
                {
                    parent_has_configuration = false;
                }
                categorydata.Append("<tr><td>");

                categorydata.Append(string.Format(categorydatatemplate, TaxArr[i].TaxonomyId, IsChecked(parent_has_configuration), DisabledMsg, TaxArr[i].TaxonomyName));
                categorydata.Append("<br/>");
                categorydata.Append("</td></tr>");

                i++;
            }
            categorydata.Append("</table>");
        }

        StringBuilder str = new StringBuilder();
        str.Append("<input type=\"hidden\" id=\"TaxonomyParentHasConfig\" name=\"TaxonomyParentHasConfig\" value=\"");
        if (parent_has_configuration)
        {
            str.Append("1");
        }
        else
        {
            str.Append("0");
        }

        str.Append("\" />");

        DisabledMsg = " ";
        if (_FolderData.Id == 0)
        {
            DisabledMsg = " disabled ";
        }
        else
        {
            DisabledMsg = IsChecked(_FolderData.TaxonomyInherited);
        }
        if (!_IsTaxonomyUiEnabled)
        {
            DisabledMsg += " disabled ";
        }
        string catchecked = "";
        if (_FolderData.CategoryRequired)
        {
            catchecked = " checked ";
        }
        if (_FolderData.Id > 0)
        {
            FolderData parentfolderdata = m_refContentApi.GetFolderById(_FolderData.ParentId, true);
            if ((parentfolderdata.FolderTaxonomy != null) && parentfolderdata.FolderTaxonomy.Length > 0)
            {
                for (int i = 0; i <= parentfolderdata.FolderTaxonomy.Length - 1; i++)
                {
                    if (_SelectedTaxonomyParentList.Length > 0)
                    {
                        _SelectedTaxonomyParentList = _SelectedTaxonomyParentList + "," + parentfolderdata.FolderTaxonomy[i].TaxonomyId;
                    }
                    else
                    {
                        _SelectedTaxonomyParentList = parentfolderdata.FolderTaxonomy[i].TaxonomyId.ToString();
                    }
                }
                _ParentCategoryChecked = Convert.ToInt32(parentfolderdata.CategoryRequired);
                parent_category_required.Value = _ParentCategoryChecked.ToString();
            }
        }

        //str.Append("<input name=""TaxonomyTypeBreak"" id=""TaxonomyTypeBreak"" type=""checkbox"" onclick=""ToggleTaxonomyInherit(this)"" " & DisabledMsg & "/><b>Inherit Parent Taxonomy Configuration</b>")
        str.Append("<input name=\"CategoryRequired\" id=\"CategoryRequired\" type=\"checkbox\"" + catchecked + catdisabled + " /><span class=\"label\">"+m_refMsg.GetMessage("lbl Require category selection")+"</span>");
        str.Append("<div class=\"ektronTopSpace\"></div>");
        str.Append(categorydata.ToString());
        taxonomy_list.Text = str.ToString();
        str = new StringBuilder();

        str.Append("var taxonomytreearr=\"" + _SelectedTaxonomyList + "\".split(\",\");");
        str.Append("var taxonomyparenttreearr=\"" + _SelectedTaxonomyParentList + "\".split(\",\");");
        str.Append("var __jscatrequired=\"" + _CurrentCategoryChecked + "\";");
        str.Append("var __jsparentcatrequired=\"" + _ParentCategoryChecked + "\";");
        tax_js.Text = str.ToString();
    }
Example #25
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        _MessageHelper = _Common.EkMsgRef;
            AppImgPath = _Common.AppImgPath;
            AppPath = _Common.AppPath;
            _PageAction = Request.QueryString["action"];

            if (!string.IsNullOrEmpty(Request.QueryString["reloadtrees"]))
            {
                reloadTree = true;
            }

            object refCommon = _Common as object;
            Utilities.SetLanguage(_Common);
            //Utilities.SetLanguage(_Common);
            RegisterResources();
            TaxonomyLanguage = _Common.ContentLanguage;
            TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            if (Request.QueryString["view"] != null)
            {
                _ViewItem = AntiXss.HtmlEncode(Request.QueryString["view"]);
            }
            taxonomy_request = new TaxonomyRequest();
            taxonomy_request.TaxonomyId = TaxonomyId;
            taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
            _Content = _Common.EkContentRef;
            taxonomy_request.PageSize = 99999999; // pagesize of 0 used to mean "all"
            TaxonomyBaseData[] taxcats;
            taxcats = _Content.ReadAllSubCategories(taxonomy_request);
            if (taxcats != null)
            {
                TaxonomyCategoryCount = taxcats.Length;
            }
            if (Page.IsPostBack && Request.Form[isPostData.UniqueID] != "")
            {
                if (Request.Form["submittedaction"] == "delete")
                {
                    _Content.DeleteTaxonomy(taxonomy_request);
                    //Response.Write("<script type=""text/javascript"">parent.CloseChildPage();</script>")
                    Response.Redirect("taxonomy.aspx?action=reload&rf=1&reloadtrees=Tax", true);
                }
                else if (Request.Form["submittedaction"] == "deleteitem")
                {
                    if (_ViewItem != "folder")
                    {
                        taxonomy_request.TaxonomyIdList = Request.Form["selected_items"];
                        if (_ViewItem.ToLower() == "cgroup")
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Group;
                        }
                        else if (_ViewItem.ToLower() == "user")
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                        }
                        else
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Content;
                        }
                        _Content.RemoveTaxonomyItem(taxonomy_request);
                    }
                    else
                    {
                        TaxonomySyncRequest tax_folder = new TaxonomySyncRequest();
                        tax_folder.TaxonomyId = TaxonomyId;
                        tax_folder.TaxonomyLanguage = TaxonomyLanguage;
                        tax_folder.SyncIdList = Request.Form["selected_items"];
                        _Content.RemoveTaxonomyFolder(tax_folder);
                    }
                    if (Request.Params["ccp"] == null)
                    {
                        Response.Redirect("taxonomy.aspx?" + Request.ServerVariables["query_string"] + "&ccp=true", true);
                    }
                    else
                    {
                        Response.Redirect((string) ("taxonomy.aspx?" + Request.ServerVariables["query_string"]), true);
                    }
                }
            }
            else if (IsPostBack == false)
            {
                DisplayPage();
            }
            AssignTextStrings();
            isPostData.Value = "true";
            hdnSourceId.Value = TaxonomyId.ToString();
    }
Example #26
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refContentApi.EkMsgRef;
            AppImgPath = m_refContentApi.AppImgPath;
            AppPath = m_refContentApi.AppPath;
            m_strPageAction = Request.QueryString["action"];
            object refApi = m_refContentApi as object;
            Utilities.SetLanguage(m_refContentApi);
            //Utilities.SetLanguage(m_refContentApi);
            TaxonomyLanguage = m_refContentApi.ContentLanguage;
            if (TaxonomyLanguage == -1)
            {
                TaxonomyLanguage = m_refContentApi.DefaultContentLanguage;
            }
            if (Request.QueryString["taxonomyid"] != null)
            {
                TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            }
            if (Request.QueryString["parentid"] != null)
            {
                TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
            }
            if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "author")
            {
                m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User;
                m_UserType = Ektron.Cms.Common.EkEnumeration.UserTypes.AuthorType;
            }
            else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "member")
            {
                m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User;
                m_UserType = Ektron.Cms.Common.EkEnumeration.UserTypes.MemberShipType;
            }
            else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "cgroup")
            {
                m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup;
            }

            if ((Request.QueryString["contFetchType"] != null) && Request.QueryString["contFetchType"].ToLower() != "")
            {
                contentFetchType = Request.QueryString["contFetchType"];
            }
            m_refContent = m_refContentApi.EkContentRef;
            CalendarIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/calendar.png\" alt=\"Calendar Event\">";
            FormsIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/contentForm.png\" alt=\"Form\">";
            ContentIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/contentHtml.png\" alt=\"Content\">";
            pageIcon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/layout.png\" alt=\"Page\">"; //-HC-
            if (this.m_UserType == Ektron.Cms.Common.EkEnumeration.UserTypes.AuthorType)
            {
                UserIcon = "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/user.png\" alt=\"Content\">";
            }
            else
            {
                UserIcon = "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/userMembership.png\" alt=\"Content\">";
            }
            if ((Page.IsPostBack && (!string.IsNullOrEmpty(Request.Form[isPostData.UniqueID])) && (m_ObjectType == EkEnumeration.CMSObjectTypes.Content | (m_ObjectType == EkEnumeration.CMSObjectTypes.User & !string.IsNullOrEmpty(Request.Form["itemlist"])) | (m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup & !string.IsNullOrEmpty(Request.Form["itemlist"]) | (m_ObjectType == EkEnumeration.CMSObjectTypes.Folder & !string.IsNullOrEmpty(Request.Form["itemlist"]))))))
            //if (Page.IsPostBack && (Request.Form[isPostData.UniqueID] != "") && (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content || (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User && Request.Form["itemlist"] != "") || (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup && Request.Form["itemlist"] != "")))
                {
                if (m_strPageAction == "additem")
                {
                    TaxonomyRequest item_request = new TaxonomyRequest();
                    item_request.TaxonomyId = TaxonomyId;
                    item_request.TaxonomyIdList = Validate(Request.Form["itemlist"]);
                    if (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User)
                    {
                        item_request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.User;
                    }
                    else if (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup)
                    {
                        item_request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group;
                    }
                    item_request.TaxonomyLanguage = TaxonomyLanguage;
                    m_refContent.AddTaxonomyItem(item_request);
                }
                else if (m_strPageAction == "addfolder")
                {
                    TaxonomySyncRequest sync_request = new TaxonomySyncRequest();
                    sync_request.TaxonomyId = TaxonomyId;
                    sync_request.SyncIdList = Validate(Request.Form["selectedfolder"]); //Validate(Request.Form("itemlist"))
                    //sync_request.SyncRecursiveIdList = Validate(Request.Form("recursiveidlist"))
                    sync_request.TaxonomyLanguage = TaxonomyLanguage;
                    m_refContent.AddTaxonomySyncFolder(sync_request);
                }
                if (Request.QueryString["iframe"] == "true")
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    Response.Redirect((string) ("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId));
                }
            }
            else
            {
                FolderId = Convert.ToInt64(Request.QueryString["folderid"]);

                folder_data_col = m_refContent.GetFolderInfoWithPath(FolderId);
                FolderName = folder_data_col["FolderName"].ToString();
                FolderParentId = Convert.ToInt64(folder_data_col["ParentID"].ToString());
                FolderPath = folder_data_col["Path"].ToString();
                folder_request_col = new Collection();
                folder_request_col.Add(FolderId, "ParentID", null, null);
                folder_request_col.Add("name", "OrderBy", null, null);
                folder_data_col = m_refContent.GetAllViewableChildFoldersv2_0(folder_request_col);

                if (m_strPageAction != "additem")
                {
                    if (Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "")
                    {
                        if (Information.IsNumeric(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]))
                        {
                            SelectedContentType = System.Convert.ToInt32(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]);
                            m_refContentApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, SelectedContentType.ToString());
                        }
                    }
                    else if (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "")
                    {
                        if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]))
                        {
                            SelectedContentType = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]);
                        }
                    }
                    asset_data = m_refContent.GetAssetSuperTypes();
                }
                RegisterResources();
                TaxonomyToolBar();
                if (! Page.IsPostBack || m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User || m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup)
                {
                    // avoid redisplay when clicking next/prev buttons
                    DisplayPage();
                }
            }
    }
    /// <summary>
    /// Handles the Populating the content Grid Data when the user clicks on assign the items or folders to a locale taxonomy.
    /// </summary>
    private void PopulateGridData()
    {
        if ((TaxonomyItemList.Columns.Count == 0))
        {
            TaxonomyItemList.Columns.Add(m_refstyle.CreateBoundField("ITEM1", string.Empty, "info", HorizontalAlign.NotSet, HorizontalAlign.NotSet, Unit.Percentage(0), Unit.Percentage(0), false, false));
        }

        string iframe = string.Empty;
        if ((Request.QueryString["iframe"] != null && !string.IsNullOrEmpty(Request.QueryString["iframe"])))
        {
            iframe = "&iframe=true";
        }
        DataTable dt = new DataTable();
        DataRow dr = null;
        dt.Columns.Add(new DataColumn("ITEM1", typeof(string)));

        dr = dt.NewRow();
        if ((this.m_strPageAction == "additem") && this.m_ObjectType == EkEnumeration.CMSObjectTypes.User)
        {
            dr[0] = this.m_refMsg.GetMessage("lbl select users") + "<br/>";
        }
        else if ((m_strPageAction == "additem") && this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup)
        {
            dr[0] = this.m_refMsg.GetMessage("lbl select cgroups") + "<br/>";
        }
        else if ((m_strPageAction == "additem") && this.m_ObjectType == EkEnumeration.CMSObjectTypes.TaxonomyNode)
        {
            dr[0] = this.m_refMsg.GetMessage("lbl assign locale taxonomy item") + "<br/>";
        }
        else if ((m_strPageAction == "additem") && this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale)
        {
            dr[0] = this.m_refMsg.GetMessage("assigntaxonomylocalelabel") + "<br/>";
        }
        else if ((this.m_strPageAction == "additem"))
        {
            dr[0] = this.m_refMsg.GetMessage("assigntaxonomyitemlabel") + "<br/>";
        }
        else
        {
            dr[0] = this.m_refMsg.GetMessage("assigntaxonomyfolderlabel") + "<br/>";
        }

        dt.Rows.Add(dr);

        if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.Content && (m_LocaleObjectType != EkEnumeration.TaxonomyItemType.Locale))
        {
            dr = dt.NewRow();
            dr[0] = m_refMsg.GetMessage("generic Path") + FolderPath;
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            if ((FolderId != 0))
            {
                dr[0] = "<a href=\"LocaleTaxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + FolderParentId + "&parentid=" + FolderParentId + iframe;
                dr[0] = dr[0] + "&title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\"><img src=\"" + m_refContentApi.AppPath + "images/ui/icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" align=\"absbottom\">..</a>";
            }

            dt.Rows.Add(dr);
            if ((folder_data_col != null))
            {
                foreach (Collection folder in folder_data_col)
                {
                    dr = dt.NewRow();
                    dr[0] = "<a href=\"LocaleTaxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + folder["id"] + "&parentid=" + FolderParentId + iframe;
                    dr[0] += "&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\"><img src=\"";
                    switch ((EkEnumeration.FolderType)folder["FolderType"])
                    {
                        case EkEnumeration.FolderType.Catalog:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderGreen.png";
                            break;
                        case EkEnumeration.FolderType.Community:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderCommunity.png";
                            break;
                        case EkEnumeration.FolderType.Blog:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBlog.png";
                            break;
                        case EkEnumeration.FolderType.DiscussionBoard:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png";
                            break;
                        case EkEnumeration.FolderType.DiscussionForum:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png";
                            break;
                        case EkEnumeration.FolderType.Calendar:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderCalendar.png";
                            break;
                        case EkEnumeration.FolderType.Domain:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/foldersite.png";
                            break;
                        default:
                            dr[0] += m_refContentApi.AppPath + "images/ui/icons/folder.png";
                            break;
                    }

                    dr[0] += "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" align=\"absbottom\"></a> ";
                    dr[0] += "<a href=\"LocaleTaxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + folder["id"] + "&parentid=" + FolderParentId + iframe + "&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\">" + folder["Name"] + "</a>";
                    dt.Rows.Add(dr);
                }
            }
            if ((m_strPageAction == "additem"))
            {
                ContentData[] taxonomy_unassigneditem_arr = null;
                TaxonomyRequest request = new TaxonomyRequest();
                request.TaxonomyId = TaxonomyId;
                request.TaxonomyLanguage = TaxonomyLanguage;
                request.FolderId = FolderId;
                if ((contentFetchType.ToLower() == "activecontent"))
                {
                request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.ActiveContent;
                }
                else if ((contentFetchType.ToLower() == "archivedcontent"))
                {
                    request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.ArchivedContent;
                }
                else
                {
                    request.TaxonomyItemType = 0;
                }

                //// get total #pages first because the API doesn't return it (lame slow way to do this)-:
                request.PageSize = 99999999;
                request.CurrentPage = 1;
                Ektron.Cms.BusinessObjects.Localization.L10nManager l10nMgr = new Ektron.Cms.BusinessObjects.Localization.L10nManager(m_refContentApi.RequestInformationRef);
                Criteria<FolderData> criteria = new Criteria<FolderData>();
                criteria.PagingInfo.RecordsPerPage = 500;
                List<ILocalizable> donotTranslateList = l10nMgr.GetDoNotTranslateList(FolderId, true, TaxonomyLanguage, Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes, criteria);
                List<long> NonTranslatedList = new List<long>();
                if (donotTranslateList.Count > 0)
                {
                    for (int l = 0; l < donotTranslateList.Count; l++)
                    {
                        NonTranslatedList.Add(donotTranslateList[l].Id);
                    }
                }

                taxonomy_unassigneditem_arr = m_refContent.ReadAllUnAssignedTaxonomyItems(request);
                this.m_intTotalPages = Convert.ToInt32((taxonomy_unassigneditem_arr.Length + (m_refContentApi.RequestInformationRef.PagingSize - 1)) / m_refContentApi.RequestInformationRef.PagingSize);
               //// get the real page data set
                request.PageSize =this.m_refContentApi.RequestInformationRef.PagingSize;
                request.CurrentPage = this.m_intCurrentPage;
                taxonomy_unassigneditem_arr = this.m_refContent.ReadAllUnAssignedTaxonomyItems(request);
                LibraryData library_dat = default(LibraryData);
                foreach (ContentData taxonomy_item in taxonomy_unassigneditem_arr)
                {
                    if (!NonTranslatedList.Contains(taxonomy_item.Id))
                    {
                        dr = dt.NewRow();
                        if (taxonomy_item.Type == 1 | taxonomy_item.Type == 2)
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;" + GetTypeIcon(taxonomy_item.Type, taxonomy_item.SubType) + "&nbsp;" + taxonomy_item.Title;
                        }
                        else if (taxonomy_item.Type == 3)
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/contentArchived.png" + "\"&nbsp;border=\"0\"  alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                        }
                        else if (taxonomy_item.Type == 1111)
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/asteriskOrange.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                        }
                        else if (taxonomy_item.Type == 1112)
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/tree/folderBlog.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                        }
                        else if (taxonomy_item.Type == 7)
                        {
                            library_dat = this.m_refContentApi.GetLibraryItemByContentID(taxonomy_item.Id);
                            if (library_dat != null && !string.IsNullOrEmpty(library_dat.FileName))
                            {
                                string extension = "";
                                extension = System.IO.Path.GetExtension(library_dat.FileName);
                                switch (extension.ToLower())
                                {
                                    case ".doc":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/word.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".ppt":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/powerpoint.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".pdf":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/acrobat.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".xls":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/excel.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case ".jpg":
                                    case ".jpeg":
                                    case ".png":
                                    case ".gif":
                                    case ".bmp":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/image.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    default:
                                        //// other files
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                }
                            }
                        }
                        else if (taxonomy_item.Type == 3333)
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/brick.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                        }
                        else if (string.IsNullOrEmpty(taxonomy_item.AssetData.ImageUrl) & (taxonomy_item.Type != 1 & taxonomy_item.Type != 2 & taxonomy_item.Type != 3 & taxonomy_item.Type != 1111 & taxonomy_item.Type != 1112 & taxonomy_item.Type != 3333))
                        {
                            dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                        }
                        else
                        {
                            ////Bad Approach however no other way untill AssetManagement/Images/ are updated with version 8 images or DMS points to workarea images
                            if (string.IsNullOrEmpty(taxonomy_item.AssetData.ImageUrl))
                            {
                                dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                            }
                            else
                            {
                                switch (Path.GetFileName(taxonomy_item.AssetData.ImageUrl).ToLower())
                                {
                                    case "ms-word.gif":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/word.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case "ms-excel.gif":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/excel.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case "ms-powerpoint.gif":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/powerpoint.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case "adobe-pdf.gif":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/acrobat.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    case "image.gif":
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/image.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                    default:
                                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/>&nbsp;<img src=\"" + taxonomy_item.AssetData.ImageUrl + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img>&nbsp;" + taxonomy_item.Title;
                                        break;
                                }
                            }
                        }
                        dt.Rows.Add(dr);
                    }

                }
            }
        }
        else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup)
        {
            CollectSearchText();
            dr = dt.NewRow();
            dr[0] = "<input type=text size=25 id=\"txtSearch\" name=\"txtSearch\" value=\"" + this.m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">";
            dr[0] += "<input type=button value=\"Search\" id=\"btnSearch\" name=\"btnSearch\"  class=\"ektronWorkareaSearch\" onclick=\"searchuser();\" title=\"Search Users\">";
            dt.Rows.Add(dr);
            this.GetAssignedCommunityGroups();
            this.GetCommunityGroups();
            if (this.cgroup_list != null)
            {

                for (int j = 0; j <= (cgroup_list.Length - 1); j++)
                {
                    dr = dt.NewRow();
                    if (DoesGroupExistInList(cgroup_list[j].GroupId))
                    {
                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;" + GetTypeIcon(EkEnumeration.CMSObjectTypes.User.GetHashCode(), EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\" id=\"itemlistNoId\" name=\"itemlistNoId\" value=\"" + cgroup_list[j].GroupId + "\"/>" + cgroup_list[j].GroupName;
                    }
                    else
                    {
                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;" + GetTypeIcon(EkEnumeration.CMSObjectTypes.User.GetHashCode(), EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + cgroup_list[j].GroupId + "\"/>" + cgroup_list[j].GroupName;
                    }

                    dt.Rows.Add(dr);
                }
            }
        }
        else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.User)
        {
            CollectSearchText();
            dr = dt.NewRow();
            dr[0] = "<input type=text size=25 id=\"txtSearch\" name=\"txtSearch\" value=\"" + this.m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">";
            dr[0] += "<select id=\"searchlist\" name=\"searchlist\">";
            dr[0] += "<option value=-1" + IsSelected("-1") + ">All</option>";
            dr[0] += "<option value=\"last_name\"" + IsSelected("last_name") + ">Last Name</option>";
            dr[0] += "<option value=\"first_name\"" + IsSelected("first_name") + ">First Name</option>";
            dr[0] += "<option value=\"user_name\"" + IsSelected("user_name") + ">User Name</option>";
            dr[0] += "</select><input type=button value=\"Search\" id=\"btnSearch\" name=\"btnSearch\" class=\"ektronWorkareaSearch\"  onclick=\"searchuser();\" title=\"Search Users\">";
            dt.Rows.Add(dr);

            GetUsers();
            if (userList != null)
            {
                for (int j = 0; j <= (userList.Length - 1); j++)
                {
                    dr = dt.NewRow();
                    dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;" + GetTypeIcon(EkEnumeration.CMSObjectTypes.User.GetHashCode(), EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + userList[j].Id + "\"/>" + (!string.IsNullOrEmpty(userList[j].DisplayName) ? userList[j].DisplayName : userList[j].Username);
                    dt.Rows.Add(dr);
                }
            }
        }
        else if (this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale)
        {
            List<int> langList = new List<int>();
            Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy api = new Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy(m_refCommonApi.RequestInformationRef);
            langList = api.GetLocaleIdList(TaxonomyId, TaxonomyLanguage,true);
            Ektron.Cms.Framework.Localization.LocaleManager localizationApi = new Ektron.Cms.Framework.Localization.LocaleManager();
            List<Ektron.Cms.Localization.LocaleData> locData = localizationApi.GetEnabledLocales();
            ////Disable the checkbox for Default Language.and loop through all the enabled Languages.
            for (int k = 0; k < locData.Count; k++)
            {
                Boolean taxonomyItemAlreadyExists = langList.Contains(locData[k].Id);
                //// Boolean isTaxonomyItemDefault = langList.Contains(TaxonomyLanguage);
                if (!taxonomyItemAlreadyExists)
                {
                    if (locData[k].Id == TaxonomyLanguage)
                    {
                        dr = dt.NewRow();
                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" disabled name=\"itemlist\" value=\"" + locData[k].Id + "\"/>&nbsp;&nbsp;<img src='" + objLocalizationApi.GetFlagUrlByLanguageID(locData[k].Id) + "' />&nbsp;&nbsp;" + locData[k].CombinedName;
                        dt.Rows.Add(dr);
                    }
                    else
                    {
                        dr = dt.NewRow();
                        dr[0] = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + locData[k].Id + "\"/>&nbsp;&nbsp;<img src='" + objLocalizationApi.GetFlagUrlByLanguageID(locData[k].Id) + "' />&nbsp;&nbsp;" + locData[k].CombinedName;
                        dt.Rows.Add(dr);
                    }
                }
            }
        }
        DataView dv = new DataView(dt);
        TaxonomyItemList.DataSource = dv;
        TaxonomyItemList.DataBind();
    }
Example #28
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            Response.CacheControl = "no-cache";
            Response.AddHeader("Pragma", "no-cache");
            Response.Expires = -1;
            CurrentUserId = m_refCommon.RequestInformationRef.UserId;
            m_refContent = m_refCommon.EkContentRef;
            m_refMsg = m_refCommon.EkMsgRef;
            RegisterResources();
            Utilities.ValidateUserLogin();
            if ((m_refContentApi.RequestInformationRef.IsMembershipUser == 1 || (!m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminXliff))) && (!m_refContentApi.IsAdmin()))
            {
                Response.Redirect("../reterror.aspx?info=" + m_refContentApi.EkMsgRef.GetMessage("msg login xliff administrator"), false);
                return;
            }
            else
            {
                AppImgPath = m_refCommon.AppImgPath;
                AppPath = m_refCommon.AppPath;
                litAppPath.Text = AppPath;
                EnableMultilingual = m_refCommon.EnableMultilingual;
                displaystylesheet.Text = m_refStyle.GetClientScript();
                if ((Request.QueryString["action"] != null && !string.IsNullOrEmpty(Request.QueryString["action"])))
                {
                    m_strPageAction = Request.QueryString["action"].ToLower();
                }
                Utilities.SetLanguage(m_refCommon);

                TaxonomyLanguage = m_refCommon.ContentLanguage;
                if ((Page.IsPostBack))
                {
                    if (((Request.Form[submittedaction.UniqueID]) == "deleteSelected"))
                    {
                        TaxonomyRequest taxonomy_request_data = new TaxonomyRequest();
                        taxonomy_request_data.TaxonomyIdList = Request.Form["selected_taxonomy"];
                        taxonomy_request_data.TaxonomyLanguage = TaxonomyLanguage;
                        m_refContent.DeleteTaxonomy(taxonomy_request_data);
                        Response.Redirect("LocaleTaxonomy.aspx?rf=1", false);
                    }
                }
                switch (m_strPageAction)
                {
                    case "add":
                        addLocaleTaxonomy m_at = default(addLocaleTaxonomy);
                        m_at = (addLocaleTaxonomy)LoadControl("../controls/localetaxonomy/addLocaleTaxonomy.ascx");
                        m_at.ID = "taxonomy";
                        DataHolder.Controls.Add(m_at);
                        break;

                    case "edit":
                    case "reorder":
                        editLocaleTaxonomy m_et = default(editLocaleTaxonomy);
                        m_et = (editLocaleTaxonomy)LoadControl("../controls/localetaxonomy/editLocaleTaxonomy.ascx");
                        m_et.ID = "taxonomy";
                        DataHolder.Controls.Add(m_et);
                        break;
                    case "view":
                        viewLocaletaxonomy m_vt = default(viewLocaletaxonomy);
                        m_vt = (viewLocaletaxonomy)LoadControl("../controls/localetaxonomy/viewLocaletaxonomy.ascx");
                        m_vt.ID = "taxonomy";
                        DataHolder.Controls.Add(m_vt);
                        break;
                    case "viewcontent":
                    case "removeitems":
                        Control m_vi = default(Control);

                        m_vi = (Control)LoadControl("../controls/localetaxonomy/viewLocaleTaxonomyItems.ascx");
                        m_vi.ID = "taxonomy";
                        DataHolder.Controls.Add(m_vi);
                        break;
                    case "viewattributes":
                        Control m_va = default(Control);
                        m_va = (Control)LoadControl("../controls/localetaxonomy/viewLocaleTaxonomyAttributes.ascx");
                        m_va.ID = "taxonomy";
                        DataHolder.Controls.Add(m_va);
                        break;
                    case "additem":
                    case "addfolder":
                        if ((m_strPageAction == "addfolder"))
                        {
                            //body.Attributes.Add("onload", "Main.start();displayTreeFolderSelect();showSelectedFolderTree();setupClassNames();")
                            body.Attributes.Add("onload", "Main.start();displayTreeFolderSelect();showSelectedFolderTree();setupClassNames();");
                        }

                        assignLocaleTaxonomy m_asnt = default(assignLocaleTaxonomy);
                        m_asnt = (assignLocaleTaxonomy)LoadControl("../controls/localetaxonomy/assignLocaleTaxonomy.ascx");
                        m_asnt.ID = "taxonomy";
                        DataHolder.Controls.Add(m_asnt);

                        break;
                    default:
                        div_taxonomylist.Visible = true;
                        if ((IsPostBack == false || (IsPostBack == true & !string.IsNullOrEmpty(Request.Form[isSearchPostData.UniqueID]))))
                        {
                            //ViewAllTaxonomy();
                            ViewAllToolBar();
                        }
                        break;
                }

                //if ((Request.QueryString["rf"] == "1"))
                //{
                //    litRefreshAccordion.Text = "<script language=\"javascript\">" + "\n" + "top.refreshTaxonomyAccordion(" + TaxonomyLanguage + ");" + "\n" + "</script>" + "\n";
                //}

            }
            SetJsServerVariables();
        }
        catch (System.Threading.ThreadAbortException)
        {
            //Do nothing
        }
        catch (Exception ex)
        {
            Response.Redirect("../reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage, false);
        }
    }
Example #29
0
    // ****************************************************************************************************
    // Implement the callback interface
    private string RaiseCallbackEvent()
    {
        string result = "";
        FolderData[] folder_arr_data;
        FolderData folder_data;
        long m_intId;
        try
        {
            // handle language switch if needed
            int LangId = -1;
            if ((Request.Params["langid"] != null) && Information.IsNumeric(Request.Params["langid"]))
            {
                LangId = Convert.ToInt32(Request.Params["langid"]);
                if (LangId != -99)
                {
                    if (LangId > 0)
                    {
                        m_refContentApi.SetCookieValue("LastValidLanguageID", LangId.ToString());
                    }

                    m_refContentApi.ContentLanguage = LangId;
                    m_refApi.ContentLanguage = LangId;
                    //m_refApi.EkContentRef.RequestInformation.ContentLanguage = LangId
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["method"]))
            {
                if (Request.QueryString["method"].ToLower() == "get_folder")
                {
                    m_intId = Convert.ToInt64(Request.Params["id"]);
                    folder_data = m_refContentApi.GetFolderDataWithPermission(m_intId); //GetFolderById(m_intId)
                    folder_data.XmlConfiguration = null;
                    result = SerializeAsXmlData(folder_data, folder_data.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_child_folders")
                {
                    m_intId = Convert.ToInt64(Request.Params["folderid"]);
                    folder_arr_data = m_refContentApi.GetChildFolders(m_intId, false, Ektron.Cms.Common.EkEnumeration.FolderOrderBy.Name);
                    //when there are no folders in the content tree like CMS400min
                    if (folder_arr_data != null)
                    {
                        result = SerializeAsXmlData(folder_arr_data, folder_arr_data.GetType());
                    }
                }
                else if (Request.QueryString["method"].ToLower() == "get_child_category")
                {
                    Ektron.Cms.Content.EkContent m_refContent;
                    long TaxFolderId = -1;
                    if (Request.Params["folderid"] != null)
                    {
                        TaxFolderId = Convert.ToInt64(Request.Params["folderid"]);
                    }
                    long TaxOverrideId = -1;
                    if (Request.Params["taxonomyoverrideid"] != null)
                    {
                        TaxOverrideId = Convert.ToInt64(Request.Params["taxonomyoverrideid"]);
                    }

                    long TaxLangId = -99;
                    if (Request.Params["langid"] != null)
                    {
                        if (Request.Params["langid"] != "undefined")
                        {
                            TaxLangId = Convert.ToInt64(Request.Params["langid"]);
                        }
                    }

                    TaxonomyRequest taxonomy_request = new TaxonomyRequest();
                    TaxonomyBaseData[] taxonomy_data_arr = null;
                    Utilities.SetLanguage(m_refContentApi);
                    m_refContent = m_refContentApi.EkContentRef;
                    if (TaxFolderId == -2)
                    {
                        taxonomy_data_arr = m_refContent.GetAllTaxonomyByConfig(Ektron.Cms.Common.EkEnumeration.TaxonomyType.Group);
                    }
                    else
                    {
                        m_intId = Convert.ToInt64(Request.Params["taxonomyid"]);
                        taxonomy_request.TaxonomyId = m_intId;
                        if ((TaxFolderId > -1) && (TaxOverrideId <= 0) && (m_intId == 0))
                        {
                            taxonomy_data_arr = m_refContent.GetAllFolderTaxonomy(TaxFolderId);
                        }
                        else
                        {
                            if (TaxLangId != -99)
                            {
                                taxonomy_request.TaxonomyLanguage = Convert.ToInt32(TaxLangId);
                            }
                            else if (m_refContentApi.ContentLanguage == -1)
                            {
                                taxonomy_request.TaxonomyLanguage = m_refContentApi.DefaultContentLanguage;
                            }
                            else
                            {
                                taxonomy_request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
                            }
                            taxonomy_request.PageSize = m_maxTreeTopNodes; // default of 0 used to mean "everything" but storedproc changed
                            if (TaxFolderId == -3)
                            {
                                taxonomy_request.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Locale;
                            }
                            taxonomy_data_arr = m_refContent.ReadAllSubCategories(taxonomy_request);
                        }
                    }
                    result = SerializeAsXmlData(taxonomy_data_arr, taxonomy_data_arr.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_taxonomy")
                {
                    if (Request.Params["taxonomyid"] != "")
                    {
                        Ektron.Cms.Content.EkContent m_refContent;
                        TaxonomyRequest taxonomy_request = new TaxonomyRequest();
                        m_intId = Convert.ToInt64(Request.Params["taxonomyid"]);
                        Utilities.SetLanguage(m_refContentApi);
                        m_refContent = m_refContentApi.EkContentRef;
                        taxonomy_request.TaxonomyId = m_intId;
                        taxonomy_request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
                        TaxonomyData taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);
                        if (taxonomy_data != null)
                        {
                            result = SerializeAsXmlData(taxonomy_data, taxonomy_data.GetType());
                        }
                    }
                }
                else if (Request.QueryString["method"].ToLower() == "get_taxonomies")
                {
                    TaxonomyRequest request = new TaxonomyRequest();
                    request.TaxonomyId = 0;
                    Utilities.SetLanguage(m_refContentApi);
                    request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
                    if (m_refContentApi.ContentLanguage == -1)
                    {
                        request.TaxonomyLanguage = m_refContentApi.DefaultContentLanguage;
                    }
                    request.PageSize = m_maxTreeTopNodes;
                    request.CurrentPage = 1;
                    TaxonomyBaseData[] taxonomy_data = m_refApi.EkContentRef.ReadAllSubCategories(request);
                    result = SerializeAsXmlData(taxonomy_data, taxonomy_data.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_collections")
                {
                    PageRequestData request = new PageRequestData();
                    request.PageSize = m_maxTreeTopNodes;
                    request.CurrentPage = 1;
                    CollectionListData[] collection_list = m_refApi.EkContentRef.GetCollectionList("", ref request);
                    result = SerializeAsXmlData(collection_list, collection_list.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_menus")
                {
                    PageRequestData request = new PageRequestData();
                    request.PageSize = m_maxTreeTopNodes;
                    request.CurrentPage = 1;
                    Collection menus = m_refApi.EkContentRef.GetMenuReport("", ref request);
                    List<AxMenuData> menuList = GetMenuList(menus);
                    result = SerializeAsXmlData(menuList, menuList.GetType());
                    if (m_refContentApi.ContentLanguage == -1)
                    {
                        XmlDocument xdoc = new XmlDocument();
                        xdoc.LoadXml(result);
                        XmlNodeList nodes = xdoc.SelectNodes("//HasChildren");
                        foreach (XmlNode node in nodes)
                        {
                            node.InnerText = "false";
                        }
                        result = xdoc.InnerXml;
                    }
                }
                else if (Request.QueryString["method"].ToLower() == "get_submenus")
                {
                    m_intId = Convert.ToInt64(Request.Params["menuid"]);
                    List<AxMenuData> items = GetSubmenuList(m_intId);
                    result = SerializeAsXmlData(items, items.GetType());
                }
            }
        }
        catch (Exception ex)
        {
            EkException.LogException(ex);
            result = "";
        }

        return result;
    }
    private void DisplayPage()
    {
        if (!(Request.QueryString["metadataFormTagId"] == null))
        {
            ExtraQuery += (string)("&metadataFormTagId=" + Request.QueryString["metadataFormTagId"]);
            ExtraQuery += (string)("&separator=" + Request.QueryString["separator"]);
            frmFormTagId.Value = Request.QueryString["metadataFormTagId"];
            System.Drawing.Color sClr;
            sClr = System.Drawing.Color.FromArgb(255, 255, 225);
            ContentGrid.BackColor = sClr;
            ContentGrid.BorderColor = sClr;
        }
        if (mode == "Taxonomy")
        {
            TaxonomyRequest requestTax = new TaxonomyRequest();
            requestTax.TaxonomyId = FolderId;
            requestTax.TaxonomyLanguage = ContentLanguage;
            requestTax.SearchText = string.Empty;
            requestTax.PageSize = m_refCommonApi.RequestInformationRef.PagingSize;
            requestTax.CurrentPage = m_intCurrentPage;
            if (Request.QueryString["CopyType"] == "Locale")
            {
                requestTax.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Locale;
            }
            taxonomyList = m_refContent.ReadAllSubCategories(requestTax);
            if ((requestTax.TotalPages > 0) && (m_intCurrentPage > requestTax.TotalPages))
            {
                m_intCurrentPage = requestTax.TotalPages;
                requestTax.CurrentPage = m_intCurrentPage;
                taxonomyList = m_refContent.ReadAllSubCategories(requestTax);
            }
            taxDetails = m_refContent.GetTaxonomyRecursiveToParent(FolderId, ContentLanguage, 1);

            if (taxDetails.Length >= 1)
            {
                fPath = taxDetails[taxDetails.Length - 1].TaxonomyPath;
                ParentFolderId = taxDetails[taxDetails.Length - 1].TaxonomyParentId;
            }

            m_intTotalPages = requestTax.TotalPages;
            PopulateTaxonomyGridData();
        }
        else
        {
            gtNavs = m_refContent.GetFolderInfoWithPath(FolderId);
            FolderName = gtNavs["FolderName"];
            ParentFolderId = (long)gtNavs["ParentID"];
            prodDomain = (string)(gtNavs["DomainProduction"]);

            if (!String.IsNullOrEmpty(prodDomain) && ParentFolderId != 0)
            {
                fPath = (string)(gtNavs["Path"]);
                int secondIndex;
                secondIndex = fPath.IndexOf("\\", 1);
                fPath = fPath.Substring(secondIndex);

            }
            else if (!String.IsNullOrEmpty(prodDomain) && ParentFolderId == 0)
            {
                fPath = "\\";
            }
            else
            {
                fPath = (string)(gtNavs["Path"]);

            }
            if (((Collection)gtNavs["XmlConfiguration"]).Count > 0)
                m_nTargetFolderIsXml = 1;
            else
                m_nTargetFolderIsXml = 0;
            cTmp = new Collection();
            cTmp.Add("name", "OrderBy", null, null);
            cTmp.Add(FolderId, "FolderID", null, null);
            cTmp.Add(FolderId, "ParentID", null, null);
            cFolders = m_refContent.GetAllViewableChildFoldersv2_0(cTmp);
            PopulateFolderGridData();
        }

        PageSettings();
    }
 public static bool IsValid(this TaxonomyRequest createRequest)
 {
     return(createRequest.VocabularyId == 1 || createRequest.VocabularyId == 2);
 }
Example #32
0
        private void Display_TaxonomyTab()
        {
            if (m_cPerms.CanEdit || m_cPerms.CanAdd || (m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.TaxonomyAdministrator, m_refContentApi.RequestInformationRef.UserId, false)))
            {
                TaxonomyRoleExists = true;
            }
            EditTaxonomyHtml.Text = "<p class=\"info\">" + this.m_refMsg.GetMessage("lbl select categories entry") + "</p><div id=\"TreeOutput\"></div>";
            lit_add_string.Text = m_refMsg.GetMessage("generic add title");

            TaxonomyBaseData[] taxonomy_cat_arr = null;
            m_refContentApi.RequestInformationRef.ContentLanguage = ContentLanguage;
            m_refContentApi.ContentLanguage = ContentLanguage;

            TaxonomyRequest taxonomy_request = new TaxonomyRequest();
            TaxonomyBaseData[] taxonomy_data_arr = null;
            if (m_sEditAction == "add")
            {
                if ((Request.QueryString["SelTaxonomyId"] != null) && Request.QueryString["SelTaxonomyId"] != "")
                {
                    TaxonomySelectId = Convert.ToInt64(Request.QueryString["SelTaxonomyId"]);
                }
                if (TaxonomySelectId > 0)
                {
                    taxonomyselectedtree.Value = TaxonomySelectId.ToString();
                    TaxonomyTreeIdList = (string)taxonomyselectedtree.Value;
                    taxonomy_cat_arr = m_refContentApi.EkContentRef.GetTaxonomyRecursiveToParent(TaxonomySelectId, m_refContentApi.ContentLanguage, 0);
                    if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
                    {
                        foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                        {
                            if (TaxonomyTreeParentIdList == "")
                            {
                                TaxonomyTreeParentIdList = Convert.ToString(taxonomy_cat.TaxonomyId);
                            }
                            else
                            {
                                TaxonomyTreeParentIdList = TaxonomyTreeParentIdList + "," + Convert.ToString(taxonomy_cat.TaxonomyId);
                            }
                        }
                    }
                }
            }
            else
            {
                taxonomy_cat_arr = m_refContentApi.EkContentRef.ReadAllAssignedCategory(m_iID);
                if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
                {
                    foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                    {
                        if (taxonomyselectedtree.Value == "")
                        {
                            taxonomyselectedtree.Value = Convert.ToString(taxonomy_cat.TaxonomyId);
                        }
                        else
                        {
                            taxonomyselectedtree.Value = taxonomyselectedtree.Value + "," + Convert.ToString(taxonomy_cat.TaxonomyId);
                        }
                    }
                }
                TaxonomyTreeIdList = (string)taxonomyselectedtree.Value;
                if (TaxonomyTreeIdList.Trim().Length > 0)
                {
                    TaxonomyTreeParentIdList = m_refContentApi.EkContentRef.ReadDisableNodeList(m_iID);
                }
            }

            taxonomy_request.TaxonomyId = m_iFolder;
            taxonomy_request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
            taxonomy_data_arr = m_refContentApi.EkContentRef.GetAllFolderTaxonomy(m_iFolder);

            if ((taxonomy_data_arr == null || taxonomy_data_arr.Length == 0) && (TaxonomyOverrideId == 0))
            {
                ShowTaxonomyTab = false;
            }

            m_intTaxFolderId = m_iFolder;
            //If (Request.QueryString("TaxonomyId") IsNot Nothing AndAlso Request.QueryString("TaxonomyId") <> "") Then
            //    TaxonomyOverrideId = Convert.ToInt32(Request.QueryString("TaxonomyId"))
            //End If

            //set CatalogEntry_Taxonomy_A_Js vars - see RegisterJS() and CatalogEntry.Taxonomy.A.aspx under CatalogEntry/js
            this._JSTaxonomyFunctions_TaxonomyTreeIdList = EkFunctions.UrlEncode(TaxonomyTreeIdList);
            this._JSTaxonomyFunctions_TaxonomyTreeParentIdList = EkFunctions.UrlEncode(TaxonomyTreeParentIdList);
            this._JSTaxonomyFunctions_TaxonomyOverrideId = TaxonomyOverrideId.ToString();
            this._JSTaxonomyFunctions_TaxonomyFolderId = m_iFolder.ToString();
        }
Example #33
0
    private void TaxonomyToolBar()
    {
        string _taxName = "";

        if (taxonomy_data != null && taxonomy_data.TaxonomyName != null && taxonomy_data.TaxonomyName != "")
        {
            _taxName = taxonomy_data.TaxonomyName;
        }
        else if (TaxonomyId > 0) //will be called only on reorder items screen. No other way to get the taxonomy name
        {
            taxonomy_request = new TaxonomyRequest();
            taxonomy_request.TaxonomyId = TaxonomyId;
            taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
            TaxonomyData _taxData = m_refContent.ReadTaxonomy(ref taxonomy_request);
            _taxName = _taxData.TaxonomyName;
        }

        if (m_strPageAction == "reorder")
        {
            divTitleBar.InnerHtml = m_refstyle.GetTitleBar((string)(m_refMsg.GetMessage("reorder taxonomy page title") + "&nbsp;&nbsp;\"" + _taxName + "\"&nbsp;&nbsp;<img style=\'vertical-align:middle;\' src=\'" + objLocalizationApi.GetFlagUrlByLanguageID(TaxonomyLanguage) + "\' />"));
        }
        else
        {
            divTitleBar.InnerHtml = m_refstyle.GetTitleBar((string)(m_refMsg.GetMessage("edit taxonomy page title") + "&nbsp;&nbsp;\"" + _taxName + "\"&nbsp;&nbsp;<img style=\'vertical-align:middle;\' src=\'" + objLocalizationApi.GetFlagUrlByLanguageID(TaxonomyLanguage) + "\' />"));
        }

        System.Text.StringBuilder result = new System.Text.StringBuilder();

        result.Append("<table><tr>" + "\r\n");

        if (Request.QueryString["iframe"] == "true")
        {
            result.Append(m_refstyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/cancel.png", "#", m_refMsg.GetMessage("generic Cancel"), m_refMsg.GetMessage("generic Cancel"), "onClick=\"javascript:parent.CancelIframe();\"", StyleHelper.CancelButtonCssClass, true));
        }
        else
        {
            result.Append(m_refstyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/back.png", (string)("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
        }

        if (m_strPageAction == "edit")
        {
            result.Append(m_refstyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/save.png", "#", m_refMsg.GetMessage("alt update button text (taxonomy)"), m_refMsg.GetMessage("btn update"), "onclick=\"javascript:if(SetPropertyIds()){Validate(true);}\"", StyleHelper.SaveButtonCssClass, true));
        }
        else
        {
            if (ShowSaveIcon)
            {
                result.Append(m_refstyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/save.png", "#", m_refMsg.GetMessage("alt update button text (taxonomy)"), m_refMsg.GetMessage("btn update"), "onclick=\"javascript:if(SetPropertyIds()){Validate(false);}\"", StyleHelper.SaveButtonCssClass, true));
            }
        }

        if (m_strPageAction != "edit")
        {
            result.Append(StyleHelper.ActionBarDivider);
            result.Append("<td>" + ReorderDropDown() + "</td>");
            result.Append(StyleHelper.ActionBarDivider);
            result.Append("<td>" + m_refstyle.GetHelpButton("ReOrderTaxonomyOrCategoryItem", "") + "</td>");
        }
        else
        {
            result.Append(StyleHelper.ActionBarDivider);
            result.Append("<td>" + m_refstyle.GetHelpButton("EditTaxonomyOrCategory", "") + "</td>");
        }

        result.Append("</tr></table>");
        divToolBar.InnerHtml = result.ToString();
        result = null;
    }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     m_refMsg = m_refCommon.EkMsgRef;
     AppImgPath = m_refCommon.AppImgPath;
     m_strPageAction = Request.QueryString["action"];
     //object refCommon = m_refCommon as object;
     Utilities.SetLanguage(m_refCommon);
     TaxonomyLanguage = m_refCommon.ContentLanguage;
     TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
     if ((Request.QueryString["view"] != null))
     {
         m_strViewItem = Request.QueryString["view"];
     }
     taxonomy_request = new TaxonomyRequest();
     taxonomy_request.TaxonomyId = TaxonomyId;
     taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
     m_refContent = m_refCommon.EkContentRef;
     if ((Page.IsPostBack))
     {
         if ((Request.Form["submittedaction"] == "delete"))
         {
             m_refContent.DeleteTaxonomy(taxonomy_request);
             Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
         }
         else if ((Request.Form["submittedaction"] == "deleteitem"))
         {
             if ((m_strViewItem != "folder"))
             {
                 taxonomy_request.TaxonomyIdList = Request.Form["selected_items"];
                 if ((m_strViewItem.ToLower() == "cgroup"))
                 {
                     taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Group;
                 }
                 else if ((m_strViewItem.ToLower() == "user"))
                 {
                     taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                 }
                 else
                 {
                     taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Content;
                 }
                 m_refContent.RemoveTaxonomyItem(taxonomy_request);
             }
             else
             {
                 TaxonomySyncRequest tax_folder = new TaxonomySyncRequest();
                 tax_folder.TaxonomyId = TaxonomyId;
                 tax_folder.TaxonomyLanguage = TaxonomyLanguage;
                 tax_folder.SyncIdList = Request.Form["selected_items"];
                 m_refContent.RemoveTaxonomyFolder(tax_folder);
             }
             if ((Request.Params["ccp"] == null))
             {
                 Response.Redirect("LocaleTaxonomy.aspx?" + Request.ServerVariables["query_string"] + "&ccp=true", true);
             }
             else
             {
                 Response.Redirect("LocaleTaxonomy.aspx?" + Request.ServerVariables["query_string"], true);
             }
         }
     }
     else if ((IsPostBack == false))
     {
         DisplayPage();
     }
 }
Example #35
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refCommon.EkMsgRef;
            AppImgPath = m_refCommon.AppImgPath;
            m_strPageAction = Request.QueryString["action"];
            object refAPI = m_refCommon as object;
            Utilities.SetLanguage(m_refCommon);
            //Utilities.SetLanguage(m_refCommon);
            TaxonomyLanguage = m_refCommon.ContentLanguage;
            TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            if (Request.QueryString["view"] != null)
            {
                m_strViewItem = AntiXss.HtmlEncode(Request.QueryString["view"]);
            }

            PageLabel.Text = PageLabel.ToolTip = m_refMsg.GetMessage("lbl pagecontrol page");
            OfLabel.Text = OfLabel.ToolTip = m_refMsg.GetMessage("lbl pagecontrol of");

            FirstPage.ToolTip = m_refMsg.GetMessage("lbl first page");
            PreviousPage.ToolTip = m_refMsg.GetMessage("lbl previous page");
            NextPage.ToolTip = m_refMsg.GetMessage("lbl next page");
            LastPage.ToolTip = m_refMsg.GetMessage("lbl last page");

            FirstPage.Text = "[" + m_refMsg.GetMessage("lbl first page") + "]";
            PreviousPage.Text = "[" + m_refMsg.GetMessage("lbl previous page") + "]";
            NextPage.Text = "[" + m_refMsg.GetMessage("lbl next page") + "]";
            LastPage.Text = "[" + m_refMsg.GetMessage("lbl last page") + "]";

            taxonomy_request = new TaxonomyRequest();
            taxonomy_request.TaxonomyId = TaxonomyId;
            taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
            m_refContent = m_refCommon.EkContentRef;
            if (Page.IsPostBack && Request.Form[isPostData.UniqueID] != "")
            {
                if (Request.Form["submittedaction"] == "delete")
                {
                    m_refContent.DeleteTaxonomy(taxonomy_request);
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else if (Request.Form["submittedaction"] == "deleteitem")
                {
                    if (m_strViewItem != "folder")
                    {
                        taxonomy_request.TaxonomyIdList = Request.Form["selected_items"];
                        if (m_strViewItem.ToLower() == "cgroup")
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Group;
                        }
                        else if (m_strViewItem.ToLower() == "user")
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                        }
                        else
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Content;
                        }
                        m_refContent.RemoveTaxonomyItem(taxonomy_request);
                    }
                    else
                    {
                        TaxonomySyncRequest tax_folder = new TaxonomySyncRequest();
                        tax_folder.TaxonomyId = TaxonomyId;
                        tax_folder.TaxonomyLanguage = TaxonomyLanguage;
                        tax_folder.SyncIdList = Request.Form["selected_items"];
                        m_refContent.RemoveTaxonomyFolder(tax_folder);
                    }
                    if (Request.Params["ccp"] == null)
                    {
                        Response.Redirect("taxonomy.aspx?" + Request.ServerVariables["query_string"] + "&ccp=true", true);
                    }
                    else
                    {
                        Response.Redirect((string) ("taxonomy.aspx?" + Request.ServerVariables["query_string"]), true);
                    }
                }
            }
            else if (IsPostBack == false)
            {
                DisplayPage();
            }
            isPostData.Value = "true";
    }
Example #36
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            CurrentUserId = m_refCommon.RequestInformationRef.UserId;
            m_refMsg = m_refCommon.EkMsgRef;
            Utilities.ValidateUserLogin();
            if (m_refCommon.RequestInformationRef.IsMembershipUser > 0 || CurrentUserId == 0)
            {
                Response.Redirect(m_refCommon.ApplicationPath + "reterror.aspx?info=" + Server.UrlEncode(m_refMsg.GetMessage("msg login cms user")), false);
                return;
            }
            else
            {
                AppImgPath = (string)m_refCommon.AppImgPath;
                EnableMultilingual = System.Convert.ToInt32(m_refCommon.EnableMultilingual);
                displaystylesheet.Text = m_refStyle.GetClientScript();
                if (!String.IsNullOrEmpty(Request.QueryString["action"]))
                {
                    m_strPageAction = Request.QueryString["action"].ToLower();
                }
                Utilities.SetLanguage(m_refCommon);
                m_refContent = m_refCommon.EkContentRef;
                TaxonomyLanguage = System.Convert.ToInt32(m_refCommon.ContentLanguage);

                RegisterResources();
                SetJsServerVariables();

                TaxonomyRequest taxonomy_request_data = null;
                if (Page.IsPostBack)
                {
                    string xml = "";
                    string title = "";
                    title = (string)txttitle.Text;
                    if (textimport.Text.Trim().Length > 0)
                    {
                        xml = (string)textimport.Text;
                    }
                    else
                    {
                        System.IO.Stream stream = fileimport.FileContent;
                        stream.Flush();
                        stream.Position = 0;
                        int FileLen = fileimport.PostedFile.ContentLength;
                        byte[] byteArr = new byte[FileLen + 1]; //= stream.ToArray
                        stream.Read(byteArr, 0, FileLen);
                        xml = System.Convert.ToBase64String(byteArr, 0, byteArr.Length);
                        UTF8Encoding utf8 = new UTF8Encoding();
                        xml = utf8.GetString(Convert.FromBase64String(xml));
                    }
                    if (xml.Trim().Length > 0 && title.Trim().Length > 0)
                    {
                        if (xml.IndexOf("<ArrayOfTaxonomyData ") != -1)
                        {
                            m_intTaxonomyId = m_refContent.ImportTaxonomyCollection(xml.Trim(), title);
                        }
                        else
                        {
                            m_intTaxonomyId = m_refContent.ImportTaxonomy(xml.Trim(), title);
                        }
                        string strConfig = string.Empty;
                        if (!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID]))
                        {
                            strConfig = "0";
                        }
                        if (!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID]))
                        {
                            if (string.IsNullOrEmpty(strConfig))
                            {
                                strConfig = "1";
                            }
                            else
                            {
                                strConfig = strConfig + ",1";
                            }
                        }
                        if (!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID]))
                        {
                            if (string.IsNullOrEmpty(strConfig))
                            {
                                strConfig = "2";
                            }
                            else
                            {
                                strConfig = strConfig + ",2";
                            }
                        }
                        if (!(string.IsNullOrEmpty(strConfig)))
                        {
                            m_refContent.UpdateTaxonomyConfig(m_intTaxonomyId, strConfig);
                        }
                    }
                    if (m_intTaxonomyId > 0)
                    {
                        Response.Redirect("taxonomy.aspx?reloadtrees=tax", false);
                    }
                    else
                    {
                        textimport.Text = xml;
                        textimport.Attributes.Add("onkeypress", "ClearErr();");
                        textimport.Focus();
                    }
                }
                else
                {
                    if (m_strPageAction == "export")
                    {
                        Response.Clear();
                        Response.Charset = "";
                        Response.ContentType = "text/xml";
                        if (!String.IsNullOrEmpty(Request.QueryString["taxonomyid"]))
                        {
                            m_intTaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
                        }
                        TaxonomyDataCollection col = new TaxonomyDataCollection();
                        LanguageData[] langList = (new SiteAPI()).GetAllActiveLanguages();
                        foreach (LanguageData langitem in langList)
                        {
                            taxonomy_request_data = new TaxonomyRequest();
                            taxonomy_request_data.TaxonomyId = m_intTaxonomyId;
                            taxonomy_request_data.TaxonomyLanguage = langitem.Id;
                            taxonomy_request_data.Depth = -1;
                            taxonomy_request_data.IncludeItems = false;
                            taxonomy_request_data.ReadCount = false;
                            TaxonomyData data = m_refContent.LoadTaxonomy(ref taxonomy_request_data);
                            if (data != null)
                            {
                                col.Add(data);
                            }
                        }

                        string returnXml = (string)(EkXml.Serialize(typeof(TaxonomyDataCollection), col));
                        XmlDocument doc;
                        try
                        {
                            doc = new XmlDocument();
                            doc.LoadXml(returnXml);
                            string[] removablenode = new string[] { "TaxonomyParentId", "TaxonomyLevel", "TaxonomyPath", "TaxonomyCreatedDate", "TaxonomyItemCount", "TaxonomyHasChildren", "TemplateId", "TemplateName", "TemplateInherited", "TemplateInheritedFrom", "TaxonomyType", "Visible", "TaxonomyImage", "TaxonomyItems", "CategoryUrl", "FolderId" };
                            XmlNodeList nodelist = doc.GetElementsByTagName("TaxonomyData");
                            for (int i = 0; i <= nodelist.Count - 1; i++)
                            {
                                XmlNode node = nodelist[i];
                                for (int j = 0; j <= removablenode.Length - 1; j++)
                                {
                                    XmlNode n = node.SelectSingleNode(removablenode[j]);
                                    try
                                    {
                                        n.ParentNode.RemoveChild(n);
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                            returnXml = doc.InnerXml;
                        }
                        catch (Exception)
                        {
                        }
                        Response.Write(returnXml);
                        Response.AddHeader("content-disposition", "attachment; filename=taxonomy_" + m_intTaxonomyId + ".xml");
                    }
                    ViewImportToolBar();
                }
            }
        }
        catch (Exception ex)
        {
            Response.Redirect((string)("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage), false);
        }
    }