root / hci / trunk / eneraptor-web-app / grails-app / taglib / com / eneraptor / hci / ErptrTagLib.groovy @ 6
History | View | Annotate | Download (3.83 KB)
1 |
package com.eneraptor.hci
|
---|---|
2 |
|
3 |
class ErptrTagLib { |
4 |
|
5 |
static namespace = 'erptr' |
6 |
def mainMenuService
|
7 |
|
8 |
def menu = { attrs ->
|
9 |
|
10 |
List menuItems = mainMenuService.getMainMenu()
|
11 |
|
12 |
menuItems.each { |
13 |
out << "<li"
|
14 |
if(attrs.chosen == it.name) { |
15 |
out << " class='current'"
|
16 |
} |
17 |
out << "><a href='"
|
18 |
out << g.createLink(controller: "${it.name}", action: "${it.url}") |
19 |
out << "'>${it.label}</a></li>"
|
20 |
} |
21 |
|
22 |
} |
23 |
|
24 |
def subMenu = { attrs ->
|
25 |
|
26 |
List subMenuItems = mainMenuService.getSubMenu(attrs.menu)
|
27 |
if(subMenuItems == null) { |
28 |
out << "<p>This sub-menu is not configured yet.</p>"
|
29 |
} else {
|
30 |
subMenuItems.each { |
31 |
out << "<li><a href='"
|
32 |
out << g.createLink(controller: "${it.name}", action: "${it.url}") |
33 |
out << "' class='"
|
34 |
out << "${it.name}-${it.url}"
|
35 |
out << "'>"
|
36 |
if(attrs.chosen == it.url) out << "<u>" |
37 |
out << it.label
|
38 |
if(attrs.chosen == it.url) out << "</u>" |
39 |
out << "</a></li>"
|
40 |
} |
41 |
} |
42 |
|
43 |
} |
44 |
|
45 |
def box = { attrs, body ->
|
46 |
|
47 |
out << "<div class='box'>"
|
48 |
out << "<h3>${attrs['title']}</h3>"
|
49 |
out << "<div class='boxContents'>"
|
50 |
out << body() |
51 |
out << "</div>"
|
52 |
out << "</div>"
|
53 |
out << "<br />"
|
54 |
|
55 |
} |
56 |
|
57 |
def helpImg = {
|
58 |
out << "<img style='position: relative; top: 3px;' src='" + g.resource(dir: 'img/icons/', file:'help.png') + "' />" |
59 |
} |
60 |
|
61 |
def helpBox = {
|
62 |
out << "<div id='helpBox'>"
|
63 |
out << "</div><br />"
|
64 |
} |
65 |
|
66 |
def confirmBox = { attrs, body ->
|
67 |
out << "<div id='confirmBox'>"
|
68 |
out << "<div class='confirmBoxContent'>"
|
69 |
out << "<img style='float: left;margin:5px;position:relative;top:-2px;' src='" + g.resource(dir: 'img/icons/', file:'tick.png') + "' />" |
70 |
out << body() |
71 |
out << "</div>"
|
72 |
out << "</div><br />"
|
73 |
} |
74 |
|
75 |
def errorBox = { attrs, body ->
|
76 |
out << "<div id='errorBox'>"
|
77 |
out << "<div class='errorBoxContent'>"
|
78 |
out << "<img style='float: left;margin:5px;position:relative;top:-2px;' src='" + g.resource(dir: 'img/icons/', file:'cross.png') + "' />" |
79 |
out << body() |
80 |
out << "</div>"
|
81 |
out << "</div><br />"
|
82 |
} |
83 |
|
84 |
def warningBox = { attrs, body ->
|
85 |
out << "<div id='warningBox'>"
|
86 |
out << "<div class='warningBoxContent'>"
|
87 |
out << "<img style='float: left;margin:5px;position:relative;top:-2px;' src='" + g.resource(dir: 'img/icons/', file:'error.png') + "' />" |
88 |
out << body() |
89 |
out << "</div>"
|
90 |
out << "</div><br />"
|
91 |
} |
92 |
|
93 |
def logEntryOptions = { attrs ->
|
94 |
out << "<a href='"
|
95 |
out << g.createLink(action: 'detail', id: attrs.for) |
96 |
out << "'>"
|
97 |
out << "<img src='"
|
98 |
out << g.resource(dir: 'img/icons/', file: 'information.png') |
99 |
out << "' />"
|
100 |
out << "</a>"
|
101 |
out << "<a href='"
|
102 |
out << g.createLink(action: 'deleteEntry', id: attrs.for) |
103 |
out << "'>"
|
104 |
out << "<img src='"
|
105 |
out << g.resource(dir: 'img/icons/', file: 'delete.png') |
106 |
out << "' />"
|
107 |
out << "</a>"
|
108 |
} |
109 |
|
110 |
def changeDeleteOptions = { attrs ->
|
111 |
out << "<a href='"
|
112 |
out << g.createLink(action: 'change' + attrs.table + 'Entry', id: attrs.for) |
113 |
out << "'>"
|
114 |
out << "<img src='"
|
115 |
out << g.resource(dir: 'img/icons/', file: 'wrench_orange.png') |
116 |
out << "' />"
|
117 |
out << "</a>"
|
118 |
out << "<a href='"
|
119 |
out << g.createLink(action: 'delete' + attrs.table + 'Entry', id: attrs.for) |
120 |
out << "'>"
|
121 |
out << "<img src='"
|
122 |
out << g.resource(dir: 'img/icons/', file: 'delete.png') |
123 |
out << "' />"
|
124 |
out << "</a>"
|
125 |
} |
126 |
|
127 |
def icon = { attrs ->
|
128 |
out << "<img style='float:left;position:relative;bottom:2px;' src='"
|
129 |
out << g.resource(dir: "img/icons/", file: attrs.w + ".png") |
130 |
out << "' />"
|
131 |
} |
132 |
|
133 |
def helpLink = { attrs ->
|
134 |
|
135 |
out << g.remoteLink(action:"getHelp", params: [what: attrs.for], update: "helpBox", after: "\$('helpBox').pulsate({pulses: 2, duration: 0.5, from: 0.5})", erptr.helpImg()) |
136 |
|
137 |
} |
138 |
|
139 |
def rawInfoBox = { attrs, body ->
|
140 |
out << "<div class='rawInfoBox'>"
|
141 |
out << body() |
142 |
out << "</div>"
|
143 |
} |
144 |
|
145 |
} |