CheckStateTagLib.groovy
上传用户:steveyhw
上传日期:2019-05-13
资源大小:307k
文件大小:4k
- class CheckStateTagLib {
- def delState = { attrs, body ->
- def del = attrs['del']
- body()
- if(del == '1') {
- out << "DELETED"
- }else out << " "
- }
- def salaryState = {attrs, body ->
- def del = attrs['del']
- def salarypass = attrs['salarypass']
- def staffid = attrs['staffid']
- body()
- if(del == '1') {
- out << "DELETED"
- }else {
- if(salarypass){
- def pass=Staff.get(staffid).staPass
- if(pass==salarypass){
- out << "HAS underwrite"
- }else {out << "underwrite IS WRONG" }
- }else{
- out << "NO underwrite"
- }
- }
- }
-
- def nodeNext = {attrs, body->
- def elem = attrs['bigList']
- body()
- if(elem.size()>=1){
- out << '»'
- }else{out << ''}
- }
- def generateUrl1 = { attrs, body ->
- def elem = attrs['bigList']
- body()
- //out << "<ul > "
- if(elem instanceof ArrayList){
- elem.each {ele->
- out << g.childUrl1(bigList:ele)
- }
- }else{
- println '-------------'+ elem
- out << "<li ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}") +"</a> </li>"
- }
- // out << "</ul>"
- }
- def generateUrl2 = { attrs, body ->
- def elem = attrs['bigList']
- body()
- //out << "<ul > "
- if(elem instanceof ArrayList){
- elem.each {ele->
- out << g.childUrl2(bigList:ele)
- }
- }else{
- println '-------------'+ elem
- out << "<li ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}") +"</a> </li>"
- }
- // out << "</ul>"
- }
- def childUrl2 = { attrs, body ->
- def elem = attrs['bigList']
- body()
- if(elem instanceof ArrayList){
- if(!(elem[0] instanceof ArrayList)){
- out << "<li ><span><a href='#'>"+ g.message(code:elem[0]?.substring(0,elem[0]?.indexOf('/'))) + "</a></span>"
- }else{ out << "<li > <a target='mainFrame' href=''> </a>"}
- out << "<ul>"
- elem?.each {ele->
- out << g.childUrl2(bigList:ele)
- }
- out << "</ul>"
- out << "</li>"
- }else{
- //屏蔽重复的**管理
- // if(!elem.toLowerCase().contains('/index') ){
- String href = g.createLink(controller:elem.substring(0,elem.indexOf('/')),action:elem.substring(elem.indexOf('/')+1))//子连接
- out << "<li ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}") +"</a> </li>"
- //}
- }
- }
- def childUrl1 = { attrs, body ->
- def elem = attrs['bigList']
- body()
- if(elem instanceof ArrayList){
- if(!(elem[0] instanceof ArrayList)){
- out << "<li > <span> "+ g.message(code:elem[0]?.substring(0,elem[0]?.indexOf('/'))) + " </span>"
- }else{ out << "<li > <a target='mainFrame' href=''> </a>"}
- out << "<ul>"
- elem?.each {ele->
- out << g.childUrl1(bigList:ele)
- }
- out << "</ul>"
- out << "</li>"
- }else{
- //屏蔽重复的**管理
- // if(!elem.toLowerCase().contains('/index') ){
- String href = g.createLink(controller:elem.substring(0,elem.indexOf('/')),action:elem.substring(elem.indexOf('/')+1))//子连接
- out << "<li ><a target='mainFrame' href='${href}'>" +g.message(code:"${'/'+elem+'/**'}") +"</a> </li>"
- //}
- }
- }
- }