| 1 |
<?php |
| 2 |
function sfondo_avcp_trasparenza() { |
| 3 |
global $current_screen; |
| 4 |
if ($current_screen->post_type == 'avcp') { |
| 5 |
$css = '<style type="text/css">' . '#annirifdiv { background:yellow; } #error { border: 2px solid red; #right { border: 2px solid green;' . '</style>'; |
| 6 |
echo $css; |
| 7 |
$javascript = '<script> |
| 8 |
document.getElementById("avcp_data_inizio").setAttribute("readonly", "true"); |
| 9 |
document.getElementById("avcp_data_fine").setAttribute("readonly", "true"); |
| 10 |
document.getElementById("avcp_aggiudicazione").setAttribute("onkeyup", "valid(this)"); |
| 11 |
document.getElementById("avcp_aggiudicazione").setAttribute("onblur", "valid(this)"); |
| 12 |
document.getElementById("avcp_somme_liquidate").setAttribute("onkeyup", "valid(this)"); |
| 13 |
document.getElementById("avcp_somme_liquidate").setAttribute("onblur", "valid(this)"); |
| 14 |
document.getElementById("avcp_cig").setAttribute("onkeyup", "validcig(this)"); |
| 15 |
function valid(f) { |
| 16 |
f.value = f.value.replace(/[^.0-9-\s]/ig,\'\'); |
| 17 |
$("#avcp_aggiudicazione").val.toFixed(2); |
| 18 |
$("#avcp_somme_liquidate").val.toFixed(2); |
| 19 |
} |
| 20 |
function validcig(f) { |
| 21 |
f.value = f.value.replace(/[^A-Z0-9-\s]/ig,\'\'); |
| 22 |
if(f.length != 10){ |
| 23 |
$("#avcp_cig").addClass("error"); |
| 24 |
} else { |
| 25 |
$("#avcp_cig").addClass("valid"); |
| 26 |
} |
| 27 |
} |
| 28 |
</script>'; |
| 29 |
echo $javascript; |
| 30 |
} |
| 31 |
} |
| 32 |
add_action('admin_footer', 'sfondo_avcp_trasparenza'); |
| 33 |
?> |