~ubuntu-branches/ubuntu/natty/prewikka/natty

« back to all changes in this revision

Viewing changes to prewikka/templates/MessageListing.tmpl

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2008-07-02 16:49:06 UTC
  • mfrom: (6.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080702164906-q2bkfn6i40hd95tt
Tags: 0.9.14-2
* Update watch file
* Bump Standards version to 3.8.0 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#extends prewikka.templates.ClassicLayout
3
3
 
4
4
#def layout_start_hook
5
 
<form method="post" action="?">
 
5
 
 
6
<script type="text/javascript">
 
7
<!--
 
8
var second_reload  = 0;
 
9
var second_count   = 0;
 
10
var autorefresh_enabled = true;
 
11
 
 
12
\$(document).ready(function() {
 
13
  \$("#allbox").click(function(){
 
14
    \$('input[@name=delete]').check(\$(this).attr('checked'));
 
15
  });
 
16
 
 
17
 
 
18
  if ( navigator.userAgent.indexOf("Konqueror") != -1 ) {
 
19
        \$("th.filter_popup > div").css("display", "block");
 
20
        \$("th.filter_popup > div").hide();
 
21
   }
 
22
   
 
23
  \$("th.filter_popup > a").click(function(){
 
24
        \$(this).next().popupUnique(function(data){data.show()}, function(data){data.hide()})
 
25
        return false;
 
26
  });
 
27
 
 
28
  \$("input[@name=auto_apply_value], input[@type=submit]").focus(function(){
 
29
        autorefresh_possible = false;
 
30
  });
 
31
 
 
32
  \$("input[@name=auto_apply_value]").blur(function(){
 
33
        if ( second_reload <= second_count )
 
34
                second_count = 0;
 
35
 
 
36
        autorefresh_possible = true;
 
37
  });
 
38
 
 
39
  \$(".auto_apply_button").click(function(){
 
40
        if ( document.messagelisting.auto_apply_enable.value == "true" ) {
 
41
                autorefresh_enabled = false;
 
42
 
 
43
                document.messagelisting.auto_apply_enable.value = "false";
 
44
                document.messagelisting.auto_apply_image.src = "prewikka/images/play.png";
 
45
        } else {
 
46
                autorefresh_enabled = true;
 
47
 
 
48
                document.messagelisting.auto_apply_enable.value = "true";
 
49
                document.messagelisting.auto_apply_image.src = "prewikka/images/pause.png";
 
50
        }
 
51
  });
 
52
 
 
53
  \$("a[@href]").click(function(){
 
54
        autorefresh_possible = false;
 
55
  });
 
56
}); 
 
57
 
 
58
 
 
59
function pad(number)
 
60
{
 
61
        if ( number < 10 )
 
62
            return "0" + number;
 
63
        else
 
64
            return number;
 
65
}
 
66
 
 
67
function autoApplyTime() {
 
68
        if ( document.messagelisting.auto_apply_value.value )
 
69
                var rawtime = document.messagelisting.auto_apply_value.value;
 
70
        else
 
71
                var rawtime = "0:00";
 
72
 
 
73
        var old = second_reload;
 
74
        var parselimit = rawtime.split(":");
 
75
 
 
76
        if ( parselimit[0] && parselimit[1] && parselimit[2] )
 
77
                second_reload = parselimit[0] * 3600 + parselimit[1] * 60 + parselimit[2] * 1;
 
78
 
 
79
        else if ( parselimit[0] && parselimit[1] )
 
80
                second_reload = parselimit[0] * 60 + parselimit[1] * 1;
 
81
 
 
82
        else
 
83
                second_reload = rawtime;
 
84
 
 
85
        if ( second_reload != old )
 
86
                secound_count = 0;
 
87
}
 
88
 
 
89
 
 
90
function autoApplyCounter() {
 
91
        autoApplyTime();
 
92
 
 
93
        if ( autorefresh_enabled == false || autorefresh_possible == false || second_reload == 0 ) {
 
94
                setTimeout("autoApplyCounter()", 1000);
 
95
                return;
 
96
        }
 
97
 
 
98
        second_count += 1;
 
99
        document.getElementById("auto_apply_current").innerHTML = Math.floor(second_count / 60) + ":" + pad((second_count % 60));
 
100
 
 
101
        if ( second_count != second_reload )
 
102
                setTimeout("autoApplyCounter()", 1000);
 
103
 
 
104
        else if ( second_count == second_reload ) {
 
105
                second_count = 0;
 
106
 
 
107
                var yaxis = 0;
 
108
 
 
109
                if ( window.pageYOffset )
 
110
                        yaxis = window.pageYOffset;
 
111
 
 
112
                else if ( window.documentElement && window.documentElement.scrollTop )
 
113
                        yaxis = window.documentElement.scrollTop;
 
114
 
 
115
                else if ( document.body.scrollTop )
 
116
                        yaxis = window.body.scrollTop;
 
117
 
 
118
                document.messagelisting.y.value = yaxis;
 
119
                document.messagelisting.submit("Apply");
 
120
        }
 
121
}
 
122
 
 
123
 
 
124
function setScrollBar() {
 
125
        if ( document.messagelisting.y.value ) {
 
126
                window.scrollTo('0', document.messagelisting.y.value) ;
 
127
                document.messagelisting.y.value = 0;
 
128
        }
 
129
}
 
130
 
 
131
 
 
132
function beginAutoApply() {
 
133
#if $auto_apply_enable == "true"
 
134
        autorefresh_enabled = true;
 
135
#else
 
136
        autorefresh_enabled = false;
 
137
#end if
 
138
 
 
139
        setScrollBar();
 
140
        setTimeout("autoApplyCounter()", 1000);
 
141
}
 
142
 
 
143
//--></script>
 
144
 
 
145
<form id="messagelisting" name="messagelisting" method="post" action="?">
6
146
#for $name, $value in $hidden_parameters
7
147
  <input type="hidden" name="$name" value="$value"/>
8
148
#end for
13
153
#end def
14
154
 
15
155
 
16
 
 
17
156
#block main_content
 
157
 
18
158
#def message_listing_header
19
159
#end def
20
160
$message_listing_header
29
169
      #set global $message = $message
30
170
        <tr class="$row_classes[$cnt % 2]">
31
171
          $message_fields
32
 
          <td class="static_content_column">
 
172
          <td>
33
173
            #if $prewikka.user.has(User.PERM_IDMEF_ALTER)
34
174
              <input class="checkbox" type="checkbox" name="delete" value="$message.delete"/>
35
 
            #else
36
 
              &nbsp;
 
175
            #else
 
176
              &nbsp;
37
177
            #end if
38
178
          </td>
39
179
        </tr>
40
180
        #set $cnt += 1
41
181
      #end for
 
182
    </tbody>
42
183
 
43
184
#if $prewikka.user.has(User.PERM_IDMEF_ALTER) and $cnt
 
185
   <tfoot>
44
186
     <tr>
45
187
      <td colspan="4">&nbsp;</td>
46
188
      <td style="text-align: right;"><input type="submit" value="$_("Delete")"/></td>
47
 
      <td class="static_content_column">
48
 
       <input class="checkbox" type="checkbox" id="allbox" onclick="checkBoxByName('delete', document.forms[0].allbox.checked);"/>
 
189
      <td>
 
190
       <input class="checkbox" type="checkbox" id="allbox" />
49
191
      </td>
50
192
     </tr>
51
 
    </tbody>
 
193
    </tfoot>
52
194
#end if
53
 
 
54
 
  </table>
 
195
</table>
55
196
#end block main_content
56
197
 
57
198
 
58
 
 
 
199
#block orderby_option
 
200
     <option value="time_desc" $timeline.time_desc_selected>By time (descending)</option>
 
201
     <option value="time_asc" $timeline.time_asc_selected>By time (ascending)</option>
 
202
#end block
59
203
 
60
204
#block menu_extra_content
 
205
 
61
206
<table id="timeline">
62
207
  #def timeline_extra_content
63
208
  #end def
64
209
  $timeline_extra_content
65
 
  
 
210
 
66
211
  <tr>
67
212
   <th id="timeline_step_label">$_("Period")</th>
68
 
   <td>
69
 
    <input class="timeline_value" name="timeline_value" type="text" size="2" value="$timeline.value"/>
70
 
   </td>
71
 
   <td> 
72
 
    <select class="timeline_unit_select" name="timeline_unit">
 
213
   <td colspan="2">
 
214
    <input name="timeline_value" type="text" size="2" value="$timeline.value"/>
 
215
    <select name="timeline_unit">
73
216
     <option value="min" $timeline.min_selected>$_("Minutes")</option>
74
217
     <option value="hour" $timeline.hour_selected>$_("Hours")</option>
75
218
     <option value="day" $timeline.day_selected>$_("Days")</option>
83
226
  <tr>
84
227
    <th id="timezone_control_label">$_("Timezone")</th>
85
228
    <td colspan="2">
86
 
      <select class="timezone_control_select" name="timezone">
 
229
      <select name="timezone">
87
230
        <option value="frontend_localtime" $timeline.frontend_localtime_selected>$_("Frontend localtime")</option>
88
 
        <option value="sensor_localtime" $timeline.sensor_localtime_selected>$_("Sensor localtime")</option>
89
 
        <option value="utc" $timeline.utc_selected>$_("UTC")</option>
 
231
        <option value="sensor_localtime" $timeline.sensor_localtime_selected>$_("Sensor localtime")</option>
 
232
        <option value="utc" $timeline.utc_selected>$_("UTC")</option>
90
233
       </select>
91
234
     </td>
92
235
  </tr>
93
 
        
 
236
 
94
237
  <tr>
95
238
   <th id="timeline_limit_label">$_("Limit")</th>
96
239
 
97
 
   <td colspan="2">
 
240
   <td colspan="1">
98
241
    <input id="timeline_limit_value" type="text" size="2" name="limit" value="$limit"/>
99
242
   </td>
 
243
   <td>
 
244
    <select name="orderby">
 
245
    $orderby_option
 
246
    </select>
 
247
   </td>
100
248
  </tr>
101
249
 
102
 
  <tr style="text-align: center;">
103
 
      <td colspan=3><input type="submit" name="apply" value="$_("Apply")" />
104
 
      <input type="submit" name="_save" value="$_("Save")" /></td>
 
250
  <tr>
 
251
    <th id="auto_apply_label">$_("Refresh")</th>
 
252
 
 
253
    <td colspan="2">
 
254
    #if $auto_apply_enable == "true"
 
255
        #set $img = "prewikka/images/pause.png"
 
256
    #else:
 
257
        #set $img = "prewikka/images/play.png"
 
258
    #end if
 
259
 
 
260
<input type="hidden" name="auto_apply_enable" value="$auto_apply_enable" />
 
261
 
 
262
<div class="auto_apply_current" id="auto_apply_current">0:00</div>
 
263
<input type="text" size="3" name="auto_apply_value" value="$auto_apply_value" />
 
264
<a class="auto_apply_button"><img id="auto_apply_image" src="$img" alt="Play/Pause" /></a>
 
265
 
 
266
    </td>
105
267
  </tr>
106
268
 
107
269
#filter CleanOutput
108
270
 
 
271
<tr>
 
272
 <td colspan="3" style="text-align: center">
 
273
 
 
274
<br style="line-height: 5px;" />
 
275
 
 
276
<div>
 
277
 <input id="form_apply" type="submit" name="apply" value="$_("Apply")" />&nbsp;<input type="submit" name="_save" value="$_("Save")" />
 
278
</div>
 
279
 
 
280
<br style="line-height: 5px;" />
 
281
 
 
282
<div class="timeline_range">
109
283
#if not $timeline.start
110
 
 <tr><td colspan="4" class="timeline_range">Unlimited</td></tr>
111
 
 <tr><td colspan="4" class="timeline_range">-</td></tr>
 
284
 Unlimited<br/>
 
285
 -<br/>
112
286
#else
113
 
 <tr><td colspan="4" class="timeline_range">$timeline.start</td></tr>
114
 
 <tr><td colspan="4" class="timeline_range">$timeline.end</td></tr>
 
287
 $timeline.start<br/>
 
288
 $timeline.end<br/>
115
289
#end if
116
 
 <tr><td colspan="4" class="timeline_range">$timeline.range_timezone</td></tr>
 
290
 $timeline.range_timezone
 
291
</div>
 
292
 
 
293
</td>
 
294
</tr>
117
295
 
118
296
 <tr>
119
 
  <td colspan="4" style="text-align: center;">
 
297
  <td colspan="3">
120
298
   <table><tr>
121
299
    #if $timeline.prev
122
300
     <td class="timeline_control_prev"><a href="$timeline.prev"><b>$_("prev")</b></a></td>
132
310
 
133
311
    #if $timeline.next
134
312
     <td class="timeline_control_next"><a href="$timeline.next"><b>$_("next")</b></a></td>
135
 
    #else 
 
313
    #else
136
314
     <td class="timeline_control_inactive"><b>$_("next")</b></td>
137
315
    #end if
138
316
 
142
320
 
143
321
 </table>
144
322
 
145
 
 
146
323
<table id="message_list_nav">
147
324
  <tr>
148
325
    #if $nav.prev
171
348
#filter Filter
172
349
#end filter
173
350
#end block menu_extra_content
 
351
 
 
352
#block body
 
353
<body class="$body_class" onload="beginAutoApply()">
 
354
        <div id="top_view">
 
355
                <div id="top_view_header">
 
356
                        <div id="top_view_header_software">$prewikka.software</div>
 
357
                        <div id="top_view_header_place">$prewikka.place</div>
 
358
                        <div id="top_view_header_title">$prewikka.title</div>
 
359
                </div>
 
360
                $toplayout_content
 
361
        </div>
 
362
</body>
 
363
#end block body