diff --git a/html/js/managetable.js b/html/js/managetable.js index 3d5d15f81..916ba0e98 100644 --- a/html/js/managetable.js +++ b/html/js/managetable.js @@ -87,6 +87,10 @@ var ManageTable = function (p_table_name) this.sort_column=p_column; }; + + this.set_dialog_box=function (p_dialog_box){ + this.control=p_dialog_box; + } /** * Insert the row a the right location * @param {type} p_element_row DOMElement TR @@ -225,12 +229,12 @@ var ManageTable = function (p_table_name) new Effect.Highlight(answer['ctl_row'] ,{startcolor: '#FAD4D4',endcolor: '#F78082' }); alternate_row_color("tb"+answer['ctl']); remove_waiting_box(); - $("dtr").hide(); + $(here.control).hide(); } else { remove_waiting_box(); smoke.alert(content[48]); - $("dtr").update(answer['html']); + $(here.control).update(answer['html']); } } diff --git a/html/js/scripts.js b/html/js/scripts.js index 4451f8349..3bd5e758e 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -3676,7 +3676,7 @@ function toggle_row_warning_enable(p_enable, p_row) /** * return a json object which is the merge of the 2 json objects - * + * from 2015 : Object.assign(obj1, obj2); * @param p_json1 object 1 to merge * @param p_json2 object 2 to merge * @returns new json object diff --git a/include/ajax/ajax_save_predf_op.php b/include/ajax/ajax_save_predf_op.php index c84830ffe..4286d1db7 100644 --- a/include/ajax/ajax_save_predf_op.php +++ b/include/ajax/ajax_save_predf_op.php @@ -56,8 +56,14 @@ $operation_predef_mtable->set_callback("ajax_misc.php"); if ($action=="input") { - header('Content-type: text/xml; charset=UTF-8'); - echo $operation_predef_mtable->ajax_input()->saveXML(); + if ($p_id == -1 ) { + // new operation to insert + + } else { + // display existing operation for updating + header('Content-type: text/xml; charset=UTF-8'); + echo $operation_predef_mtable->ajax_input()->saveXML(); + } return; } elseif ($action == "save") diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index cd364686b..20479426a 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -71,15 +71,16 @@ class Manage_Table_SQL protected $a_prop; //!< property for each col. protected $a_type; //!< Type of the column : date , select ... Only in input protected $a_select; //!< Possible value if a_type is a SELECT - protected $object_name; //!< Object_name is used for the javascript + protected $object_name; //!< Object_name is used for the javascript , it is the row id to update or delete protected $row_delete; //!< Flag to indicate if rows can be deleted protected $row_update; //!< Flag to indicate if rows can be updated protected $row_append; //!< Flag to indicate if rows can be added - protected $json_parameter; //!< Default parameter to add (gDossier...) + protected $json_parameter; //!< Default parameter to add (gDossier...), sent to the ajax callback protected $aerror; //!< Array containing the error of the input data protected $col_sort; //!< when inserting, it is the column to sort,-1 to disable it and append only protected $a_info; //!< Array with the infotip protected $sort_column; //!< javascript sort , if empty there is no js sort + protected $dialog_box; //!< ID of the dialog box which display the result of the ajax calls const UPDATABLE=1; const VISIBLE=2; @@ -121,6 +122,7 @@ class Manage_Table_SQL $this->col_sort=0; // By default no js sort $this->sort_column=""; + $this->dialog_box="dtr"; } /** * send the XML headers for the ajax call @@ -129,6 +131,25 @@ class Manage_Table_SQL { header('Content-type:text/xml;charset="UTF-8"'); } + + /** + * @return mixed + */ + public function get_dialog_box() + { + return $this->dialog_box; + return $this; + } + + /** + * @param mixed $dialog_box + */ + public function set_dialog_box($dialog_box) + { + $this->dialog_box = $dialog_box; + return $this; + } + /** * When adding an element , it is column we checked to insert before, * @return none @@ -363,6 +384,7 @@ function check() {$this->object_name}.set_callback(\"{$this->callback}\"); {$this->object_name}.param_add({$this->json_parameter}); {$this->object_name}.set_sort({$this->get_col_sort()}); + {$this->object_name}.set_control(\"{$this->get_dialog_box()}\"); "; @@ -1046,9 +1068,10 @@ function check() try { $status=$p_status; + ob_start(); - echo HtmlInput::title_box("Donnée", "dtr","close","","y"); + echo HtmlInput::title_box("Donnée", $this->dialog_box,"close","","y"); printf('