<!-- $Id: viewlogs.tt2 12726 2016-03-09 04:01:24Z sikeda $ -->
<div class="block">

<h2>[%|loc%]Logs view[%END%]</h2>

<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"/>

    <label for="date_from">[%|loc%]Search by date from:[%END%]</label>
    <input type="text" id="date_from" name="date_from" maxlength="10" size="10" value="[% date_from %]" onfocus="visuCal(this,param_ddeb);" onblur="masqueCal(this);" >
    <label for="date_to">[%|loc%]to:[%END%]</label>
    <input type="text" id="date_to" name="date_to" maxlength="10" size="10" value="[% date_to %]" onfocus="visuCal(this,param_dfin)" onblur="masqueCal(this)" ><noscript><em>[%|loc%]ex: 24-05-2006[%END%]</em></noscript>

    <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>

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

    <label for="submit"></label>
    <input  class="MainMenuLinks" id="btnsubmit" type="submit" name="action_viewlogs" value="[%|loc%]View[%END%]" />
    &nbsp;&nbsp;
    <input  class="MainMenuLinks" id="btnreset" 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 />
[% IF total_results %]
<em>[%|loc(list)%]Research was carried out in list <strong>%1</strong>.[%END%]</em><br />
<br />
<em>[%|loc(total_results)%]%1 results[%END%].</em>
<div id="table_container">
<table class="responsive listOfItems" >
<caption>[%|loc%]Logs table[%END%]</caption>
      <tr>
	[% IF sortby == 'date' %]
  	    <th class="sortby">
	    [%|loc%]Sub date[%END%]
	[% ELSE %]
	    <th>
            <a href="[% 'viewlogs' | url_rel([list,1,size,'date']) %]" >[%|loc%]Date[%END%]</a>
	[% END %]
        </th>

	    <th>
               <a href="[% 'viewlogs' | url_rel([list,1,size,'list']) %]">[%|loc%]List[%END%]</a>
	</th>

	[% IF sortby == 'action' %]
  	    <th class="sortby">
	    [%|loc%]Action[%END%]
	[% ELSE %]
	    <th>
               <a href="[% 'viewlogs' | url_rel([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 == 'user_email' %]
  	    <th class="sortby">
	    [%|loc%]User Email[%END%]
	[% ELSE %]
	    <th>	    
	    <a href="[% 'viewlogs' | url_rel([list,1,size,'user_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>
[% END %]

[% IF action != 'search' %]
  <div id="page_size">
  <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 %]" />
  <label for="size">[%|loc%]Page size[%END%]</label>
  <select id="size" 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="[% 'viewlogs' | url_rel([list,prev_page,size,sortby]) %]"><img src="[% icons_url %]/left.png" alt="[%|loc%]Previous page[%END%]" /></a>
  [% END %]
  [% IF page %]
    [%|loc(page,total_page)%]page %1 / %2[%END%]
  [% END %]
  [% IF next_page %]
    <a href="[% 'viewlogs' | url_rel([list,next_page,size,sortby]) %]"><img src="[% icons_url %]/right.png" alt="[%|loc%]Next page[%END%]" /></a>
  [% END %]
  </div>
[% END %]

</div>
<!-- end viewlogs.tt2 -->
