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
| <script type="text/javascript">
$(function() {
$("#notice").hide();
$("#notice2").hide();
$("#notice3").hide();
$("#confirmDocument").dialog({
autoOpen: false,
bgiframe: true,
resizable: false,
draggable: false,
height:130,
width:400,
modal: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
'Add this document': function() {
$("#addDocumentForm").submit();
},
'Cancel': function() {
$(this).dialog('close');
}
}
});
$("#addDocumentLink").click(function() {
var verifName = new RegExp ("^CS_OCP_[a-zA-Z]+[_a-zA-Z]+_[a-zA-Z]{2}\.[a-zA-Z0-9]+$");
var filename = $("#dFile").val();
if ( $("#dFile").val() != "" && $("#dLbl").val() != ""
&& $("#dDate").val() != "" && verifName.test(filename)){
/* $("#confirmDocument").empty().append(filename); */
$("#confirmDocument").dialog('open');
} else {
$("#notice").show();
}
});
$("#dFile").change(function() {
var str = $("#dFile").val();
$.ajax({
type: "POST",
url: "../ajax/documentLabel.php",
data: "docName="+str,
success: function(msg){
$("#dLbl").val(msg);
}
});
$.ajax({
type: "POST",
url: "../ajax/documentType.php",
data: "docName="+str,
success: function(msg) {
$("#dType").val(msg);
}
});
});
$("#searchDoc").keyup(function() {
var str = $("#searchDoc").val();
$.ajax({
type: "POST",
url: "../ajax/documentsCriteria.php",
data: "criteria="+str+"&pId=<?= $pId ?>",
success: function(msg){
$("#docSelect").empty().append(msg);
}
});
});
$("#updateDocumentLink").click(function() {
if ( $("#docSelect").val() == "token") {
$("#notice2").show();
} else {
$("#actionHidden").val("update");
$("#updateDocForm").submit();
}
}); |
Partager