forked from Wavyzz/dolibarr
Replace javascript by jQuery
This commit is contained in:
@@ -29,12 +29,14 @@ function autofilltownfromzip_PopupPostalCode(url_root, postalcode,objecttown,obj
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Pour la saisie des dates par calendrier
|
||||
Input: base "/theme/eldy"
|
||||
dateFieldID "dateo" Nom du champ
|
||||
format "dd/MM/yyyy" Format issu de Dolibarr de SimpleDateFormat a utiliser pour retour
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Pour la saisie des dates par calendrier Input: base "/theme/eldy" dateFieldID
|
||||
* "dateo" Nom du champ format "dd/MM/yyyy" Format issu de Dolibarr de
|
||||
* SimpleDateFormat a utiliser pour retour
|
||||
* ==================================================================
|
||||
*/
|
||||
function showDP(base,dateFieldID,format,codelang)
|
||||
{
|
||||
// check to see if another box is already showing
|
||||
@@ -131,7 +133,8 @@ function loadMonth(base,month,year,ymd,codelang)
|
||||
|
||||
req=loadXMLDoc(theURL,null,false);
|
||||
if (req.responseText == '') alert('Failed to get URL '.theURL);
|
||||
//alert(theURL+' - '+req.responseText); // L'url doit avoir la meme racine que la pages et elements sinon pb de securite.
|
||||
// alert(theURL+' - '+req.responseText); // L'url doit avoir la meme racine
|
||||
// que la pages et elements sinon pb de securite.
|
||||
showDP.box.innerHTML=req.responseText;
|
||||
}
|
||||
|
||||
@@ -296,7 +299,8 @@ function loadXMLDoc(url,readyStateFunction,async)
|
||||
return req;
|
||||
}
|
||||
|
||||
// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and not put popup completely on the front)
|
||||
// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
|
||||
// not put popup completely on the front)
|
||||
function hideSelectBoxes() {
|
||||
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
|
||||
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
|
||||
@@ -324,23 +328,19 @@ function displaySelectBoxes() {
|
||||
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Function: formatDate (javascript object Date(), format)
|
||||
Purpose: Returns a date in the output format specified.
|
||||
The format string can use the following tags:
|
||||
Field | Tags
|
||||
-------------+-------------------------------
|
||||
Year | yyyy (4 digits), yy (2 digits)
|
||||
Month | MM (2 digits)
|
||||
Day of Month | dd (2 digits)
|
||||
Hour (1-12) | hh (2 digits)
|
||||
Hour (0-23) | HH (2 digits)
|
||||
Minute | mm (2 digits)
|
||||
Second | ss (2 digits)
|
||||
Author: Laurent Destailleur
|
||||
Author: Matelli (see http://matelli.fr/showcases/patchs-dolibarr/update-date-input-in-action-form.html)
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Function:
|
||||
* formatDate (javascript object Date(), format) Purpose: Returns a date in the
|
||||
* output format specified. The format string can use the following tags: Field |
|
||||
* Tags -------------+------------------------------- Year | yyyy (4 digits), yy
|
||||
* (2 digits) Month | MM (2 digits) Day of Month | dd (2 digits) Hour (1-12) |
|
||||
* hh (2 digits) Hour (0-23) | HH (2 digits) Minute | mm (2 digits) Second | ss
|
||||
* (2 digits) Author: Laurent Destailleur Author: Matelli (see
|
||||
* http://matelli.fr/showcases/patchs-dolibarr/update-date-input-in-action-form.html)
|
||||
* Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function formatDate(date,format)
|
||||
{
|
||||
// alert('formatDate date='+date+' format='+format);
|
||||
@@ -363,7 +363,9 @@ function formatDate(date,format)
|
||||
c=format.charAt(i); // Recupere char du format
|
||||
substr="";
|
||||
j=i;
|
||||
while ((format.charAt(j)==c) && (j < format.length)) // Recupere char successif identiques
|
||||
while ((format.charAt(j)==c) && (j < format.length)) // Recupere char
|
||||
// successif
|
||||
// identiques
|
||||
{
|
||||
substr += format.charAt(j++);
|
||||
}
|
||||
@@ -389,25 +391,19 @@ function formatDate(date,format)
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Function: getDateFromFormat(date_string, format_string)
|
||||
Purpose: This function takes a date string and a format string.
|
||||
It parses the date string with format and it returns
|
||||
the date as a javascript Date() object.
|
||||
If date does not match format, it returns 0.
|
||||
The format string can use the following tags:
|
||||
Field | Tags
|
||||
-------------+-------------------------------
|
||||
Year | yyyy (4 digits), yy (2 digits)
|
||||
Month | MM (2 digits)
|
||||
Day of Month | dd (2 digits)
|
||||
Hour (1-12) | hh (2 digits)
|
||||
Hour (0-23) | HH (2 digits)
|
||||
Minute | mm (2 digits)
|
||||
Second | ss (2 digits)
|
||||
Author: Laurent Destailleur
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Function:
|
||||
* getDateFromFormat(date_string, format_string) Purpose: This function takes a
|
||||
* date string and a format string. It parses the date string with format and it
|
||||
* returns the date as a javascript Date() object. If date does not match
|
||||
* format, it returns 0. The format string can use the following tags: Field |
|
||||
* Tags -------------+------------------------------- Year | yyyy (4 digits), yy
|
||||
* (2 digits) Month | MM (2 digits) Day of Month | dd (2 digits) Hour (1-12) |
|
||||
* hh (2 digits) Hour (0-23) | HH (2 digits) Minute | mm (2 digits) Second | ss
|
||||
* (2 digits) Author: Laurent Destailleur Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function getDateFromFormat(val,format)
|
||||
{
|
||||
// alert('getDateFromFormat val='+val+' format='+format);
|
||||
@@ -425,14 +421,17 @@ function getDateFromFormat(val,format)
|
||||
var seconde=now.getSeconds();
|
||||
|
||||
var i=0;
|
||||
var d=0; // -d- follows the date string while -i- follows the format string
|
||||
var d=0; // -d- follows the date string while -i- follows the format
|
||||
// string
|
||||
|
||||
while (i < format.length)
|
||||
{
|
||||
c=format.charAt(i); // Recupere char du format
|
||||
substr="";
|
||||
j=i;
|
||||
while ((format.charAt(j)==c) && (j < format.length)) // Recupere char successif identiques
|
||||
while ((format.charAt(j)==c) && (j < format.length)) // Recupere char
|
||||
// successif
|
||||
// identiques
|
||||
{
|
||||
substr += format.charAt(j++);
|
||||
}
|
||||
@@ -483,10 +482,12 @@ function getDateFromFormat(val,format)
|
||||
return newdate;
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Function: stringIsInteger(string)
|
||||
Purpose: Return true if string is an integer
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Function:
|
||||
* stringIsInteger(string) Purpose: Return true if string is an integer
|
||||
* ==================================================================
|
||||
*/
|
||||
function stringIsInteger(str)
|
||||
{
|
||||
var digits="1234567890";
|
||||
@@ -500,10 +501,13 @@ function stringIsInteger(str)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Function: getIntegerInString(string,pos,minlength,maxlength)
|
||||
Purpose: Return part of string from position i that is integer
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Function:
|
||||
* getIntegerInString(string,pos,minlength,maxlength) Purpose: Return part of
|
||||
* string from position i that is integer
|
||||
* ==================================================================
|
||||
*/
|
||||
function getIntegerInString(str,i,minlength,maxlength)
|
||||
{
|
||||
for (var x=maxlength; x>=minlength; x--)
|
||||
@@ -516,23 +520,24 @@ function getIntegerInString(str,i,minlength,maxlength)
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Clean string to have it url encoded
|
||||
Input: s
|
||||
Author: Laurent Destailleur
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Clean string to have it url encoded Input: s Author: Laurent Destailleur
|
||||
* Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function urlencode(s) {
|
||||
return s.replace(/\+/gi,'%2B');
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Show a popup HTML page.
|
||||
Input: url,title
|
||||
Author: Laurent Destailleur
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Show a popup HTML page. Input: url,title Author: Laurent Destailleur Licence:
|
||||
* GPL ==================================================================
|
||||
*/
|
||||
function newpopup(url,title) {
|
||||
var argv = newpopup.arguments;
|
||||
var argc = newpopup.arguments.length;
|
||||
@@ -545,21 +550,24 @@ return false;
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Fonction pour champ saisie en mode ajax. Used for autocompletion of products.
|
||||
Author: Laurent Destailleur
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Fonction pour champ saisie en mode ajax. Used for autocompletion of products.
|
||||
* Author: Laurent Destailleur Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function publish_selvalue(obj) { $(obj.name).value = obj.options[obj.selectedIndex].value; }
|
||||
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Set value of a field after return of Ajax call. Used for autocompletion.
|
||||
Input: HTML field name, val
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Set value of a field after return of Ajax call. Used for autocompletion.
|
||||
* Input: HTML field name, val Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function ac_return(field, val){
|
||||
/* alert('field.name='+field.name+'-'+val.innerHTML); */
|
||||
/* on met en place l'expression reguliere */
|
||||
@@ -574,25 +582,26 @@ function ac_return(field, val){
|
||||
$(field.name+'_id').value = id;
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Applique un delai avant execution. Used for autocompletion of companies.
|
||||
Input: funct, delay
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Applique un delai avant execution. Used for autocompletion of companies.
|
||||
* Input: funct, delay Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function ac_delay(funct,delay) {
|
||||
// delay before start of action
|
||||
setTimeout(funct,delay);
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Clean values of a "Sortable.serialize".
|
||||
Used by drag and drop. Works for Scriptaculous and jQuery.
|
||||
Input: expr
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Clean values of a "Sortable.serialize". Used by drag and drop. Works for
|
||||
* Scriptaculous and jQuery. Input: expr Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function cleanSerialize(expr) {
|
||||
var reg = new RegExp("(&)", "g");
|
||||
var reg2 = new RegExp("[^A-Z0-9,]", "g");
|
||||
@@ -602,13 +611,13 @@ function cleanSerialize(expr) {
|
||||
}
|
||||
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Display a temporary message in input text fields (For showing help message on input field).
|
||||
Input: fieldId
|
||||
Input: message
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Display a temporary message in input text fields (For showing help message on
|
||||
* input field). Input: fieldId Input: message Author: Regis Houssin Licence:
|
||||
* GPL ==================================================================
|
||||
*/
|
||||
function displayMessage(fieldId,message) {
|
||||
var textbox = document.getElementById(fieldId);
|
||||
if (textbox.value == '') {
|
||||
@@ -617,25 +626,27 @@ function displayMessage(fieldId,message) {
|
||||
}
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: Hide a temporary message in input text fields (For showing help message on input field).
|
||||
Input: fiedId
|
||||
Input: message
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose:
|
||||
* Hide a temporary message in input text fields (For showing help message on
|
||||
* input field). Input: fiedId Input: message Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function hideMessage(fieldId,message) {
|
||||
var textbox = document.getElementById(fieldId);
|
||||
textbox.style.color = 'black';
|
||||
if (textbox.value == message) textbox.value = '';
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: To show an element (To support multiselect of checkboxes in some pages)
|
||||
Input: fieldId
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose: To
|
||||
* show an element (To support multiselect of checkboxes in some pages) Input:
|
||||
* fieldId Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function displayElement(fieldId) {
|
||||
var elementId = document.getElementById(fieldId);
|
||||
if (elementId.style.visibility == 'hidden') {
|
||||
@@ -643,12 +654,13 @@ function displayElement(fieldId) {
|
||||
}
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: To hide an element (To support multiselect of checkboxes in some pages)
|
||||
Input: fieldId
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose: To
|
||||
* hide an element (To support multiselect of checkboxes in some pages) Input:
|
||||
* fieldId Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function hideElement(fieldId) {
|
||||
var elementId = document.getElementById(fieldId);
|
||||
if (elementId.style.visibility == 'visible') {
|
||||
@@ -656,12 +668,13 @@ function hideElement(fieldId) {
|
||||
}
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: To check a checkbox (To support multiselect of checkboxes in some pages)
|
||||
Input: fieldId
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose: To
|
||||
* check a checkbox (To support multiselect of checkboxes in some pages) Input:
|
||||
* fieldId Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function checkBox(boxId) {
|
||||
var elementId = document.getElementById(boxId);
|
||||
if (elementId.checked == false) {
|
||||
@@ -669,12 +682,13 @@ function checkBox(boxId) {
|
||||
}
|
||||
}
|
||||
|
||||
/*=================================================================
|
||||
Purpose: To uncheck a checkbox (To support multiselect of checkboxes in some pages)
|
||||
Input: fieldId
|
||||
Author: Regis Houssin
|
||||
Licence: GPL
|
||||
==================================================================*/
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose: To
|
||||
* uncheck a checkbox (To support multiselect of checkboxes in some pages)
|
||||
* Input: fieldId Author: Regis Houssin Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function uncheckBox(boxId) {
|
||||
var elementId = document.getElementById(boxId);
|
||||
if (elementId.checked == true) {
|
||||
@@ -682,4 +696,3 @@ function uncheckBox(boxId) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user