torrus, RT#10574
[freeside.git] / torrus / templates / html-incblocks.txt
1 [%#
2   $Id: html-incblocks.txt,v 1.2 2010-12-27 08:40:19 ivan Exp $
3   All BLOCK statements are defined here
4 %]
5
6 [%#  ###########    Initialize globals   ################ %]
7 [% global.setDateDialog = 0; %]
8
9
10 [%#  ###########    Print the starting HTML blahblah   ################ %]
11
12 [% BLOCK htmlstart;
13    IF ! contentClass; contentClass="Content"; END %]
14
15 [% freesideHeader(title, style('stylesheet')) %]
16
17 <SCRIPT language="JavaScript"> 
18 <!--
19 function helpwindow() 
20
21 window.open('[%url(token) _ '&view=helptext-html'%]','helpwindow',
22 'width=600,height=400,resizable=yes,left=200,top=100'); 
23
24 //--> 
25 </SCRIPT>
26
27 <DIV CLASS="Header">
28
29 [% IF siteInfo %]
30 <SPAN CLASS="SiteInfo">
31 [% siteInfo %]
32 </SPAN>
33 [% END %]
34
35 [% IF treeName and treeInfo %]
36 <SPAN CLASS="TreeInfo">
37 [% treeInfo %]
38 </SPAN>
39 [% END %]
40
41 [% IF userAuth and uid;
42      commonname = userAttr('cn');
43      IF commonname == ''; commonname = uid; END; %]
44 <DIV CLASS="LoginInfo">
45 <SPAN CLASS="UserName">[% commonname %]</SPAN>
46 <SPAN CLASS="Logout"><A HREF="[% topURL _ '?LOGOUT=1' %]">Logout</A></SPAN>
47 </DIV>
48 [% END %]
49 </DIV>
50 <DIV CLASS="CurrentTime">[% timestamp %]</DIV>
51 [% IF printpath %]
52   <DIV CLASS="PathMenu">
53     [% INCLUDE treename %]
54     <DIV CLASS="CurrentPath">
55       <SPAN CLASS="PathMenuHeader">Current path:</SPAN>
56       <SPAN CLASS="PathURLs">[% splitUrls(token) %]</SPAN>
57     </DIV>
58   </DIV>
59 [% END %]
60 [% IF not noTopMenu %]
61 <DIV CLASS="TopMenu">
62 [% INCLUDE shortcut url=topURL text="Top"
63                     title="Choose from the list of trees"%]
64 [% theParent=parent(token);
65    IF theParent and theParent != token;
66      INCLUDE shortcut url=url(theParent) text="Up"
67                     title="Climb up the tree";
68    END %]
69 [% INCLUDE helpshortcut %]
70 [% IF mayDisplayAdmInfo(token);
71      INCLUDE shortcut url=url(token,'adminfo')
72                       text="AdmInfo"
73                       title="Administrative details"
74                       newwindow=1;
75    END
76 %]
77
78 </DIV>
79 [% END %]
80 <DIV CLASS="[%contentClass%]">
81 [% global.contentFinished = 0 %]
82 [% IF global.printError %]
83 <DIV CLASS="ErrorMessage">[% global.printError %]</DIV>
84 [% global.printError = '' %]
85 [% END %]
86 [% END %]
87
88 [%#  ###########    Print the legend   ################ %]
89
90 [% BLOCK legend %]
91 [%   legend = nodeParam(token, 'legend') %]
92 [%   IF legend.length > 0 %]
93 <DIV CLASS="Legend">
94 [%     FOREACH legpairstring = legend.split(';') %]
95 [%       SET legpair = legpairstring.split(':') %]
96          <DIV CLASS="LegendRow">
97            <SPAN CLASS="LegendName">[% xmlnorm(legpair.0) %]:</SPAN>
98            <SPAN CLASS="LegendValue">[% xmlnorm(legpair.1) %]</SPAN>
99          </DIV>
100 [%     END %]
101 </DIV>
102 [%   END %]
103 [% END %]
104
105 [%# ###########    Print the TZ and NOW variables   ################ %]
106
107 [% BLOCK variables %]
108 [%   IF variables.TZ or variables.NOW %]
109 <P CLASS="Variables">
110 [%     IF variables.TZ %]
111           <SPAN CLASS="VariableName">Timezone:</SPAN>
112           <SPAN CLASS="VariableValue">[% variables.TZ %].</SPAN>
113 [%     END %]
114 [%     IF variables.NOW %]
115           <SPAN CLASS="VariableName">Report date:</SPAN>
116           <SPAN CLASS="VariableValue">[% variables.NOW %].</SPAN>
117 [%     END %]
118 </P>
119 [%   END %]
120 [% END %]
121
122
123 [%# ###########    Print the current tree name   ################ %]
124
125 [% BLOCK treename %]
126     <DIV CLASS="CurrentTree">
127       <SPAN CLASS="PathMenuHeader">Tree:</SPAN>
128       <SPAN CLASS="TreeName">[% treeName %]</SPAN>
129     </DIV>
130 [% END %]
131
132 [%# ###########    Print the shortcut   ################ %]
133
134 [% BLOCK shortcut %]
135   <SPAN CLASS="Shortcut">
136   [&nbsp;<A TITLE="[%title%]" HREF="[%url%]"
137             [%IF newwindow; 'TARGET="_blank"'; END%]>[%text%]</A>&nbsp;]
138   </SPAN>
139 [% END %]
140
141 [%# ###########    Print the Help shortcut   ################ %]
142 [% BLOCK helpshortcut;
143      IF nodeParam(token, 'help-text', 1);
144        INCLUDE shortcut
145          url="javascript:helpwindow()"
146          text="Help"
147          title="Open a help window for this page";
148      END;
149    END %]
150
151 [%# ###########    Print the common bottomline   ################ %]
152
153 [% BLOCK bottomline %]
154 </DIV><!-- Content -->[% global.contentFinished = 1 %]
155 <DIV CLASS="BottomMenu">
156 [% INCLUDE shortcut url=persistentUrl(token,view,global.bookmarkVars)
157                     text="Bookmark"
158                     title="Permanent link to this page"%]
159 [% INCLUDE shortcut url=url('SS')           text="Tokensets"
160                     title="List of non-empty tokensets"%]
161 [% INCLUDE shortcut url=url(token,view,'MEDIA','printer','OVS',ovs)
162                     text="Printable view"
163                     title="Prepare this page for printing"
164                     newwindow=1%]
165 [% IF mayDisplayReports();
166      INCLUDE shortcut url=reportsUrl
167                       text="Reports"
168                       title="Show reports page"
169                       newwindow=1;
170    END %]
171 [% IF global.setDateDialog; INCLUDE enterdate; END %]
172 [% INCLUDE searchdialog %]
173 </DIV>
174 [% END %]
175
176 [%# ###########    Print the Tokensets bottomline   ################ %]
177
178 [% BLOCK tsetbottomline %]
179 </DIV><!-- Content -->[% global.contentFinished = 1 %]
180 <DIV CLASS="BottomMenu">
181 [% INCLUDE shortcut url=url(pathToken('/')) text="Datasources tree"
182                     title="Back to the datasources tree" %]
183 [% INCLUDE shortcut url=url(token,view,'MEDIA','printer')
184                     text="Printable view"
185                     title="Prepare this page for printing"
186                     newwindow=1%]
187 [% INCLUDE helpshortcut %]
188 [% INCLUDE searchdialog %]
189 </DIV>
190 [% END %]
191
192
193 [%# ###########    Print the ending HTML blahblah   ################ %]
194
195 [% BLOCK htmlend %]
196 [% IF ! global.contentFinished %]</DIV><!-- Content -->[% END %]
197 <DIV CLASS="Footer">
198   Powered by <A HREF="http://torrus.org">Torrus</A> [% version %]
199 </DIV>
200 </BODY>
201 </HTML>
202 [% END %]
203
204 [%# ########   Print the RRD graph image   ####### %]
205
206 [% BLOCK rrgraph %]
207 <DIV CLASS="GraphImage">
208 <IMG SRC="[%url(token, view, vars)%]"
209      ALT="[% param(view, 'description') %]">
210 </DIV>
211 [% END %]
212
213
214 [%# ########   Print the short-term RRD graph image   ####### %]
215
216 [% BLOCK shortgraph %]
217 [%
218   hidden = 0;
219   IF nodeParam(token,'hidden') == 'yes';
220     hidden = 1;
221   END;
222   IF not hidden or variables.SHOWHIDDEN
223 %]
224 <DIV CLASS="ShortGraph">
225       [% IF not urltoken; urltoken = token; END %]
226       [% hidden ? '<SPAN CLASS="ShowHidden">':'' %]
227       <DIV CLASS="NodeName">
228         <A HREF="[%url(urltoken,urlview)%]">[% nodename %]</A>
229       </DIV>
230       [%IF comment%]<DIV CLASS="NodeDescr">[%xmlnorm(comment)%]</DIV>[%END%]
231       [% hidden ? '</SPAN>':'' %]
232       
233       [%
234         shortView = nodeParam(token,'rrgraph-views').split(',').0;
235         shortvars = [];
236         IF nodeParam(token, 'rrd-hwpredict') == 'enabled' and
237            param(view, 'rrd-hwpredict') != 'disabled';
238           global.hwpredict = 1;
239           IF variables.NOHW;
240             shortvars = ['NOHW', 1];
241           ELSE;
242             shortvars = ['NOHW', ''];          
243           END;
244         END
245       %]
246       <DIV CLASS="GraphImage">
247       <A HREF="[%url(urltoken,urlview)%]">
248       <IMG SRC="[%url(token, shortView, shortvars)%]"
249            ALT="[% param(shortView, 'description') %]">
250       </A>
251       </DIV>
252 </DIV>
253   [% END %]
254 [% END %]
255
256
257 [%# ########   Print the overview shortcuts   ####### %]
258 [% BLOCK overviewShortcuts %]
259 [%
260   IF nodeParam(token, 'has-overview-shortcuts', 1) == 'yes';
261     FOREACH ovs = nodeParam(token,'overview-shortcuts').split('\s*,\s*');
262      p1 = 'overview-shortcut-text-' _ ovs;
263      p2 = 'overview-shortcut-title-' _ ovs;
264      INCLUDE shortcut
265         url=url(token, 'overview-subleaves-html', 'OVS', ovs)
266         text=nodeParam(token, p1, 1)
267         title=nodeParam(token, p2, 1);
268     END;
269   END %]
270 [% END %]
271
272
273 [%# ########   Set the date variable   ####### %]
274 [% BLOCK setdate %]
275 [% IF variables.SETDATE == 1;
276      thedate = verifyDate( variables.SETDATEV );
277      IF thedate.length == 0;
278          global.printError = 'Incorrect date format';
279          clearVar('SETDATE');
280      ELSE;
281          variables.NOW = thedate;
282      END;
283    ELSE;
284      clearVar('NOW');
285      clearVar('SETDATE');
286      clearVar('SETDATEV');
287    END;
288    global.setDateDialog = 1;
289 %]
290 [% END %]
291
292
293 [%# ########   Print the date selection elements   ####### %]
294 [% BLOCK enterdate %]
295 <SPAN CLASS="SetDateDialog">
296 <FORM METHOD=GET ACTION="[%topUrl()%]">
297 <INPUT TYPE="hidden" NAME="token" VALUE="[%token%]"/>
298 <INPUT TYPE="hidden" NAME="view" VALUE="[%view%]"/>
299 [% IF ovs %]<INPUT TYPE="hidden" NAME="OVS" VALUE="[%ovs%]"/>[% END %]
300 <LABEL>
301 <INPUT TYPE="checkbox" NAME="SETDATE" VALUE="1"
302 [%variables.SETDATE ? 'CHECKED':''%]/>
303 Set date</LABEL>
304 <INPUT TYPE="text" NAME="SETDATEV" SIZE="22" VALUE="[%variables.SETDATEV%]"/>
305 <INPUT TYPE="submit" VALUE="&gt;"/>
306 </FORM>
307 </SPAN>
308 [% END %]
309
310
311 [%# ########   Print the searchform HTML   ####### %]
312 [% BLOCK searchdialog %]
313 [% IF searchEnabled %]
314 <SPAN CLASS="SearchDialog">
315 <FORM METHOD=GET ACTION="[%topUrl()%]">
316 <INPUT TYPE="hidden" NAME="token" VALUE="[%pathToken('/')%]"/>
317 <INPUT TYPE="hidden" NAME="view" VALUE="search"/>
318 <LABEL>Search</LABEL>
319 <INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
320 <INPUT TYPE="submit" VALUE="&gt;"/>
321 </FORM>
322 </SPAN>
323 [% END %]
324 [% END %]
325
326 [%# ########   Print the Global searchform HTML   ####### %]
327 [% BLOCK globalsearchdialog %]
328 [% IF mayGlobalSearch() %]
329 <SPAN CLASS="SearchDialog">
330 <FORM METHOD=GET ACTION="[%topUrl()%]">
331 <LABEL>Search</LABEL>
332 <INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
333 <INPUT TYPE="submit" VALUE="&gt;"/>
334 </FORM>
335 </SPAN>
336 [% END %]
337 [% END %]