Javascript : documentation avec JSDOC

This commit is contained in:
sparkyx 2024-08-06 21:38:20 +02:00
parent 3f0444a3be
commit 508e8cc051
11 changed files with 76 additions and 69 deletions

View file

@ -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..
*
*/

View file

@ -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
/**

View file

@ -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
*

View file

@ -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
*
*
*/

View file

@ -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;
}
}

View file

@ -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;
}
}
}

View file

@ -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)
}
}
);
}
}

View file

@ -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;

View file

@ -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
<xml>
<ctl> id of the control to update for diag.box, row </ctl>
<status> OK , FAIL ...</status>
<html> Html to display</html>
</xml>
@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);
}
</script>
@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)
// <tr ctl_pk_id="" ...> </tr>
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
<xml>
<ctl> id of the control to update for diag.box, row </ctl>
<status> OK , FAIL ...</status>
<html> Html to display</html>
</xml>
*/
var ManageTable = function (p_table_name)
{
this.callback = "ajax.php"; //!< File to call

View file

@ -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 {

View file

@ -17,7 +17,10 @@
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @class
*
*/
var TagGroup = function ()
{
this.callback = "ajax_misc.php";
@ -67,4 +70,4 @@ var TagGroup = function ()
}
});
};
};
};