|
dolibarr
13.0.2
|
Page called to enhance interface with Javascript and Ajax features. More...
Go to the source code of this file.
Functions | |
| ajax_autocompleter ($selected, $htmlname, $url, $urloption= '', $minLength=2, $autoselect=0, $ajaxoptions=array(), $moreparams= '') | |
| Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php). More... | |
| ajax_multiautocompleter ($htmlname, $fields, $url, $option= '', $minLength=2, $autoselect=0) | |
| Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: core/ajax/ziptown.php). More... | |
| ajax_dialog ($title, $message, $w=350, $h=150) | |
| Show an ajax dialog. More... | |
| ajax_combobox ($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve') | |
| Convert a html select field into an ajax combobox. More... | |
| ajax_constantonoff ($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0) | |
| On/off button for constant. More... | |
| ajax_object_onoff ($object, $code, $field, $text_on, $text_off, $input=array()) | |
| On/off button to change status of an object This is called when MAIN_DIRECT_STATUS_UPDATE is set and it use tha ajax service objectonoff.php. More... | |
Page called to enhance interface with Javascript and Ajax features.
Definition in file ajax.lib.php.
| ajax_autocompleter | ( | $selected, | |
| $htmlname, | |||
| $url, | |||
$urloption = '', |
|||
$minLength = 2, |
|||
$autoselect = 0, |
|||
$ajaxoptions = array(), |
|||
$moreparams = '' |
|||
| ) |
Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php).
The HTML field must be an input text with id=search_$htmlname. This use the jQuery "autocomplete" function. If we want to use the select2, we must also convert the input into select on funcntions that call this method.
| string | $selected | Preselected value |
| string | $htmlname | HTML name of input field |
| string | $url | Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list) |
| string | $urloption | More parameters on URL request |
| int | $minLength | Minimum number of chars to trigger that Ajax search |
| int | $autoselect | Automatic selection if just one value (trigger("change") on field is done is search return only 1 result) |
| array | $ajaxoptions | Multiple options array
|
| string | $moreparams | More params provided to ajax call |
Definition at line 47 of file ajax.lib.php.
Referenced by Form\select_company(), Form\select_produits(), Form\select_produits_fournisseurs(), FormProjets\select_projects(), and FormCompany\selectCompaniesForNewContact().
| ajax_combobox | ( | $htmlname, | |
$events = array(), |
|||
$minLengthToAutocomplete = 0, |
|||
$forcefocus = 0, |
|||
$widthTypeOfAutocomplete = 'resolve' |
|||
| ) |
Convert a html select field into an ajax combobox.
Use ajax_combobox() only for small combo list! If not, use instead ajax_autocompleter(). TODO: It is used when COMPANY_USE_SEARCH_TO_SELECT and CONTACT_USE_SEARCH_TO_SELECT are set by html.formcompany.class.php. Should use ajax_autocompleter instead like done by html.form.class.php for select_produits.
| string | $htmlname | Name of html select field ('myid' or '.myclass') |
| array | $events | More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) |
| int | $minLengthToAutocomplete | Minimum length of input string to start autocomplete |
| int | $forcefocus | Force focus on field |
| string | $widthTypeOfAutocomplete | 'resolve' or 'off' |
Definition at line 391 of file ajax.lib.php.
References select2arrayoflanguage.
Referenced by FormOther\getBoxesArea(), BookKeeping\select_account(), FormAccounting\select_accounting_category(), FormOther\select_categories(), FormCompany\select_civility(), Form\select_comptes(), Form\select_conditions_paiements(), FormContract\select_contract(), Form\select_country(), Form\select_dolgroups(), Form\select_dolusers(), FormOther\select_export_model(), FormOther\select_import_model(), Form\select_incoterms(), FormCompany\select_juridicalstatus(), FormAdmin\select_language(), FormOther\select_month(), Form\select_produits_fournisseurs_list(), Form\select_produits_list(), FormProjets\select_projects_list(), FormCompany\select_region(), FormResource\select_resource_list(), FormOther\select_salesrepresentatives(), FormCompany\select_state(), Form\select_thirdparty_list(), FormSocialContrib\select_type_socialcontrib(), Form\select_types_paiements(), FormEcm\selectAllSections(), Form\selectAvailabilityDelay(), FormBarCode\selectBarcodeType(), FormCompany\selectCompaniesForNewContact(), Form\selectcontacts(), FormWebsite\selectContainer(), Form\selectCurrency(), Form\selectExpenseCategories(), FormExpenseReport\selectExpensereportStatus(), FormTicket\selectGroupTickets(), Form\selectInputReason(), Form\selectInvoice(), FormProduct\selectLotStock(), Form\selectMassAction(), Form\selectModelMail(), Form\selectMultiCurrency(), FormProjets\selectOpportunityStatus(), Form\selectPriceBaseType(), FormOther\selectProjectTasks(), FormPropal\selectProposalStatus(), FormCompany\selectProspectCustomerType(), FormWebsite\selectSampleOfContainer(), FormTicket\selectSeveritiesTickets(), Form\selectShippingMethod(), Holiday\selectStatutCP(), FormProjets\selectTasks(), FormCompany\selectTypeContact(), FormExpenseReport\selectTypeExpenseReport(), FormWebsite\selectTypeOfContainer(), FormTicket\selectTypesTickets(), FormProduct\selectWarehouses(), FormOther\selectyear(), Form\selectyesno(), FormFile\showdocuments(), and ExtraFields\showInputField().
| ajax_constantonoff | ( | $code, | |
$input = array(), |
|||
$entity = null, |
|||
$revertonoff = 0, |
|||
$strict = 0, |
|||
$forcereload = 0, |
|||
$marginleftonlyshort = 2, |
|||
$forcenoajax = 0 |
|||
| ) |
On/off button for constant.
| string | $code | Name of constant |
| array | $input | Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid')) |
| int | $entity | Entity. Current entity is used if null. |
| int | $revertonoff | Revert on/off |
| int | $strict | Use only "disabled" with delConstant and "enabled" with setConstant |
| int | $forcereload | Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input) |
| string | $marginleftonlyshort | 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. Works for fontawesome picto only. |
| int | $forcenoajax | 1 = Force to use a ahref link instead of ajax code. |
Definition at line 503 of file ajax.lib.php.
References $_SERVER, code, img_picto(), newToken(), and print.
Referenced by showSkins().
| ajax_dialog | ( | $title, | |
| $message, | |||
$w = 350, |
|||
$h = 150 |
|||
| ) |
Show an ajax dialog.
| string | $title | Title of dialog box |
| string | $message | Message of dialog box |
| int | $w | Width of dialog box |
| int | $h | height of dialog box |
Definition at line 348 of file ajax.lib.php.
References dol_string_nohtmltag(), and dol_textishtml().
| ajax_multiautocompleter | ( | $htmlname, | |
| $fields, | |||
| $url, | |||
$option = '', |
|||
$minLength = 2, |
|||
$autoselect = 0 |
|||
| ) |
Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: core/ajax/ziptown.php).
The Ajax page can also returns several values (json format) to fill several input fields. The HTML field must be an input text with id=$htmlname. This use the jQuery "autocomplete" function.
| string | $htmlname | HTML name of input field |
| array | $fields | Array of key of fields to autocomplete |
| string | $url | URL for ajax request : /chemin/fichier.php |
| string | $option | More parameters on URL request |
| int | $minLength | Minimum number of chars to trigger that Ajax search |
| int | $autoselect | Automatic selection if just one value |
Definition at line 241 of file ajax.lib.php.
Referenced by FormCompany\select_ziptown().
| ajax_object_onoff | ( | $object, | |
| $code, | |||
| $field, | |||
| $text_on, | |||
| $text_off, | |||
$input = array() |
|||
| ) |
On/off button to change status of an object This is called when MAIN_DIRECT_STATUS_UPDATE is set and it use tha ajax service objectonoff.php.
| Object | $object | Object to set |
| string | $code | Name of constant : status or status_buy for product by example |
| string | $field | Name of database field : 'tosell' or 'tobuy' for product by example |
| string | $text_on | Text if on |
| string | $text_off | Text if off |
| array | $input | Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) |
Definition at line 573 of file ajax.lib.php.
Referenced by dol_banner_tab().