123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <{include file="admin/permission/header.html"}>
- <{include file="admin/permission/nav.html"}>
- <link rel="stylesheet" href="<{$web_cfg.cdn}>/public/static/css/zTreeStyle/zTreeStyle.css">
- <script src="<{$web_cfg.cdn}>/public/static/js/jquery-1.4.4.min.js"></script>
- <script src="<{$web_cfg.cdn}>/public/static/js/jquery.ztree.all-3.5.js"></script>
- <style>
- .ztree_add_node {
- color:blue;margin-right:0px;
- }
- .ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position:-144px 0; vertical-align:top; *vertical-align:middle}
- .ztree li span.button.add,.ztree li span.button.edit,.ztree li span.button.remove{margin-right:5px;}
- </style>
- <div class="container">
- <div class="panel">
- <div class="panel-body">
- 注:资源被删除后,拥有此资源权限的用户,将不在有权限。
-
- <div style="margin-left:10px;">
- <p></p>
- <!-- tree -->
- <div id='tree' class="ztree"></div>
- <div class='block_15'></div>
- <div>
- <a class='btn btn-primary btn-xs' href="<{$web_cfg.domain}>/?c=permission&a=AddResourceNew&type=dir" title="创建目录" >创建新目录</a>
- </div>
- <p></p>
- </div>
- </div>
- </div>
- </div>
- <script>
- var setting = {
- view: {
- nameIsHTML: true,
- selectedMulti: false,
- addHoverDom: addHoverDom,
- removeHoverDom: removeHoverDom
- },
- edit: {
- drag: {
- isCopy: false,
- isMove: false
- },
- enable: true,
- removeTitle: "删除资源",
- renameTitle: "编辑资源",
- showRemoveBtn: showRemoveBtn,
- showRenameBtn: showRenameBtn
- },
- data: {
- simpleData: {
- enable: true
- }
- },
- callback: {
- beforeRemove: beforeRemove,
- beforeEditName: beforeEditName
- }
- };
- var zNodes = <{$resource}>;
-
- $(document).ready(function(){
- $.fn.zTree.init($("#tree"), setting, zNodes);
- });
-
- //显示添加按钮
- function addHoverDom(treeId, treeNode) {
- var id = treeNode.id;
- var parent_id = treeNode.pId;
- var isParent = treeNode.isParent;
-
- var sObj = $("#" + treeNode.tId + "_span");
- if (treeNode.editNameFlag || $("#addBtn_"+treeNode.tId).length>0) return;
-
- var addStr = "";
- if (isParent) {
- var addStr = "<span class='button add' id='addBtn_" + treeNode.tId
- + "' title='添加' onfocus='this.blur();'></span>";
- } else {
-
- }
- sObj.after(addStr);
-
- //跳转到添加页面
- var btn = $("#addBtn_"+treeNode.tId);
- if (btn) btn.bind("click", function(){
- window.open("<{$web_cfg.domain}>/?c=permission&a=AddResourceNew&parent_id="+id);
- });
- }
-
- //隐藏添加按钮
- function removeHoverDom(treeId, treeNode) {
- $("#addBtn_"+treeNode.tId).unbind().remove();
- };
-
- //显示删除按钮
- function showRemoveBtn(treeId, treeNode) {
- var isParent = treeNode.isParent;
- if (isParent) return false;
- return true;
- }
-
- //显示编辑按钮
- function showRenameBtn(treeId, treeNode) {
- return true;
- }
-
- //点击编辑,并在进入编辑前触发
- function beforeEditName(treeId, treeNode) {
- var id = treeNode.id;
- //跳转到编辑页面
- window.open("<{$web_cfg.domain}>/?c=permission&a=EditResourceNew&id="+id);
- return false;
- }
-
- //点击删除,并在进入删除前触发
- function beforeRemove(treeId, treeNode) {
- var id = treeNode.id;
- var name = treeNode.name;
- if (!confirm('确认要删除“'+name+'”资源吗?')) {
- return false;
- }
-
- $.get('<{$web_cfg.domain}>?c=permission&a=delResourceNew',
- {'id': id},
- function (data) {
- if (!data.ok) {
- alert(data.msg);
- return false;
- }
- },
- 'json'
- );
- }
- </script>
- <{include file="admin/permission/bottom.html"}>
|