<!-- 
  Available request parameters:
    "isUpdateReport"       (boolean) ALWAYS FALSE Right-click report
    "idReport"             (long)    NEVER USED   Right-click report
  Specific R15:
    "dataValues"           (String)  MANDATORY    UID of an ItemRevision
-->

<script src="/kurt-web/js/obtain_data.js"></script>

<table cellspacing="0" cellpadding="3" border="0">
	<tr>
        <td class="tdFieldTitle required">N° d'article* :</td>
        <td>
            <input type="text" id="num_article" name="num_article" value="" readonly />
        </td>
    </tr>
	<tr>
        <td class="tdFieldTitle required">R&eacute;vision* :</td>
        <td>
            <input type="text" id="rev_article" name="rev_article" value="" readonly />
        </td>
    </tr>
	<tr>
        <td class="tdFieldTitle required">Langue* :</td>
        <td>
            <select type="text" id="langue" name="langue">
                <option selected="selected" value="Francais">Fran&ccedil;ais</option>
                <option value="Anglais">Anglais</option>
            </select>
    		<input type="hidden" id="type_article" name="type_article" value=""/>
    	</td>
    </tr>
	<tr>
        <td class="tdFieldTitle" colspan="2" style="text-align:center;">
        <br/>
    	<div id="loading" style="display:none;">
    		<i>Traitement en cours...</i>
            <br/>
            <img src="/kurt-web/ihm/progress.gif" vspace="6" width="129" height="20">
    	</div>
        </td>
    </tr>
</table>

<script>
    /* Automatic checks before sending the form */
    function checkForm() {
        var isCheckOk = false;
        if (isMandatoryFieldEmpty("num_article")){
            parent.Dialog("Erreur", "Veuillez saisir le champ obligatoire : N° d'article.");
        }else if (isMandatoryFieldEmpty("rev_article")){
            parent.Dialog("Erreur", "Veuillez saisir le champ obligatoire : R&eacute;vision.");
        }else{
            isCheckOk = true;
        }
        return isCheckOk;
    }
    
    /* Retrieve data for filling current form */
    function ServerResponseForObtainData() {
        if (objGetRequest.readyState == 4)  {
            if (objGetRequest.status == 200) {
                var queryResponse = JSON.parse(objGetRequest.responseText);
                if (queryResponse.success){
                    document.getElementById("num_article").value= queryResponse.ObjectId;
                    document.getElementById("rev_article").value= queryResponse.ObjectRev;
                    document.getElementById("type_article").value= queryResponse.ObjectType;
                }else{
                    parent.Dialog("Erreur",queryResponse.error);
                    document.getElementById("submitButton").style.display = 'none';
                }
            }else{
                parent.Dialog("Erreur","La connexion avec le site semble interrompue.");
            }
            /* Display buttons and hide loading bar */
            document.getElementById("loading").style.display = 'none';
            document.getElementById("btZone").style.display = '';
        }
    }
</script>

<script>
	/* Run asynchronous AJAX query for loading input content */
	setTimeout("ObtainData('/kurt-web/report_r15/obtainDataR15?dataValues=" + parseURL("dataValues","") + "')",100);
</script>