From b7bde670fbe4ccb3e80adc4e701bed87e2ccd9a7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 Mar 2008 20:40:57 +0000 Subject: clean up popup link elements a bit, have the iframe name autogenerate to work around safari fuckery --- httemplate/elements/popup_link-cust_main.html | 43 ++++++++++----------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'httemplate/elements/popup_link-cust_main.html') diff --git a/httemplate/elements/popup_link-cust_main.html b/httemplate/elements/popup_link-cust_main.html index 3b1363f49..cbb48c008 100644 --- a/httemplate/elements/popup_link-cust_main.html +++ b/httemplate/elements/popup_link-cust_main.html @@ -5,7 +5,7 @@ Example: - 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,34 +23,21 @@ Example: ) +% 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 .= '?'. $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; -<% $cust_main - ? include('/elements/popup_link.html', { 'action' => $action, - 'label' => $label, - 'actionlabel' => $actionlabel, - 'color' => $color, - 'closetext' => $closetext, - } - ) - : '' -%> -- cgit v1.2.1