From c13e11794f80ddbe8748132d78bff1559782d570 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Dec 2010 23:44:38 +0000 Subject: [PATCH] add cust_main-external_links and menu-prepend_links options for wisper NORM links, RT#10889 --- FS/FS/Conf.pm | 14 ++++++++++++++ httemplate/elements/menu.html | 16 +++++++++++++--- httemplate/view/cust_main.cgi | 18 ++++++++++++++++-- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index ba0bc5b6d..e975fe1d3 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -4132,6 +4132,20 @@ and customer address. Include units.', 'type' => 'textarea', }, + { + 'key' => 'menu-prepend_links', + 'section' => 'UI', + 'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".', + 'type' => 'textarea', + }, + + { + 'key' => 'cust_main-external_links', + 'section' => 'UI', + 'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)". The URL will have custnum appended.', + 'type' => 'textarea', + }, + { key => "apacheroot", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachine", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachines", section => "deprecated", description => "DEPRECATED", type => "text" }, diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index acbaf41bd..69d793626 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -563,9 +563,19 @@ $help_menu{"About RT v$RT::VERSION"} = [ 'http://www.bestpractical.com/rt', 'Req if $conf->config('ticket_system') eq 'RT_Internal'; -tie my %menu, 'Tie::IxHash', - 'Billing Main' => [ $fsurl, 'Billing start page', ], -; +tie my %menu, 'Tie::IxHash'; + +if ( $conf->config('menu-prepend_links')) { + my @links = split(/\n/, $conf->config('menu-prepend_links')); + foreach my $link (@links) { + $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next; + my($url, $label, $alt) = ($1, $2, $4); + $menu{$label} = [ $url, $alt ]; + } +} + +$menu{'Billing Main'} = [ $fsurl, 'Billing start page', ]; + if ( $conf->config('ticket_system') ) { $menu{'Ticketing Main'} = [ diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index df875f939..e6db0a6c1 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -93,14 +93,28 @@ function areyousure(href, message) {

+% my $br = 0; % if ( $curuser->access_right('Billing event reports') % || $curuser->access_right('View customer billing events') % ) { - +% $br=1; View billing events for this customer -

+% } +% if ( $conf->config('cust_main-external_links') ) { + <% $br++ ? ' | ' : '' %> +% my @links = split(/\n/, $conf->config('menu-prepend_links')); +% foreach my $link (@links) { +% $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next; +% my($url, $label, $alt) = ($1, $2, $4); + <% $label |h %> +% } +% } + +% if ( $br ) { +

% } + %my $signupurl = $conf->config('signupurl'); %if ( $signupurl ) { -- 2.11.0