public void SideBar() { Page data = ctx.GetItem("_currentPage") as Page; List <Page> relativeList = ctx.GetItem("_relativeList") as List <Page>; // 1) 所属分类 set("category.Name", data.Category.Name); // 2) 添加命令 String cmd = hasPermission(data.Category) ? string.Format("<a href=\"{0}\" class=\"btn\"><i class=\"icon-plus\"></i> 添加页面</a>", to(Add, data.Category.Id)) : ""; set("addCmd", cmd); // 3) 树形列表 Tree <Page> tree = new Tree <Page>(relativeList); CurrentRequest.setItem("__currentPageParentId", data.ParentId); treeBinder binder = new treeBinder(data.Id); binder.link = this.ctx.link; List <zNode> nodes = tree.GetZNodeList(binder); set("jsonData", Json.ToString(nodes)); // 4) 传统链接 set("tree", tree.RenderList("mytree", true, binder, data.Id)); // 5) 当前菜单的url Page homePage = relativeList.Count == 0 ? data : tree.GetAllOrdered()[0]; ctx.SetItem("_moduleUrl", to(Show, homePage.Id)); }
private void bindSidebar(Page data) { List <Page> relativeList = pageService.GetPosts(ctx.owner.obj, data.Category.Id); IBlock sidebar = getBlock("sidebar"); if (relativeList.Count <= 1) { return; } sidebar.Set("category.Name", data.Category.Name); Tree <Page> tree = new Tree <Page>(relativeList); treeBinder binder = new treeBinder(); binder.link = this.ctx.link; sidebar.Set("tree", tree.RenderList("mytree", true, binder, data.Id)); String cmd = hasPermission(data.Category) ? string.Format("<img src=\"{1}\" /> <a href=\"{0}\">添加页面</a>", to(Add, data.Category.Id), strUtil.Join(sys.Path.Img, "add.gif")) : ""; sidebar.Set("addCmd", cmd); sidebar.Next(); }
private void bindSidebar( Page data ) { List<Page> relativeList = pageService.GetPosts( ctx.owner.obj, data.Category.Id ); IBlock sidebar = getBlock( "sidebar" ); if (relativeList.Count <= 1) return; sidebar.Set( "category.Name", data.Category.Name ); Tree<Page> tree = new Tree<Page>( relativeList ); treeBinder binder = new treeBinder(); binder.link = this.ctx.link; sidebar.Set( "tree", tree.RenderList( "mytree", true, binder, data.Id ) ); String cmd = hasPermission( data.Category ) ? string.Format( "<img src=\"{1}\" /> <a href=\"{0}\">���ҳ��</a>", to( Add, data.Category.Id ), strUtil.Join( sys.Path.Img, "add.gif" ) ) : ""; sidebar.Set( "addCmd", cmd ); sidebar.Next(); }
private void bindSidebar( Page data ) { List<Page> relativeList = pageService.GetPosts( ctx.owner.obj, data.Category.Id ); IBlock sidebar = getBlock( "sidebar" ); if (relativeList.Count <= 1) return; sidebar.Set( "category.Name", data.Category.Name ); Tree<Page> tree = new Tree<Page>( relativeList ); CurrentRequest.setItem( "__currentPageParentId", data.ParentId ); treeBinder binder = new treeBinder(); binder.link = this.ctx.link; sidebar.Set( "tree", tree.RenderList( "mytree", true, binder, data.Id ) ); String cmd = hasPermission( data.Category ) ? string.Format( "<a href=\"{0}\" class=\"btn\"><i class=\"icon-plus\"></i> 添加页面</a>", to( Add, data.Category.Id ) ) : ""; sidebar.Set( "addCmd", cmd ); sidebar.Next(); }
public virtual void SideBar() { Page data = ctx.GetItem( "_currentPage" ) as Page; List<Page> relativeList = ctx.GetItem( "_relativeList" ) as List<Page>; // 1) 所属分类 set( "category.Name", data.Category.Name ); // 2) 添加命令 String cmd = hasPermission( data.Category ) ? string.Format( "<a href=\"{0}\" class=\"btn\"><i class=\"icon-plus\"></i> 添加页面</a>", to( Add, data.Category.Id ) ) : ""; set( "addCmd", cmd ); // 3) 树形列表 Tree<Page> tree = new Tree<Page>( relativeList ); CurrentRequest.setItem( "__currentPageParentId", data.ParentId ); treeBinder binder = new treeBinder( data.Id ); binder.link = this.ctx.link; List<zNode> nodes = tree.GetZNodeList( binder ); set( "jsonData", Json.ToString( nodes ) ); // 4) 传统链接 set( "tree", tree.RenderList( "mytree", true, binder, data.Id ) ); // 5) 当前菜单的url Page homePage = relativeList.Count == 0 ? data : tree.GetAllOrdered()[0]; ctx.SetItem( "_moduleUrl", to( Show, homePage.Id ) ); }