diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 3ef24008a..5ec3e61b7 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -450,4 +450,10 @@ case 'input_per': case 'save_per': require_once('modify_periode.inc.php'); break; +case 'mod_predf': + require_once('modify_predf_op.php'); + break; +case 'save_predf': + require_once('save_predf_op.php'); + break; } diff --git a/html/js/scripts.js b/html/js/scripts.js index b482175be..ad84f23de 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -373,11 +373,20 @@ function change_month(obj) { var queryString="gDossier="+obj.gDossier+"&op=cal"+"&per="+obj.value; var action = new Ajax.Request( - "ajax_misc.php" , { method:'get', parameters:queryString,onFailure:ajax_misc_failure,onSuccess:change_month_success} + "ajax_misc.php" , { method:'get', parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_misc} ); } -function change_month_success(req) +/** +*@brief basic answer to ajax on success, it will fill the DOMID code with +* the code. In that case, you need to create the object before the Ajax.Request +*The difference with success box is that +*@see add_div removeDiv success_box is that the width and height are not changed ajax_misc.php +*@parameter code is the ID of the object containing the html (div, button...) +*@parameter value is the html code, with it you fill the ctl element +*/ + +function success_misc(req) { try { @@ -988,3 +997,51 @@ function fill_box(req) } +/** +*display a popin to let you modified a predefined operation +*@param dossier_id +*@param od_id from table op_predef +*/ +function mod_predf_op(dossier_id,od_id) +{ + var target="mod_predf_op"; + if ( $(target)) + { + removeDiv(target); + } + var sx=posY; + var sy=posX; + var str_style="top:"+sx+";left:"+sy; + + var div={id:target, cssclass:'op_detail',style:str_style,html:loading(),drag:1}; + + add_div(div); + + var qs="?gDossier="+dossier_id+'&op=mod_predf&id='+od_id; + + var action=new Ajax.Request ( 'ajax_misc.php', + { + method:'get', + parameters:qs, + onFailure:null, + onSuccess:fill_box + } + ); + +} + +function save_predf_op(obj) +{ + var querystring="?"+$(obj).serialize()+'&op=save_predf'; + // Create a ajax request to get all the person + var action = new Ajax.Request ('ajax_misc.php', + { + method: 'get', + parameters: querystring, + onFailure: null, + onSuccess: refresh_window + } + ); + + return false; +} diff --git a/include/modify_predf_op.php b/include/modify_predf_op.php new file mode 100644 index 000000000..942e99da8 --- /dev/null +++ b/include/modify_predf_op.php @@ -0,0 +1,59 @@ +check_action(PARPREDE)==0) + { + echo alert('Action interdite'); + } +else + { + echo HtmlInput::anchor_close('mod_predf_op'); + echo h2info('Modification du nom'); + echo ' +
'; + + } +$html=ob_get_contents(); +ob_clean(); +$html=escape_xml($html); + +header('Content-type: text/xml; charset=UTF-8'); +echo <<$html
+
+EOF;
diff --git a/include/preod.inc.php b/include/preod.inc.php
index d2631ddf8..890223684 100644
--- a/include/preod.inc.php
+++ b/include/preod.inc.php
@@ -85,10 +85,12 @@ if ( $sa == 'jrn' )
foreach ($array as $row )
{
- if ( $count %2 == 0 )
- echo '