[BACK]Return to index.html CVS log [TXT][DIR] Up to [local] / todotxt / Text-Todo-REST-API / example / htdocs

Annotation of todotxt/Text-Todo-REST-API/example/htdocs/index.html, Revision 1.8

1.2       andrew      1: <html><head>
1.8     ! andrew      2:         <!-- $AFresh1: index.html,v 1.7 2010/02/02 06:11:31 andrew Exp $ -->
1.7       andrew      3:         <title>todo.txt - ajax client</title>
                      4:         <link rel="stylesheet" href="todo.css">
                      5:         <script src="scriptaculous/lib/prototype.js"></script>
                      6:         <script src="scriptaculous/src/scriptaculous.js?load=effects,controls"></script>
1.2       andrew      7: <script type='text/javascript'>
1.4       andrew      8: var base_url = '/~andrew/user-bin/todo.cgi';
                      9:
1.7       andrew     10: function getFiles() {
                     11:     $('files').update("Getting Files . . .");
                     12:     new Ajax.Updater('files', base_url, {
                     13:         method: 'get',
                     14:         //insertion: Insertion.Top
                     15:     });
1.6       andrew     16: }
                     17:
1.7       andrew     18: function updateList(list, transport) {
                     19:     var todo = transport.responseJSON;
                     20:
                     21:     $('list').update('');
                     22:     for (var i=0; i <= todo.length; i++) {
                     23:         $('list').insert({ bottom: new Element('div', { id: todo[i].md5 }) });
                     24:         $(todo[i].md5).update(todo[i].text);
                     25:
1.8     ! andrew     26:         var entry_url = base_url + '/' + list + '/entry/' + todo[i].md5;
1.4       andrew     27:
1.7       andrew     28:         new Ajax.InPlaceEditor(todo[i].md5, entry_url + '.txt', {
1.8     ! andrew     29:             cols: 80,
        !            30:             //loadTextURL: entry_url + '.txt',
1.7       andrew     31:         });
                     32:     }
1.2       andrew     33: }
1.7       andrew     34:
1.2       andrew     35: function getList(list) {
1.7       andrew     36:     $('list').update("Getting List . . .");
                     37:     var list_url = base_url + '/' + list;
                     38:
                     39:     new Ajax.Request(list_url + '.json', {
                     40:         method: 'get',
                     41:         onSuccess: function(transport) { updateList(list, transport) },
                     42:     });
1.2       andrew     43: }
1.7       andrew     44:
1.2       andrew     45: </script>
                     46: </head>
1.6       andrew     47:
1.7       andrew     48: <body onLoad="getFiles();getList('todo')">
                     49:     <h1>Files:</h1><div id='files'></div>
                     50:     <h1>List:</h1> <div id='list'></div>
1.1       andrew     51: </body></html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>