<!-- $Id: viewlogs.tt2 4752 2007-12-13 14:47:33Z david.verdin $ -->

[% IF action != 'search' %]
<div id="page_size">
[%|loc%]Page size[%END%]
  <form action="[% path_cgi %]">
  <fieldset>
  <input type="hidden" name="sortby" value="[% sortby %]" />
  <input type="hidden" name="action" value="viewlogs" />
  <input type="hidden" name="list" value="[% list %]" />
  <input type="hidden" name="target_type" value="[% target_type %]" />
  <input type="hidden" name="target" value="[% target %]" />
  <input type="hidden" name="date_from" value="[% date_from %]" />
  <input type="hidden" name="date_to" value="[% date_to %]" />
  <input type="hidden" name="type" value="[% type %]" />
  <input type="hidden" name="ip" value="[% ip %]" />
  <select name="size" onchange="this.form.submit();">
          <option value="[% size %]" selected="selected">[% size %]</option>
	  <option value="25">25</option>
          <option value="50">50</option>
          <option value="100">100</option>
	  <option value="500">500</option>
  </select>
  </fieldset>
  </form>
<br />
   [% IF prev_page %]
    <a href="[% path_cgi %]/viewlogs/[% list %]/[% prev_page %]/[% size %]/[% sortby %]"><img src="[% icons_url %]/left.png" alt="[%|loc%]Previous page[%END%]" /></a>
   [% END %]
   [% IF page %]
     [%|loc%]page[%END%] [% page %] / [% total_page %]
   [% END %]
   [% IF next_page %]
     <a href="[% path_cgi %]/viewlogs/[% list %]/[% next_page %]/[% size %]/[% sortby %]"><img src="[% icons_url %]/right.png" alt="[%|loc%]Next page[%END%]" /></a>
   [% END %]



</div>
[% END %]

<form id="logs_form" name="log_form" method="post" action="[% path_cgi %]">
<fieldset>
  <input type="hidden" name="list" value="[% list %]" />
  <input type="hidden" name="action" value="viewlogs" />

  <label for="target_type">[%|loc%]Search by :[%END%]</label>
    <select id="target_type" name="target_type">

       [% IF target_type  == 'target_email' %]
	 <option value="[% target_type %]">[%|loc%]Email[%END%]</option>
	 <option value="none">-----------</option>
       [% ELSE %] 
	 [% IF target_type == 'msg_id' %]
	   <option value="[% target_type %]">[%|loc%]Message Id[%END%]</option>
	   <option value="none">-----------</option>
         [% END %]
       [% END %]

       <option value="target_email">[%|loc%]Email[%END%]</option>
       <option value="msg_id">[%|loc%]Message Id[%END%]</option>
       <option value="none">-----------</option>
    </select>
       
    <input id="target" type="text" name="target" value="[% target %]" size ="20"/><br />

    <label for="date_from">[%|loc%]Search by date from:[%END%]</label>
      <input id="date_from" type="text" name="date_from" value="[% date_from %]" size ="10"/>&nbsp;
    <label for="date_to">[%|loc%]to:[%END%]</label>
      <input id="date_to"type="text" name="date_to" value="[% date_to %]" size ="10"/>&nbsp; <em>[%|loc%]ex: 24/05/2006[%END%]</em><br />

    <label for="type">[%|loc%]Search by type :[%END%]</label>
      <select id="type" name="type">
       [% IF type %]
	 [% IF type == 'all_actions' %]
	   <option value="all_actions">[%|loc%]All[%END%]</option>
	   <option value="none">------------</option>
	 [% ELSE %]
           <option value="[% type %]">[% type %]</option>
	   <option value="none">------------</option>
	 [% END %]
       [% END %]
       <option value="all_actions">[%|loc%]All[%END%]</option>
       <option value="none">------------</option>
       <option value="authentication">[%|loc%]Authentication[%END%]</option>
       <option value="bounced">[%|loc%]Bounce management[%END%]</option>
       <option value="list_management">[%|loc%]List Management[%END%]</option>
       <option value="message">[%|loc%]Message[%END%]</option>
       <option value="preferences">[%|loc%]User preferences[%END%]</option>
       <option value="subscription">[%|loc%]User management[%END%]</option>
       <option value="shared">[%|loc%]Web documents management[%END%]</option>
       <option value="none">------------</option>
      </select><br />
       
   [% IF is_listmaster %]

	<label for="ip">[%|loc%]Search by IP :[%END%]</label>
	  <input id="ip" type="text" name="ip" value="[% ip %]"/><br />
   [% END %]

       <label for="submit"></label>
	 <input id="submit" type="submit" name="action_viewlogs" value="[%|loc%]View[%END%]" />
       &nbsp;&nbsp;
         <input id="reset" type="button" value="[%|loc%]Reset[%END%]" onclick="javascript:clear_log_form()"/>
</fieldset>
</form>



<em>[%|loc%]Search period: [%END%]<strong>[%|locdt(date_from_formated)%]%d %b %Y %H:%M:%S[%END%]</strong> [%|loc%]to[%END%] <strong>[%|locdt(date_to_formated)%]%d %b %Y %H:%M:%S[%END%]</strong></em><br />
<em>[%|loc(list)%]Research was carried out in list <strong>%1</strong>.[%END%]</em><br />
[% IF rows_nb %]
  <br />
  <em>[%|loc(rows_nb)%]%1 results[%END%].</em>
[% END %]
<div id="table_container">
<table class="listOfItems" summary="logs table">
      <tr>
	[% IF sortby == 'date' %]
  	    <th class="sortby">
	    [%|loc%]Sub date[%END%]
	[% ELSE %]
	    <th>
            <a href="[% path_cgi %]/viewlogs/[% list %]/1/[% size %]/date" >[%|loc%]Date[%END%]</a>
	[% END %]
        </th>

	    <th>
               <a href="[% path_cgi %]/viewlogs/[% list %]/1/[% size %]/list">[%|loc%]List[%END%]</a>
	</th>

	[% IF sortby == 'action' %]
  	    <th class="sortby">
	    [%|loc%]Action[%END%]
	[% ELSE %]
	    <th>
               <a href="[% path_cgi %]/viewlogs/[% list %]/1/[% size %]/action">[%|loc%]Action[%END%]</a>
	[% END %]
	</th>

	<th>
	  [%|loc%]Parameters[%END%]
	</th>

	<th>
	  [%|loc%]Target Email[%END%]
	</th>

	<th>
	  [%|loc%]Message ID[%END%]
	</th>

	<th>
	  [%|loc%]Status[%END%]
	</th>

	<th>
	  [%|loc%]Error type[%END%]
	</th>

	[% IF sortby == 'email' %]
  	    <th class="sortby">
	    [%|loc%]User Email[%END%]
	[% ELSE %]
	    <th>	    
	    <a href="[% path_cgi %]/viewlogs/[% list %]/1/[% size %]/email">[%|loc%]User Email[%END%]</a>
	[% END %]
	</th>

	[% IF is_listmaster || is_owner %]
	<th>
	  [%|loc%]User IP[%END%]
	</th>
	[% END %]

	<th>
	  [%|loc%]Service[%END%]
	</th>
        
      </tr>
 
      [% FOREACH l = log_entries %]
	[% IF dark == '1' %]
	    <tr>
	[% ELSE %]
            <tr class="color0">
	[% END %]
	
	[% IF l.status == 'error' %]
	  <tr class="bg_color_error">
	[% END %]
	  <td>
	    [% l.date %]
	  </td>
	 [% IF is_listmaster || is_owner %]
	  <td>
  	      [% l.list %]
	  </td>
	  [% END %]
	  <td>
  	      [% l.action %]
	  </td>
	  <td>
  	      [% l.parameters %]
	  </td>
	  <td>
  	      [% l.target_email %]
	  </td>
	  <td>
	      [% IF l.msg_id %]
  	        <a href="javascript:searched_by_msgId('[% l.msg_id %]')" title="[%|loc%]view other events related to this message id.[%END%]">[%|loc%]Other events[%END%]</a>
	      [% END %]
	  </td>
	  <td>
	     [% l.status %]
	  </td>
	  <td>
  	      [% l.error_type %]
	  </td>
	  <td>
  	    [% l.user_email %]</span>
	  </td>
	  [% IF is_listmaster || is_owner %]
	  <td>
  	      [% l.client %]
	  </td>
	  [% END %]
	  <td>
  	      [% l.daemon %]
	  </td>
	</tr>
      	[% IF dark == '1' %]
	  [% SET dark = 0 %]
	[% ELSE %]
	  [% SET dark = 1 %]
	[% END %]

      [% END %]
</table>
</div>
