Beispiel #1
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;
            //}
        }
    }