From 508e8cc051dcdaf84291254201cdc902c5a6d9e1 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Tue, 6 Aug 2024 21:38:20 +0200 Subject: [PATCH] Javascript : documentation avec JSDOC --- html/js/acc_ledger.js | 6 +-- html/js/accounting_item.js | 4 ++ html/js/ajax_fiche.js | 4 +- html/js/calc.js | 7 ++-- html/js/card.js | 9 +++-- html/js/compute_direct.js | 7 ++-- html/js/gestion.js | 11 +++--- html/js/infobulle.js | 9 +++-- html/js/managetable.js | 75 +++++++++++++++++--------------------- html/js/noalyss_script.js | 6 ++- html/js/taggroup.js | 7 +++- 11 files changed, 76 insertions(+), 69 deletions(-) diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index e0055181b..d69d0bf80 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -19,9 +19,9 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/*! - * \file - * \brief javascript script for the ledger in accountancy, +/** + * @file + * javascript script for the ledger in accountancy, * compute the sum, add a row at the table.. * */ diff --git a/html/js/accounting_item.js b/html/js/accounting_item.js index 1a0292080..20db90d03 100644 --- a/html/js/accounting_item.js +++ b/html/js/accounting_item.js @@ -16,6 +16,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Revision$ */ +/** + * @file + * manage accounting + */ // Copyright Author Dany De Bontridder danydb@aevalys.eu /** diff --git a/html/js/ajax_fiche.js b/html/js/ajax_fiche.js index be7a7a4fa..efecc0e45 100644 --- a/html/js/ajax_fiche.js +++ b/html/js/ajax_fiche.js @@ -18,8 +18,8 @@ /* $Revision$ */ // Copyright Author Dany De Bontridder danydb@aevalys.eu - -/* +/** + * @file * This file permit to use the AJAX function to fill up * info from fiche * diff --git a/html/js/calc.js b/html/js/calc.js index d62f80afa..dbc48745b 100644 --- a/html/js/calc.js +++ b/html/js/calc.js @@ -19,9 +19,10 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/*! \file - * \brief This file show a little online calculator, in the caller - * the span id result, listing, the id form calc_line and the +/** + * @file + * This file show a little online calculator, in the caller the span id result, + * listing, the id form calc_line and the * * */ diff --git a/html/js/card.js b/html/js/card.js index ad5cde65e..a3f74ad44 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -19,8 +19,9 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/** \file - * \brief javascript for searching a card +/** + * @file + * javascript for searching a card */ var card_layer=1; @@ -1170,7 +1171,7 @@ function action_remove_concerned(p_dossier,p_fiche_id,p_action_id) } /** * Remove a card after checking it is not used - * @param object obj {gDossier,op,op2:rm_card,ctl,f_id} + * @param obj {json} = gDossier,op,op2:rm_card,ctl,f_id */ function delete_card(obj) { smoke.confirm("Confirmez ? ", function (e) { @@ -1418,4 +1419,4 @@ function save_linked_card_option(obj) } }); return false; -} \ No newline at end of file +} diff --git a/html/js/compute_direct.js b/html/js/compute_direct.js index 3e2457f42..4c4f7c5bb 100644 --- a/html/js/compute_direct.js +++ b/html/js/compute_direct.js @@ -15,8 +15,9 @@ * along with NOALYSS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*!\file - *\brief common function for "Ecriture directe" +/** + * @file + *common function for "Ecriture directe" */ /** * Compute the sum of the debit and credit of the operation in the input screen for misceallenous operation @@ -112,4 +113,4 @@ function controleBalance() smoke.alert(content[58]); return false; } -} \ No newline at end of file +} diff --git a/html/js/gestion.js b/html/js/gestion.js index 4e0258ed7..0364b477b 100644 --- a/html/js/gestion.js +++ b/html/js/gestion.js @@ -19,8 +19,9 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/*!\file - * \brief javascript scripts for the gestion +/** + * @file + * javascript scripts for the gestion * */ @@ -28,8 +29,8 @@ /** * remove an attached document of an action - *@param dossier - *@param dt_id id of the document (pk document:d_id) + *@param {int} dossier + *@param {int} dt_id id of the document (pk document:d_id) */ function remove_document(p_dossier,p_id) { @@ -460,4 +461,4 @@ function delete_filter_followup(p_dossier,filter_id) } } ); -} \ No newline at end of file +} diff --git a/html/js/infobulle.js b/html/js/infobulle.js index 94e160e31..e2d054392 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -15,13 +15,14 @@ * along with NOALYSS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*!\file - * \brief create the infobulle, the internalization is not yet implemented - * \code +/** + * @file + * create the infobulle, the internalization is not yet implemented + * @code // Example echo JS_INFOBULLE; echo Icon_Action::infobulle(x); - \endcode + @endcode */ var posX=0,posY=0,offsetX=10,offsetY=10; diff --git a/html/js/managetable.js b/html/js/managetable.js index 4630700fb..7b522288d 100644 --- a/html/js/managetable.js +++ b/html/js/managetable.js @@ -16,44 +16,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Copyright Author Dany De Bontridder danydb@aevalys.eu - /** - *@class ManageTable Javascript object to manage ajax calls to + * @class + * Javascript object to manage ajax calls to * save , input or delete data row. * The callback must respond with a XML file , the tag status for the result and data the HTML code to display - *@param {string} p_table_name the data table on which we're working - in javascript , to create an object to manipulate the table - version. - - Example of code - @code - // Version will manage the table "version" - var version=new ManageTable("version"); - - // the file ajax_my.php will be called - version.set_callback("ajax_my.php"); - - // Add supplemental parameter to this file - version.param_add ({"plugin_code":"OIC"}; - - // Set the id of dialog box , table and tr prefix - version.set_control("dialbox1"); - - @endcode - - - The answer from ajax must be like this template - @verbatim - - id of the control to update for diag.box, row - OK , FAIL ... - Html to display - - @endverbatim - + List of function + ==================== - set_control(p_ctl_name) - set_callback (p_new_callback) - param_add (json object) @@ -61,12 +33,11 @@ - save - delete - input - How to call a function AFTER save ? You set a function afterSaveFct like in the example, it will be trigger after you submit the FORM a function named afterSaveFct(r) where r is the row in HTML to display, with a attribute ctl_pk_id which is the primary key and id of the row - Example : - @code + + @example document_attach_obj.afterSaveFct=function(e) { var ctl_pk_id=e.getAttribute("ctl_pk_id"); var formData = new FormData(); @@ -76,12 +47,8 @@ xhr.open("POST", "ajax.php?p_id="+ctl_pk_id+"&do=upload_document", true); xhr.send(formData); } - - @endcode As a hidden parameter the Manage_Table:object_name must be set - Example : - @code // the object_name is tbl6030ee4ee519e , in the table each row (TR) has an attribute ctl_pk_id which is the id (primary key) // tbl6030ee4ee519e.afterSaveFct=function(p_param) { @@ -89,9 +56,35 @@ console.log(this) console.log(p_param.getAttribute(ctl_pk_id)) } - @endcode - */ + +/** + * @constructor + * @param {string} p_table_name the data table on which we're working + in javascript , to create an object to manipulate the table + version. +@example +// Version will manage the table "version" + var version=new ManageTable("version"); + + // the file ajax_my.php will be called + version.set_callback("ajax_my.php"); + + // Add supplemental parameter to this file + version.param_add ({"plugin_code":"OIC"}; + + // Set the id of dialog box , table and tr prefix + version.set_control("dialbox1"); + + //The answer from ajax must be like this template + + + id of the control to update for diag.box, row + OK , FAIL ... + Html to display + + +*/ var ManageTable = function (p_table_name) { this.callback = "ajax.php"; //!< File to call diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index b448b4b64..9e3f6a978 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -19,8 +19,9 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/*!\file - * \brief javascript script, always added to every page +/** + * + * javascript script, always added to every page * */ var ask_reload = 0; @@ -56,6 +57,7 @@ function in_child(p_element, name_child) { /** * callback function when we just need to update a hidden div with an info * message + * @see removeOperation , reverseOperation */ function infodiv(req, json) { try { diff --git a/html/js/taggroup.js b/html/js/taggroup.js index b159a0f6c..b4cda684d 100644 --- a/html/js/taggroup.js +++ b/html/js/taggroup.js @@ -17,7 +17,10 @@ */ // Copyright (2002-2020) Author Dany De Bontridder - +/** + * @class + * + */ var TagGroup = function () { this.callback = "ajax_misc.php"; @@ -67,4 +70,4 @@ var TagGroup = function () } }); }; -}; \ No newline at end of file +};