From 2755d4a4810600f4392eaf73f362b4f358adeec6 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 17 Mar 2009 09:58:17 +0000 Subject: add eps preview to config, for RT#5025 --- httemplate/config/config-view.cgi | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 0f5fd6213..f2ae892a6 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -69,22 +69,32 @@ Click on a configuration value to change it. % } elsif ( $type eq 'image' ) { - - <% $conf->exists($i->key, $agentnum) - ? '' - : 'empty' - %> + + <% $conf->exists($i->key, $agentnum) + ? '' + : 'empty' + %> + + + + + <% $conf->exists($i->key, $agentnum) + ? qq!download! + : '' + %> + % } elsif ( $type eq 'binary' ) { - - <% $conf->exists($i->key, $agentnum) - ? qq!download! - : 'empty' - %> + + <% $conf->exists($i->key, $agentnum) + ? qq!download! + : 'empty' + %> + % } elsif ( $type eq 'textarea' -- cgit v1.2.1 From 6a1d3fe46f65b0a24ec025c22afcdb75af3c9e9a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 08:02:29 +0000 Subject: show labels for select(select_hash) config options, RT#3997 --- httemplate/config/config-view.cgi | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index f2ae892a6..41ecfd268 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -66,7 +66,7 @@ Click on a configuration value to change it. no type -% } elsif ( $type eq 'image' ) { +% } elsif ( $type eq 'image' ) { @@ -86,7 +86,7 @@ Click on a configuration value to change it. -% } elsif ( $type eq 'binary' ) { +% } elsif ( $type eq 'binary' ) { @@ -112,17 +112,36 @@ Click on a configuration value to change it. + % } elsif ( $type eq 'checkbox' ) { YES' : 'ff0000">NO' %> + +% } elsif ( $type eq 'select' && $i->select_hash ) { +% +% my %hash; +% if ( ref($i->select_hash) eq 'ARRAY' ) { +% tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash }; +% } else { +% tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash }; +% } + + + + <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %> + + + % } elsif ( $type eq 'text' || $type eq 'select' ) { <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %> - + + + % } elsif ( $type eq 'select-sub' ) { @@ -131,6 +150,7 @@ Click on a configuration value to change it. <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %> + % } else { -- cgit v1.2.1 From 8cda5aa78a9ae58afe4b9f3684165658eb73c163 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 1 May 2009 01:07:45 +0000 Subject: add ability to edit the agent overrides from the main config, RT#4218 --- httemplate/config/config-view.cgi | 93 +++++++++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 19 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 41ecfd268..534de0231 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -3,6 +3,21 @@ Click on a configuration value to change it.

+% unless ( $page_agent ) { +% +% if ( $cgi->param('showagent') ) { +% $cgi->param('showagent', 0); + ( hide agent overrides ) +% $cgi->param('showagent', 1); +% } else { +% $cgi->param('showagent', 1); + ( show agent overrides ) +% $cgi->param('showagent', 0); +% } +% +% } +

+ <% include('/elements/init_overlib.html') %> % if ($FS::UID::use_confcompat) { @@ -42,6 +57,26 @@ Click on a configuration value to change it. % #$width = % #$height = % } +% +% my @agents = (); +% if ( $page_agent ) { +% @agents = ( $page_agent ); +% } else { +% @agents = ( +% '', +% grep { defined( _config_agentonly($conf, $i->key, $_->agentnum) ) } +% @all_agents +% ); +% } +% +% foreach my $agent ( @agents ) { +% my $agentnum = $agent ? $agent->agentnum : ''; +% +% my $label = $i->key; +% $label = '['. $agent->agent. "] $label" +% if $agent && $cgi->param('showagent'); +% +% #indentation :/ <% include('/elements/popup_link.html', @@ -50,8 +85,9 @@ Click on a configuration value to change it. 'width' => $width, 'height' => $height, 'actionlabel' => 'Enter configuration value', - 'label' => ''. $i->key. '', - 'aname' => $i->key, + 'label' => "$label", + 'aname' => $i->key, #agentnum + # if $cgi->param('showagent')? ) %>: <% $i->description %> @@ -102,21 +138,19 @@ Click on a configuration value to change it. % || $type eq 'selectmultiple' ) { - -
-<% encode_entities(join("\n",
+              
+
<% encode_entities(join("\n",
      map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
          $conf->config($i->key, $agentnum)
    ) )
-%>
-
+%>
% } elsif ( $type eq 'checkbox' ) { - YES' : 'ff0000">NO' %> + YES' : 'ff0000">NO' %> % } elsif ( $type eq 'select' && $i->select_hash ) { @@ -129,7 +163,7 @@ Click on a configuration value to change it. % } - + <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %> @@ -137,7 +171,7 @@ Click on a configuration value to change it. % } elsif ( $type eq 'text' || $type eq 'select' ) { - + <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %> @@ -145,7 +179,7 @@ Click on a configuration value to change it. % } elsif ( $type eq 'select-sub' ) { - + <% $conf->config($i->key, $agentnum) %>: <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %> @@ -162,35 +196,50 @@ Click on a configuration value to change it. -% } + +% } # foreach my $agentnum + +% } # foreach my $i

-% } +% } # foreach my $nav_section +<%once> + +#should probably be a Conf method. what else would need to use it? +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> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $agentnum = ''; +my $page_agent = ''; my $title; my @menubar = (); if ($cgi->param('agentnum') =~ /^(\d+)$/) { - $agentnum = $1; - my $agent = qsearchs('agent', { 'agentnum' => $agentnum } ); - die "Agent $agentnum not found!" unless $agent; + my $page_agentnum = $1; + $page_agent = qsearchs('agent', { 'agentnum' => $page_agentnum } ); + die "Agent $page_agentnum not found!" unless $page_agent; push @menubar, 'View all agents' => $p.'browse/agent.cgi'; - $title = 'Agent Configuration for '. $agent->agent; + $title = 'Agent Configuration for '. $page_agent->agent; } else { $title = 'Global Configuration'; } my $conf = new FS::Conf; -my @config_items = grep { $agentnum ? $_->per_agent : 1 } +my @config_items = grep { $page_agent ? $_->per_agent : 1 } grep { $_->key != ~/^invoice_(html|latex|template)/ } $conf->config_items; @@ -204,4 +253,10 @@ foreach my $section (@sections) { @sections = grep scalar( @{ $section_items{$_} } ), @sections; +my @all_agents = (); +if ( $cgi->param('showagent') ) { + @all_agents = qsearch('agent', { 'disabled' => '' } ); +} +warn 'all agents: '. join('-', @all_agents); + -- cgit v1.2.1 From 983584fdcdfb282750f6b40beb5e1c43cc498274 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 1 May 2009 02:43:24 +0000 Subject: view all overrides when asked, even the ones without values. hmm :/ RT#5218 --- httemplate/config/config-view.cgi | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 534de0231..bb6a3ca0b 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -58,16 +58,7 @@ Click on a configuration value to change it. % #$height = % } % -% my @agents = (); -% if ( $page_agent ) { -% @agents = ( $page_agent ); -% } else { -% @agents = ( -% '', -% grep { defined( _config_agentonly($conf, $i->key, $_->agentnum) ) } -% @all_agents -% ); -% } +% my @agents = $page_agent ? ( $page_agent ) : ( '', @all_agents ); % % foreach my $agent ( @agents ) { % my $agentnum = $agent ? $agent->agentnum : ''; @@ -209,13 +200,15 @@ Click on a configuration value to change it. <%once> #should probably be a Conf method. what else would need to use it? -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); -} +#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); +#} <%init> -- cgit v1.2.1 From b19bf30f0d745d20e5e4f0a8e47ce16a04b02dd9 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 2 May 2009 00:02:07 +0000 Subject: finish up useful agent stuff on the config editor: adding, deleting overrides too. also add a confirmation to override deletion from the agent browse page. RT#5218 --- httemplate/config/config-view.cgi | 95 ++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 10 deletions(-) (limited to 'httemplate/config/config-view.cgi') 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> -- cgit v1.2.1 From 53cadf47dea115cf804d07beb58c7de67429873f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 May 2009 01:11:50 +0000 Subject: add ability to remove suffix-ed config items, RT#5218 --- httemplate/config/config-view.cgi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index aca37f2ad..9b5b13251 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -97,7 +97,16 @@ Click on a configuration value to change it. ) %>: <% $i->description %> % if ( $agent && $cgi->param('showagent') ) { - (delete agent override) +% my $confnum = +% _config_agentonly($conf, $i->key, $agent->agentnum)->confnum; + (delete agent override) +% } elsif ( $i->base_key ) { +% my $confnum = +% $agent +% ? _config_agentonly($conf, $i->key, $agent->agentnum)->confnum +% : $conf->_config( $i->key )->confnum; +% my $showagent = $cgi->param('showagent') ? '_showagent' : ''; + (delete configuration item) % } @@ -308,7 +317,6 @@ if ($cgi->param('agentnum') =~ /^(\d+)$/) { my $conf = new FS::Conf; my @config_items = grep { $page_agent ? $_->per_agent : 1 } - grep { $_->key != ~/^invoice_(html|latex|template)/ } $conf->config_items; my @sections = qw(required billing username password UI session shell BIND ); -- cgit v1.2.1 From e91ac7e6e069df321b815b08bf0e35d5fd3bd8f7 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 May 2009 01:45:09 +0000 Subject: add ability to delete invoice_latexreturnaddress and invoice_htmlreturnaddress too, RT#5218 --- httemplate/config/config-view.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 9b5b13251..c5ac1a685 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -100,7 +100,8 @@ Click on a configuration value to change it. % my $confnum = % _config_agentonly($conf, $i->key, $agent->agentnum)->confnum; (delete agent override) -% } elsif ( $i->base_key ) { +% } elsif ( $i->base_key +% || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) { % my $confnum = % $agent % ? _config_agentonly($conf, $i->key, $agent->agentnum)->confnum @@ -319,6 +320,9 @@ my $conf = new FS::Conf; my @config_items = grep { $page_agent ? $_->per_agent : 1 } $conf->config_items; +my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress ); +my %deleteable = map { $_ => 1 } @deleteable; + my @sections = qw(required billing username password UI session shell BIND ); push @sections, '', 'deprecated'; -- cgit v1.2.1 From 44a63e5978af2b5b4e00cabbc4b3541df4144305 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 27 Jul 2009 06:17:20 +0000 Subject: add deprecated config options back to Conf.pm to fix "unapplypayments" fails existential comparison errors, RT#2927 --- httemplate/config/config-view.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index c5ac1a685..9e9e64eb2 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -78,6 +78,8 @@ Click on a configuration value to change it. % foreach my $agent ( @agents ) { % my $agentnum = $agent ? $agent->agentnum : ''; % +% next if $section eq 'deprecated' && ! $conf->exists($i->key, $agentnum); +% % my $label = $i->key; % $label = '['. $agent->agent. "] $label" % if $agent && $cgi->param('showagent'); -- cgit v1.2.1 From 56a2965996454a0649d43ecbc062beda61106e21 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 12 Aug 2009 14:58:50 +0000 Subject: internalize billco-upload and automate the transfer to the provider RT#5902 --- httemplate/config/config-view.cgi | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 9e9e64eb2..0f6c99232 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -66,7 +66,7 @@ Click on a configuration value to change it. % @agents = ( '' ); % if ( $i->per_agent ) { % foreach my $agent (@all_agents) { -% if ( defined(_config_agentonly($conf, $i->key, $agent->agentnum)) ) { +% if ( defined($conf->conf( $i->key, $agent->agentnum, 1 ) ) ) { % push @agents, $agent; % } else { % push @add_agents, $agent; @@ -99,15 +99,14 @@ Click on a configuration value to change it. ) %>: <% $i->description %> % if ( $agent && $cgi->param('showagent') ) { -% my $confnum = -% _config_agentonly($conf, $i->key, $agent->agentnum)->confnum; +% my $confnum = $conf->conf( $i->key, $agent->agentnum, 1 )->confnum; (delete agent override) % } elsif ( $i->base_key % || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) { % my $confnum = % $agent -% ? _config_agentonly($conf, $i->key, $agent->agentnum)->confnum -% : $conf->_config( $i->key )->confnum; +% ? $conf->conf( $i->key, $agent->agentnum, 1 )->confnum +% : $conf->conf( $i->key )->confnum; % my $showagent = $cgi->param('showagent') ? '_showagent' : ''; (delete configuration item) % } @@ -286,18 +285,6 @@ Click on a configuration value to change it. -<%once> - -#should probably be a Conf method. what else would need to use it? -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> die "access denied" @@ -320,6 +307,7 @@ if ($cgi->param('agentnum') =~ /^(\d+)$/) { my $conf = new FS::Conf; my @config_items = grep { $page_agent ? $_->per_agent : 1 } + grep { $page_agent ? 1 : !$_->agentonly } $conf->config_items; my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress ); -- cgit v1.2.1 From 81e426fe755eaea508041bc2d7b25ac44c777434 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Sep 2009 10:14:30 +0000 Subject: nomadix, RT#5876 --- httemplate/config/config-view.cgi | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 0f6c99232..80a65d09b 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -156,7 +156,9 @@ Click on a configuration value to change it. % } elsif ( $type eq 'textarea' % || $type eq 'editlist' -% || $type eq 'selectmultiple' ) { +% || $type eq 'selectmultiple' +% ) +% { @@ -197,7 +199,7 @@ Click on a configuration value to change it. -% } elsif ( $type eq 'select-sub' ) { +% } elsif ( $type eq 'select-sub' ) { @@ -206,12 +208,25 @@ Click on a configuration value to change it. -% } else { +% } elsif ( $type eq 'select-part_svc' ) { +% my @svcparts = $conf->config($i->key, $agentnum); + + + + <% join('
', map { $_ # ': '. $svc + } + @svcparts + ) + %> + + + +% } else { unknown type <% $type %> -% } +% } % $n++; % } -- cgit v1.2.1 From 8800e519dc0e4b8eee4ab2cddc74d52c205bc536 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Sep 2009 12:29:16 +0000 Subject: processing fee on credit card recharges, RT#5889 --- httemplate/config/config-view.cgi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'httemplate/config/config-view.cgi') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 80a65d09b..51535d762 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -48,7 +48,8 @@ Click on a configuration value to change it. % foreach my $i (@{ $section_items{$section} }) { % my @types = ref($i->type) ? @{$i->type} : ($i->type); -% my( $width, $height ) = ( 522, 336 ); +%# my( $width, $height ) = ( 522, 336 ); +% my( $width, $height ) = ( 600, 336 ); % if ( grep $_ eq 'textarea', @types ) { % #800x600 % $width = 763; @@ -208,14 +209,14 @@ Click on a configuration value to change it. -% } elsif ( $type eq 'select-part_svc' ) { -% my @svcparts = $conf->config($i->key, $agentnum); +% } elsif ( $type =~ /^select-(part_svc|part_pkg)$/ ) { +% my @keys = $conf->config($i->key, $agentnum); - <% join('
', map { $_ # ': '. $svc + <% join('
', map { $_ # ': '. $svc, $pkg, whatever } - @svcparts + @keys ) %> -- cgit v1.2.1