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

% content_for 'module' => begin


<div class="card-body">

    % if (config->{debug} == 1) {
        <pre>
            <%= dumper $c->current_route %>
        </pre>
    % }
    % if ( stash 'error' ) {
        <br>
        <div class="text-danger">
            <%= $c->render_to_string(inline => stash 'error') %>
        </div>
    % }

    <h1><%=$title %></h1>
    <br>

    <div>
        If the Webmail panel does not appear after logging in, then please check your password.
    </div>

    <br>

    % my $thisdomain = $c->req->url->to_abs->host;
    % my $url = $c->stash('modul');
    % my $username = 'admin';

    % if (!$url) {
        % $url = $thisdomain."/roundcube";
    % }

    % if ($url =~ /[?&]_user=([^&]+)/) {
        % $username = $1;
    % }

    % if (!($url =~ /https:/)) {
        % $url = 'https://' . $url;
    % }

    <div class="container-fluid">
        <a href="<%= "https://".$thisdomain."/" %>roundcube?_user=<%= $username %>">
            <button class="" width=20em title="<%= l('Full Window') %>"><%= l('Full Window') %>
            </button>
        </a>
        <object data="<%=$url %>" title="<%= $c->stash('title') %>"  type="text/html" ><%= $c->stash('title') %> not found</object>
    </div>
</div>


<iframe width="100%" height="600" style="border:1px solid black;" src="<%= "https://".$thisdomain."/" %>roundcube?_user=<%= $username %>">
</iframe>

    % my $btn = l('Full Window');

        <div class="row g-3 align-items-center">
            <div class="col-md-2">
                <button type="submit" class="btn btn-primary btn-sm"><%= $btn %></button>
            </div>
        </div>


%end