Gestion simplissime des Todo

crabs_todo-2.0 ©2008-2011 - Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)

~~ / onglet.js
Makefile todo.css todo.js onglet.js liste.js detail.js modif.js index.php logout.php todo.php hr_todo_create.php hr_todo_list.php hr_todo_info.php hr_todo_change.php hr_todo_del.php hr_projet_liste.php hr_pseudo_liste.php
    1 //
    2 // =============================================================================
    3 //  crabs_todo-2.0 : Gestion simplissime des Todo
    4 //  Copyright (C) 2008-2011 : Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)
    5 //
    6 //  Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    7 //  et/ou le modifier en respectant les termes de la GNU General Public License
    8 //  version 2 ou (suite a votre propre choix) une version ulterieure.
    9 //
   10 //  Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   11 //  sans aucune garantie, meme si il est associe a un produit qui vous en
   12 //  propose une. Conformez-vous a la GNU General Public License pour avoir
   13 //  plus de precisions.
   14 //
   15 //  L'auteur ne peut etre tenu responsable de l'utilisation faite des
   16 //  composantes associees a ce projet (en partie ou dans leur totalite).
   17 //
   18 //  Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   19 //  de ce projet sous le nom gnu_gpl.txt
   20 //
   21 // =============================================================================
   22 //
   23 // GESTION DE LA BOITE A ONGLET
   24 
   25 // changement d'onglet pour la boite a filtre
   26 function fo_change( onglet, class_onglet )
   27     {
   28     var element, nom ;
   29     if ( !!onglet.charAt )
   30         { element = $( '#on_'+onglet ) ; nom = onglet ; }
   31     else
   32         { element = $(onglet) ; nom = element.attr('id').substring(3) ; }
   33     if ( class_onglet )
   34         $( '.'+class_onglet ).removeClass('on').addClass('off') ;
   35     $(element).removeClass('off').addClass('on') ;
   36     fo_charge_liste( nom ) ;
   37     }
   38 
   39 function fo_charge_liste( nom )
   40     {
   41     $.ajax( {
   42         url: "hr_"+nom+"_liste.php",
   43         dataType : "text",
   44         success : function( data, textStatus, XMLHttpRequest )
   45             {
   46             if ( data == '' ) { $('#filtre_liste').html('vide'); return ; }
   47             var l = data.split("<#>") ;
   48             if ( l[0] != 'OK' )
   49                 {
   50                 $('#filtre_liste').html('<pre>'+data+'</pre>') ;
   51                 return ;
   52                 }
   53             var ht  = '<p id="of0" class="lien foi"'
   54                     + ' onclick="fo_item(\''+nom+'\',\'0\');">'
   55                     + i18n_all+'</p>' ;
   56             for( var i=1; i<l.length; i++ )
   57                 {
   58                 var id = 'of'+i ;
   59                 ht += '<p id="'+id+'" class="lien foi"'
   60                     + ' onclick="fo_item(\''+nom+'\',\''+l[i]+'\');">'
   61                     + l[i]+'</p>' ;
   62                 }
   63             $('#filtre_liste').html(ht) ;
   64             fo_select_default( nom ) ;
   65             }
   66         } ) ;
   67     }
   68 
   69 // clic sur un item dans la liste de l'onglet => filtre
   70 //  nom : nom de l'onglet
   71 //  item : nom de l'item
   72 function fo_item( nom, item )
   73     {
   74     if ( !resetCurrentTodo() ) return ;
   75     url_var[ nom ] = item ;
   76     fo_select_default( nom ) ;
   77     liste_charge() ;
   78     }
   79 
   80 // parcours la liste de l'onglet et active la ligne selectionnee
   81 function fo_select_default( nom )
   82     {
   83     var val = url_var[nom] ;
   84     if ( val == '0' ) val = i18n_all ;
   85     var trouve = false ;
   86     $('.foi').each( function( index )
   87         {
   88         if ( $(this).html() == val )
   89             {
   90             trouve = true ;
   91             $(this).addClass('active') ;
   92             element_visible( '#filtre_liste', $(this ) ) ;
   93             }
   94         else
   95             $(this).removeClass('active') ;
   96         } ) ;
   97     if ( !trouve )
   98         {
   99         $('#of0').addClass('active') ; url_var[nom] = '0' ;
  100         element_visible( '#filtre_liste', '#of0' ) ;
  101         liste_charge() ;
  102         }
  103     }
  104 
  105 function fo_reload( class_onglet )
  106     {
  107     $( '.'+class_onglet ).each( function( index )
  108         {
  109         if ( $(this).hasClass('on') )
  110             {
  111             nom = $(this).attr('id').substring(3) ;
  112             fo_charge_liste( nom ) ;
  113             }
  114         } ) ;
  115     }
  116 
Makefile todo.css todo.js onglet.js liste.js detail.js modif.js index.php logout.php todo.php hr_todo_create.php hr_todo_list.php hr_todo_info.php hr_todo_change.php hr_todo_del.php hr_projet_liste.php hr_pseudo_liste.php
~~ / onglet.js

Haut de page

Contacter crabs

Date de génération : 22/09/2011 21:49