javascript for searching a card More...
Go to the source code of this file.
Functions | |
function | add_category (obj) |
add a category of card, | |
function | boxsearch_card (p_dossier) |
search a card an display the result into a inner box | |
function | clean_Fid (p_ctl) |
clean the row (the label, price and vat) | |
function | dis_blank_card (obj) |
function | errorFid (request, json) |
function | fill_data (text, li) |
is called when something change in ICard | |
function | fill_data_onchange (ctl) |
is called when something change in ICard | |
function | fill_fin_data (text, li) |
is called when something change in ICard | |
function | fill_fin_data_onchange (ctl) |
is called when something change in ICard | |
function | fill_ipopcard (obj) |
show the ipopup window and display the details of a card, to work some attribute must be set obj.qcode is the qcode, obj.nohistory if you don't want to display the history button, obj.ro is the popin is readonly | |
function | form_blank_card (obj) |
function | removeCardAttribut (ad_id, gDossier, table_id, row) |
Remove a definition of an attribut. | |
function | result_card_search (req) |
show the answer of ajax request | |
function | save_card (obj) |
save the data contained into the form 'save_card' | |
function | save_card_category (obj) |
save the form and add a new category of card | |
function | search_card (obj) |
show the ipopup with the form to search a card the properties | |
function | search_get_card (obj) |
when you submit the form for searching a card | |
function | select_card_type (obj) |
show the ipopup for selecting a card type, it is a needed step before adding a card | |
function | setCtrl (p_ctrl, p_quickcode, p_ctrlname, p_label) |
Set the value of 2 input fields. | |
function | successFill_ipopcard (req, json) |
function | update_card (obj) |
update a card in ajax | |
function | update_value (text, li) |
Variables | |
var | card_layer = 1 |
javascript for searching a card
Definition in file card.js.
function add_category | ( | obj | ) |
add a category of card,
obj | with the attribute
|
Definition at line 600 of file card.js.
References add_div(), errorFid(), fill_box(), removeDiv(), style, value, and waiting_box().
{ var sx=0; if ( window.scrollY) { sx=window.scrollY+120; } else { sx=document.body.scrollTop+120; } var div_style="top:"+sx+"px;width:60%;height:80%"; // show ipopup var div={id:obj.ipopup, cssclass:"inner_box",drag:1,style:div_style}; if ( $(div) ) { removeDiv(div); } add_div(div); waiting_box(); var dossier=$('gDossier').value; var queryString='gDossier='+dossier; queryString+='&op=ac'; queryString+='&ctl='+obj.ipopup; if ( obj.type_cat) { queryString+='&cat='+obj.type_cat; } var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:errorFid, onSuccess:fill_box } ); }
function boxsearch_card | ( | p_dossier | ) |
search a card an display the result into a inner box
Definition at line 30 of file card.js.
References add_div(), ajax_misc_failure(), alert(), loading(), remove_waiting_box(), removeDiv(), sorttable, style, value, and waiting_box().
{ try { waiting_box(); removeDiv('boxsearch_card_div'); var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+$(card_search).value; var action = new Ajax.Request( "ajax_misc.php" , { method:'get', parameters:queryString, onFailure:ajax_misc_failure, onSuccess:function(req){ remove_waiting_box(); var y=posY+15; var div_style="left:10%;width:80%;"+";top:"+y+"px"; add_div({id:'boxsearch_card_div',cssclass:'inner_box',html:loading(),style:div_style,drag:true}); $('boxsearch_card_div').innerHTML=req.responseText; sorttable.makeSortable($('tb_fiche')); } } ); }catch( e) { alert(e.getMessage); } }
function clean_Fid | ( | p_ctl | ) |
function dis_blank_card | ( | obj | ) |
Definition at line 494 of file card.js.
References add_div(), calcy(), content, errorFid(), loading(), posX, removeDiv(), successFill_ipopcard(), and value.
{ // first we have to take the form elt we need if ( obj.fd_id.value != undefined ) { var fd_id=$F('fd_id'); } else {fd_id=obj.fd_id;} var ref=""; if ( obj.elements && obj.elements['ref'] ) { ref='&ref'; } var content='div_new_card'; var nTop=calcy(30); var nLeft=posX; var str_style="top:"+nTop+"px;right:"+nLeft+"px;height:auto"; var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true}; if ( $(content)) {removeDiv(content);} add_div(popup); if ( obj.gDossier.value != undefined ) { var dossier=$('gDossier').value;} else { var dossier=obj.gDossier; } var queryString='gDossier='+dossier; queryString+='&ctl='+content; queryString+='&fd_id='+fd_id; queryString+=ref; queryString+='&op=bc'; // bc for blank card var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:errorFid, onSuccess:successFill_ipopcard } ); }
function errorFid | ( | request, | |
json | |||
) |
function fill_data | ( | text, | |
li | |||
) |
function fill_data_onchange | ( | ctl | ) |
function fill_fin_data | ( | text, | |
li | |||
) |
is called when something change in ICard
the | input field |
Definition at line 310 of file card.js.
References ajax_saldo(), and ajaxFid().
{ ajaxFid(text); ajax_saldo($(text.id)); }
function fill_fin_data_onchange | ( | ctl | ) |
is called when something change in ICard
the | input field |
Definition at line 300 of file card.js.
References ajax_saldo(), and ajaxFid().
{ ajaxFid(ctl); ajax_saldo(ctl.id); }
function fill_ipopcard | ( | obj | ) |
show the ipopup window and display the details of a card, to work some attribute must be set obj.qcode is the qcode, obj.nohistory if you don't want to display the history button, obj.ro is the popin is readonly
Definition at line 324 of file card.js.
References add_div(), card_layer, content, errorFid(), fill_box(), loading(), and value.
{ card_layer++; var content='card_'+card_layer; var nTop=posY-40; //var nLeft=posX-20; var nLeft="20%"; var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:45em;height:auto"; var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true}; add_div(popup); var dossier=$('gDossier').value; var qcode=''; if ( $(obj).qcode != undefined ) { qcode=obj.qcode; } else { qcode=$(obj).value; } // ctl=$(obj).id; var queryString='gDossier='+dossier; queryString+='&qcode='+qcode; queryString+='&ctl='+content; queryString+='&op=dc'; // dc for detail card if ( obj.readonly != undefined) { queryString+='&ro'; } if ( obj.nohistory != undefined) { queryString+='&nohistory'; } var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:errorFid, onSuccess:fill_box } ); }
function form_blank_card | ( | obj | ) |
Definition at line 535 of file card.js.
References add_div(), content, errorFid(), loading(), posX, removeDiv(), successFill_ipopcard(), and value.
{ // first we have to take the form elt we need var fd_id=obj.fd_id; var content='div_new_card'; var nTop=posY-40; var nLeft=posX-20; var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:60em;height:auto"; var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true}; if ( $(content)) {removeDiv(content);} add_div(popup); var dossier=$('gDossier').value; var queryString='gDossier='+dossier; queryString+='&ctl='+content; queryString+='&fd_id='+fd_id; queryString+='&op=bc'; // bc for blank card var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:errorFid, onSuccess:successFill_ipopcard } ); }
function removeCardAttribut | ( | ad_id, | |
gDossier, | |||
table_id, | |||
row | |||
) |
Remove a definition of an attribut.
attr_def.ad_id | |
gDossier | |
table_id | to rm the row |
special | this pointer of the row |
Definition at line 682 of file card.js.
References deleteRowRec().
{ var queryString='gDossier='+gDossier; queryString+='&op=rmfa'; queryString+='&ctl=debug'; // debug id queryString+='&ad_id='+ad_id; var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:null, onSuccess:null } ); deleteRowRec(table_id,row); }
function result_card_search | ( | req | ) |
show the answer of ajax request
answer | in XML |
Definition at line 183 of file card.js.
References alert(), getNodeText(), and unescape_xml().
Referenced by search_card(), and search_get_card().
{ try { var answer=req.responseXML; var a=answer.getElementsByTagName('ctl'); if ( a.length == 0 ) { var rec=req.responseText; alert ('erreur :'+rec); } var html=answer.getElementsByTagName('code'); var name_ctl=a[0].firstChild.nodeValue; var nodeXml=html[0]; var code_html=getNodeText(nodeXml); code_html=unescape_xml(code_html); $('search_card').innerHTML=code_html; } catch (e) { alert(e.message); } try { code_html.evalScripts(); } catch(e) { alert("Impossible executer script de la reponse\n"+e.message); } }
function save_card | ( | obj | ) |
save the data contained into the form 'save_card'
input | field (obj) it must have the attribute ipopup possible attribute : |
Definition at line 572 of file card.js.
References content, errorFid(), fill_box(), loading(), and value.
{ var content=$(obj).ipopup; // Data must be taken here data=$('save_card').serialize(false); $(content).innerHTML=loading(); var dossier=$('gDossier').value; var queryString='gDossier='+dossier; queryString+='&ctl='+content; queryString+=data; queryString+='&op=sc'; // sc for save card var action=new Ajax.Request ( 'ajax_card.php', { method:'post', parameters:queryString, onFailure:errorFid, onSuccess:fill_box } ); }
function save_card_category | ( | obj | ) |
save the form and add a new category of card
obj | if the form object |
Definition at line 643 of file card.js.
References alert(), errorFid(), fill_box(), and value.
{ if ( ! $(obj).ipopup) { alert('Erreur pas d\' attribut ipopup '+obj.id); return; }; try { // Data must be taken here data=$('newcat').serialize(false); var dossier=$('gDossier').value; queryString='ctl='+obj.ipopup+'&'; queryString+=data; queryString+='&op=scc'; // sc for save card var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:errorFid, onSuccess:fill_box } ); } catch(e) { alert(e.message); return false; } return false; }
function search_card | ( | obj | ) |
show the ipopup with the form to search a card the properties
Definition at line 68 of file card.js.
References add_div(), alert(), encodeJSON(), errorFid(), g(), jrn, label, loading(), removeDiv(), result_card_search(), style, and value.
{ try { var gDossier=$('gDossier').value; var inp=obj.inp; var string_to_search=$(inp).value; var label=obj.label; var typecard=obj.typecard; var price=obj.price; var tvaid=obj.tvaid; var jrn=obj.jrn; if ( jrn==undefined) { if ( g('p_jrn')) { jrn=$('p_jrn').value; } else { jrn=-1; } } var query=encodeJSON({'gDossier':gDossier, 'inp':inp,'label':label,'price':price,'tvaid':tvaid, 'ctl':'search_card','op':'fs','jrn':jrn, 'typecard':typecard,'query':string_to_search }); if ( $('search_card') ) { removeDiv('search_card'); } var sx=0; if ( window.scrollY) { sx=window.scrollY+40; } else { sx=document.body.scrollTop+60; } var div_style="top:"+sx+"px;height:80%"; add_div({id:'search_card',cssclass:'inner_box',html:loading(),style:div_style,drag:true}); var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:query, onFailure:errorFid, onSuccess:result_card_search } ); } catch(e) { alert('search_card failed'+e.message); } }
function search_get_card | ( | obj | ) |
when you submit the form for searching a card
obj | form |
Definition at line 130 of file card.js.
References errorFid(), loading(), result_card_search(), and value.
{ var dossier=$('gDossier').value; var queryString="gDossier="+dossier; queryString+="&op=fs"; if ( obj.elements['inp'] ) { queryString+="&inp="+$F('inp'); } if ( obj.elements['typecard'] ) { queryString+="&typecard="+$F('typecard'); } if ( obj.elements['jrn'] ) { queryString+="&jrn="+$F('jrn'); } if ( obj.elements['label']) { queryString+="&label="+$F('label'); } if ( obj.elements['price']) { queryString+="&price="+$F('price'); } if ( obj.elements['tvaid']) { queryString+="&tvaid="+$F('tvaid'); } if( obj.elements['query']) { queryString+="&query="+$F('query'); } if (obj.ctl ) { queryString+="&ctl="+obj.ctl; } $('asearch').innerHTML=loading(); var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:errorFid, onSuccess:result_card_search } ); }
function select_card_type | ( | obj | ) |
show the ipopup for selecting a card type, it is a needed step before adding a card
input | field (obj) it must have the attribute ipopup possible attribute :
|
Definition at line 420 of file card.js.
References add_div(), content, errorFid(), fill_box(), jrn, loading(), removeDiv(), and value.
{ var dossier=$('gDossier').value; // give a filter, -1 if not var filter=$(obj).filter; if ( filter==undefined) { filter=-1; } var content="select_card_div"; if ( $(content)){removeDiv(content);} var sx=0; if ( window.scrollY) { sx=window.scrollY+40; } else { sx=document.body.scrollTop+60; } var str_style="top:"+sx+"px;left:25%;height:30%"; var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true}; add_div(popup); var queryString='gDossier='+dossier; queryString+='&ctl='+content; queryString+='&op=st'; // st for selecting type if ( $(obj).win_refresh!=undefined) { queryString+='&ref'; } queryString+='&fil='+filter; // filter on the ledger, -1 if not var oledger=$(obj).jrn; if (oledger==undefined) { ledger=-1; } else { ledger=$(obj).jrn; } queryString+='&ledger='+ledger; if ( obj.type_cat) { queryString+='&cat='+obj.type_cat; } var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:queryString, onFailure:errorFid, onSuccess:fill_box } ); }
function setCtrl | ( | p_ctrl, | |
p_quickcode, | |||
p_ctrlname, | |||
p_label | |||
) |
Set the value of 2 input fields.
Set the quick code in the first ctrl and the label of the quickcode in the second one. This function is a variant of SetData for some specific need. This function is called if the caller is searchcardCtrl
p_ctrl | the input with the name of the quick code |
p_quickcode | the found quick_code |
p_ctrlname | the name of the input field with the label |
p_label | the label of the quickcode |
Definition at line 229 of file card.js.
References g().
function successFill_ipopcard | ( | req, | |
json | |||
) |
request | : object request |
json | : json answer |
Definition at line 378 of file card.js.
References alert(), getNodeText(), and unescape_xml().
Referenced by dis_blank_card(), form_blank_card(), and update_card().
{ try { var answer=req.responseXML; var a=answer.getElementsByTagName('ctl'); var html=answer.getElementsByTagName('code'); if ( a.length == 0 ) { var rec=req.responseText; alert ('erreur :'+rec); } var name_ctl=a[0].firstChild.nodeValue; var code_html=getNodeText(html[0]); code_html=unescape_xml(code_html); $(name_ctl).innerHTML=code_html; } catch (e) { alert(e.message); } try { code_html.evalScripts(); } catch(e) { alert("Impossible executer script de la reponse\n"+e.message); } }
function update_card | ( | obj | ) |
update a card in ajax
Definition at line 703 of file card.js.
References alert(), errorFid(), name, and successFill_ipopcard().
{ try { var name=obj.id; var qs=Form.serialize(name)+'&op=upc'; var action=new Ajax.Request ( 'ajax_card.php', { method:'get', parameters:qs, onFailure:errorFid, onSuccess:successFill_ipopcard } ); } catch (e) { alert(e.message); return false; } }
function update_value | ( | text, | |
li | |||
) |
var card_layer = 1 |
Definition at line 26 of file card.js.
Referenced by fill_ipopcard().