noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 07/15: ICard Improve doc and test


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 07/15: ICard Improve doc and test
Date: Fri, 5 Feb 2021 11:38:30 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit cd6ddfc78e5d18e18fea065f5b8a8c12cd562736
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue Feb 2 17:36:48 2021 +0100

    ICard Improve doc and test
---
 include/lib/icard.class.php | 49 +++++++++++++++++++++++++++++++++++++++++----
 scenario/HtmlInput.test.php | 11 ++++++++++
 2 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/include/lib/icard.class.php b/include/lib/icard.class.php
index f1dc236..e0c171d 100644
--- a/include/lib/icard.class.php
+++ b/include/lib/icard.class.php
@@ -120,7 +120,45 @@ require_once 
NOALYSS_INCLUDE.'/lib/function_javascript.php';
 
 class ICard extends HtmlInput
 {
-
+    //!< $fct ,by default it is update_value called BEFORE the querystring is 
send
+    var $fct;
+    
+    //!< $dblclick action if double click
+    var $dblclick;
+    
+    //!< $callback , 
+    var $callback;
+    
+    //!< $choice 
+    var $choice;
+    
+    //!< $indicator, text displaid when searching
+    var $indicator;
+    
+    //!< $choice_create 1 , display a (+) button , default 1
+    var $choice_create;
+    
+    //!< $autocomplete : 1 enable - 0 disable
+    var $autocomplete;
+    
+    //!< $style supplemental CSS 
+    var $style='  ';
+    
+    //!< $accvis account_visible =1 otherwise 0, default 1
+    var $accvis; 
+    
+    //!< $limit Max of row show
+    var $limit;
+    
+    //!< $amount_from_type : accountancy , sell or purchase price
+    var $amount_from_type;
+    
+    //!< $typecard : type of card
+    var $typecard;
+    
+    //!< $autocomplete_file , ajax file used for autocompletion (see 
Ajax.Autocompleter)
+    private $autocomplete_file;
+    
     function __construct($name="", $value="", $p_id="")
     {
         parent::__construct($name, $value);
@@ -137,6 +175,8 @@ class ICard extends HtmlInput
         $this->accvis=1; //!< account_visible =1 otherwise 0
         $this->limit=12; //!< Max of row show
         $this->amount_from_type=''; //!< in the follow up ,when a card is 
selected you take Prix Vente or Prix Achat 
+        $this->typecard='all';
+        $this->autocomplete_file="fid_card.php";
     }
    
     /**
@@ -155,7 +195,8 @@ class ICard extends HtmlInput
     }
 
   
-    /**\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
@@ -256,12 +297,12 @@ class ICard extends HtmlInput
 
             $query=http_build_query([ 
'gDossier'=>Dossier::id(),'e'=>$this->typecard,'limit'=>$this->limit]);
             
-            $javascript=sprintf('try { new 
Ajax.Autocompleter("%s","%s","fid_card.php?%s",'.
+            $javascript=sprintf('try { new 
Ajax.Autocompleter("%s","%s","%s?%s",'.
                     '{paramName:"FID",minChars:1,indicator:%s, '.
                     'callback:%s, '.
                     'limit:%s,'.
                     ' afterUpdateElement:%s});} catch (e){alert(e.message);};',
-                    $this->id, $this->choice, $query, $this->indicator,
+                    $this->id, $this->choice, $this->autocomplete_file,$query, 
$this->indicator,
                     $this->callback, $this->limit, $this->fct);
 
             $javascript=create_script($javascript.$this->dblclick);
diff --git a/scenario/HtmlInput.test.php b/scenario/HtmlInput.test.php
index 7abbd12..54675cb 100644
--- a/scenario/HtmlInput.test.php
+++ b/scenario/HtmlInput.test.php
@@ -135,9 +135,12 @@ $http=new HttpInput();
     $file=new IFILE("file_to_upload");
     $file->id="file_to_upload";
     echo "fichier ",$file->input();
+    
     echo HtmlInput::submit("file","Upload");
 ?>
+    <p>Vérifier le changement de taille fichier dans la console JS</p>
 </form>
+
 <script>
     function check_size()
     {
@@ -159,6 +162,14 @@ $http=new HttpInput();
         }
     });
 </script>
+<h2>ICArd</h2>
+<h3>Aucun param suppl.</h3>
+<?php
+    $icard=new ICard("test");
+    echo $icard->input();
+    echo $icard->search();
+?>
+    
 <div id="debug_box"></div>
 
     
\ No newline at end of file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]