<%@ page language="java" %>
<%@ taglib uri="struts-html"     prefix="html"  %>
<%@ taglib uri="struts-bean"     prefix="bean"  %>
<%@ taglib uri="struts-logic"    prefix="logic" %>
<%@ taglib uri="vkc-taglib"      prefix="vkc"   %>
<%@ page import="org.apache.struts.Globals" %>
<%@ page import="vkc.administration.form.SystemMaintenanceForm" %>
<%@ page import="vkc.administration.form.ConversionsMaintenanceForm" %>

<vkc:init/>

<html:form action="/conversionsMaintenance" method="post">
<bean:define id="form" name="conversionsMaintenanceForm" type="vkc.administration.form.ConversionsMaintenanceForm"/>
<bean:define id="pageCount" name="form" property="entriesPageCount"/>
<bean:define id="entriesPerPage" name="form" property="entriesPerPage"/>

<html:hidden property="selectedContext"/>
<html:hidden property="sortMode"/>
  
<table align='left' width='100%' cellpadding='2' cellspacing='0' border='0'>


  <logic:present name="succeeded">               
    <tr>
      <td colspan="2" bgcolor="#77D369" align="center">
        <font color="white"><b><vkc:write name="succeeded"/></b></font>
      </td>
    </tr>
    <tr>
     <td align="left" nowrap="nowrap" colspan="2">&nbsp;</td>
    </tr>
  </logic:present>  
  <tr>
    <td colspan="2" align="left">
      <vkc:message key="vkc.administration.systemmaintenance.conversions.introduction"/>
      <br /><br />
    </td>
  </tr>
  <tr class="color_doctitle">
     	<td align="left" nowrap="nowrap" colspan="2">
	     	<b><vkc:message key="vkc.administration.systemmaintenance.conversions.trigger_conversions"/></b>
		</td>
  	</tr>
  <logic:iterate id="docType" name="form" property="convertibleDocTypes" type="vkc.db.entities.VKCDocumentType">
  	<tr>
	 <td align="left" nowrap="nowrap" colspan="2">
	  <html:multibox name="form" property="selectedDocTypeIds" onfocus="this.blur();"><vkc:write name="docType" property="docTypeId"/></html:multibox>
	  &#160;<vkc:write name="docType" property="extensionLabel"/>, <vkc:write name="docType" property="description"/>
	 </td>
	</tr>
	</logic:iterate>
	<vkc:hline colspan="2" lineClass="hline" lineHeight="1" topSpace="3" bottomSpace="3"/>
	<tr><td colspan="2"><input type="checkbox" name="allDocTypeItems" value="allDocTypeItems" onclick="javascript:checkAllDocTypes(this.form);">&nbsp;&#160;<vkc:message key="vkc.string.checkAll"/> <vkc:message key="vkc.administration.systemmaintenance.converter.doctypes"/></td></tr>
	<tr>
     <td align="left" nowrap="nowrap" colspan="2">&nbsp;</td>
  </tr>
  	<tr>
	 <td align="left" nowrap="nowrap" colspan="2">
	  <vkc:message key="vkc.administration.systemmaintenance.conversions.start"/>...<br />
	  <vkc:button property="action.trigger_reconversion" onclick="javascript:disableAllButtonsAndSubmit(this);">...<vkc:message key="vkc.administration.systemmaintenance.conversions.forSelectedDocType"/></vkc:button>
	  &#160;<vkc:button property="action.trigger_notconverted" onclick="javascript:disableAllButtonsAndSubmit(this);">...<vkc:message key="vkc.administration.systemmaintenance.conversions.forAllNotConverted"/></vkc:button>
	 </td>
	</tr>
  <tr>
     <td align="left" nowrap="nowrap" colspan="2">&nbsp;</td>
  </tr>
  <tr class="color_doctitle">
     	<td align="left" nowrap="nowrap" colspan="2">
	     	<b><vkc:message key="vkc.administration.systemmaintenance.conversions.failedOrOutstandingConvs"/></b>
		</td>
  	</tr>
  <logic:empty name="form" property="conversions">
 	<tr>
     	<td align="left" nowrap="nowrap" colspan="2">
			<span class="error"><b><vkc:message key="vkc.administration.systemmaintenance.conversions.noConversions"/></b></span>
		</td>
  	</tr>
  </logic:empty>
  <logic:notEmpty name="form" property="conversions">
  <%-- Start Navbar --%>
    <tr>
    <td colspan="2">
      <table width="100%">
        <tr>
          <td nowrap="nowrap"><vkc:link href="javascript:gotoFirstPage();" onclick="this.blur();"><vkc:img page="/templates/${template.name}/gfx/rewind.gif" border="0" alt=""/></vkc:link>&nbsp;&nbsp;</td>
          <td nowrap="nowrap"><vkc:link href="javascript:gotoPrevPage();" onclick="this.blur();"><vkc:img page="/templates/${template.name}/gfx/arrow-left.gif" border="0" alt=""/></vkc:link>&nbsp;&nbsp;</td>

          <td>
            <html:select name="form" property="listIndex" onchange="submitForm();">
              <logic:iterate id="pageIndex" name="form" property="pageIndices" type="java.lang.Integer">
              <html:option value="<%=pageIndex.toString()%>" key="key">
              	<vkc:message key="string.Page"/>&nbsp;<%=(pageIndex.intValue()/((Integer)entriesPerPage).intValue()+1)%>&nbsp;<vkc:message key="string.of"/>&nbsp;<%=pageCount%>&nbsp;
          	  </html:option>
              </logic:iterate>
            </html:select>
          </td>

          <td nowrap="nowrap">&nbsp;&nbsp;<vkc:link href="javascript:gotoNextPage();" onclick="this.blur();"><vkc:img page="/templates/${template.name}/gfx/arrow-right.gif" border="0" alt=""/></vkc:link></td>
          <td nowrap="nowrap">&nbsp;&nbsp;<vkc:link href="javascript:gotoLastPage();" onclick="this.blur();"><vkc:img page="/templates/${template.name}/gfx/forward.gif" border="0" alt=""/></vkc:link></td>
		  <td width="100%">&#160;</td>
          <td nowrap="nowrap">&nbsp;&nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.entriesPerPage"/>:</b></td>

          <td nowrap="nowrap">&nbsp;&nbsp;
            <html:select name="form" property="entriesPerPage" onchange="submitForm();">
              <html:option value="5"><vkc:message key="vkc.administration.systemmaintenance.conversions.perpage.five"/></html:option>
              <html:option value="10"><vkc:message key="vkc.administration.systemmaintenance.conversions.perpage.ten"/></html:option>
              <html:option value="20"><vkc:message key="vkc.administration.systemmaintenance.conversions.perpage.twenty"/></html:option>
              <html:option value="30"><vkc:message key="vkc.administration.systemmaintenance.conversions.perpage.thirty"/></html:option>
              <html:option value="40"><vkc:message key="vkc.administration.systemmaintenance.conversions.perpage.forty"/></html:option>
              <html:option value="50"><vkc:message key="vkc.administration.systemmaintenance.conversions.perpage.fifty"/></html:option>
            </html:select>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <%-- End Navbar --%>
  	<tr>
  		<td colspan="2">
        <table width="100%" cellspacing="1" cellpadding="2" border="0" class="tableLineColor">
 	    <tr>
	      	<td class="headerSelected">&nbsp;</td>
	      <%-- Document column --%>	
	      <logic:equal value="true" name="form" property="sortByDocument">
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_DOCUMENT_UP )%>" name="form" property="sortMode">
        	<td align="left" nowrap="nowrap" class="headerSelected">
        	  &nbsp;<b><vkc:message key="vkc.document"/></b>
        	  <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_DOCUMENT_DOWN + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up.gif" border="0" alt=""/></vkc:link>&nbsp;
        	</td>
            </logic:equal>
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_DOCUMENT_DOWN )%>" name="form" property="sortMode">
            <td align="left" nowrap="nowrap" class="headerSelected">
              &nbsp;<b><vkc:message key="vkc.document"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_DOCUMENT_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-down.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
            </logic:equal>
          </logic:equal>
          <logic:equal value="false" name="form" property="sortByDocument">
            <td align="left" nowrap="nowrap" class="headerUnselected">
              &nbsp;<b><vkc:message key="vkc.document"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_DOCUMENT_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up-shaded.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
          </logic:equal>
          <%-- Status column --%>
	      <logic:equal value="true" name="form" property="sortByStatus">
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_STATUS_UP )%>" name="form" property="sortMode">
        	<td align="left" nowrap="nowrap" class="headerSelected">
        	  &nbsp;<b>Status</b>
        	  <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_STATUS_DOWN + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up.gif" border="0" alt=""/></vkc:link>&nbsp;
        	</td>
            </logic:equal>
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_STATUS_DOWN )%>" name="form" property="sortMode">
            <td align="left" nowrap="nowrap" class="headerSelected">
              &nbsp;<b>Status</b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_STATUS_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-down.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
            </logic:equal>
          </logic:equal>
          <logic:equal value="false" name="form" property="sortByStatus">
            <td align="left" nowrap="nowrap" class="headerUnselected">
              &nbsp;<b>Status</b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_STATUS_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up-shaded.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
          </logic:equal>
            
          <%-- Started column --%>
	      <logic:equal value="true" name="form" property="sortByStarted">
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_STARTED_UP )%>" name="form" property="sortMode">
        	<td align="left" nowrap="nowrap" class="headerSelected">
        	  &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.startedAt"/></b>
        	  <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_STARTED_DOWN + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up.gif" border="0" alt=""/></vkc:link>&nbsp;
        	</td>
            </logic:equal>
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_STARTED_DOWN )%>" name="form" property="sortMode">
            <td align="left" nowrap="nowrap" class="headerSelected">
              &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.startedAt"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_STARTED_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-down.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
            </logic:equal>
          </logic:equal>
          <logic:equal value="false" name="form" property="sortByStarted">
            <td align="left" nowrap="nowrap" class="headerUnselected">
              &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.startedAt"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_STARTED_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up-shaded.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
          </logic:equal>
          
        <%-- Reiterations column --%>
	      <logic:equal value="true" name="form" property="sortByReiterations">
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_REITERATIONS_UP )%>" name="form" property="sortMode">
        	<td align="left" nowrap="nowrap" class="headerSelected">
        	  &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.reiterations"/></b>
        	  <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_REITERATIONS_DOWN + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up.gif" border="0" alt=""/></vkc:link>&nbsp;
        	</td>
            </logic:equal>
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_REITERATIONS_DOWN )%>" name="form" property="sortMode">
            <td align="left" nowrap="nowrap" class="headerSelected">
              &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.reiterations"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_REITERATIONS_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-down.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
            </logic:equal>
          </logic:equal>
          <logic:equal value="false" name="form" property="sortByReiterations">
            <td align="left" nowrap="nowrap" class="headerUnselected">
              &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.reiterations"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_REITERATIONS_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up-shaded.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
          </logic:equal>
          
          <%-- Remark column --%>
	      <logic:equal value="true" name="form" property="sortByRemark">
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_REMARK_UP )%>" name="form" property="sortMode">
        	<td align="left" nowrap="nowrap" class="headerSelected">
        	  &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.remark"/></b>
        	  <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_REMARK_DOWN + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up.gif" border="0" alt=""/></vkc:link>&nbsp;
        	</td>
            </logic:equal>
            <logic:equal value="<%=String.valueOf( ConversionsMaintenanceForm.SORT_REMARK_DOWN )%>" name="form" property="sortMode">
            <td align="left" nowrap="nowrap" class="headerSelected">
              &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.remark"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_REMARK_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-down.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
            </logic:equal>
          </logic:equal>
          <logic:equal value="false" name="form" property="sortByRemark">
            <td align="left" nowrap="nowrap" class="headerUnselected">
              &nbsp;<b><vkc:message key="vkc.administration.systemmaintenance.conversions.remark"/></b>
              <vkc:link href='<%="javascript:sort(" + ConversionsMaintenanceForm.SORT_REMARK_UP + ")"%>'><vkc:img page="/templates/${template.name}/gfx/arrow-up-shaded.gif" border="0" alt=""/></vkc:link>&nbsp;
            </td>
          </logic:equal>
		</tr>
  <logic:iterate id="conversionStatus" name="form" property="visibleConversions" type="vkc.db.common.ConversionStatus">
		<tr>
		  <td class="columnUnselected">
			  <html:multibox name="form" property="selectedIds" onfocus="this.blur();"><vkc:write name="conversionStatus" property="documentId"/></html:multibox>
		  </td>

          <td align="left" class="columnUnselected">
	          <a href="<%=ctxPath%>/sysLink.do?linkType=documentLink&objectId=<%=conversionStatus.getDocumentId()%>">
	          	<vkc:write name="conversionStatus" property="documentString"/>
	          </a>
          </td>
          <td align="left" nowrap="nowrap" class="columnUnselected">
	          <%=conversionStatus.getLocalizedStatus(user.getLanguage().getLocale())%>
          </td>
          <td align="left" nowrap="nowrap" class="columnUnselected">
	          <vkc:write name="conversionStatus" property="started" formatKey="date.medium.format"/>
          </td>
          <td align="right" nowrap="nowrap" class="columnUnselected">
	          <vkc:write name="conversionStatus" property="reiterations"/>&#160;
          </td>
          <td align="left" class="columnUnselected">
	          <vkc:write name="conversionStatus" property="comment"/>
          </td>
          
		</tr>  	
  </logic:iterate>
  		</table>
	  </td>
  	</tr>
  	<tr><td align="center" colspan="2"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" height="5" border="0"/></td></tr>
  <tr><td colspan="2">&nbsp;<input type="checkbox" name="allItems" value="allItems" onclick="javascript:checkAll(this.form);">&nbsp;<vkc:message key="vkc.string.checkAll"/></td></tr>
  <tr><td align="center" colspan="2"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" height="5" border="0"/></td></tr>
  <tr>
    <td colspan="2">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" border="0"/><vkc:img page="/templates/${template.name}/gfx/function-arrow.gif" alt="-->" border="0"/></td>
          <td>
            <html:select name="form" property="selectedCmdAction" value="noaction">
	  	      <html:option value="noaction"><vkc:message key="vkc.string.chooseFunction"/></html:option>
		      <html:option value="noaction1">------------------------------------</html:option>
		      <html:option value="action.delete_status"><vkc:message key="button.delete"/></html:option>
		      <html:option value="action.reset_status"><vkc:message key="vkc.administration.systemmaintenance.conversions.reset"/></html:option>
	        </html:select>
	      </td>
          <td>&nbsp;<vkc:button property="action.execute" onclick="doAction(this);"><vkc:message key="button.execute"/></vkc:button></td>
        </tr>
      </table>
    </td>
  </tr>
  </logic:notEmpty>
</table>
</html:form>
