[freeside-commits] freeside/httemplate/elements popup_link-cust_main.html, 1.3, 1.4 popup_link-cust_pkg.html, 1.2, 1.3 popup_link-cust_svc.html, 1.2, 1.3 popup_link.html, 1.2, 1.3

Ivan,,, ivan at wavetail.420.am
Mon Mar 31 13:40:35 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv12220

Modified Files:
	popup_link-cust_main.html popup_link-cust_pkg.html 
	popup_link-cust_svc.html popup_link.html 
Log Message:
clean up popup link elements a bit, have the iframe name autogenerate to work around safari fuckery

Index: popup_link.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/popup_link.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- popup_link.html	16 Mar 2008 23:05:26 -0000	1.2
+++ popup_link.html	31 Mar 2008 20:40:33 -0000	1.3
@@ -5,7 +5,7 @@
   <SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
   <SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>
 
-  include( '/elements/popup_link.html', {
+  include( '/elements/popup_link.html', { #hashref or a list, either way is fine
 
     #required
     'action'         => 'content.html', # uri for content of popup
@@ -18,30 +18,39 @@
     'width'          => '540',
     'color'          => '#ff0000',
     'closetext'      => 'Go Away',      # the value '' removes the link
-  )
+  } )
 
 </%doc>
+% if ($action && $label) {
+<A HREF="javascript:void(0);" onClick="<% $onclick %>"><% $label %></A>\
+% }
 <%init>
-my($params, $action, $label, $actionlabel, $width, $color);
+
+my($action, $label, $actionlabel) = ( '', '', '' );
 my $closetext = 'Close';
-if (ref(@_[0]) eq 'HASH') {
+my $width = 540;
+my $color = '#333399';
+
+my $params;
+if (ref($_[0]) eq 'HASH') {
+  #$params = { %$params, %{ $_[0] } };
   $params = shift;
-  foreach (qw(action label actionlabel width color)) {
-    $action      = $params->{'action'}      if exists $params->{'action'};
-    $label       = $params->{'label'}       if exists $params->{'label'};
-    $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
-    $width       = $params->{'width'}       if exists $params->{'width'};
-    $color       = $params->{'color'}       if exists $params->{'color'};
-    $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
-  }
-}else{  # deprecated
-  ($action, $label, $actionlabel, $width) = @_;
+} else {
+  #$params = { %$params, @_ };
+  $params = { @_ };
 }
 
-$width ||= 540;
-$color ||= '#333399';
+$action      = $params->{'action'}      if exists $params->{'action'};
+$label       = $params->{'label'}       if exists $params->{'label'};
+$actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
+$width       = $params->{'width'}       if exists $params->{'width'};
+$color       = $params->{'color'}       if exists $params->{'color'};
+$closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
+
+#stupid safari is caching the "location" of popup iframs, and submitting them
+#instead of displaying them.  this should prevent that.
+my $popup_name = 'popup-'.time. "-$$-". rand() * 2**32;
+
+my $onclick = "overlib( OLiframeContent('$action', $width, 336, '$popup_name' ), CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '$color', CGCOLOR, '$color', CLOSETEXT, '$closetext' ); return false;";
 
 </%init>
-%if ($action && $label) {
-<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% "$action" %>', <% $width %>, 336, 'pkg_or_svc_action_popup' ), CAPTION, '<% $actionlabel %>', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '<% $color %>', CGCOLOR, '<% $color %>', CLOSETEXT, '<% $closetext %>' ); return false;"><% $label %></A>
-%}

Index: popup_link-cust_main.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/popup_link-cust_main.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- popup_link-cust_main.html	29 Mar 2008 08:15:45 -0000	1.3
+++ popup_link-cust_main.html	31 Mar 2008 20:40:33 -0000	1.4
@@ -5,7 +5,7 @@
   <SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
   <SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>
 
-  include( '/elements/cust_popup_link.html', {
+  include( '/elements/cust_popup_link.html', { #hashref or a list, either way
 
     #required
     'action'         => 'content.html', # uri for content of popup which should
@@ -23,35 +23,21 @@
   )
 
 </%doc>
+% if ( $params->{'cust_main'} ) {
+<% include('/elements/popup_link.html', $params ) %>\
+% }
 <%init>
-my($params, $action, $label, $actionlabel, $color, $cust_main, $width);
-my $closetext = '';
-if (ref(@_[0]) eq 'HASH') {
-  $params = shift;
-  foreach (qw(action label actionlabel width color)) {
-    $action      = $params->{'action'}      if exists $params->{'action'};
-    $label       = $params->{'label'}       if exists $params->{'label'};
-    $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
-    $width       = $params->{'width'}       if exists $params->{'width'};
-    $color       = $params->{'color'}       if exists $params->{'color'};
-    $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
-    $cust_main   = $params->{'cust_main'}   if exists $params->{'cust_main'};
-  }
-}else{  # deprecated
-  ($action, $label, $actionlabel, $color, $cust_main) = @_;
-}
 
-$action .= ( $action =~ /\?/ ) ? ';' : '?';
-$action .= 'custnum='. $cust_main->custnum;
+my $params = { 'closetext' => 'Close' };
+
+if (ref($_[0]) eq 'HASH') {
+  $params = { %$params, %{ $_[0] } };
+} else {
+  $params = { %$params, @_ };
+}
+ 
+$params->{'action'} .=
+  ( $params->{'action'} =~ /\?/ ? ';' : '?' ).
+  'custnum='. $params->{'cust_main'}->custnum;
 
 </%init>
-<% $cust_main 
-   ? include('/elements/popup_link.html', { 'action'       => $action,
-                                            'label'        => $label,
-                                            'actionlabel'  => $actionlabel,
-                                            'color'        => $color,
-                                            'closetext'    => $closetext,
-                                          }
-            )
-   : ''
-%>

Index: popup_link-cust_svc.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/popup_link-cust_svc.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- popup_link-cust_svc.html	16 Mar 2008 23:05:26 -0000	1.2
+++ popup_link-cust_svc.html	31 Mar 2008 20:40:33 -0000	1.3
@@ -5,7 +5,7 @@
   <SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
   <SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>
 
-  include( '/elements/svc_popup_link.html', {
+  include( '/elements/svc_popup_link.html', { #hashref or a list, either way
 
     #required
     'action'         => 'content.html', # uri for content of popup which should
@@ -23,37 +23,26 @@
   )
 
 </%doc>
+% if ( $params->{'cust_svc'} ) {
+<% include( '/elements/popup_link.html', $params ) %>\
+% }
 <%init>
-my($params, $action, $label, $actionlabel, $cust_svc, $color, $width);
-my $closetext = 'Close';
-if (ref(@_[0]) eq 'HASH') {
-  $params = shift;
-  foreach (qw(action label actionlabel width color)) {
-    $action      = $params->{'action'}      if exists $params->{'action'};
-    $label       = $params->{'label'}       if exists $params->{'label'};
-    $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
-    $width       = $params->{'width'}       if exists $params->{'width'};
-    $color       = $params->{'color'}       if exists $params->{'color'};
-    $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
-    $cust_svc    = $params->{'cust_svc'}    if exists $params->{'cust_svc'};
-  }
-}else{  # deprecated
-  ($action, $label, $actionlabel, $cust_svc) = @_;
+
+my $params = { 'closetext' => 'Close',
+               'width'     => 392,
+             };
+
+if (ref($_[0]) eq 'HASH') {
+  $params = { %$params, %{ $_[0] } };
+} else {
+  $params = { %$params, @_ };
 }
 
-$action .= '?svcnum='. $cust_svc->svcnum;
-$actionlabel .= ' service '. $cust_svc->svcnum;
-$width ||= 392;
+$params->{'action'} .=
+  ( $params->{'action'} =~ /\?/ ? ';' : '?' ).
+  'svcnum='. $params->{'cust_svc'}->svcnum;
+
+$params->{'actionlabel'} .=
+  ' service '. $params->{'cust_svc'}->svcnum; #XXX svcnum? really?
 
 </%init>
-<% $cust_svc
-   ? include('/elements/popup_link.html', { 'action'       => $action,
-                                            'label'        => $label,
-                                            'actionlabel'  => $actionlabel,
-                                            'color'        => $color,
-                                            'width'        => $width,
-                                            'closetext'    => $closetext,
-                                          }
-            )
-   : ''
-%>

Index: popup_link-cust_pkg.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/popup_link-cust_pkg.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- popup_link-cust_pkg.html	16 Mar 2008 23:05:25 -0000	1.2
+++ popup_link-cust_pkg.html	31 Mar 2008 20:40:33 -0000	1.3
@@ -5,7 +5,7 @@
   <SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
   <SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>
 
-  include( '/elements/pkg_popup_link.html', {
+  include( '/elements/pkg_popup_link.html', { #hashref or a list, either way
 
     #required
     'action'         => 'content.html', # uri for content of popup which should
@@ -23,37 +23,26 @@
   )
 
 </%doc>
+% if ( $params->{'cust_pkg'} ) {
+<% include('/elements/popup_link.html', $params ) %>\
+% }
 <%init>
-my($params, $action, $label, $actionlabel, $color, $cust_pkg, $width);
-my $closetext = 'Close';
-if (ref(@_[0]) eq 'HASH') {
-  $params = shift;
-  foreach (qw(action label actionlabel width color)) {
-    $action      = $params->{'action'}      if exists $params->{'action'};
-    $label       = $params->{'label'}       if exists $params->{'label'};
-    $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
-    $width       = $params->{'width'}       if exists $params->{'width'};
-    $color       = $params->{'color'}       if exists $params->{'color'};
-    $closetext   = $params->{'closetext'}   if exists $params->{'closetext'};
-    $cust_pkg    = $params->{'cust_pkg'}    if exists $params->{'cust_pkg'};
-  }
-}else{  # deprecated
-  ($action, $label, $actionlabel, $color, $cust_pkg) = @_;
+
+my $params = { 'closetext' => 'Close',
+               'width'     => 768,
+             };
+
+if (ref($_[0]) eq 'HASH') {
+  $params = { %$params, %{ $_[0] } };
+} else {
+  $params = { %$params, @_ };
 }
 
-$action .= '&pkgnum='. $cust_pkg->pkgnum;
-$actionlabel .= ' package '. $cust_pkg->pkgnum;
-$width ||= 768;
+$params->{'action'} .=
+  ( $params->{'action'} =~ /\?/ ? ';' : '?' ).
+  'pkgnum='. $params->{'cust_pkg'}->pkgnum;
+
+$params->{'actionlabel'} .=
+  ' package '. $params->{'cust_pkg'}->pkgnum; #XXX pkgnum?  really?
 
 </%init>
-<% $cust_pkg
-   ? include('/elements/popup_link.html', { 'action'       => $action,
-                                            'label'        => $label,
-                                            'actionlabel'  => $actionlabel,
-                                            'color'        => $color,
-                                            'width'        => $width,
-                                            'closetext'    => $closetext,
-                                          }
-            )
-   : ''
-%>



More information about the freeside-commits mailing list