From 806d426d106efea2b2b13314108c4ac046511e1c Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 18 Sep 2012 02:56:30 -0700 Subject: [PATCH] export host selection per service, RT#17914 --- FS/FS/part_export.pm | 25 +++++++++++++++++++++++++ httemplate/browse/part_export.cgi | 12 +----------- httemplate/browse/part_svc.cgi | 11 +---------- httemplate/edit/part_svc.cgi | 7 +------ 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 97394af18..c757d368d 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -330,6 +330,31 @@ sub label { ($self->exportname || $self->exporttype ). ' ('. $self->machine. ')'; } +=item label_html + +Returns a label for this export, "exportname: exporttype to machine". + +=cut + +sub label_html { + my $self = shift; + + my $label = $self->exportname + ? ''. $self->exportname. ': ' #
'. + : ''; + + $label .= $self->exporttype; + + $label .= ' to '. ( $self->machine eq '_SVC_MACHINE' + ? 'per-service hostname' + : $self->machine + ) + if $self->machine; + + $label; + +} + #=item part_svc # #Returns the service definition (see L) for this export. diff --git a/httemplate/browse/part_export.cgi b/httemplate/browse/part_export.cgi index beed70887..b7ecc00a6 100755 --- a/httemplate/browse/part_export.cgi +++ b/httemplate/browse/part_export.cgi @@ -36,17 +36,7 @@ function part_export_areyousure(href) { <% $part_export->exportnum %> -% if( $part_export->exportname ) { - <% $part_export->exportname %>:
-% } - <% $part_export->exporttype %> - <% $part_export->machine - ? 'to '. ( $part_export->machine eq '_SVC_MACHINE' - ? 'per-service hostname' - : $part_export->machine - ) - : '' - %> + <% $part_export->label_html %> (edit | delete) diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 26d090a3d..a8f4a7c84 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -141,16 +141,7 @@ function part_export_areyousure(href) { % - -<% $part_export->exportnum %>:  -% if ($part_export->exportname) { -<% $part_export->exportname %> ( -% } -<% $part_export->exporttype %> to <% $part_export->machine %> -% if ($part_export->exportname) { -) -% } - + <% $part_export->label_html %> % } diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 4bd083798..007c24629 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -144,12 +144,7 @@ % && qsearchs( 'export_svc', { % exportnum => $part_export->exportnum, % svcpart => $clone || $part_svc->svcpart }); -% $html .= '>'.$part_export->exportnum. ': '; -% $html .= $part_export->exportname . '
' -% if ( $part_export->exportname ); -% $html .= $part_export->exporttype. ' to '. $part_export->machine; -% $html .= '
' if ( $part_export->exportname ); -% $html .= ''; +% $html .= '>'. $part_export->label_html. ''; % $count++; % $html .= '' unless $count % $columns; % } -- 2.11.0