| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
- <%@ page import="cn.sinobest.framework.comm.iface.IOperator" %>
- <%@ page import="cn.sinobest.sysmngr.comm.ConVar,cn.sinobest.framework.util.ConfUtil,cn.sinobest.framework.comm.Environment" %>
- <%@include file="./taglib.jsp" %>
- <%
- //页面参数
- Boolean _isEllipsis = false;//是否对超长菜单名进行截取
- Boolean _isShowQtip = false;//是否使用qtip插件
-
- String jsMin = "";
- if (Environment.getAppProductMode()) {
- jsMin = "-min";
- }
- %>
- <jsp:useBean id="treebean" scope="page" class="cn.sinobest.sysmngr.web.left.LeftTreeBean"></jsp:useBean>
- <%
- response.setHeader("Pragma","No-cache");
- response.setHeader("Cache-Control","no-cache");
- response.setDateHeader("Expires", 0);
-
- IOperator Operator = null;
- Object obj = request.getSession().getAttribute(ConVar.LOGIN_SESSION_ID);
-
- if(obj != null){
- Operator = (IOperator)obj;
- }
-
- StringBuilder model= treebean.getTreeMenus(Operator.getMenus(),request);
- //字典获取方法
- final String DICT_MODE = ConfUtil.getSysParam("app.dictMode","server");
- String jsVersion = ConfUtil.getParam("HEAD_JSP_VERSION","V1");
- %>
-
- <html>
- <head>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <%-- <% if ("-min".equals(jsMin)) { %>
- <link href="${ctx}/themes/default/fw-all-default<%=jsMin%>.css" rel="stylesheet" type="text/css">
- <% } else { %> --%>
- <link href="${ctx}/themes/default/letf.css" rel="stylesheet" type="text/css">
- <link href="${ctx}/themes/default/default.css" rel="stylesheet" type="text/css">
- <%-- <% } %> --%>
- <!--[if IE 6]>
- <link href="${ctx}/themes/default/ie6.css" rel="stylesheet" type="text/css">
- <![endif]-->
- <link href="${ctx}/js/comm/ui/dynatree/ui.dynatree<%=jsMin%>.css" rel="stylesheet" type="text/css">
- <style>
- <%if (_isEllipsis){%>
- body{
- overflow-x: hidden;
- }
- a{
- font-size: 13px;
- }
- .ui-dynatree-title{
- text-overflow:ellipsis; overflow:hidden; white-space:nowrap; width:140px;
- }
- <%}%>
- .leftbody{
- /*background:url('${ctx}/jsp/framework/source/bg.jpg') center bottom repeat-x #fff;*/
- background:#d1e2ff;
- }
- .searchIcon{
- position: absolute;
- left: 5px;
- top : 3px;
- background: url("<%=request.getContextPath()%>/themes/default/images/search.png");
- width: 16px;
- height: 16px;
- }
- #menuTab{
- /*padding: 2px;*/
- padding-top:10px;
- padding-bottom:2px;
- }
- .tabon{
- padding: 4px 8px 4px 8px;
- border-top: 1px solid #C1E0F9;
- border-bottom: 1px solid #C1E0F9;
- color: #ffffff;
- cursor: pointer;
- font-weight: bold;
- background:#2f68bd;
- text-align:center;
- }
- .taboff{
- text-align:center;
- padding: 4px 0px 4px 0px;
- color: #564444;
- cursor: pointer;
- text-align:center;
- }
- #menuTree .ui-dynatree-container div{
- width: 100%; height: 40px;
- /*background-image: url("source/system.png");
- background:#4b80d7;*/
- background:#3570c7;
- border-bottom:1px solid #ffffff;
- }
- #menuTree .ui-dynatree-container div:hover{
- background:#1ea7d3;
- }
- #menuTree .ui-dynatree-container div:hover .ui-dynatree-icon{
- background-image:url("../../js/comm/ui/dynatree/fold_new_w.png");
- }
- #menu2Tree .ui-dynatree-container div{
- /*height: 28px;*/
- padding: 3px 0px 3px 0px;
- }
- span.ui-dynatree-icon{
- margin-left: 3px;
- background-image: url("../../js/comm/ui/dynatree/document_3.gif");
- }
- #menuTree .ui-dynatree-folder span.ui-dynatree-icon{
- /* background-image: url("../../js/comm/ui/dynatree/folder_3.gif"); */
- margin-right: 6px;
- padding:8px 0;
- background-image: url("../../js/comm/ui/dynatree/fold_new.png");
- }
- #menuTree .ui-dynatree-folder a{
- text-decoration:none;
- color: /* #c0392b; */#ffffff;
- font-size: 14px;
- font-weight:bold;
- border: 0px;
- height: 40px;
- line-height:38px;
- }
- #menu2Tree a{
- text-decoration:none;
- border: 0px;
- }
- #menuTree .ui-dynatree-folder a:focus,
- #menuTree .ui-dynatree-folder a:link,
- #menuTree .ui-dynatree-folder a:visited,
- div.ui-dynatree-container,
- #menuTree span.ui-dynatree-active a{
- background: transparent;
- }
- #menu2Tree .ui-dynatree-folder span.ui-dynatree-icon{
- background-image: url("../../js/comm/ui/dynatree/folder_2.gif");
- }
- #menu2Tree .ui-dynatree-folder a{
- text-decoration:none;
- }
- span.ui-dynatree-expander{
- background-image: url("../../js/comm/ui/dynatree/collapsed_1.gif");
- background-position: 0 4;
- width: 9px; height: 18px;
- }
- .ui-dynatree-expanded span.ui-dynatree-expander{
- background-image: url("../../js/comm/ui/dynatree/expanded_1.gif");
- background-position: 0 4;
- width: 9px; height: 18px;
- }
- </style>
- <script type="text/javascript">
- var contextPath='${ctx}';
- var _selfUrl = '${url}';
- </script>
- <script src="${ctx}/js/comm/lib/jquery-min.js" language="JavaScript" type="text/javascript"></script>
- <% if ("-min".equals(jsMin)) { %>
- <script src="${ctx}/js/comm/fw-comm-all<%=jsMin%>.js" language="JavaScript" type="text/javascript"></script>
- <% } else { %>
- <script src="${ctx}/js/comm/lib/ui.core.js" language="JavaScript" type="text/javascript"></script>
- <script src="${ctx}/js/comm/lib/ui.widget.js" language="JavaScript" type="text/javascript"></script>
- <script src="${ctx}/js/comm/ui/dynatree/jquery.dynatree.js" language="JavaScript" type="text/javascript"></script>
- <% if (DICT_MODE.equalsIgnoreCase("local")) { %>
- <script src="${ctx}/js/comm/fn/deployJava.js" language="JavaScript" type="text/javascript"></script>
- <% } %>
- <% } %>
- <% if (_isShowQtip){ %>
- <script src="${ctx}/js/comm/ui/qtip/jquery.qtip.js"></script>
- <link href="${ctx}/js/comm/ui/qtip/jquery.qtip.css" rel="stylesheet" type="text/css">
- <% } %>
- </head>
- <body class="leftbody">
- <div id="div_tree" style="width:199px;height:100%;">
- <table style="padding-left:1px" width="100%" height="100%" border=0 cellpadding=0 cellspacing=0 >
- <tr height=“32px”>
- <td align="left" class="menubutton" width="100%" >
- <div id="menuTab">
- <span id="tab1" onclick="showTab('1')" class="tabon">系统菜单</span>
- <span id="tab2" onclick="showTab('2')" class="taboff"> </span>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <div id="menuTree" style="float:left;width:100%;"></div>
- <div id="menu2Tree-container" style="float:left;display:none;position:absolute;">
- <span id="zk-ss" style="cursor:pointer;">全部收缩</span>
- <div id="menu2Tree" style="float:left;display:block;"></div>
- </div>
- </td>
- </tr>
- <tr height="100%">
- <td>
- </td>
- </tr>
- <tr height="1px">
- <td align="center">
- <% if(DICT_MODE.equalsIgnoreCase("local")) { %>
- <script type="text/javascript">
- var attributes = {
- id : 'dictapplet',
- width : 100,
- height : 20,
- code:'cn.sinobest.framework.applet.DictCacheApplet',
- archive: contextPath+'/applet/DictApplet-0.0.1-SNAPSHOT.jar'
- };
- var parameters = {
- boxbgcolor:'white',
- MAYSCRIPT:true,
- scriptable:true,
- boxborder:false,
- userid:"<%=Operator.getOperID()%>",
- myxxid:"<%=session.getId()%>",
- serviceUrl:_getUrl()+'/downFile.do',
- contextPath:_getUrl()
- };
- deployJava.runApplet(attributes, parameters, '1.5');
- function _getUrl(){
- var url = window.location.toString();
- var count = 0;
- var pos = 0;
- for(var i=0;i<url.length;i++){
- if(url.charAt(i) == "/"){
- count++;
- }
- if(count == 4){
- pos = i;
- break;
- }
- }
- return url.substring(0,pos);
- }
- </script>
- <% } %>
- </td>
- </tr>
- </table>
-
- </div>
- </body>
- <script language="javascript">
- var model='';
- <%if(!model.toString().equals("")){%>
- model=<%=model.toString()%>;
- <%}%>
- var lvl1 = parseLvl1(model);
- $(function(){
- // Attach the dynatree widget to an existing <div id="tree"> element
- // and pass the tree options as an argument to the dynatree() function:
- $("#menuTree").dynatree({
- selectMode:1,
- minExpandLevel:1,
- imagePath: "images/",
- icon:"operateunit.gif",
- onClick: function(dtnode) {
- //alert("You activated "+dtnode.data.key);
- var lvl23 = parseLvl23(model, dtnode.data.key);
- //alert(lvl23[0].key);
- $("#menu2Tree").dynatree({
- selectMode:1,
- minExpandLevel:1,
- imagePath: "images/",
- onClick: function(dtnode) {
- // A DynaTreeNode object is passed to the activation handler
- // Note: we also get this event, if persistence is on, and the page is reloaded.
- var url= dtnode.data.url;
- if (!url ||url.length==0){
- return;
- }
- //新窗口中打开
- if( event.altKey ) {
- window.open(url);
- }else{
- top.frames['workspace'].location.href=url;
- }
- //alert("You activated " + dtnode.data.url);
- },
- children: lvl23
- });
- $("#menu2Tree").dynatree("getTree").reload();
- var maxLen = 8;
- $('#tab2').text(dtnode.data.title.substring(0,maxLen)+(dtnode.data.title.length>maxLen?"...":""));
- $('#tab2').mouseover(function(){
- //FWvalidateTip('#tab2',dtnode.data.title);
- var defaults = {content: {text: dtnode.data.title},
- hide: { delay:0,
- event: false,
- inactive: 3000},
- position: {
- my: 'top center',
- at: 'bottom center'
- }
- };
- <%if (_isShowQtip){%>
- $('#tab2').qtip(defaults).qtip("show");
- <%}else{%>
- $('#tab2').attr("title", dtnode.data.title);
- <%}%>
- });
- <%if (_isShowQtip){%>
- $('#tab2').mouseout(function(){
- $('#tab2').qtip("hide");
- });
- <%}%>
- showTab('2');
- //alert($("#menu2Tree").html());
- $('#zk-ss').text("全部展开");
- <%if (_isEllipsis){%>
- //为每个菜单加上title,因为现在多超长菜单名进行了截取
- $('.ui-dynatree-title').each(function(){
- $(this).attr('title', $(this).text());
- });
- <%}%>
- },
- children: lvl1
- });
- <%if (_isEllipsis){%>
- //为每个菜单加上title,因为现在多超长菜单名进行了截取
- $('.ui-dynatree-title').each(function(){
- $(this).attr('title', $(this).text());
- });
- <%}%>
- //全部展开/全部收缩
- $('#zk-ss').click(function(){
- var flag = $('#zk-ss').text()=="全部展开"?true:false;
- $("#menu2Tree").dynatree("getRoot").visit(function(dtnode){
- dtnode.expand(flag);
- });
- $('#zk-ss').text(flag?"全部收缩":"全部展开");
- });
- });
- function cloneObject(obj){
- if (obj === null){
- return null;
- }
- var o = obj.constructor === Array ? [] : {};
- for(var i in obj){
- if(obj.hasOwnProperty(i)){
- o[i] = typeof obj[i] === "object" ? cloneObject(obj[i]) : obj[i];
- }
- }
- return o;
- }
- function sortBy(arr, prop, desc){
- var props=[],
- ret=[],
- i=0,
- len=arr.length;
- if(typeof prop=='string') {
- for(; i<len; i++){
- var oI = arr[i];
- (props[i] = new String(oI && oI[prop] || ''))._obj = oI;
- }
- }
- else if(typeof prop=='function') {
- for(; i<len; i++){
- var oI = arr[i];
- (props[i] = new String(oI && prop(oI) || ''))._obj = oI;
- }
- }
- else {
- throw '参数类型错误';
- }
- props.sort();
- for(i=0; i<len; i++) {
- ret[i] = props[i]._obj;
- }
- if(desc) ret.reverse();
- return ret;
- }
- function showTab(type){
- if (type == '1'){
- $('#tab1').removeClass().addClass("tabon");
- $('#tab2').removeClass().addClass("taboff");
- $('#menuTree').css("display", "block");
- $('#menu2Tree-container').css("display", "none");
- }else if (type == '2'){
- $('#tab1').removeClass().addClass("taboff");
- $('#tab2').removeClass().addClass("tabon");
- $('#menuTree').css("display", "none");
- $('#menu2Tree-container').css("display", "block");
- }
- }
- function parseLvl1(model){
- var newnode = cloneObject(model);
- var len = newnode.length;
- for (var i=0; i<len; ++i){
- newnode[i].isFolder = "false";
- newnode[i].children = null;
- }
- return sortBy(newnode, "key", false);
- }
- function parseLvl23(model, rootnode){
- //alert(model.length);
- var newnode = null;
- var len = model.length;
- for (var i=0; i<len; ++i){
- //alert(rootnode+" "+model[i].key);
- if (rootnode == model[i].key){
- newnode = cloneObject(model[i].children);
- break;
- }
- }
- return newnode;
- }
- parent.mLoadStatus.TreeMenu = true;
- </script>
- </html>
|