OpenInteract2/Brick/Widgets.pm

filter: Statementstmt 98.6% 74 / 75 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 63 / 63 Podpod 0.0% 0 / 60 totaltotal 69.0% 138 / 200 CC 2 SCAR 0.3
CC
2
Cov
97%
load
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« OpenInteract2/SQLInstall.pm ↑ Summary OpenInteract2/ContentGenerator/TT2Process.pm »
1 package OpenInteract2::Brick::Widgets;
2  
3 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 87 ▶use base qw( OpenInteract2::Brick );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 87 ▶use OpenInteract2::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 87 my %INLINED_SUBS = (
8 'base_main' => 'BASE_MAIN',
9 'base_simple' => 'BASE_SIMPLE',
10 'common_action_error' => 'COMMON_ACTION_ERROR',
11 'data_cell_begin' => 'DATA_CELL_BEGIN',
12 'date_select' => 'DATE_SELECT',
13 'error_message' => 'ERROR_MESSAGE',
14 'error_not_found' => 'ERROR_NOT_FOUND',
15 'error_object_inactive' => 'ERROR_OBJECT_INACTIVE',
16 'error_object_security' => 'ERROR_OBJECT_SECURITY',
17 'error_task_forbidden' => 'ERROR_TASK_FORBIDDEN',
18 'error_task_no_default' => 'ERROR_TASK_NO_DEFAULT',
19 'form_begin' => 'FORM_BEGIN',
20 'form_button' => 'FORM_BUTTON',
21 'form_checkbox' => 'FORM_CHECKBOX',
22 'form_end' => 'FORM_END',
23 'form_hidden' => 'FORM_HIDDEN',
24 'form_login' => 'FORM_LOGIN',
25 'form_password' => 'FORM_PASSWORD',
26 'form_radio' => 'FORM_RADIO',
27 'form_radioset' => 'FORM_RADIOSET',
28 'form_reset' => 'FORM_RESET',
29 'form_select' => 'FORM_SELECT',
30 'form_select_intro' => 'FORM_SELECT_INTRO',
31 'form_select_option' => 'FORM_SELECT_OPTION',
32 'form_select_options_iterator' => 'FORM_SELECT_OPTIONS_ITERATOR',
33 'form_select_options_list' => 'FORM_SELECT_OPTIONS_LIST',
34 'form_select_options_plain_list' => 'FORM_SELECT_OPTIONS_PLAIN_LIST',
35 'form_submit' => 'FORM_SUBMIT',
36 'form_submit_row' => 'FORM_SUBMIT_ROW',
37 'form_text' => 'FORM_TEXT',
38 'form_textarea' => 'FORM_TEXTAREA',
39 'form_upload' => 'FORM_UPLOAD',
40 'global_javascript' => 'GLOBAL_JAVASCRIPT',
41 'header_cell' => 'HEADER_CELL',
42 'header_row' => 'HEADER_ROW',
43 'inactive_object_banner' => 'INACTIVE_OBJECT_BANNER',
44 'label_error_row_extra' => 'LABEL_ERROR_ROW_EXTRA',
45 'label_form_checkbox_row' => 'LABEL_FORM_CHECKBOX_ROW',
46 'label_form_date_row' => 'LABEL_FORM_DATE_ROW',
47 'label_form_login_row' => 'LABEL_FORM_LOGIN_ROW',
48 'label_form_radio_row' => 'LABEL_FORM_RADIO_ROW',
49 'label_form_select_row' => 'LABEL_FORM_SELECT_ROW',
50 'label_form_text_row' => 'LABEL_FORM_TEXT_ROW',
51 'label_form_textarea_row' => 'LABEL_FORM_TEXTAREA_ROW',
52 'label_form_upload_row' => 'LABEL_FORM_UPLOAD_ROW',
53 'label_row' => 'LABEL_ROW',
54 'label_row_begin' => 'LABEL_ROW_BEGIN',
55 'label_text_row' => 'LABEL_TEXT_ROW',
56 'object_updates' => 'OBJECT_UPDATES',
57 'page_count' => 'PAGE_COUNT',
58 'row_color' => 'ROW_COLOR',
59 'search_results_page_listing' => 'SEARCH_RESULTS_PAGE_LISTING',
60 'show_label' => 'SHOW_LABEL',
61 'status_message' => 'STATUS_MESSAGE',
62 'table_bordered_begin' => 'TABLE_BORDERED_BEGIN',
63 'table_bordered_end' => 'TABLE_BORDERED_END',
64 'to_group' => 'TO_GROUP',
65 );
66  
67 87 ▶sub get_name {
Subroutine get_name: called CC=1 SCAR=0.0
Pod undocumented
68 87 return 'widgets';
69 }
70  
71 58 ▶sub get_resources {
Subroutine get_resources: called CC=1 SCAR=0.0
Pod undocumented
72 return (
73 58 'base_main' => [ 'template base_main', 'no' ],
74 'base_simple' => [ 'template base_simple', 'no' ],
75 'common_action_error' => [ 'template common_action_error', 'no' ],
76 'data_cell_begin' => [ 'template data_cell_begin', 'no' ],
77 'date_select' => [ 'template date_select', 'no' ],
78 'error_message' => [ 'template error_message', 'no' ],
79 'error_not_found' => [ 'template error_not_found', 'no' ],
80 'error_object_inactive' => [ 'template error_object_inactive', 'no' ],
81 'error_object_security' => [ 'template error_object_security', 'no' ],
82 'error_task_forbidden' => [ 'template error_task_forbidden', 'no' ],
83 'error_task_no_default' => [ 'template error_task_no_default', 'no' ],
84 'form_begin' => [ 'template form_begin', 'no' ],
85 'form_button' => [ 'template form_button', 'no' ],
86 'form_checkbox' => [ 'template form_checkbox', 'no' ],
87 'form_end' => [ 'template form_end', 'no' ],
88 'form_hidden' => [ 'template form_hidden', 'no' ],
89 'form_login' => [ 'template form_login', 'no' ],
90 'form_password' => [ 'template form_password', 'no' ],
91 'form_radio' => [ 'template form_radio', 'no' ],
92 'form_radioset' => [ 'template form_radioset', 'no' ],
93 'form_reset' => [ 'template form_reset', 'no' ],
94 'form_select' => [ 'template form_select', 'no' ],
95 'form_select_intro' => [ 'template form_select_intro', 'no' ],
96 'form_select_option' => [ 'template form_select_option', 'no' ],
97 'form_select_options_iterator' => [ 'template form_select_options_iterator', 'no' ],
98 'form_select_options_list' => [ 'template form_select_options_list', 'no' ],
99 'form_select_options_plain_list' => [ 'template form_select_options_plain_list', 'no' ],
100 'form_submit' => [ 'template form_submit', 'no' ],
101 'form_submit_row' => [ 'template form_submit_row', 'no' ],
102 'form_text' => [ 'template form_text', 'no' ],
103 'form_textarea' => [ 'template form_textarea', 'no' ],
104 'form_upload' => [ 'template form_upload', 'no' ],
105 'global_javascript' => [ 'template global_javascript', 'no' ],
106 'header_cell' => [ 'template header_cell', 'no' ],
107 'header_row' => [ 'template header_row', 'no' ],
108 'inactive_object_banner' => [ 'template inactive_object_banner', 'no' ],
109 'label_error_row_extra' => [ 'template label_error_row_extra', 'no' ],
110 'label_form_checkbox_row' => [ 'template label_form_checkbox_row', 'no' ],
111 'label_form_date_row' => [ 'template label_form_date_row', 'no' ],
112 'label_form_login_row' => [ 'template label_form_login_row', 'no' ],
113 'label_form_radio_row' => [ 'template label_form_radio_row', 'no' ],
114 'label_form_select_row' => [ 'template label_form_select_row', 'no' ],
115 'label_form_text_row' => [ 'template label_form_text_row', 'no' ],
116 'label_form_textarea_row' => [ 'template label_form_textarea_row', 'no' ],
117 'label_form_upload_row' => [ 'template label_form_upload_row', 'no' ],
118 'label_row' => [ 'template label_row', 'no' ],
119 'label_row_begin' => [ 'template label_row_begin', 'no' ],
120 'label_text_row' => [ 'template label_text_row', 'no' ],
121 'object_updates' => [ 'template object_updates', 'no' ],
122 'page_count' => [ 'template page_count', 'no' ],
123 'row_color' => [ 'template row_color', 'no' ],
124 'search_results_page_listing' => [ 'template search_results_page_listing', 'no' ],
125 'show_label' => [ 'template show_label', 'no' ],
126 'status_message' => [ 'template status_message', 'no' ],
127 'table_bordered_begin' => [ 'template table_bordered_begin', 'no' ],
128 'table_bordered_end' => [ 'template table_bordered_end', 'no' ],
129 'to_group' => [ 'template to_group', 'no' ],
130 );
131 }
132  
133 57 ▶sub load {
Subroutine load: called CC=2 SCAR=7.4
Pod undocumented
134 57 my ( $self, $resource_name ) = @_;
135 57 my $inline_sub_name = $INLINED_SUBS{ $resource_name };
136 57 ▶ unless ( $inline_sub_name ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($inline_sub_name) 0 57 57
137 0 OpenInteract2::Exception->throw(
138 "Resource name '$resource_name' not found ",
139 "in ", ref( $self ), "; cannot load content." );
140 }
141 57 return $self->$inline_sub_name();
142 }
143  
144 87 OpenInteract2::Brick->register_factory_type( get_name() => __PACKAGE__ );
145  
146 =pod
147  
148 =head1 NAME
149  
150 OpenInteract2::Brick::Widgets - All global TT2 template files
151  
152 =head1 SYNOPSIS
153  
154 oi2_manage create_website --website_dir=/path/to/site
155  
156 =head1 DESCRIPTION
157  
158 This class holds all global (non-package) Template Toolkit templates, also known as "widgets".
159  
160 These resources are associated with OpenInteract2 version 1.99_06.
161  
162 =head2 Resources
163  
164 You can grab resources individually using the names below and
165 C<load_resource()> and C<copy_resources_to()>, or you can copy all the
166 resources at once using C<copy_all_resources_to()> -- see
167 L<OpenInteract2::Brick> for details.
168  
169 =over 4
170  
171  
172 =item B<base_main>
173  
174 =item B<base_simple>
175  
176 =item B<common_action_error>
177  
178 =item B<data_cell_begin>
179  
180 =item B<date_select>
181  
182 =item B<error_message>
183  
184 =item B<error_not_found>
185  
186 =item B<error_object_inactive>
187  
188 =item B<error_object_security>
189  
190 =item B<error_task_forbidden>
191  
192 =item B<error_task_no_default>
193  
194 =item B<form_begin>
195  
196 =item B<form_button>
197  
198 =item B<form_checkbox>
199  
200 =item B<form_end>
201  
202 =item B<form_hidden>
203  
204 =item B<form_login>
205  
206 =item B<form_password>
207  
208 =item B<form_radio>
209  
210 =item B<form_radioset>
211  
212 =item B<form_reset>
213  
214 =item B<form_select>
215  
216 =item B<form_select_intro>
217  
218 =item B<form_select_option>
219  
220 =item B<form_select_options_iterator>
221  
222 =item B<form_select_options_list>
223  
224 =item B<form_select_options_plain_list>
225  
226 =item B<form_submit>
227  
228 =item B<form_submit_row>
229  
230 =item B<form_text>
231  
232 =item B<form_textarea>
233  
234 =item B<form_upload>
235  
236 =item B<global_javascript>
237  
238 =item B<header_cell>
239  
240 =item B<header_row>
241  
242 =item B<inactive_object_banner>
243  
244 =item B<label_error_row_extra>
245  
246 =item B<label_form_checkbox_row>
247  
248 =item B<label_form_date_row>
249  
250 =item B<label_form_login_row>
251  
252 =item B<label_form_radio_row>
253  
254 =item B<label_form_select_row>
255  
256 =item B<label_form_text_row>
257  
258 =item B<label_form_textarea_row>
259  
260 =item B<label_form_upload_row>
261  
262 =item B<label_row>
263  
264 =item B<label_row_begin>
265  
266 =item B<label_text_row>
267  
268 =item B<object_updates>
269  
270 =item B<page_count>
271  
272 =item B<row_color>
273  
274 =item B<search_results_page_listing>
275  
276 =item B<show_label>
277  
278 =item B<status_message>
279  
280 =item B<table_bordered_begin>
281  
282 =item B<table_bordered_end>
283  
284 =item B<to_group>
285  
286  
287 =back
288  
289 =head1 COPYRIGHT
290  
291 Copyright (c) 2005 Chris Winters. All rights reserved.
292  
293 This library is free software; you can redistribute it and/or modify
294 it under the same terms as Perl itself.
295  
296 =head1 AUTHORS
297  
298  
299 Chris Winters E<lt>chris@cwinters.comE<gt>
300  
301  
302 =cut
303  
304  
305 1 ▶sub BASE_MAIN {
Subroutine BASE_MAIN: called CC=1 SCAR=0.0
Pod undocumented
306 1 return <<'SOMELONGSTRING';
307 [%- DEFAULT theme = OI.theme_properties;
308 style_url = OI.make_url( BASE = '/main.css' );
309 home_url = OI.make_url( BASE = '/' );
310 logo_url = OI.make_url( IMAGE = '/images/oi_logo.gif' );
311 powered_url = OI.make_url( IMAGE = '/images/pw_by_oi.gif' ); -%]
312 <html>
313 <head>
314 <link rel="stylesheet" href="[% style_url %]" />
315 <title>[% title %]</title>
316 <script language="javascript">
317 <!--
318  
319 [% script %]
320  
321 [% PROCESS global_javascript %]
322  
323 // -->
324 </script>
325 </head>
326 <body bgcolor="[% theme.bgcolor %]">
327  
328 <a href="[% home_url %]"><img src="[% logo_url %]" width="316" height="74"
329 border="0" alt="[% MSG( 'base_main.label.logo' ) %]"></a>
330 <br clear="all">
331 <table border="0" width="100%" cellpadding="2" bgcolor="[% theme.main_menu_border_color %]">
332 <tr><td>
333 <table border="0" width="100%" bgcolor="[% theme.main_menu_bgcolor %]"
334 cellpadding="4" cellspacing="0">
335 <tr valign="middle">
336 <td align="left"><div class="titlebar">
337 <b><a href="[% home_url %]">[% MSG( 'base_main.label.home' ) %]</a></b> |
338 <b><a href="[% OI.make_url( ACTION = 'user' ) %]">[% MSG( 'base_main.label.users' ) %]</a></b> |
339 <b><a href="[% OI.make_url( ACTION = 'group' ) %]">[% MSG( 'base_main.label.groups' ) %]</a></b> |
340 <b><a href="[% OI.make_url( ACTION = 'page',
341 TASK = 'directory_list' ) %]">[% MSG( 'base_main.label.pages' ) %]</a></b> |
342 <b><a href="[% OI.make_url( ACTION = 'news' ) %]">[% MSG( 'base_main.label.news' ) %]</a></b> |
343 <b><a href="[% OI.make_url( ACTION = 'new' ) %]">[% MSG( 'base_main.label.whats_new' ) %]</a></b>
344 </div></td>
345 <td align="right">[%- INCLUDE full_text::search_box( submit_label = MSG( 'base_main.label.search' ) ) -%]</td>
346 </tr>
347 </table>
348  
349 </td></tr>
350 </table>
351  
352 <table border="0" width="100%" bgcolor="[% theme.bgcolor %]"
353 cellpadding="1" cellspacing="0">
354 <tr valign="top">
355 <td width="75%" align="left">
356 <br>
357  
358 [% content %]
359  
360 </td>
361 <td width="25%" align="right">
362 <br>
363  
364 [%- OI.action_execute( 'boxes' ) -%]
365  
366 </td></tr>
367 </table>
368  
369 <hr width="50%" noshade="noshade">
370 <p align="center">
371 [% MSG( 'base_main.phrase.questions' ) %]
372 </p>
373 <p align="right">
374 <a href="http://openinteract.sourceforge.net/cgi-bin/twiki/view/OI/PoweredBy"><img
375 src="[% powered_url %]" width="88" height="31"
376 border="0" alt="[% MSG( 'base_main.label.powered_by' ) %]"></a>
377 </p>
378  
379 </body>
380 </html>
381 SOMELONGSTRING
382 }
383  
384 1 ▶sub BASE_SIMPLE {
Subroutine BASE_SIMPLE: called CC=1 SCAR=0.0
Pod undocumented
385 1 return <<'SOMELONGSTRING';
386 [%- DEFAULT theme = OI.theme_properties -%]
387 <html>
388 <head><title>[% page.title %]</title>
389 <script language="javascript">
390 <!--
391  
392 [% page.script %]
393  
394 [%- PROCESS global_javascript -%]
395  
396 // -->
397 </script>
398  
399 </head>
400 <body bgcolor="[% theme.bgcolor %]">
401  
402 [% page.content %]
403  
404 </body>
405 </html>
406 SOMELONGSTRING
407 }
408  
409 1 ▶sub COMMON_ACTION_ERROR {
Subroutine COMMON_ACTION_ERROR: called CC=1 SCAR=0.0
Pod undocumented
410 1 return <<'SOMELONGSTRING';
411 [%- IF NOT error_msg;
412 error_msg = OI.action.param( 'error_msg' ) || OI.request.message( 'error_msg' );
413 END -%]
414  
415 <h1>[% MSG( 'c_a_error.title' ) %]</h1>
416  
417 <p>[% MSG( 'c_a_error.summary' ) %]</p>
418  
419 [% FOREACH msg = error_msg -%]
420 <p class="errorMessage">[% msg %]</p>
421 [% END %]
422  
423  
424 SOMELONGSTRING
425 }
426  
427 1 ▶sub DATA_CELL_BEGIN {
Subroutine DATA_CELL_BEGIN: called CC=1 SCAR=0.0
Pod undocumented
428 1 return <<'SOMELONGSTRING';
429 [%########################################
430 data_cell_begin( colspan, align )
431 Begin a datarow, taking care of colspan issues.
432 ########################################-%]
433  
434 [%- SET colspan = ( colspan > 1 ) ? colspan - 1 : 1;
435 DEFAULT align = 'left'; -%]
436 <td colspan="[% colspan %]" align="[% align %]">
437  
438 SOMELONGSTRING
439 }
440  
441 1 ▶sub DATE_SELECT {
Subroutine DATE_SELECT: called CC=1 SCAR=0.0
Pod undocumented
442 1 return <<'SOMELONGSTRING';
443 [%########################################
444 date_select( year_list, year_value, month_value, day_value,
445 blank, year_field, month_field, day_field, field_prefix )
446 Display three dropdown boxes for inputting dates.
447  
448 Parameters:
449  
450 year_list = list of years
451 object = Class::Date object from which we can get the year,
452 month and day; if this is given we ignore the
453 year/month/day_value fields
454 year_value = chosen year
455 month_value = chosen month (number)
456 day_value = chosen day (number)
457 is_blank = if true, start each SELECT with a blank option
458 year_field = name for year SELECT
459 month_field = name for month SELECT
460 day_field = name for day SELECT
461 field_prefix = use instead of specifying year/month/day_field;
462 prefix to put in front of '_year', '_month' and
463 '_day' (e.g, if field_prefix = 'birthdate', the
464 fields would be 'birthdate_year',
465 'birthdate_month', and 'birthdate_day')
466 comment = if true includes an HTML comment with values (debugging)
467  
468 Defaults:
469 year_list = 2000 .. 2010
470 ########################################-%]
471  
472 [%- SET month_names = [ 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' ];
473 DEFAULT year_list = [ 2000..2010 ]; -%]
474  
475 [%- IF field_prefix -%]
476 [%- month_field = "${field_prefix}_month";
477 day_field = "${field_prefix}_day";
478 year_field = "${field_prefix}_year"; -%]
479 [% END -%]
480 [%- IF object -%]
481 [%- year_value = object.year;
482 month_value = object.month;
483 day_value = object.day; -%]
484 [%- END -%]
485
486 [% INCLUDE form_select( name = month_field, plain = 1, first_blank = is_blank,
487 value_list = [ 1..12 ], label_list = month_names,
488 picked = month_value ) -%]
489 [% INCLUDE form_select( name = day_field, plain = 1, first_blank = is_blank,
490 value_list = [ 1..31 ], picked = day_value ) -%]
491 [% INCLUDE form_select( name = year_field, plain = 1, first_blank = is_blank,
492 value_list = year_list, picked = year_value ) -%]
493 [% IF comment %]<!-- Date: [% year_value %] (y) [% month_value %] (m) [% day_value %] (d) -->[% END -%]
494  
495 SOMELONGSTRING
496 }
497  
498 1 ▶sub ERROR_MESSAGE {
Subroutine ERROR_MESSAGE: called CC=1 SCAR=0.0
Pod undocumented
499 1 return <<'SOMELONGSTRING';
500 [%- IF NOT error_msg;
501 error_msg = OI.action_param( 'error_msg' ) || OI.request.message( 'error_msg' );
502 END -%]
503  
504 [%- IF error_msg -%]
505  
506 [%- DEFAULT theme = OI.theme_properties;
507 SET error_width = width || theme.error_width;
508 SET error_font_color = font_color || theme.error_font_color;
509 SET error_border = border_color || theme.error_border_color;
510 SET error_bgcolor = bgcolor ||theme.error_bgcolor; -%]
511  
512 <!-- BEGIN of error display -->
513  
514 <div align="center">
515  
516 [%- INCLUDE table_bordered_begin( table_width = error_width,
517 border_color = error_border,
518 bgcolor = error_bgcolor ) -%]
519  
520 <tr><td align="center">
521 <font color="[% error_font_color %]" size="+1"><b>[% MSG( 'error_msg.title' ) %]</b></font>
522 </td></tr>
523 <tr><td>
524 [% FOREACH error = error_msg -%]
525 <p>[% theme.bullet %] <font color="[% error_font_color %]">[% error_msg %]</font></p>
526 [% END %]
527 </td></tr>
528  
529 [% PROCESS table_bordered_end -%]
530  
531 </div>
532  
533 <!-- END of error display -->
534  
535 [%- END -%]
536 SOMELONGSTRING
537 }
538  
539 1 ▶sub ERROR_NOT_FOUND {
Subroutine ERROR_NOT_FOUND: called CC=1 SCAR=0.0
Pod undocumented
540 1 return <<'SOMELONGSTRING';
541 <div align="center">
542  
543 <h1>[% MSG( 'error_not_found.title' ) %]</h1>
544  
545 <table width="50%" border="0" cellpadding="5" cellspacing="0">
546  
547 <tr><td align="left">
548 [% MSG( 'error_not_found.title' ) %]
549 </td></tr>
550  
551 <tr><td align="right">[% MSG( 'error_not_found.signed' ) %]
552 </td></tr>
553  
554 [% IF err.referer %]
555 <tr><td>
556 [% MSG( 'error_not_found.referer', err.referer ) %]
557 </td></tr>
558 [% END %]
559  
560 </table>
561  
562 </div>
563 SOMELONGSTRING
564 }
565  
566 1 ▶sub ERROR_OBJECT_INACTIVE {
Subroutine ERROR_OBJECT_INACTIVE: called CC=1 SCAR=0.0
Pod undocumented
567 1 return <<'SOMELONGSTRING';
568 [% OI.page_title( MSG( 'error_inactive.page_title' ) ) %]
569 [%- DEFAULT object_name = 'Item' -%]
570  
571 <div align="center">
572  
573 <h1>[% MSG( 'error_inactive.title', object_name ) %]</h1>
574  
575 <table width="50%" border="0" cellpadding="5" cellspacing="0">
576 <tr><td align="left">
577 [% MSG( 'error_inactive.summary' ) %]
578 </td></tr>
579 </table>
580  
581 </div>
582 SOMELONGSTRING
583 }
584  
585 1 ▶sub ERROR_OBJECT_SECURITY {
Subroutine ERROR_OBJECT_SECURITY: called CC=1 SCAR=0.0
Pod undocumented
586 1 return <<'SOMELONGSTRING';
587 [% OI.page_title( MSG( 'error_security.page_title' ) ) %]
588  
589 <div align="center">
590  
591 <h1>[% MSG( 'error_security.title' ) %]</h1>
592  
593 <table width="50%" border="0" cellpadding="5" cellspacing="0">
594 <tr><td align="left">
595 [% MSG( 'error_security.summary' ) %]
596 </td></tr>
597 </table>
598  
599 </div>
600 SOMELONGSTRING
601 }
602  
603 1 ▶sub ERROR_TASK_FORBIDDEN {
Subroutine ERROR_TASK_FORBIDDEN: called CC=1 SCAR=0.0
Pod undocumented
604 1 return <<'SOMELONGSTRING';
605 <div align="center">
606  
607 <h1>[% MSG( 'error_forbidden.title' ) %]</h1>
608  
609 <table width="50%" border="0" cellpadding="5" cellspacing="0">
610  
611 <tr><td align="left">
612 [% MSG( 'error_forbidden_summary', admin_email ) %]
613 </td></tr>
614  
615 <tr><td align="right">
616 [% MSG( 'error_forbidden.signed' ) %]
617 </td></tr>
618  
619 </table>
620  
621 </div>
622 SOMELONGSTRING
623 }
624  
625 1 ▶sub ERROR_TASK_NO_DEFAULT {
Subroutine ERROR_TASK_NO_DEFAULT: called CC=1 SCAR=0.0
Pod undocumented
626 1 return <<'SOMELONGSTRING';
627 <div align="center">
628  
629 <h1>[% MSG( 'error_no_default.title' ) %]</h1>
630  
631 <table width="50%" border="0" cellpadding="5" cellspacing="0">
632  
633 <tr><td align="left">
634 [% MSG( 'error_no_default.summary', author_email ) %]
635 </td></tr>
636  
637 <tr><td align="right">
638 [% MSG( 'error_no_default.signed' ) %]
639 </td></tr>
640  
641 </table>
642  
643 </div>
644 SOMELONGSTRING
645 }
646  
647 1 ▶sub FORM_BEGIN {
Subroutine FORM_BEGIN: called CC=1 SCAR=0.0
Pod undocumented
648 1 return <<'SOMELONGSTRING';
649 [%- DEFAULT method = 'POST';
650 DEFAULT form_url = OI.make_url( BASE = BASE,
651 ACTION = ACTION,
652 TASK = TASK ); -%]
653 <form action="[% form_url %]" method="[% method %]"
654 [%- IF onsubmit %] onsubmit="[% onsubmit %]"[% END -%]
655 [%- IF name %] name="[% name %]"[% END -%]
656 [%- IF upload == 'yes' %]enctype="multipart/form-data"[% END %]>
657 SOMELONGSTRING
658 }
659  
660 1 ▶sub FORM_BUTTON {
Subroutine FORM_BUTTON: called CC=1 SCAR=0.0
Pod undocumented
661 1 return <<'SOMELONGSTRING';
662 [%- IF value_key;
663 value = MSG( value_key );
664 END;
665 DEFAULT value = MSG( 'global.button.default' );
666 -%]
667 <input type="button" value="[% value %]"
668 [%- IF onclick %] onClick="[% onclick %]"[% END -%]
669 [%- IF name %] name="[% name %]"[% END %]> [% field_label %]
670  
671 SOMELONGSTRING
672 }
673  
674 1 ▶sub FORM_CHECKBOX {
Subroutine FORM_CHECKBOX: called CC=1 SCAR=0.0
Pod undocumented
675 1 return <<'SOMELONGSTRING';
676 [%- DEFAULT is_checked = ( value == picked );
677 is_checked_label = ( is_checked ) ? 'CHECKED' : '' -%]
678 <input type="checkbox" name="[% name %]"
679 value="[% value %]" [% is_checked_label %]> [% field_label %]
680 SOMELONGSTRING
681 }
682  
683 1 ▶sub FORM_END {
Subroutine FORM_END: called CC=1 SCAR=0.0
Pod undocumented
684 1 return <<'SOMELONGSTRING';
685 </form>
686 SOMELONGSTRING
687 }
688  
689 1 ▶sub FORM_HIDDEN {
Subroutine FORM_HIDDEN: called CC=1 SCAR=0.0
Pod undocumented
690 1 return <<'SOMELONGSTRING';
691 <input type="hidden" name="[% name %]" value="[% value %]">
692 SOMELONGSTRING
693 }
694  
695 1 ▶sub FORM_LOGIN {
Subroutine FORM_LOGIN: called CC=1 SCAR=0.0
Pod undocumented
696 1 return <<'SOMELONGSTRING';
697 [% INCLUDE form_select( iterator = OI.get_users(),
698 first_label = MSG( 'form.default.user_list_first' ),
699 value_field = 'id',
700 label_field = 'login_name' ) -%]
701  
702 SOMELONGSTRING
703 }
704  
705 1 ▶sub FORM_PASSWORD {
Subroutine FORM_PASSWORD: called CC=1 SCAR=0.0
Pod undocumented
706 1 return <<'SOMELONGSTRING';
707 [%- DEFAULT size = 20;
708 DEFAULT maxlength = 50 -%]
709 [%- field_pre_label -%]
710 <input type="password" name="[% name %]"
711 size="[% size %]" maxlength="[% maxlength %]">
712 [%- field_label -%]
713 SOMELONGSTRING
714 }
715  
716 1 ▶sub FORM_RADIO {
Subroutine FORM_RADIO: called CC=1 SCAR=0.0
Pod undocumented
717 1 return <<'SOMELONGSTRING';
718 [%- is_picked = ( value == picked ) ? ' CHECKED' : '' -%]
719 <input type="radio" name="[% name %]" value="[% value %]"[% is_picked %]>
720 SOMELONGSTRING
721 }
722  
723 1 ▶sub FORM_RADIOSET {
Subroutine FORM_RADIOSET: called CC=1 SCAR=0.0
Pod undocumented
724 1 return <<'SOMELONGSTRING';
725 [% FOREACH val = value;
726 idx = loop.count - 1;
727 this_label = ( label.$idx ) ? label.$idx : val;
728 PROCESS form_radio( name = name,
729 value = val,
730 picked = picked ) %] [% this_label %] [% separator %]
731 [%- END %]
732  
733 SOMELONGSTRING
734 }
735  
736 1 ▶sub FORM_RESET {
Subroutine FORM_RESET: called CC=1 SCAR=0.0
Pod undocumented
737 1 return <<'SOMELONGSTRING';
738 [%- IF value_key;
739 value = MSG( value_key );
740 END;
741 DEFAULT value = MSG( 'global.button.reset' );
742 -%]
743 <input type="reset" value="[% value %]">
744 SOMELONGSTRING
745 }
746  
747 1 ▶sub FORM_SELECT {
Subroutine FORM_SELECT: called CC=1 SCAR=0.0
Pod undocumented
748 1 return <<'SOMELONGSTRING';
749 [%########################################
750 form_select( name(*), list/iterator(*), value_field(*), label_field,
751 picked, first_label, first_blank, is_multiple, size, field_label )
752 Create a SELECT dropdown box where the options are specified by
753 objects in 'list' or 'iterator'
754 ########################################-%]
755  
756 [%- INCLUDE form_select_intro -%]
757 [%- IF first_label OR first_blank -%]
758 <option value="">[% first_label %]</option>
759 [%- END -%]
760 [% IF plain %][% INCLUDE form_select_options_plain_list -%]
761 [% ELSIF iterator %][% INCLUDE form_select_options_iterator -%]
762 [% ELSE %][% INCLUDE form_select_options_list -%][% END -%]
763 </select> [% field_label %]
764 SOMELONGSTRING
765 }
766  
767 1 ▶sub FORM_SELECT_INTRO {
Subroutine FORM_SELECT_INTRO: called CC=1 SCAR=0.0
Pod undocumented
768 1 return <<'SOMELONGSTRING';
769 [%- param_multiple = ( is_multiple ) ? 'MULTIPLE' : '';
770 param_size = ( size ) ? "SIZE='$size'" : ''; -%]
771 <select name="[% name %]" [% param_multiple %] [% param_size %]>
772 SOMELONGSTRING
773 }
774  
775 1 ▶sub FORM_SELECT_OPTION {
Subroutine FORM_SELECT_OPTION: called CC=1 SCAR=0.0
Pod undocumented
776 1 return <<'SOMELONGSTRING';
777 [%- UNLESS plain -%]
778 [%- SET use_label_field = label_field || value_field;
779 SET value = item.$value_field;
780 SET label = item.$use_label_field; -%]
781 [%- END -%]
782 [%- SET is_picked = ( value == picked ) ? ' SELECTED' : '' -%]
783 <option value="[% value %]"[% is_picked %]>[% label %]</option>
784  
785 SOMELONGSTRING
786 }
787  
788 1 ▶sub FORM_SELECT_OPTIONS_ITERATOR {
Subroutine FORM_SELECT_OPTIONS_ITERATOR: called CC=1 SCAR=0.0
Pod undocumented
789 1 return <<'SOMELONGSTRING';
790 [%- WHILE ( item = iterator.get_next ) -%]
791 [%- INCLUDE form_select_option -%]
792 [%- END -%]
793 SOMELONGSTRING
794 }
795  
796 1 ▶sub FORM_SELECT_OPTIONS_LIST {
Subroutine FORM_SELECT_OPTIONS_LIST: called CC=1 SCAR=0.0
Pod undocumented
797 1 return <<'SOMELONGSTRING';
798 [%- FOREACH item = list -%]
799 [%- INCLUDE form_select_option -%]
800 [%- END -%]
801 SOMELONGSTRING
802 }
803  
804 1 ▶sub FORM_SELECT_OPTIONS_PLAIN_LIST {
Subroutine FORM_SELECT_OPTIONS_PLAIN_LIST: called CC=1 SCAR=0.0
Pod undocumented
805 1 return <<'SOMELONGSTRING';
806 [%- FOREACH idx = [ 0..value_list.max ] -%]
807 [%- SET label = ( label_list.$idx ) ? label_list.$idx : value_list.$idx;
808 SET value = value_list.$idx -%]
809 [%- INCLUDE form_select_option -%]
810 [%- END -%]
811 SOMELONGSTRING
812 }
813  
814 1 ▶sub FORM_SUBMIT {
Subroutine FORM_SUBMIT: called CC=1 SCAR=0.0
Pod undocumented
815 1 return <<'SOMELONGSTRING';
816 [%- DEFAULT name = 'form_submit';
817 IF value_key;
818 value = MSG( value_key );
819 END;
820 DEFAULT value = MSG( 'global.button.submit' );
821 -%]
822 <input type="submit" value="[% value %]" name="[% name %]"> [% field_label %]
823 SOMELONGSTRING
824 }
825  
826 1 ▶sub FORM_SUBMIT_ROW {
Subroutine FORM_SUBMIT_ROW: called CC=1 SCAR=0.0
Pod undocumented
827 1 return <<'SOMELONGSTRING';
828 [%- DEFAULT colspan = 2 -%]
829 <tr [% INCLUDE row_color %] align="right">
830 <td colspan="[% colspan %]">
831 [%- IF reset %][% INCLUDE form_reset( value = reset_label, value_key = reset_label_key ) %][% END -%]
832 [%- INCLUDE form_submit -%]
833 </td>
834 </tr>
835 SOMELONGSTRING
836 }
837  
838 1 ▶sub FORM_TEXT {
Subroutine FORM_TEXT: called CC=1 SCAR=0.0
Pod undocumented
839 1 return <<'SOMELONGSTRING';
840 [%- DEFAULT size = 20;
841 DEFAULT maxlength = 50; -%]
842 [%- field_pre_label -%]
843 <input type="text" name="[% name %]" value="[% value %]"
844 size="[% size %]" maxlength="[% maxlength %]">
845 [%- field_label -%]
846 SOMELONGSTRING
847 }
848  
849 1 ▶sub FORM_TEXTAREA {
Subroutine FORM_TEXTAREA: called CC=1 SCAR=0.0
Pod undocumented
850 1 return <<'SOMELONGSTRING';
851 [%- DEFAULT rows = 3;
852 DEFAULT cols = 30;
853 DEFAULT wrap = 'virtual' -%]
854 <textarea name="[% name %]" wrap="[% wrap %]"
855 rows="[% rows %]" cols="[% cols %]">[% value %]</textarea>
856 [%- field_label -%]
857 SOMELONGSTRING
858 }
859  
860 1 ▶sub FORM_UPLOAD {
Subroutine FORM_UPLOAD: called CC=1 SCAR=0.0
Pod undocumented
861 1 return <<'SOMELONGSTRING';
862 [%- field_pre_label -%]
863 <input type="file" name="[% name %]">
864 [%- field_label -%]
865 SOMELONGSTRING
866 }
867  
868 1 ▶sub GLOBAL_JAVASCRIPT {
Subroutine GLOBAL_JAVASCRIPT: called CC=1 SCAR=0.0
Pod undocumented
869 1 return <<'SOMELONGSTRING';
870 function confirm_remove( object_type, name, url ) {
871 var msg = [% MSG( 'global_javascript.confirm_remove' ) %]
872 if ( confirm( msg ) ) {
873 self.location = url;
874 }
875 }
876  
877 SOMELONGSTRING
878 }
879  
880 1 ▶sub HEADER_CELL {
Subroutine HEADER_CELL: called CC=1 SCAR=0.0
Pod undocumented
881 1 return <<'SOMELONGSTRING';
882 <td>[% INCLUDE show_label %]</td>
883  
884 SOMELONGSTRING
885 }
886  
887 1 ▶sub HEADER_ROW {
Subroutine HEADER_ROW: called CC=1 SCAR=0.0
Pod undocumented
888 1 return <<'SOMELONGSTRING';
889 <tr valign="bottom" align="center">
890 [%- IF labels;
891 FOREACH label = labels;
892 INCLUDE header_cell;
893 END;
894 ELSIF label_keys;
895 FOREACH label_key = label_keys;
896 INCLUDE header_cell;
897 END;
898 END -%]
899 </tr>
900 SOMELONGSTRING
901 }
902  
903 1 ▶sub INACTIVE_OBJECT_BANNER {
Subroutine INACTIVE_OBJECT_BANNER: called CC=1 SCAR=0.0
Pod undocumented
904 1 return <<'SOMELONGSTRING';
905 [% IF object.active == 'no' OR object.is_active == 'no' -%]
906 [%- DEFAULT theme = OI.theme_properties -%]
907 <table width="100%" bgcolor="#000000">
908 <tr><td align="center">
909 <font size="+1" color="#ffffff"><b>[% MSG( 'inactive_object.title' ) %]</b></font>
910 </td></tr>
911 </table>
912 [% END -%]
913 SOMELONGSTRING
914 }
915  
916 1 ▶sub LABEL_ERROR_ROW_EXTRA {
Subroutine LABEL_ERROR_ROW_EXTRA: called CC=1 SCAR=0.0
Pod undocumented
917 1 return <<'SOMELONGSTRING';
918 <tr bgcolor="[% color %]">
919 <td colspan="2">[% message %]</td>
920 </tr>
921  
922 SOMELONGSTRING
923 }
924  
925 1 ▶sub LABEL_FORM_CHECKBOX_ROW {
Subroutine LABEL_FORM_CHECKBOX_ROW: called CC=1 SCAR=0.0
Pod undocumented
926 1 return <<'SOMELONGSTRING';
927 [%########################################
928 label_form_checkbox_row( label, count, name, value, field_label, picked )
929 Display a row to input text: label on left, text input on
930 right. Optional 'checkbox_label' will be to right of checkbox.
931 ########################################-%]
932  
933 [%- DEFAULT colspan = 2;
934 IF action_messages.$name;
935 color = '#ffffe0';
936 END; -%]
937 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
938 [%- INCLUDE data_cell_begin -%][% INCLUDE form_checkbox %]
939 </td></tr>
940 [% IF action_messages.$name -%]
941 [% INCLUDE label_error_row_extra( color = color,
942 message = action_messages.$name ) -%]
943 [% END -%]
944  
945 SOMELONGSTRING
946 }
947  
948 1 ▶sub LABEL_FORM_DATE_ROW {
Subroutine LABEL_FORM_DATE_ROW: called CC=1 SCAR=0.0
Pod undocumented
949 1 return <<'SOMELONGSTRING';
950 [%########################################
951 label_form_date_row( label, count, name, value, field_label )
952 Display a row to input a date: label on left, date input on right.
953 ########################################-%]
954  
955 [%- DEFAULT colspan = 2;
956 IF action_messages.$name;
957 color = '#ffffe0';
958 END; -%]
959 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
960 [%- INCLUDE data_cell_begin -%]
961 [%- object = ( date_object ) ? date_object : OI.date_into_object( value ) -%]
962 [%- PROCESS date_select( field_prefix = name ) -%]
963 [% field_label -%]
964 </td></tr>
965 [% IF action_messages.$name -%]
966 [% INCLUDE label_error_row_extra( color = color,
967 message = action_messages.$name ) -%]
968 [% END -%]
969  
970 SOMELONGSTRING
971 }
972  
973 1 ▶sub LABEL_FORM_LOGIN_ROW {
Subroutine LABEL_FORM_LOGIN_ROW: called CC=1 SCAR=0.0
Pod undocumented
974 1 return <<'SOMELONGSTRING';
975 [%########################################
976 label_form_login_row( label, name, picked )
977 SELECT box of all users in the system, with the ID of the one
978 picked highlighted.
979 ########################################-%]
980  
981 [%- DEFAULT label = 'Users';
982 DEFAULT colspan = 2;
983 IF action_messages.$name;
984 color = '#ffffe0';
985 END; -%]
986 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
987 [%- INCLUDE data_cell_begin -%]
988 [%- INCLUDE form_login() -%]
989 [% field_label -%]
990 </td></tr>
991  
992 SOMELONGSTRING
993 }
994  
995 1 ▶sub LABEL_FORM_RADIO_ROW {
Subroutine LABEL_FORM_RADIO_ROW: called CC=1 SCAR=0.0
Pod undocumented
996 1 return <<'SOMELONGSTRING';
997 [%########################################
998 label_form_radio_row( label, name, list, picked )
999 Row with a radio button + label for each item in list.
1000 ########################################-%]
1001  
1002 [%- DEFAULT colspan = 2;
1003 IF action_messages.$name;
1004 color = '#ffffe0';
1005 END; -%]
1006 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
1007 [%- INCLUDE data_cell_begin() -%]
1008 [% FOREACH value = list -%]
1009 [%- INCLUDE form_radio %] [% value %][% UNLESS loop.last %] | [% END -%]
1010 [% END -%]
1011 </td></tr>
1012 [% IF action_messages.$name -%]
1013 [% INCLUDE label_error_row_extra( color = color,
1014 message = action_messages.$name ) -%]
1015 [% END -%]
1016  
1017 SOMELONGSTRING
1018 }
1019  
1020 1 ▶sub LABEL_FORM_SELECT_ROW {
Subroutine LABEL_FORM_SELECT_ROW: called CC=1 SCAR=0.0
Pod undocumented
1021 1 return <<'SOMELONGSTRING';
1022 [%########################################
1023 label_form_select_row( label, name, list/iterator, value_field, label_field,
1024 picked, first_label, is_multiple, size, field_label )
1025 Form row with a label and SELECT item.
1026 ########################################-%]
1027  
1028 [%- DEFAULT colspan = 2;
1029 IF action_messages.$name;
1030 color = '#ffffe0';
1031 END; -%]
1032 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
1033 [%- INCLUDE data_cell_begin -%][% INCLUDE form_select -%]
1034 </td></tr>
1035 [% IF action_messages.$name -%]
1036 [% INCLUDE label_error_row_extra( color = color,
1037 message = action_messages.$name ) -%]
1038 [% END -%]
1039  
1040 SOMELONGSTRING
1041 }
1042  
1043 1 ▶sub LABEL_FORM_TEXT_ROW {
Subroutine LABEL_FORM_TEXT_ROW: called CC=1 SCAR=0.0
Pod undocumented
1044 1 return <<'SOMELONGSTRING';
1045 [%########################################
1046 label_form_text_row( label, count, name, value, field_label )
1047 Display a row to input text: label on left, text input on right.
1048 ########################################-%]
1049  
1050 [%- DEFAULT colspan = 2;
1051 IF action_errors.$name;
1052 color = '#ffffe0';
1053 END; -%]
1054 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
1055 [%- INCLUDE data_cell_begin %][% INCLUDE form_text %]
1056 </td></tr>
1057 [% IF action_messages.$name -%]
1058 [% INCLUDE label_error_row_extra( color = color,
1059 message = action_messages.$name ) -%]
1060 [% END -%]
1061  
1062 SOMELONGSTRING
1063 }
1064  
1065 1 ▶sub LABEL_FORM_TEXTAREA_ROW {
Subroutine LABEL_FORM_TEXTAREA_ROW: called CC=1 SCAR=0.0
Pod undocumented
1066 1 return <<'SOMELONGSTRING';
1067 [%########################################
1068 label_form_textarea_row( label, count, name, value, rows, cols, wrap, colspan )
1069 Display a row to input text in a textarea (multiline) widget; :
1070 label on left, text input on right. If you specify 'colspan' then
1071 the widget will appear below the label.
1072 ########################################-%]
1073  
1074 [%- DEFAULT colspan = 1;
1075 IF action_messages.$name;
1076 color = '#ffffe0';
1077 END; -%]
1078 [%- INCLUDE label_row_begin -%]
1079 [% IF colspan > 1 -%]
1080 </tr>
1081 <tr [% INCLUDE row_color %]>
1082 [% END -%]
1083 <td colspan="[% colspan %]">
1084 [%- INCLUDE form_textarea -%]
1085 </td>
1086 </tr>
1087 [% IF action_messages.$name -%]
1088 [% INCLUDE label_error_row_extra( color = color,
1089 message = action_messages.$name ) -%]
1090 [% END -%]
1091  
1092 SOMELONGSTRING
1093 }
1094  
1095 1 ▶sub LABEL_FORM_UPLOAD_ROW {
Subroutine LABEL_FORM_UPLOAD_ROW: called CC=1 SCAR=0.0
Pod undocumented
1096 1 return <<'SOMELONGSTRING';
1097 [%########################################
1098 label_form_upload_row( label, count, name, field_label )
1099 Display a row to upload a file: label on left, file input on right.
1100 ########################################-%]
1101  
1102 [%- DEFAULT colspan = 2;
1103 IF action_messages.$name;
1104 color = '#ffffe0';
1105 END; -%]
1106 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
1107 [%- INCLUDE data_cell_begin %][% INCLUDE form_upload %]
1108 </td></tr>
1109 [% IF action_messages.$name -%]
1110 [% INCLUDE label_error_row_extra( color = color,
1111 message = action_messages.$name ) -%]
1112 [% END -%]
1113  
1114 SOMELONGSTRING
1115 }
1116  
1117 1 ▶sub LABEL_ROW {
Subroutine LABEL_ROW: called CC=1 SCAR=0.0
Pod undocumented
1118 1 return <<'SOMELONGSTRING';
1119 [%########################################
1120 label_row( align, valign, colspan, color )
1121 Display a simple label row. Default of 'align' is 'center',
1122 'colspan' is 2, 'valign' is 'bottom'
1123 ########################################-%]
1124 [%- DEFAULT colspan = 2;
1125 DEFAULT color = '#ffffe0';
1126 DEFAULT align = 'center';
1127 DEFAULT valign = 'bottom'; -%]
1128 [%- INCLUDE label_row_begin() -%]
1129 </tr>
1130 SOMELONGSTRING
1131 }
1132  
1133 1 ▶sub LABEL_ROW_BEGIN {
Subroutine LABEL_ROW_BEGIN: called CC=1 SCAR=0.0
Pod undocumented
1134 1 return <<'SOMELONGSTRING';
1135 [%########################################
1136 label_row_begin( label, align, valign, count, colspan )
1137 Display the row start and label for a text/form element
1138 row. Defaults: align = 'right', colspan = 1, valign = 'middle'
1139 ########################################-%]
1140 [%- DEFAULT colspan = 1;
1141 SET row_valign = valign || 'middle';
1142 SET label_align = align || 'right'; -%]
1143 <tr valign="[% row_valign %]" [% INCLUDE row_color %]>
1144 <td align="[% label_align %]" colspan="[% colspan %]">
1145 [%- PROCESS show_label -%]
1146 </td>
1147 SOMELONGSTRING
1148 }
1149  
1150 1 ▶sub LABEL_TEXT_ROW {
Subroutine LABEL_TEXT_ROW: called CC=1 SCAR=0.0
Pod undocumented
1151 1 return <<'SOMELONGSTRING';
1152 [%########################################
1153 label_text_row( label, count, text )
1154 Create a row with a label on the left and plain text on the right.
1155 ########################################-%]
1156  
1157 [%- DEFAULT colspan = 2; -%]
1158 [%- INCLUDE label_row_begin( colspan = 1 ) -%]
1159 [%- INCLUDE data_cell_begin -%][% text %]&nbsp;
1160 </td></tr>
1161 SOMELONGSTRING
1162 }
1163  
1164 1 ▶sub OBJECT_UPDATES {
Subroutine OBJECT_UPDATES: called CC=1 SCAR=0.0
Pod undocumented
1165 1 return <<'SOMELONGSTRING';
1166 [%- IF update_list.size == 0 -%]
1167 [% MSG( 'object_updates.new' ) %]
1168 [%- ELSE -%]
1169 <table border="0" cellpadding="3" cellspacing="0">
1170 [% FOREACH item = update_list -%]
1171 <tr><td><font size="-1">[% item.login_name %]</font></td>
1172 <td><font size="-1">[% item.date %]</font></td>
1173 <td><font size="-1">[% item.notes %]</font></td></tr>
1174 [%- END %]
1175 </table>
1176 [%- END -%]
1177  
1178 SOMELONGSTRING
1179 }
1180  
1181 1 ▶sub PAGE_COUNT {
Subroutine PAGE_COUNT: called CC=1 SCAR=0.0
Pod undocumented
1182 1 return <<'SOMELONGSTRING';
1183 [%#########################################
1184 page_count( total_pages, current_pagenum, url, break_count )
1185 Component to display the total number of pages and for each of
1186 the pages not current link it to a URL to display that page.
1187  
1188 Parameters:
1189 total_pages - Total number of pages in result set
1190 current_pagenum - Page you are currently on
1191 url - URL to which we append ';pagenum=x'
1192 break_count - number of pages to display on a line
1193  
1194 Defaults:
1195 break_count = 20
1196 ########################################-%]
1197 <!-- Given: total: [% total_pages %]; current: [% current_pagenum %]; url: [% url %]; break: [% break_count %] -->
1198 [%- DEFAULT break_count = 20 -%]
1199 [%- MSG( 'page_count.page_label' ) %]&nbsp;[&nbsp;
1200 [%- IF current_pagenum != 1 -%]
1201 <a href="[% url %];page=1">&lt;&lt;</a>&nbsp;
1202 <a href="[% url %];page=[% current_pagenum - 1 %]">&lt;</a>&nbsp;
1203 [%- END -%]
1204 [%- FOREACH page_count = [ 1 .. total_pages ] -%]
1205 [%- IF page_count == current_pagenum %][% page_count %]
1206 [%- ELSE %]<a href="[% url %];page=[% page_count %]">[% page_count %]</a>
1207 [%- END -%]
1208 [%- IF page_count mod break_count == 0 -%]<br>[% ELSE %]&nbsp;[% END -%]
1209 [%- END -%]
1210 [%- IF current_pagenum != total_pages -%]
1211 <a href="[% url %];page=[% current_pagenum + 1 %]">&gt;</a>
1212 <a href="[% url %];page=[% total_pages%]">&gt;&gt;</a>
1213 &nbsp;
1214 [%- END -%]
1215 ]
1216 SOMELONGSTRING
1217 }
1218  
1219 1 ▶sub ROW_COLOR {
Subroutine ROW_COLOR: called CC=1 SCAR=0.0
Pod undocumented
1220 1 return <<'SOMELONGSTRING';
1221 [%########################################
1222 row_color( count, color )
1223 Retrieve the row color for row 'count' (default: 1 ). You can
1224 also pass in 'color' which overrides (kind of pointless, but it
1225 can be useful).
1226 ########################################-%]
1227 bgcolor="
1228 [%- IF color %][% color -%]
1229 [%- ELSE -%]
1230 [%- DEFAULT theme = OI.theme_properties;
1231 DEFAULT count = 1; -%]
1232 [%- ( count mod 2 == 0 ) ? theme.even_color : theme.odd_color -%]
1233 [%- END -%]
1234 "
1235 SOMELONGSTRING
1236 }
1237  
1238 1 ▶sub SEARCH_RESULTS_PAGE_LISTING {
Subroutine SEARCH_RESULTS_PAGE_LISTING: called CC=1 SCAR=0.0
Pod undocumented
1239 1 return <<'SOMELONGSTRING';
1240 [%########################################
1241 search_results_page_listing( table_width, search_results_key, search_id, align,
1242 base_url, total_pages, current_page )
1243 Generate a table of the specified width with the search results
1244 listing in it.
1245  
1246 Parameters
1247 table_width - width of the table
1248 search_results_key - name of field to set the search results key to
1249 search_id - ID to retrieve search results
1250 align - align the listing
1251 base_url - URL to which we append ?$search_results_key=$search_id;pagenum=x
1252 so we can get more search results
1253 total_pages - total pages in resultset
1254 current_page - what page you're on
1255  
1256 Defaults
1257 align - 'right'
1258 table_width - '90%'
1259 search_results_key - 'search_id'
1260
1261 ########################################-%]
1262 [%- DEFAULT align = 'right';
1263 DEFAULT table_width = '90%';
1264 DEFAULT search_results_key = 'search_id'; -%]
1265 <table border="0" width="[% table_width %]"
1266 cellpadding="2" cellspacing="0">
1267 <tr><td align="[% align %]">
1268 [%- return_url = "$base_url?$search_results_key=$search_id" -%]
1269 <font size="-1">
1270 [%- PROCESS page_count( total_pages = total_pages,
1271 current_pagenum = current_page,
1272 url = return_url ) -%]
1273 </font>
1274 </td></tr>
1275 </table>
1276 SOMELONGSTRING
1277 }
1278  
1279 1 ▶sub SHOW_LABEL {
Subroutine SHOW_LABEL: called CC=1 SCAR=0.0
Pod undocumented
1280 1 return <<'SOMELONGSTRING';
1281 [%########################################
1282 show_label( label, is_required, required_display, pre_label, post_label )
1283 Display a label. If it's required, pass in a true value for
1284 'is_required'. If it's required and you don't pass anything in
1285 for 'required_display' we use what's in the theme.
1286 ########################################-%]
1287 [%- req = '' -%]
1288 [% IF is_required -%]
1289 [%- IF NOT required_display -%]
1290 [%- required_display = OI.theme_properties.required -%]
1291 [%- END -%]
1292 [%- req = required_display -%]
1293 [% END %]
1294 [%- IF NOT label AND label_key;
1295 label = MSG( label_key );
1296 END -%]
1297 [% pre_label %]<b>[% label %]</b>[% req %][% post_label %]
1298 SOMELONGSTRING
1299 }
1300  
1301 1 ▶sub STATUS_MESSAGE {
Subroutine STATUS_MESSAGE: called CC=1 SCAR=0.0
Pod undocumented
1302 1 return <<'SOMELONGSTRING';
1303 [%- IF NOT status_msg;
1304 status_msg = OI.action_param( 'status_msg' ) || OI.request.message( 'status_msg' );
1305 END -%]
1306  
1307 [%- IF status_msg -%]
1308  
1309 [%- DEFAULT theme = OI.theme_properties;
1310 SET status_width = width || '50%';
1311 SET status_font_color = font_color || '#000000';
1312 SET status_border = border_color || theme.border_color;
1313 SET status_bgcolor = bgcolor ||theme.even_bgcolor; -%]
1314  
1315 <!-- BEGIN status display -->
1316  
1317 <div align="center">
1318  
1319 [%- INCLUDE table_bordered_begin( table_width = status_width,
1320 bgcolor = status_bgcolor,
1321 border_color = status_border ) -%]
1322  
1323 <tr><td align="center">
1324 <font color="[% status_font_color %]" size="+1"><b>Status</b></font>
1325 </td></tr>
1326 <tr><td>
1327 [% FOREACH status = status_msg -%]
1328 <p>[% theme.bullet %] <font color="[% status_font_color %]">[% status %]</font></p>
1329 [% END -%]
1330 </td></tr>
1331  
1332 [%- PROCESS table_bordered_end -%]
1333  
1334 </div>
1335  
1336 <!-- END status display -->
1337  
1338 [%- END -%]
1339 SOMELONGSTRING
1340 }
1341  
1342 1 ▶sub TABLE_BORDERED_BEGIN {
Subroutine TABLE_BORDERED_BEGIN: called CC=1 SCAR=0.0
Pod undocumented
1343 1 return <<'SOMELONGSTRING';
1344 [%########################################
1345 table_bordered_begin( table_width, bgcolor, border_width, border_color)
1346 Begin a bordered table. Border color is set in theme, just pass
1347 in the table width (no default) and border width (in pixels, default: 2)
1348 ########################################-%]
1349  
1350 [%- DEFAULT theme = OI.theme_properties;
1351 DEFAULT border_width = 2;
1352 DEFAULT border_color = theme.border_color;
1353 DEFAULT bgcolor = theme.bgcolor;
1354 DEFAULT internal_padding = 5;
1355 SET internal_padding = '0' IF internal_padding == 'none';
1356 SET width = ( table_width ) ? "width='$table_width'" : '' -%]
1357 <table border="0" cellspacing="0" [% width -%]
1358 bgcolor="[% border_color %]"
1359 cellpadding="[% border_width %]">
1360 <tr><td>
1361  
1362 <table border="0" width="100%"
1363 cellpadding="[% internal_padding %]" cellspacing="0"
1364 bgcolor="[% bgcolor %]">
1365 SOMELONGSTRING
1366 }
1367  
1368 1 ▶sub TABLE_BORDERED_END {
Subroutine TABLE_BORDERED_END: called CC=1 SCAR=0.0
Pod undocumented
1369 1 return <<'SOMELONGSTRING';
1370 [%########################################
1371 table_bordered_end()
1372 End a bordered table
1373 ########################################-%]
1374  
1375 </table>
1376 </td></tr>
1377 </table>
1378 SOMELONGSTRING
1379 }
1380  
1381 1 ▶sub TO_GROUP {
Subroutine TO_GROUP: called CC=1 SCAR=0.0
Pod undocumented
1382 1 return <<'SOMELONGSTRING';
1383 [%########################################
1384 to_group()
1385 Display a from and to SELECT box (SIZEd) for moving items from
1386 one group to another, plus the Javascript necessary to make it
1387 happen.
1388  
1389 This is not a complete form, just a self-contained table you can
1390 place anywhere you wish.
1391  
1392 To make this work, you must have an onSubmit handler for your
1393 form; just add this to the form tag:
1394  
1395 onsubmit="return tally_added_items()"
1396  
1397 In your application, all the 'id' values will be
1398 semicolon-separated in a form field named whatever the
1399 'mem_list_hold' variable was set to.
1400  
1401 Parameters:
1402 form_name - name of form where these items reside
1403 from_element - name of the SELECT control that has the population of records
1404 to_element - name of the SELECT control that has the member records
1405 pop_list - list of population record hashrefs: id = x, name = y
1406 mem_list - list of member record hashrefs: id = x, name = y
1407 mem_list_hold - name of hidden variable that will hold the ID numbers
1408 label_from - label to place over SELECT control with population
1409 label_to - label to place over SELECT control with members
1410 id_field - hash key under which the ID (or 'OPTION' value) is stored
1411 name_field - hash key under which the value is stored
1412 list_size - size of SELECT lists (DEFAULT: 6)
1413  
1414 Defaults:
1415 id_field = 'id'
1416 name_field = 'name'
1417 list_size = 6
1418 ########################################%]
1419  
1420 [%- DEFAULT id_field = 'id';
1421 DEFAULT name_field = 'name';
1422 DEFAULT list_size = 6; -%]
1423  
1424 <!-- Begin table with to_group tool -->
1425  
1426 <table border="0" cellspacing="0" cellpadding="5">
1427 <tr>
1428 <td align="center">
1429 <b>[% label_from %]</b>
1430 </td>
1431 <td align="center">&nbsp;</td>
1432 <td align="center" colspan="2">
1433 <b>[% label_to %] </b>
1434 </td>
1435 </tr>
1436 <tr>
1437 <td align="right" valign="bottom">
1438 <select name="[% from_element %]" size="[% list_size %]">
1439 [% FOREACH pop_item = pop_list %]
1440 <option value="[% pop_item.$id_field %]">[% pop_item.$name_field %] </option>
1441 [% END %]
1442 </select>
1443 </td>
1444 <td align="center" valign="middle">
1445 <input type="button" name="add" value="&gt;&gt;" onclick="add_item()"><br>
1446 <input type="button" name="remove" value="&lt;&lt;" onclick="remove_item()"><br>
1447 </td>
1448 <td align="left" valign="bottom">
1449 <select name="[% to_element %]" size="6">
1450 [% FOREACH mem_item = mem_list %]
1451 <option value="[% mem_item.$id_field %]">[% mem_item.$name_field %] </option>
1452 [% END %]
1453 </select>
1454 </td>
1455 <td align="left" valign="middle">
1456 <input type="button" value="^" onclick="raise_item()"><br>
1457 <input type="button" value="\/" onclick="lower_item()"><br>
1458 </td>
1459 </tr>
1460 </table>
1461 <input type="hidden" name="[% mem_list_hold %]">
1462 <!-- End table with to_group tool -->
1463  
1464  
1465 <script language="javascript">
1466  
1467 // NAME of the form we're editing
1468  
1469 var edit_form_name = '[% form_name %]';
1470  
1471 // NAME of the element that has the list of ALL items
1472  
1473 var from_element = '[% from_element %]';
1474  
1475 // NAME of the element that has the member list
1476  
1477 var to_element = '[% to_element %]';
1478  
1479 // NAME of the hidden variable that will hold the
1480 // packed value of all the member items.
1481  
1482 var mem_list_hold = '[% mem_list_hold %]';
1483  
1484 [%#
1485 NOTE: There are no other TT-modified variables below this point;
1486 just Javascript.
1487 -%]
1488  
1489 // Raise an item in the listings. Remove the option
1490 // above the one selected.
1491  
1492 function raise_item() {
1493 var form = self.document[ edit_form_name ];
1494 var members = form[ to_element ];
1495 var idx = members.selectedIndex;
1496  
1497 // alert( 'Selected index: ' + idx );
1498  
1499 if ( idx == 0 ) {
1500 alert( 'Cannot raise an item already at the top!' );
1501 return false;
1502 }
1503  
1504 var new_opts = new Array();
1505
1506 // Remove the option above the one selected
1507 // and save it.
1508  
1509 var save_idx = idx - 1;
1510 new_opts[0] = new Option( members.options[ save_idx ].text, members.options[ save_idx ].value );
1511 members.options[ save_idx ] = null;
1512  
1513 // confirm( 'Value of first option: ' + new_opts[0].value + ' -- ' + new_opts[0].text );
1514  
1515 var end_list = members.options.length - 1;
1516 var this_opt;
1517 for ( i = end_list; i >= idx; i-- ) {
1518 // alert( 'Trying option: ' + i );
1519 this_opt = new Option( members.options[ i ].text, members.options[ i ].value );
1520 new_opts.push( this_opt );
1521 members.options[ i ] = null;
1522 // confirm( 'Value of option just added for space ' + i + ': ' + this_opt.value + ' -- ' + this_opt.text );
1523 }
1524  
1525 for ( j = 0; j < new_opts.length; j++ ) {
1526 this_opt = new_opts[ j ];
1527 // confirm( 'Going to add: ' + this_opt.value + ' -- ' + this_opt.text );
1528 members.options[ members.options.length ] = new Option( this_opt.text, this_opt.value );
1529 }
1530 return true;
1531 }
1532  
1533 // Lower an item in the listings -- first remove
1534 // it OI.from its place as well as all items below,
1535 // then reinsert the items at the end.
1536  
1537 function lower_item() {
1538 var form = self.document[ edit_form_name ];
1539 var members = form[ to_element ];
1540 var idx = members.selectedIndex;
1541 if ( idx == members.options.length - 1 ) {
1542 alert( 'Cannot lower an item already at the bottom!' );
1543 return false;
1544 }
1545  
1546 var new_opts = new Array();
1547  
1548 // Put the option selected at the head of the options
1549 // to be inserted.
1550  
1551 new_opts[0] = new Option( members.options[ idx ].text, members.options[ idx ].value );
1552  
1553 // Remove the option selected. members.options[ idx ]
1554 // will be the option that 'moves up'.
1555  
1556 members.options[ idx ] = null
1557  
1558 // alert( 'Value of first option: ' + new_opts[0].value );
1559  
1560 // Cycle down OI.from the end of the list and eliminate
1561 // options, saving them in the new_opts list.
1562  
1563 var end_list = members.options.length - 1;
1564 var this_opt;
1565 for ( i = end_list; i > idx; i-- ) {
1566 this_opt = new Option( members.options[ i ].text, members.options[ i ].value );
1567 new_opts.push( this_opt );
1568 members.options[ i ] = null;
1569 // alert( 'Value of option just added: ' + new_opts[ new_opts.length - 1 ].value );
1570 }
1571  
1572 // Now, cycle through the saved options and add each in
1573 // turn to the end of the displayed options.
1574  
1575 for ( j = 0; j < new_opts.length; j++ ) {
1576 this_opt = new Option( new_opts[ j ].text, new_opts[ j ].value );
1577 members.options[ members.options.length ] = this_opt;
1578 }
1579 return true;
1580 }
1581  
1582  
1583 function add_option ( Element, Text, Value ) {
1584 var form = self.document[edit_form_name];
1585 var members = form[ Element ];
1586 var newopt = new Option( Text , Value );
1587 for ( opt = 0; opt < members.options.length; opt++ ) {
1588 if ( members.options[opt].value == Value )
1589 return false;
1590 }
1591 members.options[ members.options.length ] = newopt;
1592 return true;
1593 }
1594  
1595 function remove_option ( Element, Value ) {
1596 var form = self.document[edit_form_name];
1597 var members = form[Element];
1598 for ( opt = 0; opt < members.options.length; opt++ ) {
1599 if ( members.options[opt].value == Value ) {
1600 members.options[opt] = null;
1601 return true;
1602 }
1603 }
1604 return false;
1605 }
1606  
1607  
1608 function add_item ( ) {
1609 var form = self.document[edit_form_name];
1610 var listing = form[from_element];
1611 var idx = listing.selectedIndex;
1612 if ( idx == -1 ) {
1613 alert('Please pick an item to add!');
1614 return false;
1615 }
1616 if ( listing.options[idx].value == '' ) {
1617 return false;
1618 }
1619 var id = listing.options[idx].value;
1620 var value = listing.options[idx].text;
1621 add_option( to_element, value, id );
1622 remove_option( from_element, id );
1623 return true;
1624 }
1625  
1626  
1627 function remove_item ( ) {
1628 var form = self.document[edit_form_name];
1629 var listing = form[to_element];
1630 var idx = listing.selectedIndex;
1631 if ( idx == -1 ) {
1632 alert('Please pick an item to remove OI.from the member list!');
1633 return false;
1634 }
1635 if ( listing.options[idx].value == '' ) {
1636 return false;
1637 }
1638 var id = listing.options[idx].value;
1639 var value = listing.options[idx].text;
1640 remove_option( to_element, id );
1641 add_option( from_element, value, id );
1642 return true;
1643 }
1644  
1645  
1646 function tally_added_items ( ) {
1647 var form = self.document[edit_form_name];
1648 var listing = form[to_element];
1649 var return_string = '';
1650 for ( opt = 0; opt < listing.options.length; opt++ ) {
1651 if ( listing.options[opt].value != '' )
1652 return_string += listing.options[opt].value + ';';
1653 }
1654 return_string = return_string.substring( 0, return_string.length - 1 );
1655 form[ mem_list_hold ].value = return_string;
1656 // return confirm( 'Value of itemlist: ['+form[mem_list_hold].value+']. Continue?');
1657 return true;
1658 }
1659 </script>
1660 SOMELONGSTRING
1661 }
1662  
« OpenInteract2/SQLInstall.pm ↑ Summary OpenInteract2/ContentGenerator/TT2Process.pm »