noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
todo_list.js
Go to the documentation of this file.
00001 /*
00002  *   This file is part of NOALYSS.
00003  *
00004  *   NOALYSS is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation; either version 2 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   NOALYSS is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with NOALYSS; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 /* $Revision$ */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief this file contains all the javascript needed by the todo_list. 
00024  *      it requires prototype.js. The calling page must have 
00025  *      the gDossier
00026  * 
00027  */
00028 function todo_list_show(p_id)
00029 {
00030     var gDossier=$('gDossier').value;
00031     $('add_todo_list').style.top=(posY+offsetY)+'px';
00032     $('add_todo_list').style.left=(posX+offsetX-200)+'px';
00033 
00034     try
00035     {
00036         var action=new Ajax.Request(
00037                        'ajax_todo_list.php',
00038                        {
00039                    method:'get',
00040                    parameters:
00041                    {'show':
00042                    1,'id':
00043                    p_id,'gDossier':
00044                                gDossier
00045                            },
00046                    onFailure:todo_list_show_error,
00047                    onSuccess:todo_list_show_success
00048                        }
00049                    );
00050     }
00051     catch (e)
00052     {
00053         alert(" Envoi ajax non possible" + e.message);
00054     }
00055     return false;
00056 }
00057 function todo_list_show_success(req)
00058 {
00059     try
00060     {
00061         var answer=req.responseXML;
00062         var tl_id=answer.getElementsByTagName('tl_id');
00063         var tl_title=answer.getElementsByTagName('tl_title');
00064         var tl_desc=answer.getElementsByTagName('tl_desc');
00065         var tl_date=answer.getElementsByTagName('tl_date');
00066 
00067         if ( tl_id.length == 0 )
00068         {
00069             var rec=req.responseText;
00070             alert ('erreur :'+rec);
00071         }
00072 
00073         $('p_title').value=getNodeText(tl_title[0]);
00074         $('p_date_todo').value=getNodeText(tl_date[0]);
00075         $('p_desc').value=getNodeText(tl_desc[0]);
00076         $('tl_id').value=getNodeText(tl_id[0]);
00077         $('add_todo_list').style.display='block';
00078     }
00079     catch (e)
00080     {
00081         alert(e.message);
00082     }
00083 }
00084 function todo_list_show_error(request_json)
00085 {
00086     alert ('failure');
00087 }
00088 function add_todo()
00089 {
00090     $('add_todo_list').style.top=posY+offsetY+"px";
00091     $('add_todo_list').style.left=posX+offsetX+"px";
00092 
00093     $('add_todo_list').style.display='block';
00094     $('p_title').value='';
00095 
00096     $('p_date_todo').value='';
00097     $('p_desc').value='';
00098     $('tl_id').value=0;
00099 }
00100 function todo_list_remove(p_ctl)
00101 {
00102     if ( confirm('Effacer ?') == false )
00103     {
00104         return;
00105     }
00106     $("tr"+p_ctl).hide();
00107     var gDossier=$('gDossier').value;
00108 
00109     var action=new Ajax.Request(
00110                    'ajax_todo_list.php',
00111                    {
00112                    method:'get',
00113                    parameters:
00114                    {'del':
00115                    1,'id':
00116                    p_ctl,'gDossier':
00117                            gDossier
00118                        }
00119                    }
00120                );
00121     return false;
00122 
00123 }
 All Data Structures Namespaces Files Functions Variables Enumerations