summaryrefslogtreecommitdiff
path: root/torrus/templates/html-incblocks.txt
blob: f2d55f6d4e378cb5e823223e32c305bc8f541920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
[%#
  $Id: html-incblocks.txt,v 1.2 2010-12-27 08:40:19 ivan Exp $
  All BLOCK statements are defined here
%]

[%#  ###########    Initialize globals   ################ %]
[% global.setDateDialog = 0; %]


[%#  ###########    Print the starting HTML blahblah   ################ %]

[% BLOCK htmlstart;
   IF ! contentClass; contentClass="Content"; END %]

[% freesideHeader(title, style('stylesheet')) %]

<SCRIPT language="JavaScript"> 
<!--
function helpwindow() 
{ 
window.open('[%url(token) _ '&view=helptext-html'%]','helpwindow',
'width=600,height=400,resizable=yes,left=200,top=100'); 
} 
//--> 
</SCRIPT>

<DIV CLASS="Header">

[% IF siteInfo %]
<SPAN CLASS="SiteInfo">
[% siteInfo %]
</SPAN>
[% END %]

[% IF treeName and treeInfo %]
<SPAN CLASS="TreeInfo">
[% treeInfo %]
</SPAN>
[% END %]

[% IF userAuth and uid;
     commonname = userAttr('cn');
     IF commonname == ''; commonname = uid; END; %]
<DIV CLASS="LoginInfo">
<SPAN CLASS="UserName">[% commonname %]</SPAN>
<SPAN CLASS="Logout"><A HREF="[% topURL _ '?LOGOUT=1' %]">Logout</A></SPAN>
</DIV>
[% END %]
</DIV>
<DIV CLASS="CurrentTime">[% timestamp %]</DIV>
[% IF printpath %]
  <DIV CLASS="PathMenu">
    [% INCLUDE treename %]
    <DIV CLASS="CurrentPath">
      <SPAN CLASS="PathMenuHeader">Current path:</SPAN>
      <SPAN CLASS="PathURLs">[% splitUrls(token) %]</SPAN>
    </DIV>
  </DIV>
[% END %]
[% IF not noTopMenu %]
<DIV CLASS="TopMenu">
[% INCLUDE shortcut url=topURL text="Top"
                    title="Choose from the list of trees"%]
[% theParent=parent(token);
   IF theParent and theParent != token;
     INCLUDE shortcut url=url(theParent) text="Up"
                    title="Climb up the tree";
   END %]
[% INCLUDE helpshortcut %]
[% IF mayDisplayAdmInfo(token);
     INCLUDE shortcut url=url(token,'adminfo')
                      text="AdmInfo"
                      title="Administrative details"
                      newwindow=1;
   END
%]

</DIV>
[% END %]
<DIV CLASS="[%contentClass%]">
[% global.contentFinished = 0 %]
[% IF global.printError %]
<DIV CLASS="ErrorMessage">[% global.printError %]</DIV>
[% global.printError = '' %]
[% END %]
[% END %]

[%#  ###########    Print the legend   ################ %]

[% BLOCK legend %]
[%   legend = nodeParam(token, 'legend') %]
[%   IF legend.length > 0 %]
<DIV CLASS="Legend">
[%     FOREACH legpairstring = legend.split(';') %]
[%       SET legpair = legpairstring.split(':') %]
         <DIV CLASS="LegendRow">
           <SPAN CLASS="LegendName">[% xmlnorm(legpair.0) %]:</SPAN>
           <SPAN CLASS="LegendValue">[% xmlnorm(legpair.1) %]</SPAN>
         </DIV>
[%     END %]
</DIV>
[%   END %]
[% END %]

[%# ###########    Print the TZ and NOW variables   ################ %]

[% BLOCK variables %]
[%   IF variables.TZ or variables.NOW %]
<P CLASS="Variables">
[%     IF variables.TZ %]
          <SPAN CLASS="VariableName">Timezone:</SPAN>
          <SPAN CLASS="VariableValue">[% variables.TZ %].</SPAN>
[%     END %]
[%     IF variables.NOW %]
          <SPAN CLASS="VariableName">Report date:</SPAN>
          <SPAN CLASS="VariableValue">[% variables.NOW %].</SPAN>
[%     END %]
</P>
[%   END %]
[% END %]


[%# ###########    Print the current tree name   ################ %]

[% BLOCK treename %]
    <DIV CLASS="CurrentTree">
      <SPAN CLASS="PathMenuHeader">Tree:</SPAN>
      <SPAN CLASS="TreeName">[% treeName %]</SPAN>
    </DIV>
[% END %]

[%# ###########    Print the shortcut   ################ %]

[% BLOCK shortcut %]
  <SPAN CLASS="Shortcut">
  [&nbsp;<A TITLE="[%title%]" HREF="[%url%]"
            [%IF newwindow; 'TARGET="_blank"'; END%]>[%text%]</A>&nbsp;]
  </SPAN>
[% END %]

[%# ###########    Print the Help shortcut   ################ %]
[% BLOCK helpshortcut;
     IF nodeParam(token, 'help-text', 1);
       INCLUDE shortcut
         url="javascript:helpwindow()"
         text="Help"
         title="Open a help window for this page";
     END;
   END %]

[%# ###########    Print the common bottomline   ################ %]

[% BLOCK bottomline %]
</DIV><!-- Content -->[% global.contentFinished = 1 %]
<DIV CLASS="BottomMenu">
[% INCLUDE shortcut url=persistentUrl(token,view,global.bookmarkVars)
                    text="Bookmark"
                    title="Permanent link to this page"%]
[% INCLUDE shortcut url=url('SS')           text="Tokensets"
                    title="List of non-empty tokensets"%]
[% INCLUDE shortcut url=url(token,view,'MEDIA','printer','OVS',ovs)
                    text="Printable view"
                    title="Prepare this page for printing"
                    newwindow=1%]
[% IF mayDisplayReports();
     INCLUDE shortcut url=reportsUrl
                      text="Reports"
                      title="Show reports page"
                      newwindow=1;
   END %]
[% IF global.setDateDialog; INCLUDE enterdate; END %]
[% INCLUDE searchdialog %]
</DIV>
[% END %]

[%# ###########    Print the Tokensets bottomline   ################ %]

[% BLOCK tsetbottomline %]
</DIV><!-- Content -->[% global.contentFinished = 1 %]
<DIV CLASS="BottomMenu">
[% INCLUDE shortcut url=url(pathToken('/')) text="Datasources tree"
                    title="Back to the datasources tree" %]
[% INCLUDE shortcut url=url(token,view,'MEDIA','printer')
                    text="Printable view"
                    title="Prepare this page for printing"
                    newwindow=1%]
[% INCLUDE helpshortcut %]
[% INCLUDE searchdialog %]
</DIV>
[% END %]


[%# ###########    Print the ending HTML blahblah   ################ %]

[% BLOCK htmlend %]
[% IF ! global.contentFinished %]</DIV><!-- Content -->[% END %]
<DIV CLASS="Footer">
  Powered by <A HREF="http://torrus.org">Torrus</A> [% version %]
</DIV>
</BODY>
</HTML>
[% END %]

[%# ########   Print the RRD graph image   ####### %]

[% BLOCK rrgraph %]
<DIV CLASS="GraphImage">
<IMG SRC="[%url(token, view, vars)%]"
     ALT="[% param(view, 'description') %]">
</DIV>
[% END %]


[%# ########   Print the short-term RRD graph image   ####### %]

[% BLOCK shortgraph %]
[%
  hidden = 0;
  IF nodeParam(token,'hidden') == 'yes';
    hidden = 1;
  END;
  IF not hidden or variables.SHOWHIDDEN
%]
<DIV CLASS="ShortGraph">
      [% IF not urltoken; urltoken = token; END %]
      [% hidden ? '<SPAN CLASS="ShowHidden">':'' %]
      <DIV CLASS="NodeName">
        <A HREF="[%url(urltoken,urlview)%]">[% nodename %]</A>
      </DIV>
      [%IF comment%]<DIV CLASS="NodeDescr">[%xmlnorm(comment)%]</DIV>[%END%]
      [% hidden ? '</SPAN>':'' %]
      
      [%
        shortView = nodeParam(token,'rrgraph-views').split(',').0;
        shortvars = [];
        IF nodeParam(token, 'rrd-hwpredict') == 'enabled' and
           param(view, 'rrd-hwpredict') != 'disabled';
          global.hwpredict = 1;
          IF variables.NOHW;
            shortvars = ['NOHW', 1];
          ELSE;
            shortvars = ['NOHW', ''];          
          END;
        END
      %]
      <DIV CLASS="GraphImage">
      <A HREF="[%url(urltoken,urlview)%]">
      <IMG SRC="[%url(token, shortView, shortvars)%]"
           ALT="[% param(shortView, 'description') %]">
      </A>
      </DIV>
</DIV>
  [% END %]
[% END %]


[%# ########   Print the overview shortcuts   ####### %]
[% BLOCK overviewShortcuts %]
[%
  IF nodeParam(token, 'has-overview-shortcuts', 1) == 'yes';
    FOREACH ovs = nodeParam(token,'overview-shortcuts').split('\s*,\s*');
     p1 = 'overview-shortcut-text-' _ ovs;
     p2 = 'overview-shortcut-title-' _ ovs;
     INCLUDE shortcut
        url=url(token, 'overview-subleaves-html', 'OVS', ovs)
        text=nodeParam(token, p1, 1)
        title=nodeParam(token, p2, 1);
    END;
  END %]
[% END %]


[%# ########   Set the date variable   ####### %]
[% BLOCK setdate %]
[% IF variables.SETDATE == 1;
     thedate = verifyDate( variables.SETDATEV );
     IF thedate.length == 0;
         global.printError = 'Incorrect date format';
         clearVar('SETDATE');
     ELSE;
         variables.NOW = thedate;
     END;
   ELSE;
     clearVar('NOW');
     clearVar('SETDATE');
     clearVar('SETDATEV');
   END;
   global.setDateDialog = 1;
%]
[% END %]


[%# ########   Print the date selection elements   ####### %]
[% BLOCK enterdate %]
<SPAN CLASS="SetDateDialog">
<FORM METHOD=GET ACTION="[%topUrl()%]">
<INPUT TYPE="hidden" NAME="token" VALUE="[%token%]"/>
<INPUT TYPE="hidden" NAME="view" VALUE="[%view%]"/>
[% IF ovs %]<INPUT TYPE="hidden" NAME="OVS" VALUE="[%ovs%]"/>[% END %]
<LABEL>
<INPUT TYPE="checkbox" NAME="SETDATE" VALUE="1"
[%variables.SETDATE ? 'CHECKED':''%]/>
Set date</LABEL>
<INPUT TYPE="text" NAME="SETDATEV" SIZE="22" VALUE="[%variables.SETDATEV%]"/>
<INPUT TYPE="submit" VALUE="&gt;"/>
</FORM>
</SPAN>
[% END %]


[%# ########   Print the searchform HTML   ####### %]
[% BLOCK searchdialog %]
[% IF searchEnabled %]
<SPAN CLASS="SearchDialog">
<FORM METHOD=GET ACTION="[%topUrl()%]">
<INPUT TYPE="hidden" NAME="token" VALUE="[%pathToken('/')%]"/>
<INPUT TYPE="hidden" NAME="view" VALUE="search"/>
<LABEL>Search</LABEL>
<INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
<INPUT TYPE="submit" VALUE="&gt;"/>
</FORM>
</SPAN>
[% END %]
[% END %]

[%# ########   Print the Global searchform HTML   ####### %]
[% BLOCK globalsearchdialog %]
[% IF mayGlobalSearch() %]
<SPAN CLASS="SearchDialog">
<FORM METHOD=GET ACTION="[%topUrl()%]">
<LABEL>Search</LABEL>
<INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
<INPUT TYPE="submit" VALUE="&gt;"/>
</FORM>
</SPAN>
[% END %]
[% END %]