From 633c48448d9468690b7ad77eb6ff7c660a286658 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Dec 2006 08:51:34 +0000 Subject: service refactor! --- httemplate/view/elements/svc_Common.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'httemplate/view/elements') diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 35434632e..7b8df3a74 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -12,6 +12,9 @@ % # if not specified all columns (except for the primary key) will be viewable % # 'fields' => [ % # ] +% # +% # # defaults to "edit/$table.cgi?", will have svcnum appended +% # 'edit_url' => % % my(%opt) = @_; % @@ -21,9 +24,15 @@ % #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ]; % || [ grep { $_ ne 'svcnum' } fields($table) ]; % -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/; -% my $svcnum = $1; +% my $svcnum; +% if ( $cgi->param('svcnum') ) { +% $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum"; +% $svcnum = $1; +% } else { +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/ or die "no svcnum"; +% $svcnum = $1; +% } % my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } ) % or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n"; % @@ -69,7 +78,8 @@ Service #<% $svcnum %> -| Edit this <% $label %> +% my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; +| Edit this <% $label %>
<% ntable("#cccccc") %><% ntable("#cccccc",2) %> -- cgit v1.2.1