<div>
    % my $btn = l('ln_LOCALNETWORK_ADD');
    %= form_for '/localnetworksa' => (method => 'POST') => begin

	% my $retref= $c->stash("ret");
	% my %ret;
	% unless (length($retref)) {%ret = (ret=>"");}
	% else {%ret = %$retref;}

    % if (config->{debug} == 1) {
	<p>
		%= dumper "Ret:".$ret{ret};
	</p>	
	%}

	% my @vars = split(",",$ret{vars});
	% my $var1 = @vars[0];
	% my $var2 = @vars[1];
	% my $var3 = @vars[2];
	% my $var4 = @vars[3];
	% my $var5 = @vars[4];
	% my $var6 = @vars[5];
	% my $var7 = @vars[6];


	%if ($ret{ret} eq "") {
		%=l "ln_FIRSTPAGE_DESC"
	%} elsif (index($ret{ret},"SUCCESS") != -1) {
	   <div class="">
	       <h2> Operation Status Report</h2>
		%= $c->render_to_string(inline => l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6,$var7));
		</div>
	   %} else { 
	   <div class="">
	       <h2> Operation Status Report - Error</h2>
		%= $c->render_to_string(inline => l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6,$var7));
    	</div>
	%}

	<p>
	<br>
	%= submit_button "$btn", class => ""
	</p>

    % end    

	<br>
    % my $numlocalnetworks = @$localnetworks;
    %	if ($numlocalnetworks == 0){
        %=l 'ln_LOCAL_NETWORK_NONE'
    %	} else {
        <br>
		<table class="table table-bordered">
		<thead>
		<tr>
			<th class="">
				%=l 'NETWORK'
			</th>
			<th class="">
				%=l 'ln_SUBNET_MASK'
			</th>

			<th class="">
				%=l 'ln_NUMBER_OF_HOSTS'
			</th>

			<th class="">
				%=l 'ROUTER'
			</th>

			<th class="">
				%=l 'ACTION'
			</th>
		</tr>
		</thead>
		<tbody>
		%    foreach my $localnetwork (@$localnetworks )
		%    {
		%     	my ($num_hosts) = esmith::util::computeHostRange( $localnetwork->key, $localnetwork->prop('Mask') );
		%     	my $removable = $localnetwork->prop('Removable') || "yes";
		%    		my $system       = $localnetwork->prop('SystemLocalNetwork') || "no";
		%   		if ( $system eq "yes" ) { $removable = "no"; }
					<tr>
					%= t td => (class => "") => $localnetwork->key
					%= t td => (class => "") => $localnetwork->prop('Mask')
					%= t td => (class => "") => $num_hosts
					%= t td => (class => "") => $localnetwork->prop('Router')
					%my $actionRemove = '&nbsp;';
					%if ($removable eq "yes") {
						%my $remove_text = l('REMOVE');  # Localized text
						%my $local_network_entry = $localnetwork->key;
						%my $csrf_token = "TOKEN";  # CSRF token for security
						%$actionRemove = qq{
                                                %       <a href="localnetworksd?CsrfDef=$csrf_token&trt=DEL&localnetwork=$local_network_entry">
						%	<button type='button' class="" title='$remove_text' >
						%		$remove_text
						%	</button>
                                                %       </a>
						%};
					% }
					<td class=""><%= $c->render_to_string(inline => $actionRemove) %></td>
					</tr>
		%  } 
		</tbody>
		</table>
		%= hidden_field 'trt' => $ln_datas->{trt}
	%}
</div>
