//------------------------------------------------------------------------------------------------------


        public void Add(int id)
        {
            target(Create);

            List <FileCategory> cats = FileCategory.GetRootList();

            dropList("fileCategory.ParentId", cats, "Name=Id", id);
        }
        public virtual void List()
        {
            set("addLink", to(Add));
            set("sortAction", to(SaveSort));

            List <FileCategory> list = FileCategory.GetRootList();

            bindList("list", "data", list, bindLink);
        }
Exemple #3
0
        private List <FileCategory> getRootList()
        {
            List <FileCategory> list = FileCategory.GetRootList();
            FileCategory        f    = new FileCategory {
                Id = 0, Name = lang("plsSelect")
            };

            list.Insert(0, f);
            return(list);
        }
        //------------------------------------------------------------------------------------------------------

        public void Files()
        {
            List <FileCategory> cats = FileCategory.GetRootList();
            IBlock block             = getBlock("cat");

            foreach (FileCategory cat in cats)
            {
                block.Set("cat.ThumbIcon", cat.ThumbIcon);
                block.Set("cat.Name", cat.Name);
                block.Set("cat.Link", to(new FileController().Category, cat.Id));

                bindSubCatsFiles(block, cat);

                block.Next();
            }
        }
        public void Edit(int id)
        {
            FileCategory cat = FileCategory.GetById(id);

            bind(cat);

            List <FileCategory> cats = FileCategory.GetRootList();

            dropList("fileCategory.ParentId", cats, "Name=Id", cat.ParentId);
            target(Update, id);

            String chkstr = "";

            if (cat.IsThumbView == 1)
            {
                chkstr = "checked=\"checked\"";
            }
            set("checked", chkstr);
        }
        public void List()
        {
            set("addLink", to(Add, 0));

            List <FileCategory> cats = FileCategory.GetRootList();
            IBlock block             = getBlock("cat");

            foreach (FileCategory cat in cats)
            {
                block.Set("cat.ThumbIcon", cat.ThumbIcon);

                block.Set("cat.Name", cat.Name);
                block.Set("cat.Link", to(new CategoryController().Edit, cat.Id));
                block.Set("cat.AddSubLink", to(Add, cat.Id));
                block.Set("cat.SortLink", to(ListSub, cat.Id));

                bindSubCats(block, cat);

                block.Next();
            }
        }
        public virtual void SaveSort()
        {
            long   id  = ctx.PostLong("id");
            String cmd = ctx.Post("cmd");

            FileCategory acategory = FileCategory.GetById(id);

            List <FileCategory> list = FileCategory.GetRootList();

            if (cmd == "up")
            {
                new SortUtil <FileCategory>(acategory, list).MoveUp();
                echoRedirect("ok");
            }
            else if (cmd == "down")
            {
                new SortUtil <FileCategory>(acategory, list).MoveDown();
                echoRedirect("ok");
            }
            else
            {
                echoError(lang("exUnknowCmd"));
            }
        }
        public virtual void sidebar()
        {
            List <FileCategory> cats = FileCategory.GetRootList();

            bindCats(cats);
        }