CheckStateTagLib.groovy
上传用户:steveyhw
上传日期:2019-05-13
资源大小:307k
文件大小:4k
源码类别:

PlugIns编程

开发平台:

Java

  1. class CheckStateTagLib {
  2. def delState = { attrs, body ->
  3.     def del = attrs['del']
  4.     body()
  5.     if(del == '1') {
  6.           out << "DELETED"
  7.     }else out << " "
  8.     }
  9.     def salaryState  =   {attrs, body ->
  10.        def del = attrs['del']
  11.        def salarypass = attrs['salarypass']
  12.        def  staffid = attrs['staffid']
  13.         body()
  14.     if(del == '1') {
  15.           out << "DELETED"
  16.     }else {
  17.            if(salarypass){
  18.                 def pass=Staff.get(staffid).staPass
  19.             if(pass==salarypass){
  20.                out << "HAS underwrite"
  21.             }else {out << "underwrite IS WRONG" }
  22.            }else{
  23.               out << "NO underwrite"
  24.            }
  25.         }
  26.     }
  27.  
  28.     def  nodeNext = {attrs, body->
  29.          def elem = attrs['bigList']
  30.     body()
  31.          if(elem.size()>=1){
  32.              out <<  '&raquo;'
  33.          }else{out << ''}
  34.     }
  35.      def generateUrl1 = { attrs, body ->
  36.     def elem = attrs['bigList']
  37.     body()
  38.             //out << "<ul > "
  39.             if(elem instanceof ArrayList){
  40.               elem.each {ele->
  41.                 out << g.childUrl1(bigList:ele)
  42.               }
  43.             }else{
  44.                 println '-------------'+ elem
  45.                out << "<li ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}")  +"</a> </li>"
  46.             }
  47.           // out << "</ul>"
  48.     }
  49.      def generateUrl2 = { attrs, body ->
  50.     def elem = attrs['bigList']
  51.     body()
  52.             //out << "<ul > "
  53.             if(elem instanceof ArrayList){
  54.               elem.each {ele->
  55.                 out << g.childUrl2(bigList:ele)
  56.               }
  57.             }else{
  58.                 println '-------------'+ elem
  59.                out << "<li ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}")  +"</a> </li>"
  60.             }
  61.           // out << "</ul>"
  62.     }
  63.      def childUrl2 = { attrs, body ->
  64.     def elem = attrs['bigList']
  65.     body()
  66.             if(elem instanceof ArrayList){
  67.               if(!(elem[0] instanceof ArrayList)){
  68.               out << "<li ><span><a href='#'>"+ g.message(code:elem[0]?.substring(0,elem[0]?.indexOf('/')))  + "</a></span>"
  69.               }else{ out << "<li > <a target='mainFrame' href=''> </a>"}
  70.                 out << "<ul>"
  71.               elem?.each {ele->
  72.                 out << g.childUrl2(bigList:ele)
  73.               }
  74.                out << "</ul>"
  75.                out << "</li>"
  76.             }else{
  77.                 //屏蔽重复的**管理
  78.                  // if(!elem.toLowerCase().contains('/index') ){
  79.               String href = g.createLink(controller:elem.substring(0,elem.indexOf('/')),action:elem.substring(elem.indexOf('/')+1))//子连接
  80.                out << "<li  ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}")  +"</a> </li>"
  81.                   //}
  82.             }
  83.     }
  84.      def childUrl1 = { attrs, body ->
  85.     def elem = attrs['bigList']
  86.     body()
  87.             if(elem instanceof ArrayList){
  88.               if(!(elem[0] instanceof ArrayList)){
  89.               out << "<li > <span> "+ g.message(code:elem[0]?.substring(0,elem[0]?.indexOf('/')))  + " </span>"
  90.               }else{ out << "<li > <a target='mainFrame' href=''> </a>"}
  91.                 out << "<ul>"
  92.               elem?.each {ele->
  93.                 out << g.childUrl1(bigList:ele)
  94.               }
  95.                out << "</ul>"
  96.                out << "</li>"
  97.             }else{
  98.                 //屏蔽重复的**管理
  99.                  // if(!elem.toLowerCase().contains('/index') ){
  100.               String href = g.createLink(controller:elem.substring(0,elem.indexOf('/')),action:elem.substring(elem.indexOf('/')+1))//子连接
  101.                out << "<li  ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}")  +"</a> </li>"
  102.                   //}
  103.             }
  104.     }
  105. }