diff options
author | ivan <ivan> | 2008-03-31 20:40:33 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-03-31 20:40:33 +0000 |
commit | a2649b652a3db877b105b4bea5b34727dbcb914f (patch) | |
tree | 535157e59a08899407fadf892405b0abd7afd57b /httemplate/elements/popup_link.html | |
parent | f9b6a37aaee52d875ea9393cda79d46f8916e593 (diff) |
clean up popup link elements a bit, have the iframe name autogenerate to work around safari fuckery
Diffstat (limited to 'httemplate/elements/popup_link.html')
-rw-r--r-- | httemplate/elements/popup_link.html | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html index 816856bba..556e19ebe 100644 --- a/httemplate/elements/popup_link.html +++ b/httemplate/elements/popup_link.html @@ -5,7 +5,7 @@ Example: <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 @@ Example: '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> -%} |