[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 174/219: space
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 174/219: space |
Date: |
Mon, 18 Dec 2017 13:22:58 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 555841b2c23d14664e507fab8a417ff641a0b3c1
Author: Dany De Bontridder <address@hidden>
Date: Tue Nov 28 19:52:41 2017 +0100
space
---
include/lib/icard.class.php | 327 +++++++++++++++++++++++---------------------
1 file changed, 169 insertions(+), 158 deletions(-)
diff --git a/include/lib/icard.class.php b/include/lib/icard.class.php
index 1751e77..419cac3 100644
--- a/include/lib/icard.class.php
+++ b/include/lib/icard.class.php
@@ -1,4 +1,5 @@
<?php
+
/*
* This file is part of NOALYSS.
*
@@ -15,49 +16,49 @@
* You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ */
// Copyright Author Dany De Bontridder address@hidden
-/*!\file
+/* !\file
* \brief Input HTML for the card show buttons
*
*/
-/*!
+/* !
* \brief Input HTML for the card show buttons, in the file, you have to add
card.js
* How to use :
* - label is the label in the button
* - extra contents the type (all, deb or cred, a list of FD_ID between
parent. or a SQL clause
* - attribute are the attribute to set (via ajax). The ledger is either a
attribute (jrn) or a
* hidden field in the document, if none are set, there is no filter on the
ledger
- *\note you must in a hidden field gDossier (dossier::hidden)
- *\see ajaxFid
- *\see card.js
- *\see fid.php
- *\see fid_card.php
- *\see ajax_card.php
+ * \note you must in a hidden field gDossier (dossier::hidden)
+ * \see ajaxFid
+ * \see card.js
+ * \see fid.php
+ * \see fid_card.php
+ * \see ajax_card.php
*
* Set the hidden field or input field to be set by javascript with the
function set_attribute
* call the input method. After selecting a value the update_value function is
called. If you need
* to modify the queryString before the request is sent, you'll use the
set_callback; the first
* parameter is the INPUT field and the second the queryString, the function
must returns a
* queryString
- *\code
-// insert all the javascript files
+ * \code
+ // insert all the javascript files
echo js_include('prototype.js');
echo js_include('scriptaculous.js');
echo js_include('effects.js');
echo js_include('controls.js');
-//
+ //
$W1=new ICard();
$W1->label="Client ".HtmlInput::infobulle(0) ;
$W1->name="e_client";
$W1->tabindex=3;
$W1->value=$e_client;
$W1->table=0;
-// If double click call the javascript fill_ipopcard
+ // If double click call the javascript fill_ipopcard
$W1->set_dblclick("fill_ipopcard(this);");
// Type of card : deb, cred or all
@@ -65,17 +66,17 @@
$W1->extra='deb';
-// Add the callback function to filter the card on the jrn
+ // Add the callback function to filter the card on the jrn
$W1->set_callback('filter_card');
-// when value selected in the autcomplete
+ // when value selected in the autcomplete
$W1->set_function('fill_data');
-// when the data change
+ // when the data change
$W1->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ',
- $W1->name);
+ $W1->name);
- // name of the field to update with the name of the card
+ // name of the field to update with the name of the card
$W1->set_attribute('label','e_client_label');
$client_label=new ISpan();
$client_label->table=0;
@@ -83,92 +84,101 @@
$f_client_qcode=$W1->input();
-// Search button for card
+ // Search button for card
$f_client_bt=$W1->search();
-* \endcode
-For searching a card, you need a popup, the script card.js and set
-the values for card, popup filter_card callback
address@hidden
-$card=new ICard('acc');
-$card->name="acc";
-$card->extra="all";
-$card->set_attribute('typecard','all');
-$card->set_callback('filter_card');
-
-echo $card->input();
-echo $card->search();
-// example 2
-$w=new ICard("av_text".$attr->ad_id);
-// filter on frd_id
-$sql=' select fd_id from fiche_def where frd_id in
('.FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX.')';
-$filter=$this->cn->make_list($sql);
-$w->set_attribute('ipopup','ipopcard');
-$w->set_attribute('typecard',$filter);
-$w->set_attribute('inp',"av_text".$attr->ad_id);
-$w->set_attribute('label',"av_text".$attr->ad_id."_label");
-
-$w->extra=$filter;
-$w->extra2=0;
-$label=new ISpan();
-$label->name="av_text".$attr->ad_id."_label";
-$msg.=td($w->search().$label->input());
address@hidden
-*/
+ * \endcode
+ For searching a card, you need a popup, the script card.js and set
+ the values for card, popup filter_card callback
+ @code
+ $card=new ICard('acc');
+ $card->name="acc";
+ $card->extra="all";
+ $card->set_attribute('typecard','all');
+ $card->set_callback('filter_card');
+
+ echo $card->input();
+ echo $card->search();
+ // example 2
+ $w=new ICard("av_text".$attr->ad_id);
+ // filter on frd_id
+ $sql=' select fd_id from fiche_def where frd_id in
('.FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX.')';
+ $filter=$this->cn->make_list($sql);
+ $w->set_attribute('ipopup','ipopcard');
+ $w->set_attribute('typecard',$filter);
+ $w->set_attribute('inp',"av_text".$attr->ad_id);
+ $w->set_attribute('label',"av_text".$attr->ad_id."_label");
+
+ $w->extra=$filter;
+ $w->extra2=0;
+ $label=new ISpan();
+ $label->name="av_text".$attr->ad_id."_label";
+ $msg.=td($w->search().$label->input());
+ @endcode
+ */
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
class ICard extends HtmlInput
{
- function __construct($name="",$value="",$p_id="")
+
+ function __construct($name="", $value="", $p_id="")
{
- parent::__construct($name,$value);
+ parent::__construct($name, $value);
$this->fct='update_value';
$this->dblclick='';
$this->callback='null';
$this->javascript='';
- $this->id=($p_id != "")?$p_id:$name;
+ $this->id=($p_id!="")?$p_id:$name;
$this->choice=null;
$this->indicator=null;
$this->choice_create=1;
- $this->autocomplete=1;
+ $this->autocomplete=1;
$this->style=' style="vertical-align:50%"';
$this->accvis=1; //!< account_visible =1 otherwise 0
}
+
/**
* @brief in the search box, the accounting will be hidden
*/
- function hide_accounting() {
+ function hide_accounting()
+ {
$this->accvis=0;
}
+
/**
* @brief in the search box, the accounting will be shown it is the default
*/
- function show_accounting() {
+ function show_accounting()
+ {
$this->accvis=1;
}
- /*!\brief set the javascript callback function
+
+ /* !\brief set the javascript callback function
* by default it is update_value called BEFORE the querystring is send
*
- *\param $p_name callback function name
+ * \param $p_name callback function name
*/
+
function set_callback($p_name)
{
$this->callback=$p_name;
}
- /*!\brief set the javascript callback function
+ /* !\brief set the javascript callback function
* by default it is update_value called AFTER an item has been selected
- *\param $p_name callback function name
+ * \param $p_name callback function name
*/
+
function set_function($p_name)
{
$this->fct=$p_name;
}
- /*!\brief return the html string for creating the ipopup, this ipopup
+
+ /* !\brief return the html string for creating the ipopup, this ipopup
* can be used for adding, modifying or display a card
- address@hidden ipopup is obsolete, the popin is created by javascript
- *\param $p_name name of the ipopup, must be set after with set_attribute
- \code
+ * @note ipopup is obsolete, the popin is created by javascript
+ * \param $p_name name of the ipopup, must be set after with set_attribute
+ \code
$f_add_button=new IButton('add_card');
$f_add_button->label='Créer une nouvelle fiche';
$f_add_button->set_attribute('ipopup','ipop_newcard');
@@ -176,110 +186,105 @@ class ICard extends HtmlInput
$f_add_button->javascript=" select_card_type(this);";
$str_add_button=$f_add_button->input();
- \endcode
- *\return html string
- *\note must be one of first instruction on a new page, to avoid problem
+ \endcode
+ * \return html string
+ * \note must be one of first instruction on a new page, to avoid problem
* of position with IE
*/
+
static function ipopup($p_name)
{
- $ip_card=new IPopup ($p_name);
+ $ip_card=new IPopup($p_name);
$ip_card->drag=true;
- $ip_card->set_width('45%');
+ $ip_card->set_width('45%');
$ip_card->title='Fiche ';
$ip_card->value='';
-
+
return $ip_card->input();
}
- /*!\brief set the extra javascript property for a double click on
+
+ /* !\brief set the extra javascript property for a double click on
* INPUT field
- *\param $p_action action when a double click happens
- *\note the $p_action cannot contain a double quote
+ * \param $p_action action when a double click happens
+ * \note the $p_action cannot contain a double quote
*/
+
function set_dblclick($p_action)
{
$this->dblclick=$p_action;
}
- /*!\brief show the html input of the widget*/
- public function input($p_name=null,$p_value=null)
+
+ /* !\brief show the html input of the widget */
+
+ public function input($p_name=null, $p_value=null)
{
- if ( $p_name == null && $this->name == "")
+ if ($p_name==null&&$this->name=="")
throw (new Exception(_('Le nom d une icard doit être donne')));
$this->value=($p_value==null)?$this->value:$p_value;
- if ( $this->readOnly==true) return $this->display();
+ if ($this->readOnly==true)
+ return $this->display();
- $this->id=($this->id=="")?$this->name:$this->id;
-
$this->choice=($this->choice==null)?sprintf("%s_choices",$this->id):$this->choice;
-
$this->indicator=($this->indicator==null)?sprintf("%s_ind",$this->id):$this->indicator;
+ $this->id=($this->id=="")?$this->name:$this->id;
+ $this->choice=($this->choice==null)?sprintf("%s_choices",
$this->id):$this->choice;
+ $this->indicator=($this->indicator==null)?sprintf("%s_ind",
$this->id):$this->indicator;
$attr=$this->get_js_attr();
$label='';
- if ( $this->dblclick != '')
+ if ($this->dblclick!='')
{
- $e=sprintf(' ondblclick="%s" ',
- $this->dblclick);
+ $e=sprintf(' ondblclick="%s" ', $this->dblclick);
$this->dblclick=$e;
}
$input=sprintf('<INPUT TYPE="Text" class="input_text" '.
- ' NAME="%s" ID="%s" VALUE="%s" SIZE="%d" %s %s %s>',
- $this->name,
- $this->id,
- $this->value,
- $this->size,
- $this->dblclick,
- $this->javascript,
- $this->style
- );
- if ( $this->autocomplete == 1)
- {
- $this->indicator="ind_".$this->id;
- $ind=sprintf('<span id="%s" class="autocomplete"
style="position:absolute;display:none">Un instant... <img
src="image/loading.gif" alt="Chargement..."/>'.
- '</span>',
- $this->indicator);
- $this->indicator="null";
- $div=($this->choice_create == 1) ? sprintf('<div
id="%s" class="autocomplete"></div>',$this->choice):"";
-
- $query=dossier::get().'&e='.urlencode($this->typecard);
-
- $javascript=sprintf('try { new
Ajax.Autocompleter("%s","%s","fid_card.php?%s",'.
-
'{paramName:"FID",minChars:1,indicator:%s, '.
- 'callback:%s, '.
- '
afterUpdateElement:%s});} catch (e){alert(e.message);};',
- $this->id,
- $this->choice,
- $query,
-
$this->indicator,
- $this->callback,
- $this->fct);
-
- $javascript=create_script($javascript.$this->dblclick);
-
- $r=$label.$input.$attr.$ind.$div.$javascript;
- }
- else
- {
- $r=$label.$input;
- }
- if ( $this->table == 1 )
+ ' NAME="%s" ID="%s" VALUE="%s" SIZE="%d" %s %s %s>',
+ $this->name, $this->id, $this->value, $this->size,
+ $this->dblclick, $this->javascript, $this->style
+ );
+ if ($this->autocomplete==1)
+ {
+ $this->indicator="ind_".$this->id;
+ $ind=sprintf('<span id="%s" class="autocomplete"
style="position:absolute;display:none"><img src="image/ajax-loader.gif"
alt="Chargement..."/></span>',
+ $this->indicator);
+ $this->indicator="null";
+ $div=($this->choice_create==1)?sprintf('<div id="%s"
class="autocomplete"></div>',
+ $this->choice):"";
+
+ $query=dossier::get().'&e='.urlencode($this->typecard);
+
+ $javascript=sprintf('try { new
Ajax.Autocompleter("%s","%s","fid_card.php?%s",'.
+ '{paramName:"FID",minChars:1,indicator:%s, '.
+ 'callback:%s, '.
+ ' afterUpdateElement:%s});} catch (e){alert(e.message);};',
+ $this->id, $this->choice, $query, $this->indicator,
+ $this->callback, $this->fct);
+
+ $javascript=create_script($javascript.$this->dblclick);
+
+ $r=$label.$input.$attr.$ind.$div.$javascript;
+ }
+ else
+ {
+ $r=$label.$input;
+ }
+ if ($this->table==1)
$r=td($r);
return $r;
-
}
- /*!\brief print in html the readonly value of the widget*/
+
+ /* !\brief print in html the readonly value of the widget */
+
public function display()
{
$r=sprintf(' <INPUT TYPE="hidden" NAME="%s" id="%s" VALUE="%s"
SIZE="8">',
- $this->name,
- $this->name,
- $this->value
- );
+ $this->name, $this->name, $this->value
+ );
$r.='<span>'.$this->value.'</span>';
return $r;
-
}
+
/**
- address@hidden return a string containing the button for displaying
+ * @brief return a string containing the button for displaying
* a search form. When clicking on the result, update the input text file
* the common used attribute as
* - jrn the ledger
@@ -290,39 +295,44 @@ class ICard extends HtmlInput
* - typecard (deb, cred, filter or list of value)
* will be set
* if ICard is in readOnly, the button disappears, so the return string is
empty
- \code
+ \code
// search ipopup
- $search_card=new IPopup('ipop_card');
- $search_card->title=_('Recherche de fiche');
- $search_card->value='';
- echo $search_card->input();
-
- $a=new ICard('test');
- $a->search();
-
- \endcode
- *\see ajax_card.php
- *\note the ipopup id is hard coded : ipop_card
- address@hidden HTML string with the button
+ $search_card=new IPopup('ipop_card');
+ $search_card->title=_('Recherche de fiche');
+ $search_card->value='';
+ echo $search_card->input();
+
+ $a=new ICard('test');
+ $a->search();
+
+ \endcode
+ * \see ajax_card.php
+ * \note the ipopup id is hard coded : ipop_card
+ * @return HTML string with the button
*/
function search()
{
- if ( $this->readOnly==true) return '';
- if ( ! isset($this->id )) $this->id=$this->name;
+ if ($this->readOnly==true)
+ return '';
+ if (!isset($this->id))
+ $this->id=$this->name;
$a="";
- foreach (array('typecard','jrn','label','price','tvaid','accvis') as
$att)
+ foreach (array('typecard', 'jrn', 'label', 'price', 'tvaid', 'accvis')
as
+ $att)
{
- if (isset($this->$att) )
+ if (isset($this->$att))
$a.="this.".$att."='".$this->$att."';";
}
- if (isset($this->id) && $this->id != "")
+ if (isset($this->id)&&$this->id!="")
$a.="this.inp='".$this->id."';";
- else
+ else
$a.="this.inp='".$this->name."';";
$a.="this.popup='ipop_card';";
$javascript=$a.' search_card(this);return false;';
-
- $button=HtmlInput::button_image($javascript,$this->name."_bt",
'alt="'._('Recherche').'" class="image_search"',"image/magnifier13.png");
+
+ $button=HtmlInput::button_image($javascript, $this->name."_bt",
+ 'alt="'._('Recherche').'" class="image_search"',
+ "image/magnifier13.png");
return $button;
}
@@ -332,11 +342,11 @@ class ICard extends HtmlInput
$_SESSION['isValid']=1;
$a=new ICard('testme');
$a->extra="all";
- $a->set_attribute('label','ctl_label');
- $a->set_attribute('tvaid','ctl_tvaid');
- $a->set_attribute('price','ctl_price');
- $a->set_attribute('purchase','ctl_purchase');
- $a->set_attribute('type','all');
+ $a->set_attribute('label', 'ctl_label');
+ $a->set_attribute('tvaid', 'ctl_tvaid');
+ $a->set_attribute('price', 'ctl_price');
+ $a->set_attribute('purchase', 'ctl_purchase');
+ $a->set_attribute('type', 'all');
echo <<<EOF
<div id="debug" style="border:solid 1px black;overflow:auto"></div>
<script type="text/javascript" language="javascript"
src="js/prototype.js">
@@ -393,15 +403,16 @@ EOF;
echo "Price ".$p->input().'<br>';
echo "Purchase ".$b->input().'<br>';
- if ( isset($_REQUEST['test_select']) )
- echo HtmlInput::hidden('test_select',$_REQUEST['test_select']);
+ if (isset($_REQUEST['test_select']))
+ echo HtmlInput::hidden('test_select', $_REQUEST['test_select']);
$a->set_function('test_value');
$a->javascript=' onchange="alert(\'onchange\');"
onblur="alert(\'onblur\');" ';
echo $a->input();
echo dossier::hidden();
- echo HtmlInput::submit('Entree','entree');
+ echo HtmlInput::submit('Entree', 'entree');
echo '</form>';
echo <<<EOF
EOF;
}
+
}
- [Noalyss-commit] [noalyss] 18/219: remove href=javascript:void(0) + HtmlInput::generate_id replaced by uniqid, (continued)
- [Noalyss-commit] [noalyss] 18/219: remove href=javascript:void(0) + HtmlInput::generate_id replaced by uniqid, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 90/219: Task #0001481: Encodage Vente, Achat, Fin ou OD 1. S'il n'y a qu'une seule catégorie de fiche , il n'est plus nécessaire d'afficher le choix (puisqu'il n'y en a qu'un) 2. Avoir pour chaque ligne un bouton ajout fiche, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 62/219: Analytic : change the name and description in Ajax, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 54/219: NEW : ICard , you can hide or show the accounting in the search box with the functions ICard->hide_accounting and ICard->show_accounting, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 67/219: Icon : for Inplace Edit field, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 166/219: Space, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 19/219: Replace global $http by new httpInput() to make the test of scenario working, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 128/219: Esthetic, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 99/219: CSS : button border, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 108/219: task #0001272: Rendre possible l'appel de la calculatrice depuis le fin fond d'une page., Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 174/219: space,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 114/219: Change max article in STOCK INV, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 16/219: Update test with new architecture, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 173/219: Improve calc, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 104/219: Réécriture de CFGPCMN pour utiliser ManageTable pas de delete proposé si compte utilisé, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 14/219: Infobulle : warning : esthetic, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 44/219: fix minor bug + doc, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 46/219: Manage_Table : Improve Javascript for adding / removing row of table, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 27/219: Task #0001443: opérations rapprochées : bug quand on utilise des tva avec autoliquidation Check with the view v_quant_detail and take into account the negative VAT, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 33/219: Task #0001324: Afficher la date (période) dans FSALDO, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 198/219: Task #001381 : reinitialize the search_form, Dany De Bontridder, 2017/12/18