X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fconfig%2Fconfig-view.cgi;h=aca37f2ad710d7b2f6427483c18184734e50c7f0;hb=b19bf30f0d745d20e5e4f0a8e47ce16a04b02dd9;hp=bb6a3ca0bf33bc514074ebfbb0289d6be3f8ba59;hpb=0609e18c044c8cf749b58dbae951fdacdb87f159;p=freeside.git diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index bb6a3ca0b..aca37f2ad 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -58,7 +58,22 @@ Click on a configuration value to change it. % #$height = % } % -% my @agents = $page_agent ? ( $page_agent ) : ( '', @all_agents ); +% my @agents = (); +% my @add_agents = (); +% if ( $page_agent ) { +% @agents = ( $page_agent ); +% } else { +% @agents = ( '' ); +% if ( $i->per_agent ) { +% foreach my $agent (@all_agents) { +% if ( defined(_config_agentonly($conf, $i->key, $agent->agentnum)) ) { +% push @agents, $agent; +% } else { +% push @add_agents, $agent; +% } +% } +% } +% } % % foreach my $agent ( @agents ) { % my $agentnum = $agent ? $agent->agentnum : ''; @@ -81,6 +96,10 @@ Click on a configuration value to change it. # if $cgi->param('showagent')? ) %>: <% $i->description %> +% if ( $agent && $cgi->param('showagent') ) { + (delete agent override) +% } + @@ -190,25 +209,81 @@ Click on a configuration value to change it. % } # foreach my $agentnum +% if ( @add_agents ) { + + + + + +% } #if @add_agents + % } # foreach my $i
+
+ Add <% $i->key %> override for + <% include('/elements/select-agent.html', + 'agents' => \@add_agents, + 'empty_label' => 'Select agent', + 'onchange' => "agent_changed", + 'id' => 'agent_'. $i->key, + ) + %> + agent + +% my $agent_el = "document.getElementById('agent_". $i->key. "')"; + $width, + 'height' => $height, + 'actionlabel' => 'Enter configuration value', + ) + %>" + > +
+


% } # foreach my $nav_section + + <%once> #should probably be a Conf method. what else would need to use it? -#not even us, apparantly... -# defined( _config_agentonly($conf, $i->key, $_->agentnum) ) -#sub _config_agentonly { -# my($self,$name,$agentnum)=@_; -# my $hashref = { 'name' => $name }; -# $hashref->{agentnum} = $agentnum; -# local $FS::Record::conf = undef; # XXX evil hack prevents recursion -# FS::Record::qsearchs('conf', $hashref); -#} +sub _config_agentonly { + my($self,$name,$agentnum)=@_; + my $hashref = { 'name' => $name }; + $hashref->{agentnum} = $agentnum; + local $FS::Record::conf = undef; # XXX evil hack prevents recursion + FS::Record::qsearchs('conf', $hashref); +} <%init>