1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
| <%@ include file="inc_connexion_auth.jsp" %>
<html>
<head>
<title>Ajout Projet</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script/gen_validatorv2.js"></script>
<script language="javascript">
function DonnerFocus(nom) {
document.forms[0].elements[nom].focus();
}
function datecomp(datesaisie,datecompar){
var datedebut=datesaisie.value;
var datefin=datecompar.value;
//vérification du format - si la date est saisie je commence le travail, ce si se termine à la fin
if (datedebut!="") {
if (datefin=='1'){
//definition des variables champs pour reprendre le focus au bon endroit
var rfocus="zddprj";
}
else {
var rfocus="zdfprj";
}
//véfification du format de date et +
if (!verifdate(datedebut)) {
alert("Attention soit la date n'est pas correcte, soit elle n'est pas au format JJ/MM/AAAA");DonnerFocus(rfocus);return false;
}
//création d'un tableau ou je range la date début dans trois cases, si il y a des zero je les supprimme
deb = new Array(3);
if (datedebut.substring(0,1)=="0"){
deb[1]=parseInt(datedebut.substring(1,2));
}
else {
deb[1]=parseInt(datedebut.substring(0,2));
}
if (datedebut.substring(3,4)=="0"){
deb[2]=parseInt(datedebut.substring(4,5));
}
else {
deb[2]=parseInt(datedebut.substring(3,5));
}
deb[3]=parseInt(datedebut.substring(6,10));
//si la datefin contient 1 on vient du formulaire dateresadebut donc on compare avec la date du jour
//dans ce cas on récupère un format de date javascript, on le transforme et on le range dans un tableau
//je ne transforme pas la variable datfin que je réutilise plus loin
if (datefin=='1') {
datef=new Date();
fin = new Array(3);
fin[1]=datef.getDate();
fin[2]=datef.getMonth()+1;
fin[3]=datef.getYear();
var message="la date de réservation ne peut être infèrieur à la date du jour";
}
//dans l'autre cas, on arrive du formulaire par dateresafin et datecompar=dateresadebut
//on récupère la dateresadebut et on la range aussi dans un tableau mais comme la datedébut
else {
fin = new Array(3);
if (datefin.substring(0,1)=="0"){
fin[1]=parseInt(datefin.substring(1,2));
}
else {
fin[1]=parseInt(datefin.substring(0,2));
}
if (datefin.substring(3,4)=="0"){
fin[2]=parseInt(datefin.substring(4,5));
}
else {
fin[2]=parseInt(datefin.substring(3,5));
}
fin[3]=parseInt(datefin.substring(6,10));
var message="la date de fin de réservation ne peut être infèrieure à la date de début";
}
//comparaison des dates
if (deb[3]<fin[3]) {
alert(message);DonnerFocus(rfocus);return false;
}
else {
if ((deb[3]== fin[3]) && (deb[2]<fin[2])){
alert(message);DonnerFocus(rfocus);return false;
}
else {
if ((deb[3]== fin[3]) && (deb[2]==fin[2]) && (deb[1]<fin[1])){
alert(message);DonnerFocus(rfocus);return false;
}
}
}
//si la date de réservation dépasse un an on demande une confirmation
if (datefin!='1'){
if ((deb[3]-fin[3])>1){
if (confirm("attention, vous avez réservé pour plus d'un an, confirmer ?")) {
return true;
}
else {
return false;
}
}
}
return true;
}
}
// Cette fonction vérifie le format JJ/MM/AAAA saisi et la validité de la date.
// Le séparateur est défini dans la variable separateur
function verifdate(d) {
var dateaverifier=d
// rangement de la date dans des variables
if (dateaverifier.substring(0,1)=="0"){
var j=parseInt(dateaverifier.substring(1,2));
}
else {
var j=parseInt(dateaverifier.substring(0,2));
}
if (dateaverifier.substring(3,4)=="0"){
var m=parseInt(dateaverifier.substring(4,5));
}
else {
var m=parseInt(dateaverifier.substring(3,5));
}
var a=parseInt(dateaverifier.substring(6,10));
//si la longueur est différent de 10 , problème
if (dateaverifier.length != 10) {
return false;
}
//les caratères / ne sont pas aux endroits attendus
else {
if((dateaverifier.charAt(2) != '/') && (dateaverifier.charAt(5) != '/')) {
return false;
}
}
//l'année n'est pa un chiffre
if (isNaN(a)) {
return false;
}
//le mois n'est pas un chiffre ou n'est pas compris entre 0 et12
if ((isNaN(m))||(m<1)||(m>12)) {
return false;
}
//test si il s'agit d'une année bissextile pour accepter le 29/02
if (((a % 4)==0 && (a % 100)!=0) || (a % 400)==0){
if ((isNaN(j)) || ((m!=2) && ((j<1)||(j>31))) || ((m==2) && ((j<1)||(j>29)))) {
return false;
}
}
else {
if ((isNaN(j)) || ((m!=2) && ((j<1)||(j>31))) || ((m==2) && ((j<1)||(j>28)))){
return false;
}
}
return true;
}
//cette fonction test si caractères numériques
function IsNumberString(NumStr)
{var regEx=/^[0-9]+$/;
var ret=false;
if (regEx.test(NumStr)) ret=true;
return ret;
}
</script></head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table class="ds_box" cellpadding="0" cellspacing="0" id="ds_conclass" style="display: none;">
<tr><td id="ds_calclass"></td></tr>
</table>
<script language="javascript" src="script/cal.js"></script>
<table width="800" height="478" border="0" align="center" cellpadding=4 cellspacing="0" id="Tableau_01" style="border:solid 1px #99CC66">
<tr>
<td height="155"><img src="images/index_01.jpg" width="800" height="147" alt=""></td>
</tr>
<tr>
<td valign=top>
<table width="100%" height="361" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="73"><TABLE WIDTH=788 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD width="13"> </TD>
<TD width="75">
<IMG SRC="images/menuorigine_21.gif" WIDTH=57 HEIGHT=73 ALT="" name="img21" onmouseover='switchImage("img21", "images/menusurvol_21.gif")' onmouseout='switchImage("img21", "images/menuorigine_21.gif")'></TD>
<TD width="3">
<IMG SRC="images/menuorigine_22.gif" WIDTH=3 HEIGHT=73 ALT="" ></TD>
<TD width="43">
<IMG SRC="images/menuorigine_23.gif" WIDTH=43 HEIGHT=73 ALT="" name="img23" onmouseover='switchImage("img23", "images/menusurvol_23.gif")' onmouseout='switchImage("img23", "images/menuorigine_23.gif")'> </TD>
<TD width="18">
<IMG SRC="images/menuorigine_24.gif" WIDTH=18 HEIGHT=73 ALT=""></TD>
<TD width="44">
<IMG SRC="images/menuorigine_25.gif" WIDTH=44 HEIGHT=73 ALT="" name="img25" onmouseover='switchImage("img25", "images/menusurvol_25.gif")' onmouseout='switchImage("img25", "images/menuorigine_25.gif")'></TD>
<TD width="15">
<IMG SRC="images/menuorigine_26.gif" WIDTH=15 HEIGHT=73 ALT=""></TD>
<TD width="57">
<IMG SRC="images/menuorigine_27.gif" WIDTH=57 HEIGHT=73 ALT="" name="img27" onmouseover='switchImage("img27", "images/menusurvol_27.gif")' onmouseout='switchImage("img27", "images/menuorigine_27.gif")'></TD>
<TD width="10">
<IMG SRC="images/menuorigine_28.gif" WIDTH=5 HEIGHT=73 ALT="" ></TD>
<TD width="54">
<IMG SRC="images/menuorigine_29.gif" WIDTH=54 HEIGHT=73 ALT="" name="img29" onmouseover='switchImage("img29", "images/menusurvol_29.gif")' onmouseout='switchImage("img29", "images/menuorigine_29.gif")'></TD>
<TD width="10">
<IMG SRC="images/menuorigine_30.gif" WIDTH=5 HEIGHT=73 ALT=""></TD>
<TD width="43">
<IMG SRC="images/menuorigine_31.gif" WIDTH=43 HEIGHT=73 ALT="" name="img31" onmouseover='switchImage("img31", "images/menusurvol_31.gif")' onmouseout='switchImage("img31", "images/menuorigine_31.gif")'></TD>
<TD width="16">
<IMG SRC="images/menuorigine_32.gif" WIDTH=16 HEIGHT=73 ALT=""></TD>
<TD width="45">
<IMG SRC="images/menuorigine_33.gif" WIDTH=45 HEIGHT=73 ALT="" name="img33" onmouseover='switchImage("img33", "images/menusurvol_33.gif")' onmouseout='switchImage("img33", "images/menuorigine_33.gif")'></TD>
<TD width="14"><img src="images/menuorigine_34.gif" width=14 height=73 alt=""></TD>
<TD width="47"><img src="images/menuorigine_35.gif" width=47 height=73 alt="" name="img35" onMouseOver='switchImage("img35", "images/menusurvol_35.gif")' onMouseOut='switchImage("img35", "images/menuorigine_35.gif")' ></TD>
<TD width="55"><img src="images/menuorigine_36.gif" width=55 height=73 alt=""></TD>
<TD width="50">
<IMG SRC="images/menuorigine_37.gif" WIDTH=50 HEIGHT=73 ALT="" name="img37" onmouseover='switchImage("img37", "images/menusurvol_37.gif")' onmouseout='switchImage("img37", "images/menuorigine_37.gif")'></TD>
<TD width="176" background="images/menuorigine_36.gif"> </TD>
</TR>
</TABLE></td>
</tr>
<tr><td><TABLE WIDTH="43%" align="center"><tr><td class="titre">Ajout projet : </td></tr></TABLE></td></tr>
<tr>
<td height="40"><form action="Trajoutprojet.jsp" method="post" name="AjoutProjet">
<br><br>
<table width="43%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class="ligne2">
<td width="40%" class="labels">Nom Projet </td>
<td width="7%"> </td>
<td width="53%"><input name="znomprj" type="text" class="zcontenu" id="znomprj"></td>
</tr>
<tr class="ligne1">
<td class="labels">Date début </td>
<td> </td>
<td><input name="zddprj" type="text" class="zcontenu" id="zddprj" style="cursor: text" onClick="ds_sh(this);" readonly="readonly"></td>
</tr>
<tr class="ligne2">
<td class="labels">Date fin </td>
<td> </td>
<td><input name="zdfprj" type="text" class="zcontenu" id="zdfprj" style="cursor: text" onClick="ds_sh(this);" readonly="readonly"></td>
</tr>
<tr class="ligne1">
<td class="labels">Description</td>
<td> </td>
<td><input name="zdescprj" type="text" class="zcontenu" id="zdescprj"></td>
</tr>
<tr class="ligne2">
<td class="labels">Etat</td>
<td> </td>
<td><input name="zetatprj" type="text" class="zcontenu" id="zetatprj"></td>
</tr>
<tr class="ligne1">
<td class="labels">Responsable</td>
<td> </td>
<td><input name="zrespprj" type="text" class="zcontenu" id="zrespprj"></td>
</tr>
<tr class="ligne2">
<td class="labels">Client</td>
<td> </td>
<td>
<select name="zcltprj" id="zcltprj" style="width:152">
<%
String requete="SELECT * FROM client";
rs = st.executeQuery(requete);
while(rs.next()){
%>
<option value="<%=rs.getInt("Id_Cl") %>"><%=rs.getString("Rai_Soc") %></option>
<%
}
%>
</select> </td>
</tr>
<tr class="ligne1">
<td class="labels">Equipe</td>
<td> </td>
<td><input name="zeqpprj" type="text" class="zcontenu" id="zeqpprj"></td>
</tr>
<tr class="ligne2">
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr class="ligne2">
<td> </td>
<td> </td>
<td><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="48%" scope="col"><input name="Submit" type="submit" class="submit" value="Insérer" onClick="compDate("zddprj","zdfprj")"></td>
<td width="41%" scope="col"><input name="Submit2" type="reset" class="submit" value="annuler"></td>
<td width="11%"> </td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td><div align="center"><a href="projet.jsp"><img src="images/retour.jpg" width="85" height="85" border="0" class="ajouter"></a></div></td>
</tr>
</table>
<script language="JavaScript" type="text/javascript">
var frmvalidator = new Validator("AjoutProjet");
frmvalidator.addValidation("znomprj","req","Nom projet : champ obligatoire ");
frmvalidator.addValidation("zddprj","req","Date début projet : champ obligatoire");
frmvalidator.addValidation("zetatprj","req","Etat : champ obligatoire");
frmvalidator.addValidation("zrespprj","req","Responsable projet : champ obligatoire");
frmvalidator.addValidation("zrespprj","alpha","Le nom du responsable doit être alphabétique");
</script> </td>
</tr>
<tr>
<td><img src="images/index_03.jpg" width="800" height="91" alt=""></td>
</tr>
</table>
</body>
</html> |
Partager