root / hci / trunk / eneraptor-web-app / grails-app / taglib / com / eneraptor / hci / ErptrTagLib.groovy @ 3
History | View | Annotate | Download (2.72 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 << "'>${it.label}</a></li>"
|
36 |
} |
37 |
} |
38 |
|
39 |
} |
40 |
|
41 |
def box = { attrs, body ->
|
42 |
|
43 |
out << "<div class='box'>"
|
44 |
out << "<h3>${attrs['title']}</h3>"
|
45 |
out << "<div class='boxContents'>"
|
46 |
out << body() |
47 |
out << "</div>"
|
48 |
out << "</div>"
|
49 |
out << "<br />"
|
50 |
|
51 |
} |
52 |
|
53 |
def helpImg = {
|
54 |
out << "<img style='position: relative; top: 3px;' src='" + g.resource(dir: 'img/icons/', file:'help.png') + "' />" |
55 |
} |
56 |
|
57 |
def helpBox = {
|
58 |
out << "<div id='helpBox'>"
|
59 |
out << "</div><br />"
|
60 |
} |
61 |
|
62 |
def confirmBox = { attrs, body ->
|
63 |
out << "<div id='confirmBox'>"
|
64 |
out << "<div class='confirmBoxContent'>"
|
65 |
out << "<img style='float: left;margin:5px;' src='" + g.resource(dir: 'img/icons/', file:'tick.png') + "' />" |
66 |
out << body() |
67 |
out << "</div>"
|
68 |
out << "</div><br />"
|
69 |
} |
70 |
|
71 |
def errorBox = { attrs, body ->
|
72 |
out << "<div id='errorBox'>"
|
73 |
out << "<div class='errorBoxContent'>"
|
74 |
out << "<img style='float: left;margin:5px;' src='" + g.resource(dir: 'img/icons/', file:'cross.png') + "' />" |
75 |
out << body() |
76 |
out << "</div>"
|
77 |
out << "</div><br />"
|
78 |
} |
79 |
|
80 |
def logEntryOptions = { attrs ->
|
81 |
out << "<a href='"
|
82 |
out << g.createLink(action: 'detail', id: attrs.for) |
83 |
out << "'>"
|
84 |
out << "<img src='"
|
85 |
out << g.resource(dir: 'img/icons/', file: 'information.png') |
86 |
out << "' />"
|
87 |
out << "</a>"
|
88 |
out << "<a href='"
|
89 |
out << g.createLink(action: 'deleteEntry', id: attrs.for) |
90 |
out << "'>"
|
91 |
out << "<img src='"
|
92 |
out << g.resource(dir: 'img/icons/', file: 'delete.png') |
93 |
out << "' />"
|
94 |
out << "</a>"
|
95 |
} |
96 |
|
97 |
def icon = { attrs ->
|
98 |
out << "<img style='float:left;position:relative;bottom:2px;' src='"
|
99 |
out << g.resource(dir: "img/icons/", file: attrs.w + ".png") |
100 |
out << "' />"
|
101 |
} |
102 |
|
103 |
def helpLink = { attrs ->
|
104 |
|
105 |
out << g.remoteLink(action:"getHelp", params: [what: attrs.for], update: "helpBox", after: "\$('helpBox').pulsate({pulses: 2, duration: 0.5, from: 0.5})", erptr.helpImg()) |
106 |
|
107 |
} |
108 |
|
109 |
} |