Gestion simplissime des Todo

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

~~ / liste.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 function liste_detail( li )
   24     {
   25     if ( !resetCurrentTodo() ) return ;
   26     if ( todo_current_active ) $(todo_current_active).removeClass('active') ;
   27     todo_current_active = li
   28     $(todo_current_active).addClass('active') ;
   29     var todo = $(li).attr('id').substring(1) ;
   30     detail_todo( todo ) ;
   31     }
   32 
   33 function liste_modif( li )
   34     {
   35     if ( !resetCurrentTodo() ) return ;
   36     if ( todo_current_active ) $(todo_current_active).removeClass('active') ;
   37     todo_current_active = li
   38     $(todo_current_active).addClass('active') ;
   39     var todo = $(li).attr('id').substring(1) ;
   40     modif_todo( todo ) ;
   41     }
   42 
   43 
   44 // le travail en AJAX
   45 function liste_charge()
   46     {
   47     var url = 'hr_todo_list.php' ; sep='?' ;
   48     for( var uv in url_var )
   49         { url += sep + uv + '=' + esc4url( url_var[uv] ) ; sep = '&' ; }
   50 
   51     $.ajax( {
   52         url: url,
   53         dataType : "text",
   54         success : liste_reponse
   55         } ) ;
   56     }
   57 
   58 function liste_reponse( data, textStatus, XMLHttpRequest )
   59     {
   60     if ( data == '' ) { $('#liste').html('vide'); return ; }
   61     var ligne = data.split("<#>") ;
   62     if ( ligne[0] != 'OK' )
   63         {
   64         $('#liste').html('<pre>'+data+'</pre>') ;
   65         return ;
   66         }
   67     if ( ligne.length == 1 ) { $('#liste').html('vide'); return ; }
   68     var hl = '<table>' ;
   69     var todo_current_present = false ;
   70     for( var l=1; l<ligne.length; l++ )
   71         {
   72         // 0:id 1:s 2:w 3:p 4:projet 5:tache 6:qui 7:r 8:dt 9:pour_le
   73         var f = ligne[l].split("<!>") ;
   74         var s = state_icon( f[1] ) ;
   75         hl  += '<tr id="l'+f[0]+'" class="lien liste_item">'
   76             + '<td class="wico">'
   77             +   '<img src="IMAGES/fs'+s+'.png" alt="s'+s+'">'
   78             + '</td><td class="wico">'
   79             +   '<img src="IMAGES/fw'+f[2]+'.png" alt="s'+f[2]+'">'
   80             + '</td><td class="wico">'
   81             +   '<img src="IMAGES/fp'+f[3]+'.png" alt="s'+f[3]+'">'
   82             + '</td><td class="wpro">' + f[4]
   83             + '</td><td>' + f[5]
   84             + '</td><td class="wico">'
   85             +   '<img src="IMAGES/fr'+f[7]+'.png" alt="r'+f[7]+'">'
   86             + '</td><td class="wps">' + f[6]
   87             + '</td><td class="wdt">' + f[8]
   88             + '</td><td class="wdt">' + f[9]
   89             + '</td></tr>'
   90         if ( todo_current )
   91             if ( todo_current[0] == f[0] )
   92                 todo_current_present = true ;
   93         }
   94     hl += '</table>' ;
   95     $('#liste').html( hl ) ;
   96     $('.liste_item').click( function() { liste_detail( $(this) ) ; } ) ;
   97     $('.liste_item').dblclick( function() { liste_modif( $(this) ) ; } ) ;
   98     if ( todo_current_present )
   99         {
  100         todo_current_active = $( '#l'+todo_current[0] ) ;
  101         $(todo_current_active).addClass('active') ;
  102         element_visible( '#liste', todo_current_active ) ;
  103         detail_todo() ;
  104         }
  105     else
  106         resetCurrentTodo() ;
  107     }
  108 
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
~~ / liste.js

Haut de page

Contacter crabs

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