torrus, RT#10574
[freeside.git] / torrus / templates / html-incblocks.txt
1 [%#
2   $Id: html-incblocks.txt,v 1.3 2010-12-27 18:11:56 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 [% freesideFooter %]
198 [% END %]
199
200 [%# ########   Print the RRD graph image   ####### %]
201
202 [% BLOCK rrgraph %]
203 <DIV CLASS="GraphImage">
204 <IMG SRC="[%url(token, view, vars)%]"
205      ALT="[% param(view, 'description') %]">
206 </DIV>
207 [% END %]
208
209
210 [%# ########   Print the short-term RRD graph image   ####### %]
211
212 [% BLOCK shortgraph %]
213 [%
214   hidden = 0;
215   IF nodeParam(token,'hidden') == 'yes';
216     hidden = 1;
217   END;
218   IF not hidden or variables.SHOWHIDDEN
219 %]
220 <DIV CLASS="ShortGraph">
221       [% IF not urltoken; urltoken = token; END %]
222       [% hidden ? '<SPAN CLASS="ShowHidden">':'' %]
223       <DIV CLASS="NodeName">
224         <A HREF="[%url(urltoken,urlview)%]">[% nodename %]</A>
225       </DIV>
226       [%IF comment%]<DIV CLASS="NodeDescr">[%xmlnorm(comment)%]</DIV>[%END%]
227       [% hidden ? '</SPAN>':'' %]
228       
229       [%
230         shortView = nodeParam(token,'rrgraph-views').split(',').0;
231         shortvars = [];
232         IF nodeParam(token, 'rrd-hwpredict') == 'enabled' and
233            param(view, 'rrd-hwpredict') != 'disabled';
234           global.hwpredict = 1;
235           IF variables.NOHW;
236             shortvars = ['NOHW', 1];
237           ELSE;
238             shortvars = ['NOHW', ''];          
239           END;
240         END
241       %]
242       <DIV CLASS="GraphImage">
243       <A HREF="[%url(urltoken,urlview)%]">
244       <IMG SRC="[%url(token, shortView, shortvars)%]"
245            ALT="[% param(shortView, 'description') %]">
246       </A>
247       </DIV>
248 </DIV>
249   [% END %]
250 [% END %]
251
252
253 [%# ########   Print the overview shortcuts   ####### %]
254 [% BLOCK overviewShortcuts %]
255 [%
256   IF nodeParam(token, 'has-overview-shortcuts', 1) == 'yes';
257     FOREACH ovs = nodeParam(token,'overview-shortcuts').split('\s*,\s*');
258      p1 = 'overview-shortcut-text-' _ ovs;
259      p2 = 'overview-shortcut-title-' _ ovs;
260      INCLUDE shortcut
261         url=url(token, 'overview-subleaves-html', 'OVS', ovs)
262         text=nodeParam(token, p1, 1)
263         title=nodeParam(token, p2, 1);
264     END;
265   END %]
266 [% END %]
267
268
269 [%# ########   Set the date variable   ####### %]
270 [% BLOCK setdate %]
271 [% IF variables.SETDATE == 1;
272      thedate = verifyDate( variables.SETDATEV );
273      IF thedate.length == 0;
274          global.printError = 'Incorrect date format';
275          clearVar('SETDATE');
276      ELSE;
277          variables.NOW = thedate;
278      END;
279    ELSE;
280      clearVar('NOW');
281      clearVar('SETDATE');
282      clearVar('SETDATEV');
283    END;
284    global.setDateDialog = 1;
285 %]
286 [% END %]
287
288
289 [%# ########   Print the date selection elements   ####### %]
290 [% BLOCK enterdate %]
291 <SPAN CLASS="SetDateDialog">
292 <FORM METHOD=GET ACTION="[%topUrl()%]">
293 <INPUT TYPE="hidden" NAME="token" VALUE="[%token%]"/>
294 <INPUT TYPE="hidden" NAME="view" VALUE="[%view%]"/>
295 [% IF ovs %]<INPUT TYPE="hidden" NAME="OVS" VALUE="[%ovs%]"/>[% END %]
296 <LABEL>
297 <INPUT TYPE="checkbox" NAME="SETDATE" VALUE="1"
298 [%variables.SETDATE ? 'CHECKED':''%]/>
299 Set date</LABEL>
300 <INPUT TYPE="text" NAME="SETDATEV" SIZE="22" VALUE="[%variables.SETDATEV%]"/>
301 <INPUT TYPE="submit" VALUE="&gt;"/>
302 </FORM>
303 </SPAN>
304 [% END %]
305
306
307 [%# ########   Print the searchform HTML   ####### %]
308 [% BLOCK searchdialog %]
309 [% IF searchEnabled %]
310 <SPAN CLASS="SearchDialog">
311 <FORM METHOD=GET ACTION="[%topUrl()%]">
312 <INPUT TYPE="hidden" NAME="token" VALUE="[%pathToken('/')%]"/>
313 <INPUT TYPE="hidden" NAME="view" VALUE="search"/>
314 <LABEL>Search</LABEL>
315 <INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
316 <INPUT TYPE="submit" VALUE="&gt;"/>
317 </FORM>
318 </SPAN>
319 [% END %]
320 [% END %]
321
322 [%# ########   Print the Global searchform HTML   ####### %]
323 [% BLOCK globalsearchdialog %]
324 [% IF mayGlobalSearch() %]
325 <SPAN CLASS="SearchDialog">
326 <FORM METHOD=GET ACTION="[%topUrl()%]">
327 <LABEL>Search</LABEL>
328 <INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
329 <INPUT TYPE="submit" VALUE="&gt;"/>
330 </FORM>
331 </SPAN>
332 [% END %]
333 [% END %]