/// <summary>
        /// Gets the child terms.
        /// </summary>
        /// <param name="Term">The term.</param>
        /// <param name="termId">The term id.</param>
        /// <param name="vocabularyId">The vocabulary id.</param>
        /// <returns>term collection which's parent is the specific term.</returns>
        internal static List <Term> GetChildTerms(this Term Term, int termId, int vocabularyId)
        {
            ITermController ctl = Util.GetTermController();

            IQueryable <Term> terms = from term in ctl.GetTermsByVocabulary(vocabularyId) where term.ParentTermId == termId select term;

            return(terms.ToList());
        }
Exemple #2
0
        public static ITermController GetTermController()
        {
            ITermController ctl = ComponentFactory.GetComponent <ITermController>();

            if (ctl == null)
            {
                ctl = new TermController();
                ComponentFactory.RegisterComponentInstance <ITermController>(ctl);
            }
            return(ctl);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// This routine Binds the DesktopModule
        /// </summary>
        /// <history>
        ///     [cnurse]	02/04/2008  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void BindDesktopModule(bool refreshDefinitions)
        {
            if (DesktopModule != null)
            {
                ITermController termController = Util.GetTermController();
                category.ListSource = termController.GetTermsByVocabulary("Module_Categories").OrderBy(t => t.Weight).ToList();

                desktopModuleForm.DataSource = DesktopModule;
                desktopModuleForm.DataBind();

                IsPremiumm.Visible = !DesktopModule.IsAdmin;

                if (!Page.IsPostBack)
                {
                    if ((Request.QueryString["ModuleDefinitionID"] != null))
                    {
                        ModuleDefinitionID = Int32.Parse(Request.QueryString["ModuleDefinitionID"]);
                    }
                }
                if (!Page.IsPostBack || refreshDefinitions)
                {
                    cboDefinitions.DataSource = DesktopModule.ModuleDefinitions.Values;
                    cboDefinitions.DataBind();

                    if (ModuleDefinitionID == Null.NullInteger && cboDefinitions.Items.Count > 0)
                    {
                        ModuleDefinitionID = int.Parse(cboDefinitions.SelectedValue);
                    }
                    if (ModuleDefinitionID != Null.NullInteger)
                    {
                        //Set the Combos selected value
                        ListItem selectedDefinition = cboDefinitions.Items.FindByValue(ModuleDefinitionID.ToString());
                        if (selectedDefinition != null)
                        {
                            cboDefinitions.SelectedIndex = -1;
                            selectedDefinition.Selected  = true;
                        }
                    }
                }
                if (!IsSuperTab)
                {
                    BindPermissions();
                }
                else
                {
                    pnlPermissions.Visible = false;
                }
                BindPortalDesktopModules();

                BindDefinition();

                lblDefinitionError.Visible = false;
            }
        }
        private void LoadCategoryList()
        {
            ITermController termController = Util.GetTermController();

            CategoryList.DataSource = termController.GetTermsByVocabulary("Module_Categories").OrderBy(t => t.Weight).Where(t => t.Name != "< None >").ToList();
            CategoryList.DataBind();
            CategoryList.AddItem(Localization.GetString("AllCategories", LocalResourceFile), "All");
            if (!IsPostBack)
            {
                CategoryList.Select("All", false);
            }
        }
        private void LoadCategoryList()
        {
            ITermController termController = Util.GetTermController();
            var             terms          = termController.GetTermsByVocabulary("Module_Categories").OrderBy(t => t.Weight).Where(t => t.Name != "< None >").ToList();
            var             allTerm        = new Term("All", Localization.GetString("AllCategories", this.LocalResourceFile));

            terms.Add(allTerm);
            this.CategoryList.DataSource = terms;
            this.CategoryList.DataBind();
            if (!this.IsPostBack)
            {
                this.CategoryList.Select(!string.IsNullOrEmpty(this.BookmarkedModuleKeys) ? this.BookmarkModuleCategory : "All", false);
            }
        }
        private void LoadCategoryList()
        {
            CategoryListPanel.Visible = !AddExistingModule.Checked;

            ITermController termController = Util.GetTermController();
            CategoryList.DataSource = termController.GetTermsByVocabulary("Module_Categories").OrderBy(t => t.Weight).Where(t => t.Name != "< None >").ToList();
            CategoryList.DataBind();
            //CategoryList.Items.Add(new ListItem(Localization.GetString("AllCategories", LocalResourceFile), "All"));
            CategoryList.AddItem(Localization.GetString("AllCategories", LocalResourceFile), "All");
            if (!IsPostBack)
            {
                CategoryList.Select("Common", false);
            }
        }
        public EditVocabularyPresenter(IEditVocabularyView editView, IVocabularyController vocabularyController, ITermController termController) : base(editView)
        {
            Requires.NotNull("vocabularyController", vocabularyController);
            Requires.NotNull("termController", termController);

            _vocabularyController = vocabularyController;
            _termController       = termController;

            View.AddTerm    += AddTerm;
            View.CancelTerm += CancelTerm;
            View.Delete     += DeleteVocabulary;
            View.DeleteTerm += DeleteTerm;
            View.Save       += SaveVocabulary;
            View.SaveTerm   += SaveTerm;
            View.SelectTerm += SelectTerm;
        }
        /// <summary>
        /// Gets the terms by content item id.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="contentItemId">The content item id.</param>
        /// <returns>term collection</returns>
        internal static List <Term> GetTerms(this ContentItem item, int contentItemId)
        {
            ITermController ctl = Util.GetTermController();

            List <Term> _Terms = null;

            if (contentItemId == Null.NullInteger)
            {
                _Terms = new List <Term>();
            }
            else
            {
                _Terms = ctl.GetTermsByContent(contentItemId).ToList();
            }

            return(_Terms);
        }
Exemple #9
0
        public string GetTermPath()
        {
            string path = "\\\\" + Name;

            if (ParentTermId.HasValue)
            {
                ITermController ctl = Util.GetTermController();

                Term parentTerm = (from t in ctl.GetTermsByVocabulary(VocabularyId) where t.TermId == ParentTermId select t).SingleOrDefault();

                if (parentTerm != null)
                {
                    path = parentTerm.GetTermPath() + path;
                }
            }
            return(path);
        }
        private void AddTerms(Vocabulary v, ArrayList terms)
        {
            ITermController termRep = Util.GetTermController();

            //Add a dummy parent term if simple vocabulary
            if (v.Type == VocabularyType.Simple)
            {
                terms.Add(new { termId = -v.VocabularyId, name = v.Name, parentTermId = Null.NullInteger });
            }
            foreach (Term t in termRep.GetTermsByVocabulary(v.VocabularyId))
            {
                if (v.Type == VocabularyType.Simple)
                {
                    t.ParentTermId = -v.VocabularyId;
                }
                terms.Add(new { termId = t.TermId, name = t.Name, parentTermId = t.ParentTermId });
            }
        }
Exemple #11
0
            private void AddTerms(Vocabulary v)
            {
                ITermController termRep = Util.GetTermController();

                //Add a dummy parent term if simple vocabulary
                if (v.Type == VocabularyType.Simple)
                {
                    Term dummyTerm = new Term(v.VocabularyId);
                    dummyTerm.ParentTermId = null;
                    dummyTerm.Name         = v.Name;
                    dummyTerm.TermId       = -v.VocabularyId;
                    _terms.Add(dummyTerm);
                }
                foreach (Term t in termRep.GetTermsByVocabulary(v.VocabularyId))
                {
                    if (v.Type == VocabularyType.Simple)
                    {
                        t.ParentTermId = -v.VocabularyId;
                    }
                    _terms.Add(t);
                }
            }
 public VocabularyNameValidator(IVocabularyController vocabularyController, ITermController termController)
 {
     _vocabularyController = vocabularyController;
     _termController       = termController;
 }
        /// <summary>
        /// Gets the terms by vocabularyId.
        /// </summary>
        /// <param name="voc">The voc.</param>
        /// <param name="vocabularyId">The vocabulary id.</param>
        /// <returns>term collection.</returns>
        internal static List <Term> GetTerms(this Vocabulary voc, int vocabularyId)
        {
            ITermController ctl = Util.GetTermController();

            return(ctl.GetTermsByVocabulary(vocabularyId).ToList());
        }
 public TermsImpl(ITermController termController)
 {
     _termController       = termController;
     _vocabularyController = new VocabularyController();
 }
Exemple #15
0
        static internal List <Term> GetTerms(this Vocabulary voc, int vocabularyId)
        {
            ITermController ctl = CommonLibrary.Entities.Content.Common.Util.GetTermController();

            return(ctl.GetTermsByVocabulary(vocabularyId).ToList());
        }