[freeside-commits] freeside/httemplate/edit/elements svc_Common.html, 1.2, 1.3 edit.html, 1.10, 1.11

Ivan,,, ivan at wavetail.420.am
Fri Dec 29 00:51:34 PST 2006


Update of /home/cvs/cvsroot/freeside/httemplate/edit/elements
In directory wavetail:/tmp/cvs-serv4384/httemplate/edit/elements

Modified Files:
	svc_Common.html edit.html 
Log Message:
service refactor!

Index: edit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/elements/edit.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- edit.html	29 Dec 2006 07:23:21 -0000	1.10
+++ edit.html	29 Dec 2006 08:51:32 -0000	1.11
@@ -53,6 +53,9 @@
 %  #                        # ...
 %  #                        "html_string";
 %  #                      },
+%  #
+%  # # overrides default popurl(1)."process/$table.html"
+%  # 'post_url' => popurl(1).'process/something', 
 %
 %  my(%opt) = @_;
 %
@@ -77,9 +80,14 @@
 %
 %  } elsif ( $cgi->keywords || $cgi->param($pkey) ) { #editing
 %
-%    my( $query ) = $cgi->keywords;
-%    $query = $cgi->param($pkey) unless $query;
-%    $query =~ /^(\d+)$/;
+%    my $value;
+%    if ( $cgi->param($pkey) ) {
+%      $value = $cgi->param($pkey)
+%    } else { 
+%      my( $query ) = $cgi->keywords;
+%      $value = $query;
+%    }
+%    $value =~ /^(\d+)$/ or die "unparsable $pkey";
 %    $object = qsearchs( $table, { $pkey => $1 } );
 %    warn "$table $pkey => $1"
 %      if $opt{'debug'};
@@ -129,8 +137,10 @@
   <BR><BR>
 % } 
 
+% my $url = $opt{'post_url'} || popurl(1)."process/$table.html";
 
-<FORM ACTION="<% popurl(1) %>process/<% $table %>.html" METHOD=POST>
+<FORM ACTION="<% $url %>" METHOD=POST>
+<INPUT TYPE="hidden" NAME="svcdb" VALUE="<% $table %>">
 <INPUT TYPE="hidden" NAME="<% $pkey %>" VALUE="<% $object->$pkey() %>">
 <% ( $opt{labels} && exists $opt{labels}->{$pkey} )
       ? $opt{labels}->{$pkey}

Index: svc_Common.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/elements/svc_Common.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- svc_Common.html	23 Aug 2006 22:25:37 -0000	1.2
+++ svc_Common.html	29 Dec 2006 08:51:32 -0000	1.3
@@ -1,19 +1,21 @@
 %
-%
 %  my %opt = @_;
 %
 %  #my( $svcnum, $pkgnum, $svcpart, $part_svc );
 %  my( $pkgnum, $svcpart, $part_svc );
 %
 %  #get & untaint pkgnum & svcpart
-%  my($query) = $cgi->keywords; #they're not proper cgi params
-%  if ( $query =~ /^pkgnum(\d+)-svcpart(\d+)$/ ) {
-%    $pkgnum  = $1;
-%    $svcpart = $2;
-%    $cgi->delete_all(); #so the standard edit.html treats this correctly as new
+%  if ( ! $cgi->param('error')
+%       && $cgi->param('pkgnum') && $cgi->param('svcpart')
+%     )
+%  {
+%    $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum';
+%    $pkgnum = $1;
+%    $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
+%    $svcpart = $1;
+%    $cgi->delete_all(); #so edit.html treats this correctly as new??
 %  }
 %
-%
 <% include( 'edit.html',
 
                  'menubar' => [],



More information about the freeside-commits mailing list