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

Diff for /todotxt/Text-Todo-REST-API/example/htdocs/index.html between version 1.9 and 1.10

version 1.9, 2010/02/16 03:45:17 version 1.10, 2010/02/17 02:16:28
Line 1 
Line 1 
 <html><head>  <html><head>
         <!-- $AFresh1: index.html,v 1.8 2010/02/13 22:32:18 andrew Exp $ -->          <!-- $AFresh1: index.html,v 1.9 2010/02/16 03:45:17 andrew Exp $ -->
         <title>todo.txt - ajax client</title>          <title>todo.txt - ajax client</title>
         <link rel="stylesheet" href="todo.css">          <link rel="stylesheet" href="todo.css">
   
Line 9 
Line 9 
   
 var TODO = function () {  var TODO = function () {
     var base_url = '/~andrew/user-bin/todo.cgi',      var base_url = '/~andrew/user-bin/todo.cgi',
           editors = {},
   
       makeEntryEditor  = function(id, list_url) {
          var url = list_url + '/entry/' + id;
   
     updateList = function (list, transport) {         if (!editors[id]) {
           editors[id] = {
               list_url: list_url,
               editor: new Ajax.InPlaceEditor(
                       id, url + '.json', {
                           cols: 80,
                           rows: 1,
                           onComplete: updateEntry,
                       }
                   ),
               };
           }
       },
   
       updateEntry = function(transport, element) {
           var list_url = editors[element.id].list_url,
               entry;
   
           if (transport && transport.responseJSON) {
               entry = transport.responseJSON;
   
               element.update(entry.text);
   
               if (element.id !== entry.md5) {
                   if (editors[element.id]) {
                       editors[element.id].editor.dispose();
                       delete editors[element.id];
                   }
   
                   element.id = entry.md5;
   
                   makeEntryEditor(element.id, list_url);
               }
           }
       },
   
       updateList = function (list_url, transport) {
         var i,          var i,
           todo = transport.responseJSON,            todo = transport.responseJSON,
           url = '';            url  = '';
   
         $('list').update('');          $("list").update();
   
         for (i=0; i <= todo.length; i++) {          for (i=0; i <= todo.length; i++) {
             $('list').insert({              $('list').insert({
                 bottom: new Element('div', {                  bottom: new Element('div',
                     id: todo[i].md5,                          { id: todo[i].md5 }
                     }).update(todo[i].text),                          ).update(todo[i].text)
             });                  }
               );
   
             url = base_url + '/' + list + '/entry/' + todo[i].md5;              makeEntryEditor(todo[i].md5, list_url);
   
             new Ajax.InPlaceEditor(todo[i].md5, url + '.json', {  
                 cols: 80,  
                 loadTextURL: url + '.txt',  
                 //getText: function () {},  
             });  
         }          }
     };      };
   
Line 68 
Line 103 
             $('list').update("Getting List . . .");              $('list').update("Getting List . . .");
   
             new Ajax.Request(url + '.json', {              new Ajax.Request(url + '.json', {
                 method: 'get',                  method:    'get',
                 onSuccess: function (transport) {                  onSuccess: function (transport) { updateList(url, transport) },
                     updateList(list, transport)  
                 },  
             });              });
   
         },          },

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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