X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Fedit.html;h=3e8b6b8edfdfa11e03521485b777517a17528d92;hb=005237d2424b22ff9e73798868194d68e18b3f6d;hp=6a74544bd69c3c2849e59902278f3b671df6a03f;hpb=d80bfac8bf4a238edcf2e929266da187a280186f;p=freeside.git diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 6a74544bd..3e8b6b8ed 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -3,8 +3,12 @@ Example: include( 'elements/edit.html', - 'name' => - 'table' => + 'name_singular' => #singular name for the record + # (preferred, will be pluralized automatically) + 'name' => #name for the record + # (deprecated, will be pluralized simplistically) + 'table' => + #? 'primary_key' => #required when the dbdef doesn't know...??? 'labels' => { 'column' => 'Label', @@ -17,42 +21,53 @@ Example: 'columname', { 'field' => 'another_columname', 'type' => 'text', #text + #password #money #percentage #checkbox #select - #selectlayers (can't use after a tablebreak-tr-title yet... grep "OneTrueTable") + #selectlayers (can now use after a tablebreak-tr-title... but not inside columnstart/columnnext/columnend) #title #tablebreak-tr-title + #columnstart + #columnnext + #columnend #hidden - hidden value from object #fixed - display fixed value from object or here - #fixedhidden - hidden value from here - 'value' => 'Y', #for checkbox, title, fixed, fixedhidden + #fixed-country + #fixed-state + 'value' => 'Y', #for checkbox, title, fixed, hidden 'disabled' => 0, 'onchange' => 'javascript_function', - 'm2name_table' => 'table_name', #only tested w/ - # selectlayers so far - # might work w/select - # dunno others - 'm2name_namecol' => 'name_column', # - 'm2name_label' => 'Label', # - 'm2name_new_default' => \@table_name_objects, #default - #m2name - #objects for - #new records - 'm2name_error_callback' => sub { my($cgi, $object) = @_; }, - 'm2name_remove_warnings' => \%warnings, #hashref of warning - #messages for - #m2name removal - 'm2name_new_js' => 'function_name', #javascript function - #called on spawned rows - #(one arg: new_element) - 'm2name_remove_js' => 'function_name', #js function called - #when a row is - #deleted - #(three args: - # value, text, - # 'no_match') + + 'include_opt_callback' => sub { #my $ = @_; + ( 'option' => 'value', ); + }, + + 'm2name_table' => 'table_name', + 'm2name_namecol' => 'name_column', + #OR# + 'm2m_method' => + #'m2m_srccol' => #opt, if not the same as this table + 'm2m_dstcol' => #required for now, eventuaully opt, if not the same as target table + #OR# + 'o2m_table' => + + 'm2_label' => 'Label', # + 'm2_new_default' => \@table_name_objects, #default + #m2 objects for + #new records + 'm2_error_callback' => sub { my($cgi, $object) = @_; }, + 'm2_remove_warnings' => \%warnings, #hashref of warning + #messages for m2 + #removal + 'm2_new_js' => 'function_name', #javascript function called + #on spawned rows (one arg: + #new_element) + 'm2_remove_js' => 'function_name', #js function called when + #a row is deleted (three + #args: value, text, + #'no_match') #layer_fields & layer_values_callback only for selectlayer 'layer_fields' => [ 'fieldname' => 'Label', @@ -80,52 +95,108 @@ Example: 'menubar' => '', #menubar arrayref #agent virtualization - 'agent_virt' => 1, - 'agent_null_right' => 'Access Right Name', - - #run when re-displaying with an error - 'error_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; }, - - #run when editing - 'edit_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; }, - - # returns a hashref for the new object - 'new_hashref_callback' - - #run when adding - 'new_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; }, - - #XXX describe - 'field_callback' => sub { }, + 'agent_virt' => 1, + 'agent_null_right' => 'Access Right Name', + 'agent_clone_extra_sql' => '', #if provided, this overrides the extra_sql + #implementing agent virt, for clone + #operations. i.e. pass "1=1" to allow + #cloning anything + + 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + + # overrides default popurl(1)."process/$table.html" + 'post_url' => popurl(1).'process/something', + + #we're in a popup (no title/menu/searchboxes) + 'popup' => 1, + + ### + # HTML callbacks + ### + + 'body_etc' => '', # Additional BODY attributes, i.e. onLoad="" + + 'html_init' => '', #after the header/menubar #string or coderef of additional HTML to add before 'html_table_bottom' => '', - - 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' - + + #after but before the submit 'html_bottom' => '', #string 'html_bottom' => sub { my $object = shift; # ... "html_string"; }, + + #at the very bottom (well, as low as you can go from here) + 'html_foot' => '', + + ### + # initialization callbacks + ### + + ###global callbacks, always run if provided + + #after decoding long CGI "redirect=" responses but + # before object creation/search + # (useful if you have a long form that might trigger redirect= and you need + # to do things with $cgi params - they're not decoded in the calling + # <%init> block yet) + 'begin_callback' = sub { my( $cgi, $fields_listref, $opt_hashref ) = @_; }, + + #after the mode-specific object creation/search + 'end_callback' = sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, + + ###mode-specific callbacks. one (and only one) of these four is called - # overrides default popurl(1)."process/$table.html" - 'post_url' => popurl(1).'process/something', + #run when adding + 'new_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, - #we're in a popup (no title/menu/searchboxes) - 'popup' => 1, + #run when editing + 'edit_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, + + #run when re-displaying with an error + 'error_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, + #run when cloning + 'clone_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, + + ###callbacks called in new mode only + + # returns a hashref for the new object + 'new_hashref_callback' + + # returns the new object iself (otherwise, ->new is called) + 'new_object_callback' + + ###display callbacks + + #run before display to return a different value + 'value_callback' => sub { my( $columname, $value ) = @_; }, + + #run before display to manipulate element of the 'fields' arrayref + 'field_callback' => sub { my( $cgi, $object, $field_hashref ) = @_; }, + ); %doc> <% include('/elements/header'. ( $opt{popup} ? '-popup' : '' ). '.html', $title, - include( '/elements/menubar.html', @menubar ) + include( '/elements/menubar.html', @menubar ), + $opt{'body_etc'}, ) %> +<% defined($opt{'html_init'}) + ? ( ref($opt{'html_init'}) + ? &{$opt{'html_init'}}() + : $opt{'html_init'} + ) + : '' +%> + <% include('/elements/error.html') %> % my $url = $opt{'post_url'} || popurl(1)."process/$table.html"; @@ -133,7 +204,7 @@ Example: