diff options
| author | jeff <jeff> | 2008-03-16 22:41:55 +0000 | 
|---|---|---|
| committer | jeff <jeff> | 2008-03-16 22:41:55 +0000 | 
| commit | aaaae7449e7e310e07a88f97f79e40b6e7dab7d1 (patch) | |
| tree | 1718c9db0e363e81a56f1c87bcceaadbb184aafc /httemplate/view | |
| parent | 000a8700b188c774aba7b0295b0dc1703b5ef098 (diff) | |
componentize conflicting %once subroutines (rt#3250)
Diffstat (limited to 'httemplate/view')
| -rwxr-xr-x | httemplate/view/cust_main.cgi | 40 | ||||
| -rwxr-xr-x | httemplate/view/cust_main/packages.html | 125 | 
2 files changed, 70 insertions, 95 deletions
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 382bf68f6..029a044e9 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -38,7 +38,15 @@ var confirm_cancel = '<FORM METHOD="POST" ACTION="<% $p %>misc/cust_main-cancel.  %        && $cust_main->ncancelled_pkgs  %      ) { -  <% cust_cancel_link($cust_main) %> |  +  <% include( '/elements/popup_link-cust_main.html', +              { 'action'      => $p. 'misc/cancel_cust.html', +                'label'       => 'Cancel this customer', +                'actionlabel' => 'Confirm Cancellation', +                'color'       => '#ff0000', +                'cust_main'   => $cust_main, +              } +            ) +  %> |   % }   % if ( $conf->exists('deletecustomers') @@ -169,33 +177,3 @@ my $cust_main = qsearchs({  die "Customer not found!" unless $cust_main;  </%init> -<%once> - - -sub cust_cancel_link { cust_popup_link( 'misc/cancel_cust.html', -                                        'Cancel this customer', -                                        'Confirm Cancellation', -                                        '#ff0000', -                                        @_, -                                      ); -} - -#false laziness w/view/cust_main/packages.html - -sub cust_popup_link { -  my($action, $label, $actionlabel, $color, $cust_main) = @_; -  $action .= '?'. $cust_main->custnum; -  popup_link($action, $label, $actionlabel, $color); -} - -sub popup_link { -  my($action, $label, $actionlabel, $color) = @_; -  $color ||= '#333399'; -  qq!<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('$p$action', 540, 336, 'pkg_or_svc_action_popup' ), CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '$color', CGCOLOR, '$color', CLOSETEXT, '' ); return false;">$label</A>!; - -# CLOSETEXT, '',  -#WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, -#BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' -} - -</%once> diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index b150b109f..0d36f5b53 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -8,7 +8,14 @@  %      ) {  % -  <% popup_link('edit/quick-charge.html?custnum='. $cust_main->custnum, 'One-time charge', 'One-time charge', 545) %> +  <% include('/elements/popup_link.html', +     {  +       'action'      => $p. 'edit/quick-charge.html?custnum='. $cust_main->custnum, +       'label'       => 'One-time charge', +       'actionlabel' => 'One-time charge', +       'width'       => 545, +     }) +  %>    <BR>  % }   % if ( $curuser->access_right('Bulk change customer packages') ) {  @@ -407,9 +414,6 @@ sub pkg_status_row_colspan {  } -</%init> -<%once> -  #subroutines  sub get_packages { @@ -489,50 +493,63 @@ sub pkg_datestr {    $strip;  } - sub pkg_change_link    { pkg_popup_link('misc/change_pkg.cgi?dummy=value', -                                           'Change package', -                                           'Change', -                                           @_ -                                        ); -                        } - -sub pkg_suspend_link   { pkg_popup_link( 'misc/cancel_pkg.html?method=suspend', -                                         'Suspend now', -                                         'Suspend', -                                         @_ -                                       ); -                       } +sub pkg_change_link { include( '/elements/popup_link-cust_pkg.html', +                               { 'action'      => $p. 'misc/change_pkg.cgi?dummy=value', +                                 'label'       => 'Change package', +                                 'actionlabel' => 'Change', +                                 'cust_pkg'    => shift, +                               } +                             ) +                     } + +sub pkg_suspend_link { include( '/elements/popup_link-cust_pkg.html', +                                { 'action'      => $p. 'misc/cancel_pkg.html?method=suspend', +                                  'label'       => 'Suspend now', +                                  'actionlabel' => 'Suspend', +                                  'cust_pkg'    => shift, +                                } +                              ) +                     }  sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg',    'Unsuspend',           @_ ); }  sub pkg_expire_link    { pkg_link('misc/expire_pkg',    'Cancel later',   @_ ); }  sub pkg_dates_link     { pkg_link('edit/REAL_cust_pkg', 'Edit dates',     @_ ); } -sub pkg_cancel_link    { pkg_popup_link( 'misc/cancel_pkg.html?method=cancel', -                                         'Cancel now', -                                         'Cancel', -                                         @_ -                                       ); -                       } -sub pkg_adjourn_link   { pkg_popup_link( 'misc/cancel_pkg.html?method=adjourn', -                                         'Suspend later', -                                         'Adjourn', -                                         @_ -                                       ); -                       } - -sub pkg_expire_link    { pkg_popup_link( 'misc/cancel_pkg.html?method=expire', -                                         'Cancel later', -                                         'Expire', #"Cancel package $num later" -                                         @_ -                                       ); -                       } - -sub svc_recharge_link  { svc_popup_link( 'misc/recharge_svc.html', -                                         'Recharge', -                                         'Recharge', -                                         @_ -                                       ); -                       } +sub pkg_cancel_link { include( '/elements/popup_link-cust_pkg.html', +                               { 'action'      => $p. 'misc/cancel_pkg.html?method=cancel', +                                 'label'       => 'Cancel now', +                                 'actionlabel' => 'Cancel', +                                 'cust_pkg'    => shift, +                               } +                             ) +                    } + +sub pkg_adjourn_link { include( '/elements/popup_link-cust_pkg.html', +                                { 'action'      => $p. 'misc/cancel_pkg.html?method=adjourn', +                                  'label'       => 'Suspend later', +                                  'actionlabel' => 'Adjourn', +                                  'cust_pkg'    => shift, +                                } +                              ) +                     } + +sub pkg_expire_link { include( '/elements/popup_link-cust_pkg.html', +                               { 'action'      => $p. 'misc/cancel_pkg.html?method=expire', +                                 'label'       => 'Cancel later', +                                 'actionlabel' => 'Expire', +                                 'cust_pkg'    => shift, +                               } +                             ) +                    } + +sub svc_recharge_link { include( '/elements/popup_link-cust_svc.html', +                                 { 'action'      => $p. 'misc/recharge_svc.html', +                                   'label'       => 'Recharge', +                                   'actionlabel' => 'Recharge', +                                   'cust_svc'    => shift, +                                 } +                               ) +                      }  sub pkg_link {    my($action, $label, $cust_pkg) = @_; @@ -540,26 +557,6 @@ sub pkg_link {    qq!<a href="$p$action.cgi?!. $cust_pkg->pkgnum. qq!">$label</a>!;  } -sub pkg_popup_link { -  my($action, $label, $actionlabel, $cust_pkg) = @_; -  $action .= '&pkgnum='. $cust_pkg->pkgnum; -  $actionlabel .= ' package '. $cust_pkg->pkgnum; -  popup_link($action, $label, $actionlabel, 768); -} - -sub svc_popup_link { -  my($action, $label, $actionlabel, $cust_svc) = @_; -  $action .= '?svcnum='. $cust_svc->svcnum; -  $actionlabel .= ' service '. $cust_svc->svcnum; -  popup_link($action, $label, $actionlabel, 392); -} - -sub popup_link { -  my($action, $label, $actionlabel, $width) = @_; -  $width ||= 540; -  qq!<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('$p$action', $width, 336, 'pkg_or_svc_action_popup' ), CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">$label</A>!; -} -  sub pkg_customize_link {    my $cust_pkg = shift or return '';    my $custnum = $cust_pkg->custnum; @@ -570,4 +567,4 @@ sub pkg_customize_link {      qq!">Customize</A>!;  } -</%once> +</%init>  | 
