summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2008-03-31 20:40:33 +0000
committerivan <ivan>2008-03-31 20:40:33 +0000
commita2649b652a3db877b105b4bea5b34727dbcb914f (patch)
tree535157e59a08899407fadf892405b0abd7afd57b /httemplate
parentf9b6a37aaee52d875ea9393cda79d46f8916e593 (diff)
clean up popup link elements a bit, have the iframe name autogenerate to work around safari fuckery
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/popup_link-cust_main.html44
-rw-r--r--httemplate/elements/popup_link-cust_pkg.html49
-rw-r--r--httemplate/elements/popup_link-cust_svc.html49
-rw-r--r--httemplate/elements/popup_link.html47
4 files changed, 81 insertions, 108 deletions
diff --git a/httemplate/elements/popup_link-cust_main.html b/httemplate/elements/popup_link-cust_main.html
index a927f39f2..cbb48c008 100644
--- a/httemplate/elements/popup_link-cust_main.html
+++ b/httemplate/elements/popup_link-cust_main.html
@@ -5,7 +5,7 @@ Example:
<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 @@ Example:
)
</%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,
- }
- )
- : ''
-%>
diff --git a/httemplate/elements/popup_link-cust_pkg.html b/httemplate/elements/popup_link-cust_pkg.html
index cd4aa4c2e..2d0c5175a 100644
--- a/httemplate/elements/popup_link-cust_pkg.html
+++ b/httemplate/elements/popup_link-cust_pkg.html
@@ -5,7 +5,7 @@ Example:
<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 @@ Example:
)
</%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,
- }
- )
- : ''
-%>
diff --git a/httemplate/elements/popup_link-cust_svc.html b/httemplate/elements/popup_link-cust_svc.html
index decb82d97..8a11fd780 100644
--- a/httemplate/elements/popup_link-cust_svc.html
+++ b/httemplate/elements/popup_link-cust_svc.html
@@ -5,7 +5,7 @@ Example:
<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 @@ Example:
)
</%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,
- }
- )
- : ''
-%>
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>
-%}