% layout 'AdminLTE', title => "Sme server 2 - remoteaccess";

% content_for 'module' => begin

<div class="card-body">

    % if (config->{debug} == 1) {
    <p>
    %= dumper $c->current_route
    %= dumper $rma_datas
    </p>
    % }
    <h1><%= $title%></h1>
    % if ( $notif ) {
    <br>
    <span class="">
    <%= $c->render_to_string(inline => $notif) %>
    </span>
    %}

    <!--<hr class="" />-->

    <%  my $btn = l('SAVE'); %>

    %= form_for 'remoteaccess' => (method => 'POST') => begin

    % my $ipsec = $c->get_ipsecrw_status();
    % if ( $ipsec ) {
    <p>
    <h2>
    %=l 'rma_TITLE_IPSECRW'
    </h2><br>

    %=l 'rma_DESC_IPSECRW'
    <br>

    <span class="">
    %=l 'rma_LABEL_IPSECRW_SESS'
    </span>
    <span class="">
    % param 'IpsecrwSess' => $c->get_ipsecrw_sessions unless param 'IpsecrwSess';
    %= text_field 'IpsecrwSess', class => ""
    </span>
    <br>

    %= $c->render_to_string(inline => $c->l('rma_DESC_IPSECRW_RESET'));
    <br>
    <span class="">
    %=l 'rma_LABEL_IPSECRW_RESET'
    </span>
    <span class="">
    %= check_box 'IpsecrwReset',class => ""
    </span>
    <br><br>

    <!--<hr class="" />-->

    %}

    <!-- percequ include 'partials/_rma_pptp' -->

    <h2>
    %= $c->l('rma_VALIDFROM_TITLE', $c->l('rma_REMOTE_MANAGEMENT'));
    </h2><br>
    %=l 'rma_VALIDFROM_DESC'
    <br><br>

    % my @vals = $self->_get_valid_from();
    % if (@vals) {
    <table class="table table-bordered">
    <thead>
    <tr>
    <th class="">
            %=l 'NETWORK'
            </th><th class="">
            %=l 'SUBNET_MASK'
            </th><th class="">
            %=l 'NUM_OF_HOSTS'
            </th><th class="">
            %=l 'REMOVE'
        </th>
        </tr>
        </thead>
        </tbody>

    %    foreach my $val ( @vals )
    %    {
    %        my ($net, $mask) = split '/', $val;
    %        $mask = '255.255.255.255' unless ($mask);
    %        my ($numhosts,$a,$b) = esmith::util::computeHostRange($net,$mask);
        <tr>
            %= t td => (class => "") => $net
            %= t td => (class => "") => $mask
            %= t td => (class => "") => $numhosts
            <td class="">
            <input type='checkbox' name='Remove_nets' value='<%= $net.'/'.$mask %>'>
            </td>
        </tr>
    %    }

        </tbody>
        </table>    

    <!-- my @cbGroup = $q->checkbox_group(-name => 'validFromRemove',
        -values => [@vals], -labels => { map {$_ => ''} @vals });
            foreach my $val (@vals)
            { esmith::cgi::genSmallCell($q, shift(@cbGroup), } -->
    % } else {
    <br><b>
        %= l('rma_NO_ENTRIES_YET');
    </b>
    %}
    %=l 'rma_DESC_VALID_FROM_ENTRIES'
    <br><br>
    <span class="">
    %=l 'NETWORK'
    </span>
    <span class="">
    %= text_field 'ValidFromNetwork', class => ""
    </span>
    <br>
    <span class="">
    %=l 'rma_SUBNET_MASK'
    </span>
    <span class="">
    %= text_field 'ValidFromMask', class => ""
    </span>

    <!--<hr class="" />-->

    <h2>
    %=l 'rma_TITLE_SSH'
    </h2><br>
    %=l 'rma_DESC_SSH'
    <br><br>
    <span class="">
    %=l 'rma_LABEL_SSH'
    </span>
    <span class="">
    % param 'SshAccess' => $c->get_ssh_access() unless param 'SshAccess';
    %= select_field 'SshAccess' => $c->networkAccess_list(), class => ""
    </span>
    <br>
    
    <span class="">
    %=l 'rma_LABEL_SSH_ADMIN'
    </span>
    <span class="">
    % param 'SshPermitRootLogin' => $rma_datas->{sshPermitRootLogin} unless param 'SshPermitRootLogin';
    %= select_field 'SshPermitRootLogin' => [[(l 'NO'), 'no'], [(l 'YES'), 'yes']], class => ""
    </span>
    <br>

    <span class="">
    %=l 'rma_LABEL_SSH_PASSWORD_ACCESS'
    </span>
    <span class="">
    % param 'SshPasswordAuthentication' => $c->get_ssh_password_auth() unless param 'SshPasswordAuthentication';
    %= select_field 'SshPasswordAuthentication' => [[(l 'NO'), 'no'], [(l 'YES'), 'yes']], class => ""
    </span>
    <br>

    <span class="">
    %=l 'rma_LABEL_SSH_PORT'
    </span>
    <span class="">
    % param 'SshTCPPort' => $c->get_ssh_port() unless param 'SshTCPPort';
    %= text_field 'SshTCPPort', class => ""
    </span>
    <br>

    <!--<hr class="" />-->

    <h2>
    %=l 'rma_TITLE_FTP_ACCESS'
    </h2><br>
    %= $c->render_to_string(inline => $c->l('rma_DESC_FTP_ACCESS'));

    <br>
    <span class="">
    %=l 'rma_LABEL_FTP_ACCESS'
    </span>
    <span class="">
    % param 'FtpAccess' => $c->get_ftp_access() unless param 'FtpAccess';
    %= select_field 'FtpAccess' => $c->networkAccess_list(), class => ""
    </span>
    <br>

    <br>
    %= $c->render_to_string(inline => $c->l('rma_DESC_FTP_LOGIN'));
    <br>
    <span class="">
    %=l 'rma_LABEL_FTP_LOGIN'
    </span>
    <span class="">
    % param 'FtpPasswordAccess' => $c->get_ftp_password_login_access() unless param 'FtpPasswordAccess';
    %= select_field 'FtpPasswordAccess' => $c->passwordLogin_list(), class => ""
    </span>
    <br>

    % my $mode = $c->get_telnet_mode();
    % if ( $mode ne 'off') {
    <!--<hr class="" />-->

    <h2>
    %=l 'rma_TITLE_TELNET_ACCESS'
    </h2><br>

    <span class="">
    %=l 'rma_DESC_TELNET_ACCESS'
    </span>
    <br><br>

    <span class="">
    %=l 'rma_LABEL_TELNET_ACCESS'
    </span>
    <span class="">
    % param 'TelnetAccess' => $mode unless param 'TelnetAccess';
    %= select_field 'TelnetAccess' => $c->networkAccess_list(), class => ""
    </span>
    <br>

    %}

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

    % end

</div>

% end
