[% META title = 'Fax' %]

<div id="headimg"><img src="/grafik/area.jpg" width="869" height="69" alt="" /></div>
<div id="headtxt">[% Catalyst.loc('Your fax preferences') %]</div>

<div id="main">

    <div id="topmsg">
        <p> [% messages.topmsg %] </p>
    </div>
    <div id="toperr">
        <p> [% messages.toperr %] </p>
        <p> [% messages.pwerr %] </p>
        <p> [% messages.prov_error %] </p>
    </div>

    <div class="sperrehead">
        <h3>[% Catalyst.loc('Fax2Mail Settings') %]</h2>
        <h2 class="umleitungfuer">[% Catalyst.loc('Settings for [_1]', subscriber.active_number) %]</h2>
    </div>


    <div id="spalten31">
        <div class="spalte1">

            [% IF mode == 'edit' %] 
                <form method="post" action="/fax/fax2mail/save" autocomplete="off">
            [% END %]
            
            <!-- <fieldset><p> -->
            <h3>[% Catalyst.loc('Preferences') %]</h3>

            <div class="span-3">[% Catalyst.loc('Password') %]</div>
            <div class="span-2"><input [% IF mode == 'view' %]disabled="disabled"[% END %] type="password" size="20" name="password" value=""/></div>
            <br clear="all" />

            <div class="span-3">[% Catalyst.loc('Repeat password') %]</div>
            <div class="span-2"><input [% IF mode == 'view' %]disabled="disabled"[% END %] type="password" size="20" name="password2" value=""/></div>
            <br clear="all" />

            <div class="span-3">[% Catalyst.loc('Name') %]</div>
            <div class="span-2"><input [% IF mode == 'view' %]disabled="disabled"[% END %] type="text" size="20" name="name" value="[% fax_preferences.name %]"/></div>
            <br clear="all" />

            <div class="span-3">[% Catalyst.loc('Active') %]</div>
            <div class="span-2"><input [% IF mode == 'view' %]disabled="disabled"[% END %] type="checkbox" size="20" name="active" [% IF fax_preferences.active == 1 %]checked="checked"[% END %]/></div>
            <br clear="all" />

            <div class="span-3">[% Catalyst.loc('Send status') %]</div>
            <div class="span-2"><input [% IF mode == 'view' %]disabled="disabled"[% END %] type="checkbox" size="20" name="send_status" [% IF fax_preferences.send_status == 1 %]checked="checked"[% END %]/></div>
            <br clear="all" />

            <div class="span-3">[% Catalyst.loc('Send copy') %]</div>
            <div class="span-2"><input [% IF mode == 'view' %]disabled="disabled"[% END %] type="checkbox" size="20" name="send_copy" [% IF fax_preferences.send_copy == 1 %]checked="checked"[% END %]/></div>
            <br clear="all" /> 
            
            <br clear="all" />
            
            <h3>[% Catalyst.loc('Destinations') %]</h3>

            <div class="set-container">
            [% PROCESS destination_header %]

            [% index = 1 %]
            [% FOREACH destination IN fax_preferences.destinations %]
                [% PROCESS destination action = 'edit' idx = index %]
                [% index = index + 1 %]
            [% END %]
            </div>
            <br clear="all" />

            [% IF mode == 'view' %] 
                <div><a href="/fax/fax2mail/edit"><span class="button-edit">[% Catalyst.loc('Edit') %]</span></a></div>
            [% ELSIF mode == 'edit' %] 
                [%# unset for BLOCK destination: %]
                [% destination = undef %]
                [% PROCESS destination action = 'add' idx = index %]
                
                <br clear="all" />
                <div><p class="link_button">
                    <label for="save_fax_preferences">[% Catalyst.loc('Save') %]</label>
                    <input type="image" class="hidden" src="/grafik/dot_trans.gif" alt="" id="save_fax_preferences">
                    <a href="/fax/fax2mail/view">[% Catalyst.loc('Cancel') %]</a>
                </p></div>
            
                    
            [% END %]
            
            </form> <!-- edit -->
            
        </div> <!-- /spalte1 -->
    </div> <!-- /spalten31 -->

</div> <!-- /main -->

<br clear="all" />

[% BLOCK destination %]
[%# IN: action ... edit|add
    IN: idx ...... element index %]

    <div class="span-3">
    <input [% IF mode == 'view' %]disabled="disabled"[% END %] type="text" size="20" name="destination_[% idx %]" value="[% destination.destination %]"/> 
    </div><div class="prepend-1 span-2">
    <select [% IF mode == 'view' %]disabled="disabled"[% END %] name="filetype_[% idx %]" value="[% destination.filetype %]"/>
        [% FOR f IN filetypes %]
            <option [% IF destination.filetype == f %]selected="selected"[% END %] value="[% f %]">[% f %]</option>
        [% END %]
    </select>
    </div><div class="span-2">
    <input [% IF mode == 'view' %]disabled="disabled"[% END %] type="checkbox" size="20" name="cc_[% idx %]" [% IF destination.cc %]checked="checked"[% END %]/> 
    </div><div class="span-2">
    <input [% IF mode == 'view' %]disabled="disabled"[% END %] type="checkbox" size="20" name="incoming_[% idx %]" [% IF destination.incoming %]checked="checked"[% END %]/> 
    </div><div class="span-2">
    <input [% IF mode == 'view' %]disabled="disabled"[% END %] type="checkbox" size="20" name="outgoing_[% idx %]" [% IF destination.outgoing %]checked="checked"[% END %]/> 
    </div><div class="span-2">
    <input [% IF mode == 'view' %]disabled="disabled"[% END %] type="checkbox" size="20" name="status_[% idx %]" [% IF destination.status %]checked="checked"[% END %]/> 
    </div>

    [% IF mode == 'edit' and destination %]
        <div><button class="astext" type="submit" name="delete_destination_[% idx %]" [% idx %]">Delete</button> </div>
    [% END %]
    
    <br clear="all" />
[% END %]

[% BLOCK destination_header %]
    <div class="span-3">[% Catalyst.loc('Destination') %]</div>
    <div class="prepend-1 span-2">[% Catalyst.loc('Filetype') %]</div>
    <div class="span-2">[% Catalyst.loc('CC') %]</div>
    <div class="span-2">[% Catalyst.loc('Incoming') %]</div>
    <div class="span-2">[% Catalyst.loc('Outgoing') %]</div>
    <div class="span-2">[% Catalyst.loc('Status') %]</div>
[% END %]
