Crabs Contents Management System

crabs_cms-1.0.4 ©2006-2008 - Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)

~~ / MEMBRE / GESTION / saisie.js
Makefile gestion.xsl gestion.css saisie.js index.php index_publie.php tout_publier.php tout_publier.js dossier.php dossier_ajout.php dossier_ajout_done.php dossier_done.php dossier_publie.php dossier_suppr.php article.php article_ajout.php article_done.php article_publie.php article_liste.php article_info.php article_suppr.php document.php document_upload.php document_suppr.php document_liste.php image.php image_upload.php image_suppr.php image_liste.php image_info.php photo.js photo.php photo_upload.php photo_download.php photo_album_modif.php photo_modif.php photo_liste.php photo_info.php photo_album_liste.php photo_album_info.php news.php news_ajout.php news_modifier.php news_done.php news_publie.php editeur.js fichier.php fichier_done.php fichier_cnt.php profil.php profil_done.php passwd.php membre.php calendrier.php calendrier.js cal_done.php forum.php forum.js forum_modif.php
    1 //
    2 // =============================================================================
    3 //  crabs_cms-1.0.4 : Crabs Contents Management System
    4 //  Copyright (C) 2006-2008 : 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 var saisie_what=0 ;
   24 var hr = false ;
   25 var add_on = '' ;
   26 
   27 function cancel()
   28     {
   29     saisie_what = 0 ; add_on='' ;
   30     document.getElementById( 'as_titre' ).innerHTML = '' ;
   31     document.getElementById( 'as_nom' ).value = '' ;
   32     document.getElementById( 'as_ttr' ).value = '' ;
   33     document.getElementById( 'as_info' ).innerHTML = '' ;
   34     document.getElementById( 'aide_saisie' ).style.display = 'none' ;
   35     }
   36 
   37 function add_doc()
   38     {
   39     if ( hr != false ) return ;
   40     document.getElementById( 'as_lst' ).options.length = 0 ;
   41     cancel() ; saisie_what = 1 ;
   42     document.getElementById( 'as_titre' ).innerHTML = "Document" ;
   43     hr = getHTTPObject() ;
   44     hr.open( 'GET', 'document_liste.php', true ) ;
   45     hr.onreadystatechange = remplir_liste ;
   46     hr.send( null ) ;
   47     }
   48 
   49 function add_img()
   50     {
   51     if ( hr != false ) return ;
   52     document.getElementById( 'as_lst' ).options.length = 0 ;
   53     cancel() ; saisie_what = 2 ;
   54     document.getElementById( 'as_titre' ).innerHTML = "Image" ;
   55     hr = getHTTPObject() ;
   56     hr.open( 'GET', 'image_liste.php', true ) ;
   57     hr.onreadystatechange = remplir_liste ;
   58     hr.send( null ) ;
   59     }
   60 
   61 function add_photo()
   62     {
   63     if ( hr != false ) return ;
   64     document.getElementById( 'as_lst' ).options.length = 0 ;
   65     cancel() ; saisie_what = 3 ;
   66     document.getElementById( 'as_titre' ).innerHTML = "Photo" ;
   67     hr = getHTTPObject() ;
   68     hr.open( 'GET', 'photo_liste.php', true ) ;
   69     hr.onreadystatechange = remplir_liste ;
   70     hr.send( null ) ;
   71     }
   72 
   73 function add_album()
   74     {
   75     if ( hr != false ) return ;
   76     document.getElementById( 'as_lst' ).options.length = 0 ;
   77     cancel() ; saisie_what = 4 ;
   78     document.getElementById( 'as_titre' ).innerHTML = "Album Photo" ;
   79     hr = getHTTPObject() ;
   80     hr.open( 'GET', 'photo_album_liste.php', true ) ;
   81     hr.onreadystatechange = remplir_liste ;
   82     hr.send( null ) ;
   83     }
   84 
   85 function add_dossier()
   86     {
   87     if ( hr != false ) return ;
   88     document.getElementById( 'as_lst' ).options.length = 0 ;
   89     cancel() ; saisie_what = 5 ;
   90     document.getElementById( 'as_titre' ).innerHTML = "Dossier/Article" ;
   91     hr = getHTTPObject() ;
   92     hr.open( 'GET', 'article_liste.php', true ) ;
   93     hr.onreadystatechange = remplir_liste ;
   94     hr.send( null ) ;
   95     }
   96 
   97 function remplir_liste()
   98     {
   99     if ( hr.readyState != 4 ) return ;
  100     l = hr.responseText.split('|') ;
  101     liste = document.getElementById( 'as_lst' ) ;
  102     for( var i=0; i<l.length; i++ )
  103         liste.options[i] = new Option( l[i], l[i] ) ;
  104     delete hr ; hr=false ;
  105     document.getElementById( 'aide_saisie' ).style.display = 'block' ;
  106     document.getElementById( 'as_info' ).innerHTML = 'Selectionner...' ;
  107     }
  108 
  109 function liste_select()
  110     {
  111     if ( saisie_what == 2 )
  112         {
  113         if ( hr != false ) return ;
  114         liste = document.getElementById( 'as_lst' ) ;
  115         l = liste.options[liste.selectedIndex].value ;
  116         hr = getHTTPObject() ;
  117         hr.open( 'GET', 'image_info.php?i='+l, true ) ;
  118         hr.onreadystatechange = img_info ;
  119         hr.send( null ) ;
  120         }
  121     if ( saisie_what == 3 )
  122         {
  123         if ( hr != false ) return ;
  124         liste = document.getElementById( 'as_lst' ) ;
  125         l = liste.options[liste.selectedIndex].value ;
  126         hr = getHTTPObject() ;
  127         hr.open( 'GET', 'photo_info.php?f='+l, true ) ;
  128         hr.onreadystatechange = photo_info ;
  129         hr.send( null ) ;
  130         }
  131     if ( saisie_what == 4 )
  132         {
  133         if ( hr != false ) return ;
  134         liste = document.getElementById( 'as_lst' ) ;
  135         l = liste.options[liste.selectedIndex].value ;
  136         hr = getHTTPObject() ;
  137         hr.open( 'GET', 'photo_album_info.php?f='+l, true ) ;
  138         hr.onreadystatechange = album_info ;
  139         hr.send( null ) ;
  140         }
  141     if ( saisie_what == 5 )
  142         {
  143         if ( hr != false ) return ;
  144         liste = document.getElementById( 'as_lst' ) ;
  145         l = liste.options[liste.selectedIndex].value ;
  146         hr = getHTTPObject() ;
  147         hr.open( 'GET', 'article_info.php?d='+l, true ) ;
  148         hr.onreadystatechange = dossier_info ;
  149         hr.send( null ) ;
  150         }
  151     }
  152 function img_info()
  153     {
  154     if ( hr.readyState != 4 ) return ;
  155     add_on = hr.responseText ;
  156     delete hr ; hr=false ;
  157     document.getElementById( 'as_info' ).innerHTML = add_on ;
  158     }
  159 function photo_info()
  160     {
  161     if ( hr.readyState != 4 ) return ;
  162     res = hr.responseText.split('|') ;
  163     delete hr ; hr=false ;
  164     document.getElementById( 'as_nom' ).value = res[0] ;
  165     document.getElementById( 'as_ttr' ).value = res[1] ;
  166     document.getElementById( 'as_info' ).innerHTML = res[2] ;
  167     add_on = res[2] ;
  168     }
  169 function album_info()
  170     {
  171     if ( hr.readyState != 4 ) return ;
  172     res = hr.responseText.split('|') ;
  173     delete hr ; hr=false ;
  174     document.getElementById( 'as_nom' ).value = res[0] ;
  175     document.getElementById( 'as_ttr' ).value = res[1] ;
  176     document.getElementById( 'as_info' ).innerHTML = res[2] ;
  177     add_on = res[2] ;
  178     }
  179 function dossier_info()
  180     {
  181     if ( hr.readyState != 4 ) return ;
  182     res = hr.responseText.split('|') ;
  183     delete hr ; hr=false ;
  184     document.getElementById( 'as_nom' ).value = res[0] ;
  185     document.getElementById( 'as_ttr' ).value = res[1] ;
  186     document.getElementById( 'as_info' ).innerHTML = res[2] ;
  187     add_on = res[2] ;
  188     }
  189 
  190 function do_add()
  191     {
  192     liste = document.getElementById( 'as_lst' ) ;
  193     if ( liste.selectedIndex >= 0 )
  194         l = liste.options[liste.selectedIndex].value ;
  195     else
  196         l = '' ;
  197     nom = document.getElementById( 'as_nom' ).value ;
  198     ttr = document.getElementById( 'as_ttr' ).value ;
  199     switch ( saisie_what )
  200         {
  201         case 1 :
  202             ajout = "<doc fichier=\""+l+"\"" ;
  203             if ( nom != '' ) ajout += " nom=\""+nom+"\"" ;
  204             if ( ttr != '' ) ajout += " titre=\""+ttr+"\"" ;
  205             ajout += " />" ;
  206         break ;
  207         case 2 :
  208             ajout = "<image fichier=\""+l+"\"" ;
  209             if ( nom != '' ) ajout += " nom=\""+nom+"\"" ;
  210             if ( ttr != '' ) ajout += " titre=\""+ttr+"\"" ;
  211             if ( add_on != '' ) ajout += add_on ;
  212             ajout += " />" ;
  213         break ;
  214         case 3 :
  215             ajout = "<photo fichier=\""+l+".jpeg\"" ;
  216             if ( nom != '' ) ajout += " nom=\""+nom+"\"" ;
  217             if ( ttr != '' ) ajout += " titre=\""+ttr+"\"" ;
  218             if ( add_on != '' ) ajout += add_on ;
  219             ajout += " />" ;
  220         break ;
  221         case 4 :
  222             ajout = "<album_photo" ;
  223             if ( nom != '' ) ajout += " nom=\""+nom+"\"" ;
  224             if ( ttr != '' ) ajout += " titre=\""+ttr+"\"" ;
  225             if ( add_on != '' ) ajout += add_on ;
  226             ajout += " />" ;
  227         break ;
  228         case 5 :
  229             ajout = "<lien" ;
  230             if ( nom != '' ) ajout += " nom=\""+nom+"\"" ;
  231             if ( ttr != '' ) ajout += " titre=\""+ttr+"\"" ;
  232             if ( add_on != '' ) ajout += add_on ;
  233             ajout += " />" ;
  234         break ;
  235         default :
  236             cancel() ; return ;
  237         }
  238     txtObj = document.getElementById( 'txtCN' ) ;
  239     oldPos = txtObj.scrollTop;
  240     oldHght = txtObj.scrollHeight;
  241 
  242     // position du curseur
  243     pos = txtObj.selectionEnd + ajout.length ;
  244 
  245     avant = txtObj.value.substr( 0, txtObj.selectionStart ) ;
  246     apres = txtObj.value.substr( txtObj.selectionEnd ) ;
  247 
  248     txtObj.value = avant + ajout + apres ;
  249 
  250     // repositionnement cuseur aprés la balise fermante
  251     // peut être grandemant amélioré ;-)
  252     txtObj.selectionStart = pos;
  253     txtObj.selectionEnd = pos;
  254 
  255     // calcul et application de la nouvelle bonne postion du scroll
  256     newHght = txtObj.scrollHeight - oldHght;
  257     txtObj.scrollTop = oldPos + newHght;
  258     cancel() ;
  259     txtObj.focus() ;
  260     }
  261 
  262 function modifier()
  263     {
  264     if ( hr != false ) return ;
  265     send = '' ; sep='' ;
  266     if ( txt = document.getElementById( 'txtRM' ) )
  267         {
  268         send = send + sep + 'rm=' + escape_entities( txt.value ) ;
  269         sep = '&' ;
  270         }
  271     if ( txt = document.getElementById( 'txtRL' ) )
  272         {
  273         send = send + sep + 'rl=' + escape_entities( txt.value ) ;
  274         sep = '&' ;
  275         }
  276     if ( txt = document.getElementById( 'txtSA' ) )
  277         {
  278         val = (txt.checked)?'Y':'N' ;
  279         send = send + sep + 'sa=' + val ;
  280         sep = '&' ;
  281         }
  282     if ( txt = document.getElementById( 'txtTT' ) )
  283         {
  284         send = send + sep + 'tt=' + escape_entities( txt.value ) ;
  285         sep = '&' ;
  286         }
  287     if ( txt = document.getElementById( 'txtTI' ) )
  288         {
  289         send = send + sep + 'ti=' + escape_entities( txt.value ) ;
  290         sep = '&' ;
  291         }
  292     if ( txt = document.getElementById( 'txtRE' ) )
  293         {
  294         send = send + sep + 're=' + escape_entities( txt.value ) ;
  295         sep = '&' ;
  296         }
  297     if ( txt = document.getElementById( 'txtCN' ) )
  298         {
  299         send = send + sep + 'cn=' + escape_entities( txt.value ) ;
  300         sep = '&' ;
  301         }
  302 
  303     action = document.getElementById( 'txtAC' ).value ;
  304     hr = getHTTPObject() ;
  305     hr.open( 'POST', action, true ) ;
  306     hr.onreadystatechange = modifier_done ;
  307     hr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  308     hr.setRequestHeader("Content-Length", send.length);
  309     hr.send( send ) ;
  310     }
  311 function modifier_done()
  312     {
  313     if ( hr.readyState != 4 ) return ;
  314     delete hr ; hr=false ;
  315     }
  316 
Makefile gestion.xsl gestion.css saisie.js index.php index_publie.php tout_publier.php tout_publier.js dossier.php dossier_ajout.php dossier_ajout_done.php dossier_done.php dossier_publie.php dossier_suppr.php article.php article_ajout.php article_done.php article_publie.php article_liste.php article_info.php article_suppr.php document.php document_upload.php document_suppr.php document_liste.php image.php image_upload.php image_suppr.php image_liste.php image_info.php photo.js photo.php photo_upload.php photo_download.php photo_album_modif.php photo_modif.php photo_liste.php photo_info.php photo_album_liste.php photo_album_info.php news.php news_ajout.php news_modifier.php news_done.php news_publie.php editeur.js fichier.php fichier_done.php fichier_cnt.php profil.php profil_done.php passwd.php membre.php calendrier.php calendrier.js cal_done.php forum.php forum.js forum_modif.php
~~ / MEMBRE / GESTION / saisie.js

Haut de page

Contacter crabs

Date de génération : 24/10/2008 21:34