[freeside-commits] freeside/httemplate/elements popup_link.html, 1.3, 1.4 popup_link_onclick.html, NONE, 1.1

Ivan,,, ivan at wavetail.420.am
Mon Mar 31 14:11:04 PDT 2008


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

Modified Files:
	popup_link.html 
Added Files:
	popup_link_onclick.html 
Log Message:
fix safari weirdness with caching iframes and auto-submitting them (in tax editor at least)

Index: popup_link.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/popup_link.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- popup_link.html	31 Mar 2008 20:40:33 -0000	1.3
+++ popup_link.html	31 Mar 2008 21:11:02 -0000	1.4
@@ -21,16 +21,11 @@
   } )
 
 </%doc>
-% if ($action && $label) {
+% if ($params->{'action'} && $label) {
 <A HREF="javascript:void(0);" onClick="<% $onclick %>"><% $label %></A>\
 % }
 <%init>
 
-my($action, $label, $actionlabel) = ( '', '', '' );
-my $closetext = 'Close';
-my $width = 540;
-my $color = '#333399';
-
 my $params;
 if (ref($_[0]) eq 'HASH') {
   #$params = { %$params, %{ $_[0] } };
@@ -40,17 +35,7 @@
   $params = { @_ };
 }
 
-$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;";
+my $label = $params->{'label'};
+my $onclick = include('/elements/popup_link_onclick.html', $params);
 
 </%init>

--- NEW FILE: popup_link_onclick.html ---
<%doc>

Example:

  <SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
  <SCRIPT TYPE="text/javascript" SRC="iframecontentmws.js"></SCRIPT>

  include( '/elements/popup_link_onclick.html', { #hashref or a list, either way

    #required
    'action'         => 'content.html', # uri for content of popup
   
    #strongly recommended
    'actionlabel     => 'You clicked',  # popup title
   
    #opt
    'width'          => '540',
    'color'          => '#ff0000',
    'closetext'      => 'Go Away',      # the value '' removes the link
  } )

</%doc>
% if ($action) { 
<% $onclick %>\
% }
<%init>

my($action, $actionlabel) = ( '', '' );
my( $width, $height ) = ( 540, 336 );
my $closetext = 'Close';
my $color = '#333399';

my $params;
if (ref($_[0]) eq 'HASH') {
  #$params = { %$params, %{ $_[0] } };
  $params = shift;
} else {
  #$params = { %$params, @_ };
  $params = { @_ };
}

$action      = $params->{'action'}      if exists $params->{'action'};
$actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
$width       = $params->{'width'}       if exists $params->{'width'};
$height      = $params->{'height'}      if exists $params->{'height'};
$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, $height, '$popup_name' ), CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '$color', CGCOLOR, '$color', CLOSETEXT, '$closetext' ); return false;";

</%init>



More information about the freeside-commits mailing list