diff options
author | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-09-12 18:11:34 +0000 |
---|---|---|
committer | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-09-12 18:11:34 +0000 |
commit | 7adfd53f17f66ffe93763e944ed1d3fc52a369dc (patch) | |
tree | 19e599e74419b41cbbe651fd226b81e8b73551d3 /root | |
parent | c728c97cb1061330e63c7cc048e768ef74988fe6 (diff) | |
download | reaction-7adfd53f17f66ffe93763e944ed1d3fc52a369dc.tar.gz reaction-7adfd53f17f66ffe93763e944ed1d3fc52a369dc.zip |
moved shit to trunk
Diffstat (limited to 'root')
55 files changed, 1204 insertions, 0 deletions
diff --git a/root/bar_form b/root/bar_form new file mode 100644 index 0000000..1eece03 --- /dev/null +++ b/root/bar_form @@ -0,0 +1,6 @@ +[% + +attrs.enctype = 'multipart/form-data'; +PROCESS form_base; + +%] diff --git a/root/bar_list b/root/bar_list new file mode 100644 index 0000000..ce57b74 --- /dev/null +++ b/root/bar_list @@ -0,0 +1,21 @@ +[% + +PROCESS listview; + +table_end_block = 'bar_list_table_end'; + +BLOCK bar_list_table_end; + + "\n</table>\n"; + include( 'create_link_block' ); + "\n<br />\n"; + + enctype = attrs.enctype || 'application/x-www-form-urlencoded'; + %]<form action="[% connect_form %]" method="post" enctype="[% enctype %]"[% + attrs.enctype = ''; process_attrs(self.attrs); '>'; + INCLUDE component type = 'search_base' attrs.value = 'xxx'; + "\n</form>"; + +END; + +%] diff --git a/root/base/actionform b/root/base/actionform new file mode 100644 index 0000000..ab5755b --- /dev/null +++ b/root/base/actionform @@ -0,0 +1 @@ +[% PROCESS form_base %] diff --git a/root/base/button b/root/base/button new file mode 100644 index 0000000..5e09c4d --- /dev/null +++ b/root/base/button @@ -0,0 +1,21 @@ +[% + +PROCESS field_base; + +main_block = 'button_control'; + +BLOCK button_control; + + %]<input type="[% button_type || 'submit' %]" [% + IF attrs.value == ''; + 'value="'; loc(self.value) | html; '" '; + END; + connect_control(self, self.event); + process_attrs(attrs) %] />[% +# IF self.img_src; +# INCLUDE component type = 'image'; +# ELSE; + +END; + +%] diff --git a/root/base/cancelbtn b/root/base/cancelbtn new file mode 100644 index 0000000..a9d8af0 --- /dev/null +++ b/root/base/cancelbtn @@ -0,0 +1,13 @@ +[% + +PROCESS button; + +control_block = 'cancelbtn_control'; + +BLOCK cancelbtn_control; + + INCLUDE button_control attrs.value = 'Cancel' self.event = 'close'; + +END; + +%] diff --git a/root/base/checkbox b/root/base/checkbox new file mode 100644 index 0000000..dd80d86 --- /dev/null +++ b/root/base/checkbox @@ -0,0 +1,22 @@ +[% + +PROCESS field_base; + +control_block = 'checkbox_control'; + +BLOCK checkbox_control; + + %]<input type="checkbox" id="[% id_attr %]" [% + connect_control(self, 'value'); + process_attrs(attrs); + IF self.value; + ' checked="checked"'; + END; + UNLESS attrs.value; + ' value="1"'; + END; + %] />[% + +END; + +%] diff --git a/root/base/checkbox_group b/root/base/checkbox_group new file mode 100644 index 0000000..52660b0 --- /dev/null +++ b/root/base/checkbox_group @@ -0,0 +1,19 @@ +[% + +PROCESS field_base; + +control_block = 'checkbox_group_control'; + +BLOCK checkbox_group_control; + + FOREACH v_name IN self.valid_value_names; + v_val = self.name_to_value_map.$v_name; + %]<input type="checkbox" id="[% id_attr %]" [% connect_control(self, 'value'); + ' value="'; v_val; '"'; + IF self.is_current_value(v_val); ' checked="checked"'; END; + process_attrs(attrs); ' />'; v_name; "\n"; + END; + +END; + +%] diff --git a/root/base/component b/root/base/component new file mode 100644 index 0000000..4f455ce --- /dev/null +++ b/root/base/component @@ -0,0 +1,64 @@ +[%- + +GLOBAL_DEBUG = ctx.debug; + +MACRO loc(text, args) BLOCK; + + ctx.localize(text, args); + +END; + +MACRO include(name, args) BLOCK; + + filename = ${name}; + + IF filename; + IF GLOBAL_DEBUG; + '<!-- Start block '; name | html; ' calling '; filename | html; " -->\n"; + END; + INCLUDE $filename args; + IF GLOBAL_DEBUG; + '<!-- End block '; name | html; " -->\n"; + END; + ELSE; + error = 'Chosen INCLUDE ' _ name _ ' is empty'; + THROW file error; + END; + +END; + +MACRO connect_form(vp, event) BLOCK; + + ''; + +END; + +MACRO connect_control(vp, event, value) BLOCK; + + 'name="'; vp.event_id_for(event); '"'; + +END; + +MACRO connect_href(vp, events) BLOCK; + + FOREACH event = events.keys; + evt_args.${vp.event_id_for(event)} = events.$event; + END; + 'href="'; ctx.req.uri_with(evt_args); '"'; + +END; + +UNLESS type; + errmsg = "type is empty rendering " _ self; + THROW file errmsg; +END; + +PROCESS $type; + +IF GLOBAL_DEBUG; '<!-- Rendering component '; type | html; " -->\n"; END; + +include( 'main_block' ); + +IF GLOBAL_DEBUG; '<!-- End component '; type | html; " -->\n"; END; + +-%] diff --git a/root/base/displayfield/list b/root/base/displayfield/list new file mode 100644 index 0000000..2dcf066 --- /dev/null +++ b/root/base/displayfield/list @@ -0,0 +1,17 @@ +[% + +PROCESS displayfield_base; + +control_block = 'list_control'; + +BLOCK list_control; + + "<ul>\n"; + FOREACH v_val IN self.value_names; + ' <li>'; v_val | html; "</li>\n"; + END; + "</ul>\n"; + +END; + +%] diff --git a/root/base/displayfield/string b/root/base/displayfield/string new file mode 100644 index 0000000..7fa3075 --- /dev/null +++ b/root/base/displayfield/string @@ -0,0 +1,13 @@ +[% + +PROCESS displayfield_base; + +control_block = 'string_control'; + +BLOCK string_control; + + self.value | html; + +END; + +%] diff --git a/root/base/displayfield/text b/root/base/displayfield/text new file mode 100644 index 0000000..dded894 --- /dev/null +++ b/root/base/displayfield/text @@ -0,0 +1,13 @@ +[% + +PROCESS displayfield_base; + +control_block = 'text_control'; + +BLOCK text_control; + + self.value | html; + +END; + +%] diff --git a/root/base/displayfield/value_string b/root/base/displayfield/value_string new file mode 100644 index 0000000..1277e83 --- /dev/null +++ b/root/base/displayfield/value_string @@ -0,0 +1,13 @@ +[% + +PROCESS displayfield_base; + +control_block = 'vstring_control'; + +BLOCK vstring_control; + + self.value_string | html; + +END; + +%] diff --git a/root/base/displayfield_base b/root/base/displayfield_base new file mode 100644 index 0000000..3fdcfca --- /dev/null +++ b/root/base/displayfield_base @@ -0,0 +1,23 @@ +[%- + +main_block = 'displayfield_base_field'; + +control_block = 'displayfield_base_control'; + +BLOCK displayfield_base_field; + + IF self.label; + '<label>'; loc(self.label); '</label>: '; + END; + + include( 'control_block' ); + +END; + +BLOCK displayfield_base_control; + + "CONTROL"; + +END; + +-%] diff --git a/root/base/dt_textfield b/root/base/dt_textfield new file mode 100644 index 0000000..749e3ca --- /dev/null +++ b/root/base/dt_textfield @@ -0,0 +1,16 @@ +[% + +PROCESS field_base; + +control_block = 'textfield_control'; + +BLOCK textfield_control; + + attrs.maxlength = '255'; # SimpleStr requires <= 255 + %]<input type="text" [% IF id_attr; 'id="'; id_attr; '"'; END; connect_control(self, 'value_string'); + ' value="'; self.value_string | html; '"'; process_attrs(attrs) %] />[% + attrs.maxlength = ''; + +END; + +%] diff --git a/root/base/dual_select_group b/root/base/dual_select_group new file mode 100644 index 0000000..1cc5243 --- /dev/null +++ b/root/base/dual_select_group @@ -0,0 +1,42 @@ +[% + +PROCESS select_group; + +control_block = 'dual_select_group_control'; + +BLOCK dual_select_group_control; + + -%]</p><table[% process_attrs(attrs) %]> + <tr> + <td> +[%- self.label = ''; self.tmp_message = self.message; self.message = ''; + values_list_type = 'available_values'; + INCLUDE component type = 'select_group' self.hide_selected = 1 attrs.size = 10 attrs.name = 'add_values' | indent(4); + attrs.name = ''; attrs.size = ''; %] + </td><td align="center">[% + INCLUDE component type = 'submitbtn' attrs.value = '>>' self.event = 'add_all_values' | indent(4); + '<br />'; + INCLUDE component type = 'submitbtn' attrs.value = '>' self.event = 'do_add_values' | indent(4); + '<br />'; + INCLUDE component type = 'submitbtn' attrs.value = '<' self.event = 'do_remove_values' | indent(4); + '<br />'; + INCLUDE component type = 'submitbtn' attrs.value = '<<' self.event = 'remove_all_values' | indent(4); %] + </td><td> +[%- attrs.value = ''; + values_list_type = 'current_values'; + INCLUDE component type = 'select_group' self.hide_selected = 1 attrs.size = 10 attrs.name = 'remove_values' | indent(4); + attrs.name = ''; attrs.size = ''; + + FOREACH v_val IN self.current_values; + v_val = self.obj_to_str(v_val); + INCLUDE component type = 'hidden' self.val = v_val attrs = '' | indent(4); + END; + +# self.message = self.tmp_message; self.tmp_message = ''; %] + </td> + </tr>[% + %]</table><p>[% + +END; + +%] diff --git a/root/base/error_404 b/root/base/error_404 new file mode 100644 index 0000000..0177cba --- /dev/null +++ b/root/base/error_404 @@ -0,0 +1,17 @@ +[% + +main_block = 'error_404_main'; + +BLOCK error_404_main; + + loc("404 Not Found"); + + %] <a href="[% ctx.uri_for(ctx.action.chain.0.attributes.Chained.0) %]">[% + + loc("Return to root"); + + %]</a>[% + +END; + +%] diff --git a/root/base/field_base b/root/base/field_base new file mode 100644 index 0000000..3605a8c --- /dev/null +++ b/root/base/field_base @@ -0,0 +1,27 @@ +[%- + +main_block = 'field_base_field'; + +control_block = 'field_base_control'; + +BLOCK field_base_field; + + IF self.label; + '<label>'; loc(self.label); '</label>: '; + END; + + include( 'control_block' ); + + IF self.message; + "\n<span>"; loc(self.message); '</span>'; + END; + +END; + +BLOCK field_base_control; + + "CONTROL"; + +END; + +-%] diff --git a/root/base/fieldset b/root/base/fieldset new file mode 100644 index 0000000..7daa8be --- /dev/null +++ b/root/base/fieldset @@ -0,0 +1,20 @@ +[% + +PROCESS field_base; + +control_block = 'fieldset_control'; + +BLOCK fieldset_control; + + %]<fieldset id="[% self.field_name | html %]"[% process_attrs(attrs) %] />[% + IF self.text; + '<legend>'; self.text; '</legend>'; + END; + +# INCLUDE( 'control_block' ); + + %]</fieldset>[% + +END; + +%] diff --git a/root/base/file b/root/base/file new file mode 100644 index 0000000..c89c397 --- /dev/null +++ b/root/base/file @@ -0,0 +1,16 @@ +[% + +PROCESS field_base; + +control_block = 'fileselect_control'; + +BLOCK fileselect_control; + + %]<input type="file" [% IF id_attr; 'id="'; id_attr; '"'; END; connect_control(self, 'value'); + # browsers ignore this for security reasons, can be uncommented for testing. + # ' value="'; self.value.filename | html; '"'; + process_attrs(attrs) %] />[% + +END; + +%] diff --git a/root/base/footer b/root/base/footer new file mode 100644 index 0000000..aa00551 --- /dev/null +++ b/root/base/footer @@ -0,0 +1,12 @@ +[%- + +#main_block = 'footer'; + +#BLOCK footer; + + %]<p>FOOTER</p> + [% + +#END; + +-%] diff --git a/root/base/form_base b/root/base/form_base new file mode 100644 index 0000000..cb988ec --- /dev/null +++ b/root/base/form_base @@ -0,0 +1,77 @@ +[% + +main_block = 'form_base_control'; + +control_block = 'form_base_control'; + +header_block = 'form_base_header'; +fields_block = 'form_base_fields'; +button_block = 'form_base_buttons'; +footer_block = 'form_base_footer'; + +form_id = 0; + +BLOCK form_base_control; + + form_id = form_id + 1; + + enctype = attrs.enctype || 'multipart/form-data'; + %]<form action="[% attrs.action || connect_form %]" method="post" id="element_[% form_id %]" enctype="[% enctype %]"[% + IF attrs.name != ""; ' name="'; attrs.name; attrs.name = ''; '"'; END; + attrs.enctype = ''; attrs.action = ''; + process_attrs(self.attrs) %]>[% "\n"; + + include( 'header_block' ); + include( 'fields_block' ); + + id_attr = ''; '<p>'; + include( 'button_block' ); + include( 'footer_block' ); + + "</p>\n</form>"; + +END; + +BLOCK form_base_header; + + ''; + +END; + +BLOCK form_base_fields; + + FOREACH f_name = self.field_names; + field = self.fields.$f_name; + id = form_id _ '_' _ loop.count; + '<p>'; window.render_viewport(field); "</p>\n"; + END; + +END; + +BLOCK form_base_buttons; + + allowed_events = self.accept_events; + + IF allowed_events.grep('^ok$').size; + INCLUDE component type = 'submitbtn' self.value = 'ok' self.event = 'ok' self.label = self.ok_label; + END; + + IF (self.field_names.size != 0) && (allowed_events.grep('^apply$').size); + INCLUDE component type = 'submitbtn' self.value = 'apply' self.event = 'apply' self.label = self.apply_label; + END; + + IF allowed_events.grep('^close$').size; + INCLUDE component type = 'cancelbtn' self.value = 'cancel' self.event = 'close' self.label = self.cancel_label; + END; + +END; + +BLOCK form_base_footer; + + IF self.message; + ' <span>'; self.message; '</span>'; + END; + +END; + +%] diff --git a/root/base/header b/root/base/header new file mode 100644 index 0000000..933457f --- /dev/null +++ b/root/base/header @@ -0,0 +1,11 @@ +[%- + +#main_block = 'header_block'; + +#BLOCK header_block; + + %]<p>HEADER</p>[% + +#END; + +-%] diff --git a/root/base/hidden b/root/base/hidden new file mode 100644 index 0000000..6b5f6c4 --- /dev/null +++ b/root/base/hidden @@ -0,0 +1,15 @@ +[% + +PROCESS field_base; + +control_block = 'hidden_control'; + +BLOCK hidden_control; + + name = attrs.name || 'value'; attrs.name = ''; + %]<input type="hidden" [% IF id_attr; 'id="'; id_attr; '"'; END; connect_control(self, name); + ' value="'; self.val; '"'; process_attrs(attrs) %] />[% + +END; + +%] diff --git a/root/base/hiddenarray b/root/base/hiddenarray new file mode 100644 index 0000000..8168ad3 --- /dev/null +++ b/root/base/hiddenarray @@ -0,0 +1,17 @@ +[% + +PROCESS field_base; + +control_block = 'hiddenarray_control'; + +BLOCK hiddenarray_control; + + name = attrs.name || 'value'; attrs.name = ''; + FOREACH val IN self.value; + %]<input type="hidden" [% IF id_attr; 'id="'; id_attr; '"'; END; connect_control(self, name); + ' value="'; val; '"'; process_attrs(attrs) %] />[% "\n"; + END; + +END; + +%] diff --git a/root/base/image b/root/base/image new file mode 100644 index 0000000..36cf927 --- /dev/null +++ b/root/base/image @@ -0,0 +1,11 @@ +[% + +main_block = 'image_base'; + +BLOCK image_base; + + %]<img src="[% self.img_src | html %]" alt="[% self.text | html %]"[% process_attrs(attrs) %] />[% + +END; + +%] diff --git a/root/base/label b/root/base/label new file mode 100644 index 0000000..e380ba0 --- /dev/null +++ b/root/base/label @@ -0,0 +1,17 @@ +[% + +PROCESS field_base; + +control_block = 'label_control'; + +BLOCK label_control; + + %]<label id="[% self.field_name | html %]" [% connect_control(self, 'value') %] value="[% self.field_value | html %]" />[% + +# INCLUDE( 'control_block' ); + + '</label>'; + +END; + +%] diff --git a/root/base/listview b/root/base/listview new file mode 100644 index 0000000..382630d --- /dev/null +++ b/root/base/listview @@ -0,0 +1,60 @@ +[% + +PROCESS listview_base; + +header_field_block = 'listview_header_field'; + +BLOCK listview_header_field; + + desc = 0; + IF (self.order_by == field_name && !self.order_by_desc); + desc = 1; + ELSE; + desc = 0; + END; + + "\n <th"; process_attrs(attrs); '><a '; connect_href(self, order_by => field_name, order_by_desc => desc); '>'; + loc(self.field_label(field_name)); '</a></th>'; + +END; + +header_block = 'listview_header'; + +BLOCK listview_header; + + INCLUDE listview_base_header; + IF self.row_action_prototypes.size; + %] + <th colspan="[% self.row_action_prototypes.size %]"[% + process_attrs(attrs); %]>[% loc('Actions'); %]</th>[% + END; + +END; + +row_block = 'listview_row'; + +BLOCK listview_row; + + INCLUDE listview_base_row; + FOREACH action IN self.row_actions_for(row); + %] <td[% process_attrs(attrs); %]><a href="[% action.uri %]">[% + loc(action.label) %]</a></td>[% + IF loop.last == 0; "\n"; END; + END; + +END; + +row_field_block = 'listview_row_field'; + +BLOCK listview_row_field; + + field_value = field_value || row.$f_name; + + IF field_value.isa('DateTime'); + field_value = field_value.strftime("%F %H:%M:%S"); + END; + INCLUDE listview_base_row_field; + +END; + +%] diff --git a/root/base/listview_base b/root/base/listview_base new file mode 100644 index 0000000..9b71c30 --- /dev/null +++ b/root/base/listview_base @@ -0,0 +1,124 @@ +[% + +main_block = 'listview_base_main'; + +table_start_block = 'listview_base_table_start'; +table_end_block = 'listview_base_table_end'; +row_block = 'listview_base_row'; +row_field_block = 'listview_base_row_field'; +header_block = 'listview_base_header'; +header_field_block = 'listview_base_header_field'; +footer_block = 'listview_base_footer'; +footer_field_block = 'listview_base_footer_field'; +create_link_block = 'listview_base_create'; + +show_footer = 1; + +BLOCK listview_base_main; + + include( 'table_start_block' ); %] + <thead> + <tr>[% include( 'header_block' ) | indent(4); %] + </tr> + </thead>[% + + IF show_footer && self.footer_field_names.size != ''; + "\n <tfoot>"; + include( 'footer_block' ) | indent(4); + "\n </tfoot>"; + END; + + %] + <tbody> + [% + + FOREACH row = self.current_rows; + "<tr>\n"; + include( 'row_block' ) | indent(4); + "\n </tr>"; + END; %] + </tbody>[% + + include( 'table_end_block' ); + +END; + +BLOCK listview_base_table_start; + + #IF self.has_per_page; + IF self.has_per_page && self.pager.last_page > self.pager.first_page; + INCLUDE component type = 'pager'; + END; + + %]<table>[% + +END; + +BLOCK listview_base_table_end; + + "\n</table>\n"; + include( 'create_link_block' ); + +END; + +BLOCK listview_base_row; + + FOREACH f_name = self.field_names; + include( 'row_field_block' ); + END; + +END; + +BLOCK listview_base_row_field; + + field_value = field_value || row.$f_name; + IF field_value.can('display_name'); field_value = field_value.display_name; END; + ' <td'; process_attrs(attrs); '>'; field_value || row.$f_name; "</td>\n"; + +END; + +BLOCK listview_base_header; + + FOREACH field_name = self.field_names; + include( 'header_field_block' ); + END; + +END; + +BLOCK listview_base_header_field; + + "\n<th>"; self.field_label(field_name); '</th>'; + +END; + +BLOCK listview_base_footer; + + "\n<tr>"; + + FOREACH footer_field_name = self.footer_field_names; + include( 'footer_field_block' ); + END; + + '</tr>'; + +END; + +BLOCK listview_base_footer_field; + + "\n <td>"; self.field_label(footer_field_name); '</td>'; + +END; + +BLOCK listview_base_create; + + '<p>'; + action = ctx.controller.action_for('create'); + IF action; + action = ctx.uri_for(action); + '<a href="'; action; '">'; loc("Create record"); '</a>'; + END; + '</p>'; + +END; + +%] diff --git a/root/base/objectview b/root/base/objectview new file mode 100644 index 0000000..567d3c8 --- /dev/null +++ b/root/base/objectview @@ -0,0 +1 @@ +[% PROCESS view_base %] diff --git a/root/base/pager b/root/base/pager new file mode 100644 index 0000000..cde0ce4 --- /dev/null +++ b/root/base/pager @@ -0,0 +1,128 @@ +[% + +main_block = 'pager_main'; + +start_block = 'pager_start'; +prev_block = 'pager_prev'; +current_block = 'pager_current'; +next_block = 'pager_next'; +end_block = 'pager_end'; +list_block = 'pager_list'; + +start_label_block = 'pager_start_label'; +prev_label_block = 'pager_prev_label'; +current_label_block = 'pager_current_label'; +next_label_block = 'pager_next_label'; +end_label_block = 'pager_end_label'; +list_label_block = 'pager_list_label'; + +BLOCK pager_main; + + '<div>[ '; + data = []; + + str = BLOCK; include( 'start_block' ); END; + data.push(str) IF str; + + str = BLOCK; include( 'prev_block' ); END; + data.push(str) IF str; + + str = BLOCK; include( 'current_block' ); END; + data.push(str) IF str; + + str = BLOCK; include( 'next_block' ); END; + data.push(str) IF str; + + str = BLOCK; include( 'end_block' ); END; + data.push(str) IF str; + + data.join(" |\n"); + " ]</div>\n"; + +END; + +BLOCK pager_start; + + %]<a [% connect_href(self, 'page' => self.pager.first_page); process_attrs(attrs) %]>[% + include( 'start_label_block' ) %]</a>[% + +END; + +BLOCK pager_start_label; + + loc('Start'); ' ('; self.pager.first_page; ')'; + +END; + +BLOCK pager_prev; + + IF self.pager.current_page != 1; + %]<a [% connect_href(self, 'page' => self.pager.previous_page); process_attrs(attrs) %]>[% + include( 'prev_label_block' ) %]</a>[% + END; + +END; + +BLOCK pager_prev_label; + + loc('Previous'); ' ('; self.pager.previous_page; ')'; + +END; + +BLOCK pager_current; + + %]<a [% connect_href(self, 'page' => self.pager.current_page); process_attrs(attrs) %]>[% + include( 'current_label_block' ) %]</a>[% + +END; + +BLOCK pager_current_label; + + loc('Current'); ' ('; self.pager.current_page; ')'; + +END; + +BLOCK pager_next; + + IF self.pager.current_page != self.pager.last_page; + %]<a [% connect_href(self, 'page' => self.pager.next_page); process_attrs(attrs) %]>[% + include( 'next_label_block' ) %]</a>[% + END; + +END; + +BLOCK pager_next_label; + + loc('Next'); ' ('; self.pager.next_page; ')'; + +END; + +BLOCK pager_end; + + %]<a [% connect_href(self, 'page' => self.pager.last_page); process_attrs(attrs) %]>[% + include( 'end_label_block' ) %]</a>[% + +END; + +BLOCK pager_end_label; + + loc('End'); ' ('; self.pager.last_page; ')'; + +END; + +BLOCK pager_list; + + FOREACH page IN self.pager.list; + '<a'; connect_href(self, 'page' => page); process_attrs(attrs); '>'; + include( 'list_label_block' ); "</a>\n"; + END; + +END; + +BLOCK pager_list_label; + + page; + +END; + +%] diff --git a/root/base/password b/root/base/password new file mode 100644 index 0000000..ba3f389 --- /dev/null +++ b/root/base/password @@ -0,0 +1,14 @@ +[% + +PROCESS field_base; + +control_block = 'passwordfield_control'; + +BLOCK passwordfield_control; + + %]<input type="password" [% IF id_attr; 'id="'; id_attr; '"'; END; connect_control(self, 'value'); + ' value="'; self.value | html; '"'; process_attrs(attrs) %] />[% + +END; + +%] diff --git a/root/base/radio b/root/base/radio new file mode 100644 index 0000000..a4e897a --- /dev/null +++ b/root/base/radio @@ -0,0 +1,14 @@ +[% + +PROCESS field_base; + +control_block = 'radio_control'; + +BLOCK radio_control; + + %]<input type="radio" id="[% id_attr %]" [% connect_control(self, 'value'); + process_attrs(attrs) %] />[% + +END; + +%] diff --git a/root/base/radio_group b/root/base/radio_group new file mode 100644 index 0000000..b64e5b8 --- /dev/null +++ b/root/base/radio_group @@ -0,0 +1,17 @@ +[% + +PROCESS field_base; + +control_block = 'radiogroup_control'; + +BLOCK radiogroup_control; + + FOREACH value IN self.values.keys; + '<input type="radio" id="[% id_attr %]" [% connect_control(self, 'value'); + IF self.default == value; ' checked="checked"'; END; + process_attrs(attrs); " />\n"; + END; + +END; + +%] diff --git a/root/base/resetbtn b/root/base/resetbtn new file mode 100644 index 0000000..859d5c8 --- /dev/null +++ b/root/base/resetbtn @@ -0,0 +1,13 @@ +[% + +PROCESS button; + +control_block = 'resetbtn_control'; + +BLOCK resetbtn_control; + + INCLUDE button_control button_type = 'reset' attrs.value = 'Reset'; + +END; + +%] diff --git a/root/base/search_base b/root/base/search_base new file mode 100644 index 0000000..24bbfff --- /dev/null +++ b/root/base/search_base @@ -0,0 +1,14 @@ +[% + +PROCESS field_base; + +control_block = 'search_base_control'; + +BLOCK search_base_control; + + INCLUDE component type = 'textfield'; + INCLUDE component type = 'submitbtn' attrs.value = 'Search'; + +END; + +%] diff --git a/root/base/select b/root/base/select new file mode 100644 index 0000000..a387fa1 --- /dev/null +++ b/root/base/select @@ -0,0 +1,38 @@ +[% + +PROCESS field_base; + +control_block = 'select_control'; + +BLOCK select_control; + + IF values_list_type; + values_list = self.${values_list_type}; + ELSE; + values_list = self.valid_values; + END; + + name = attrs.name || 'value'; attrs.name = ''; + '<select '; + IF id_attr; 'id="'; id_attr; '"'; END; + connect_control(self, name); process_attrs(attrs); ">\n"; + + IF attrs.nullable == 1 || !(self.attribute.required); + attrs.nullable = ''; + " <option value=\"\">--</option>\n"; + END; + + FOREACH v_val IN values_list; + v_val = self.obj_to_str(v_val); + v_name = self.value_to_name_map.${v_val} || v_val; + ' <option value="'; v_val | html; '"'; + IF (self.is_current_value(v_val) || self.value == v_val ) && !self.hide_selected; + ' selected="selected"'; + END; + '>'; v_name | html; "</option>\n"; + END; + '</select>'; + +END; + +%] diff --git a/root/base/select_group b/root/base/select_group new file mode 100644 index 0000000..f740d77 --- /dev/null +++ b/root/base/select_group @@ -0,0 +1,14 @@ +[% + +PROCESS select; + +control_block = 'select_group_control'; + +BLOCK select_group_control; + + INCLUDE select_control attrs.multiple = 'multiple'; + attrs.multiple = ''; + +END; + +%] diff --git a/root/base/submitbtn b/root/base/submitbtn new file mode 100644 index 0000000..6e2246c --- /dev/null +++ b/root/base/submitbtn @@ -0,0 +1,13 @@ +[% + +PROCESS button; + +control_block = 'submitbtn_control'; + +BLOCK submitbtn_control; + + INCLUDE button_control button_type = 'submit' attrs.value = 'Submit' self.event = 'ok'; + +END; + +%] diff --git a/root/base/textarea b/root/base/textarea new file mode 100644 index 0000000..57114f9 --- /dev/null +++ b/root/base/textarea @@ -0,0 +1,15 @@ +[% + +PROCESS field_base; + +control_block = 'textarea_control'; + +BLOCK textarea_control; + + attrs.maxlength = ''; + %]<textarea id="[% id_attr %]" [% connect_control(self, 'value'); + process_attrs(attrs) %]>[% self.value | html; '</textarea>'; + +END; + +%] diff --git a/root/base/textfield b/root/base/textfield new file mode 100644 index 0000000..a43f445 --- /dev/null +++ b/root/base/textfield @@ -0,0 +1,17 @@ +[% + +PROCESS field_base; + +control_block = 'textfield_control'; + +BLOCK textfield_control; + + attrs.maxlength = '255'; # SimpleStr requires <= 255 + name = attrs.name || 'value'; attrs.name = ''; + %]<input type="text" [% IF id_attr; 'id="'; id_attr; '"'; END; connect_control(self, name); + ' value="'; self.value | html; '"'; process_attrs(attrs) %] />[% + attrs.maxlength = ''; + +END; + +%] diff --git a/root/base/timerange b/root/base/timerange new file mode 100644 index 0000000..a987cfd --- /dev/null +++ b/root/base/timerange @@ -0,0 +1,44 @@ +[% + +main_block = 'timerange_field'; + +BLOCK timerange_field; + + include( 'control_block' ); + + IF self.message; + "\n<span>"; loc(self.message); '</span>'; + END; + +END; + +control_block = 'timerange_control'; + +BLOCK timerange_control; + + name = attrs.name || 'value_string'; attrs.name = ''; + self.label = ''; + data = self.value_string.split(','); + #USE dumper; dumper.dump(data); + data.0.replace('T', ' ') | ucfirst; ' to '; data.1.replace('T', ' '); + IF data.2 == 'none'; data.2 = ''; END; + IF data.2 != ''; + ' every '; data.4.replace('dai', 'day').replace('ly', ''); + ' between '; data.2.replace('T', ' '); ' and '; data.3.replace('T', ' '); + END; + inner = { + value => self.delete_label, + event => 'delete', + location => self.location, + }; +# INCLUDE component type = 'button' button_type = 'submit' self = inner; + '<input type="submit" value="'; self.delete_label; ;'" '; connect_control(self, 'delete'); ' />'; + "<br />\n"; + '<input type="hidden" '; connect_control(self, name); ' value="'; self.value_string; '"'; process_attrs(attrs); ' />'; + "\n"; + +# INCLUDE component type = 'hiddenarray' self.value = ctx.stash.ranges; + +END; + +%] diff --git a/root/base/timerangecollection b/root/base/timerangecollection new file mode 100644 index 0000000..2c0bf1a --- /dev/null +++ b/root/base/timerangecollection @@ -0,0 +1,60 @@ +[% + +PROCESS form_base; + +fields_block = 'timerangecollection_control'; + +BLOCK timerangecollection_control; + + include( 'error_block' ); + include( 'results_block' ); + FOREACH f_name = self.field_names; + NEXT IF f_name.match('range'); + field = self.fields.$f_name; + '<p>'; window.render_viewport(field); "</p>\n"; + END; + +END; + +results_block = 'timerangecollection_results'; + +BLOCK timerangecollection_results; + + FOREACH field = self.range_vps; + '<p>'; window.render_viewport(field); "</p>\n"; + END; + '<input type="hidden"'; connect_control(self, 'max_range_vps'); ' value="'; self.range_vps.size; '" />'; +# INCLUDE component type = 'hidden' self.name = 'max_range_vps' self.val = self.range_vps.size; + +END; + +error_block = 'timerangecollection_error'; + +BLOCK timerangecollection_error; + + IF self.warning; + '<p>'; self.warning; '</p>'; + END; + IF self.error; + '<p>'; self.error; '</p>'; + END; + +END; + +button_block = 'timerangecollection_buttons'; + +BLOCK timerangecollection_buttons; + + INCLUDE component type = 'submitbtn' self.value = 'add' self.event = 'add_range_vp' self.label = ''; + + IF self.has_on_next_callback; + INCLUDE component type = 'submitbtn' self.value = 'next' self.event = 'next' self.label = ''; + END; + + IF self.is_changed; self.value = 'cancel'; ELSE; self.value = 'close'; END; + INCLUDE component type = 'cancelbtn' self.label = '' self.event = 'close'; + '<br />'; + +END; + +%] diff --git a/root/base/view_base b/root/base/view_base new file mode 100644 index 0000000..e67ac8f --- /dev/null +++ b/root/base/view_base @@ -0,0 +1,22 @@ +[% + +main_block = 'view_base_control'; +control_block = 'view_base_control'; +fields_block = 'view_base_fields'; + +BLOCK view_base_control; + + include( 'fields_block' ); + +END; + +BLOCK view_base_fields; + + FOREACH f_name = self.field_names; + field = self.fields.$f_name; + window.render_viewport(field); "<br />\n"; + END; + +END; + +%] diff --git a/root/base/xhtml b/root/base/xhtml new file mode 100644 index 0000000..0c0ea26 --- /dev/null +++ b/root/base/xhtml @@ -0,0 +1,29 @@ +[% BLOCK xhtml_main; -%] +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> + +<head> + <title>[% window.title %]</title> + + [%- FOREACH stylesheet IN stylesheets; -%] + <link rel="stylesheet" type="text/css" href="[% ctx.uri_for('/stylesheets', stylesheet) %]" /> + [%- END; -%] + [%- FOREACH javascript IN javascripts; -%] + <script src="[% ctx.uri_for('/javascript', javascript) %]" type="text/javascript"></script> + [%- END; -%] + + <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> + <meta name="GENERATOR" content="Catalyst/TT" /> +</head> + +<body> +[% INCLUDE header; +window.render_viewport(self.inner); %] +[% INCLUDE footer; %] +</body> +</html> +[%- END; +main_block = 'xhtml_main'; +-%] diff --git a/root/favicon.ico b/root/favicon.ico Binary files differnew file mode 100644 index 0000000..5ad723d --- /dev/null +++ b/root/favicon.ico diff --git a/root/index b/root/index new file mode 100644 index 0000000..4cc7bc3 --- /dev/null +++ b/root/index @@ -0,0 +1,23 @@ +[% + +main_block = 'index'; + +BLOCK index; + +%] + +<h2>Using ActionReflector and DBIC (View doesn't work)</h2> +<p><a href="[% ctx.uri_for('/foo') %]">foo</a></p> +<p><a href="[% ctx.uri_for('/bar') %]">bar</a></p> +<p><a href="[% ctx.uri_for('/baz') %]">baz</a></p> + +<h2>Using InterfaceModel, ObjectClass, SchemaClass, and ModelBase</h2> +<p><a href="[% ctx.uri_for('/testmodel/foo') %]">foo</a></p> +<p><a href="[% ctx.uri_for('/testmodel/bar') %]">bar</a></p> +<p><a href="[% ctx.uri_for('/testmodel/baz') %]">baz</a></p> + +[% + +END; + +%] diff --git a/root/static/images/btn_120x50_built.png b/root/static/images/btn_120x50_built.png Binary files differnew file mode 100644 index 0000000..c709fd6 --- /dev/null +++ b/root/static/images/btn_120x50_built.png diff --git a/root/static/images/btn_120x50_built_shadow.png b/root/static/images/btn_120x50_built_shadow.png Binary files differnew file mode 100644 index 0000000..15142fe --- /dev/null +++ b/root/static/images/btn_120x50_built_shadow.png diff --git a/root/static/images/btn_120x50_powered.png b/root/static/images/btn_120x50_powered.png Binary files differnew file mode 100644 index 0000000..7249b47 --- /dev/null +++ b/root/static/images/btn_120x50_powered.png diff --git a/root/static/images/btn_120x50_powered_shadow.png b/root/static/images/btn_120x50_powered_shadow.png Binary files differnew file mode 100644 index 0000000..e6876c0 --- /dev/null +++ b/root/static/images/btn_120x50_powered_shadow.png diff --git a/root/static/images/btn_88x31_built.png b/root/static/images/btn_88x31_built.png Binary files differnew file mode 100644 index 0000000..007b5db --- /dev/null +++ b/root/static/images/btn_88x31_built.png diff --git a/root/static/images/btn_88x31_built_shadow.png b/root/static/images/btn_88x31_built_shadow.png Binary files differnew file mode 100644 index 0000000..ccf4624 --- /dev/null +++ b/root/static/images/btn_88x31_built_shadow.png diff --git a/root/static/images/btn_88x31_powered.png b/root/static/images/btn_88x31_powered.png Binary files differnew file mode 100644 index 0000000..8f0cd9f --- /dev/null +++ b/root/static/images/btn_88x31_powered.png diff --git a/root/static/images/btn_88x31_powered_shadow.png b/root/static/images/btn_88x31_powered_shadow.png Binary files differnew file mode 100644 index 0000000..aa776fa --- /dev/null +++ b/root/static/images/btn_88x31_powered_shadow.png diff --git a/root/static/images/catalyst_logo.png b/root/static/images/catalyst_logo.png Binary files differnew file mode 100644 index 0000000..21f1cac --- /dev/null +++ b/root/static/images/catalyst_logo.png |