noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 04/05: Task #1051 - Ajout fiche :Choix catég


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 04/05: Task #1051 - Ajout fiche :Choix catégorie Amélioration pour ajout catégorie
Date: Sat, 15 Nov 2014 23:24:40 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 14f3ab1527a95bdb2a4d0baa874262362c70e57e
Author: Dany De Bontridder <address@hidden>
Date:   Sun Nov 16 00:15:28 2014 +0100

    Task #1051 - Ajout fiche :Choix catégorie
    Amélioration pour ajout catégorie
---
 html/ajax_card.php           |   36 +++++++++++++++++++++++++++---------
 html/js/scripts.js           |   32 +++++++++++++++++++++++++++++++-
 include/class_html_input.php |    1 +
 include/class_iradio.php     |    1 +
 4 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/html/ajax_card.php b/html/ajax_card.php
index 00a21f0..3906c6e 100644
--- a/html/ajax_card.php
+++ b/html/ajax_card.php
@@ -222,7 +222,7 @@ case 'bc':
     /* Before inserting a new card, the type must be selected */
     /* ------------------------------------------------------------ */
 case 'st':
-    $sql="select fd_id,fd_label from fiche_def";
+    $sql="select fd_id,fd_label,fd_description from fiche_def";
     /*  if we filter  thanks the ledger*/
     if ( $ledger != -1 )
     {
@@ -275,7 +275,7 @@ case 'st':
        }
     $sql.=" ".$where." order by fd_label";
 
-    $array=$cn->make_array($sql);
+    $array=$cn->get_array($sql);
     $html=HtmlInput::title_box(_("Choix de la catégorie"), $ctl);
 
     if ( empty($array))
@@ -287,22 +287,40 @@ case 'st':
     else
     {
         $r='';
-       $r.='<p class="notice" style="padding-left:2em">';
+       $r.='<p  style="padding-left:2em">';
         $r.=_("Choississez la catégorie de fiche à laquelle vous aimeriez 
ajouter une fiche").'</p>';
-        $isel=new ISelect('fd_id');
-        $isel->value=$array;
+        
        $r.='<div style="text-align:center">';
-        $r.='<form id="sel_type" method="GET" 
onsubmit="this.ipopup='.$ctl.';dis_blank_card(this);return false;" >';
+        
+        $msg=_('Choisissez une catégorie svp');
+        $r.='<form id="sel_type" method="GET" 
onsubmit="this.ipopup='.$ctl.";if ($('fd_id').value != 0 ) 
{dis_blank_card(this);return false;} else "
+                . "{ $('error_cat').innerHTML='".$msg."'; return false;}\">" ;
+        $r.='<span id="error_cat" class="notice"></span>';
         $r.=dossier::hidden();
         $r.=(isset($ref))?HtmlInput::hidden('ref',1):'';
-
-        $r.=$isel->input();
+        $r.=_('Filtrer').' '.HtmlInput::filter_table("cat_card_table", '0,1', 
0);
+        $r.='<table id="cat_card_table" class="result">';
+        for ($i=0;$i<count($array);$i++)
+        {
+            $class=($i%2==0)?' class="even" ':' class="odd" ';
+            $r.='<tr '.$class.' id="select_cat_row_'.$array[$i]['fd_id'].'">';
+            $r.='<td >';
+            $r.='<a href="javascript:void(0)" 
onclick="select_cat(\''.$array[$i]['fd_id'].'\')">'.h($array[$i]['fd_label']).'</a>';
+            $r.='</td>';
+            $r.='<td>';
+            $r.='<a href="javascript:void(0)" 
onclick="select_cat(\''.$array[$i]['fd_id'].'\')">'.h($array[$i]['fd_description']).'</a>';
+            $r.='</td>';
+           
+             $r.="</tr>";
+        }
+        $r.='</table>';
+        $r.=HtmlInput::hidden('fd_id',0);
        $r.='<p>';
         $r.=HtmlInput::submit('st','choix');
        $r.=HtmlInput::button('Annuler',_('Annuler')," 
onclick=\"removeDiv('$ctl')\" ");
        $r.='</p>';
         $r.='</form>';
-       $r.='</div>';
+        $r.='</div>';
         $html.=$r;
 
     }
diff --git a/html/js/scripts.js b/html/js/scripts.js
index e8cd690..5d55554 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -1891,7 +1891,8 @@ function filter_table(phrase, _id, colnr, start_row) {
         aCol[0] = colnr;
     }
     var ele;
-
+    var tot_found=0;
+    
     for (var r = start_row; r < table.rows.length; r++) {
         var found = 0;
         for (var col = 0; col < aCol.length; col++)
@@ -1908,6 +1909,7 @@ function filter_table(phrase, _id, colnr, start_row) {
 
         }
         if (found === 1) {
+            tot_found++;
             table.rows[r].style.display = '';
         } else {
             table.rows[r].style.display = 'none';
@@ -1915,6 +1917,15 @@ function filter_table(phrase, _id, colnr, start_row) {
         $('info_div').style.display = "none";
         $('info_div').innerHTML = "";
     }
+    if (tot_found == 0) {
+        if ($('info_'+_id)) {
+            $('info_'+_id).innerHTML=" Aucun résultat ";
+        }
+    } else {        
+        if ($('info_'+_id)) {
+            $('info_'+_id).innerHTML="  ";
+        }
+    }
 }
 /**
  * @brief
@@ -2539,4 +2550,23 @@ function show_description(p_id)
     $('print_desc'+p_id).hide();
     $('input_desc'+p_id).show();
     
+}
+/**
+ * Hightlight the row we select and restore previous one
+ * @param {type} x
+ * @returns {undefined}
+ */
+var old_class = null;
+var old_select = null;
+
+function select_cat(x)
+{
+    if (old_select != null)
+    {
+        $(old_select).className = old_class;
+    }
+    old_select = $('select_cat_row_' + x);
+    old_class = old_select.className;
+    $(old_select).className = "highlight";
+    $('fd_id').value = x;
 }
\ No newline at end of file
diff --git a/include/class_html_input.php b/include/class_html_input.php
index 3f8ea98..8ca0c4c 100755
--- a/include/class_html_input.php
+++ b/include/class_html_input.php
@@ -779,6 +779,7 @@ class HtmlInput
                        <input type=\"button\" class=\"smallbutton\" 
onclick=\"$('lk_".$p_table_id."').value='';filter_table($('lk_".$p_table_id."'),
 '$p_table_id','$p_col',$start_row );\" value=\"X\">
                        </span>
                        ";
+                $r.=' <span class="notice" id="info_'.$p_table_id.'"></span>';
                return $r;
        }
 
diff --git a/include/class_iradio.php b/include/class_iradio.php
index 0112ba8..bf21752 100644
--- a/include/class_iradio.php
+++ b/include/class_iradio.php
@@ -39,6 +39,7 @@ class IRadio extends HtmlInput
         $check = ( $this->selected == true || $this->selected == 't' ) ? 
"checked" : "unchecked";
         $r = '<input type="RADIO" name="' . $this->name . '"';
         $r.=" VALUE=\"$this->value\"";
+        $r.=' class="css-checkbox" ';
         $r.=($this->javascript != '') ? 'onclick="' . $this->javascript . '"' 
: '';
         $r.="  $check > ";
         return $r;



reply via email to

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