From 8246933e92b391bccf040fab23e12de6876f4650 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 26 Sep 2017 23:12:54 +0200 Subject: [PATCH] Analytic : change the name and description in Ajax, improve esthetic --- html/ajax_misc.php | 4 +++- html/js/infobulle.js | 2 +- include/ajax/ajax_anc_plan.php | 2 ++ include/anc_pa.inc.php | 12 ++++-------- include/class/anc_plan.class.php | 27 +++++++++++++++++++++------ include/lib/message_javascript.php | 2 +- include/template/anc_key_input.php | 2 +- 7 files changed, 33 insertions(+), 18 deletions(-) diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 1f8bf7420..82749d116 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -183,7 +183,9 @@ $path = array( /* display the lettering , callebd from acc_ledger : dsp_letter*/ "dl"=>"ajax_display_letter", // Add , delete update anc accounting - "anc_accounting"=>"ajax_anc_accounting" + "anc_accounting"=>"ajax_anc_accounting", + // Update name and description + "anc_updatedescription"=>"ajax_anc_plan" ) ; if (array_key_exists($op, $path)) { diff --git a/html/js/infobulle.js b/html/js/infobulle.js index e87b19b1f..41750dda8 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -31,7 +31,7 @@ function showBulle(p_ctl){ var d=document.getElementById('bulle'); d.innerHTML=content[p_ctl]; d.style.top=posY+offsetY+"px"; - d.style.left=posX+offsetX+"px"; + d.style.left=posX+offsetX-10+"px"; d.style.visibility="visible"; } function getPosition(e) diff --git a/include/ajax/ajax_anc_plan.php b/include/ajax/ajax_anc_plan.php index 8e78c1983..dca03dd30 100644 --- a/include/ajax/ajax_anc_plan.php +++ b/include/ajax/ajax_anc_plan.php @@ -25,6 +25,8 @@ if (!defined('ALLOWED')) require_once NOALYSS_INCLUDE . "/lib/inplace_edit.class.php"; +if ( $g_user->check_module("PLANANC ") ) die("forbidden"); + $input = $http->request("input"); $action = $http->request("ieaction", "string", "display"); $pa_id=$http->post("id","numeric"); diff --git a/include/anc_pa.inc.php b/include/anc_pa.inc.php index dda04269a..182275775 100644 --- a/include/anc_pa.inc.php +++ b/include/anc_pa.inc.php @@ -30,6 +30,7 @@ if (!defined('ALLOWED')) require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php'; require_once NOALYSS_INCLUDE.'/class/anc_account_table.class.php'; require_once NOALYSS_INCLUDE.'/database/poste_analytique_sql.class.php'; +require_once NOALYSS_INCLUDE.'/lib/inplace_edit.class.php'; $ret=""; $str_dossier=Dossier::get(); @@ -117,23 +118,18 @@ if ($sa=="pa_detail") $pa_id=$http->get("pa_id","numeric"); - $new=new Anc_Plan($cn, $_GET['pa_id']); + $new=new Anc_Plan($cn, $pa_id); $wSa=HtmlInput::hidden("sa", "pa_update"); $new->get(); $ret.= '
'; - $ret.= '
'; - $ret.=dossier::hidden(); $ret.= $new->form(); $ret.= $wSa; - $ret.=HtmlInput::submit("submit", _("Enregistre")); - $ret.=HtmlInput::button_anchor(_('Efface'), '', 'remove_analytic_plan', + $ret.=HtmlInput::button_anchor(_('Efface ce plan'), '', 'remove_analytic_plan', 'onclick="return confirm_box(\'remove_analytic_plan\',\'Effacer ?\',function () {window.location=\'do.php?ac='.$_REQUEST['ac'].'&pa_id='.$_GET['pa_id'].'&sa=pa_delete&'.$str_dossier.'\';})"', 'smallbutton'); - $ret.= '
'; - //--------------------------------------------------------------------- // Detail now // Use Manage_Table @@ -207,7 +203,7 @@ if ($sa=='anc_menu') echo ''. ''. h($line['name']); - + echo " "; echo h($line['description']).""; echo ""; echo "\n"; diff --git a/include/class/anc_plan.class.php b/include/class/anc_plan.class.php index f5ff21a53..f7ee13570 100644 --- a/include/class/anc_plan.class.php +++ b/include/class/anc_plan.class.php @@ -111,16 +111,31 @@ class Anc_Plan } function form() { + $dossier_id=Dossier::id(); + $wName=new IText('pa_name',$this->name,"pa_name"); + $iName=new Inplace_Edit($wName); + $iName->set_callback("ajax_misc.php"); + $iName->add_json_param("gDossier",$dossier_id); + $iName->add_json_param("action","anc_updatedescription"); + $iName->add_json_param("op","anc_updatedescription"); + $iName->add_json_param("id",$this->id); - $wName=new IText('pa_name',$this->name); - $wName->table=1; - $wDescription=new IText('pa_description',$this->description); - $wDescription->table=1; + $wDescription=new IText('pa_description',$this->description,"pa_description"); + $wDescription->size=50; + if ( $this->description == "") $wDescription->value=_("Aucune description"); + $iDescription=new Inplace_Edit($wDescription); + $iDescription->add_json_param("gDossier",$dossier_id); + $iDescription->add_json_param("op","anc_updatedescription"); + $iDescription->add_json_param("action","anc_updatedescription"); + $iDescription->set_callback("ajax_misc.php"); + $iDescription->add_json_param("id",$this->id); + + $wId=new IHidden("pa_id",$this->id); $ret=""; - $ret.=''.td(_('Nom')).$wName->input().''; - $ret.="".td(_('Description')).$wDescription->input().""; + $ret.=''.td(_('Nom')).''.''; + $ret.="".td(_('Description')).''.""; $ret.="
'.$iName->input().'
'.$iDescription->input().'
"; $ret.=$wId->input(); return $ret; diff --git a/include/lib/message_javascript.php b/include/lib/message_javascript.php index 35919e271..560cf0687 100644 --- a/include/lib/message_javascript.php +++ b/include/lib/message_javascript.php @@ -69,7 +69,7 @@ content[37]=""; content[38]=""; content[39]=""; content[40]=""; -content[41]=""; +content[41]=" à zéro pour effacer la ligne")?>"; content[42]=""; \ No newline at end of file diff --git a/include/template/anc_key_input.php b/include/template/anc_key_input.php index b1f71cb08..87dfe9569 100644 --- a/include/template/anc_key_input.php +++ b/include/template/anc_key_input.php @@ -62,8 +62,8 @@ endfor; ?> - +