[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.11 and 1.12

version 1.11, 2010/02/18 05:35:04 version 1.12, 2010/02/18 06:25:31
Line 1 
Line 1 
 <html><head>  <html><head>
         <!-- $AFresh1: index.html,v 1.10 2010/02/17 02:16:28 andrew Exp $ -->          <!-- $AFresh1: index.html,v 1.11 2010/02/18 05:35:04 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 15 
Line 15 
         var url = base_url + '/' + list + '/entry/' + entry.line,          var url = base_url + '/' + list + '/entry/' + entry.line,
             id  = entry.id;              id  = entry.id;
   
        if (editors[id]) {          if (!id) {
             editors[id].editor.dispose();              id = 'entry_' + entry.line;
             delete editors[id];          }
        }  
   
        editors[id] = {          if (editors[id]) {
            list: list,                  editors[id].dispose();
            editor: new Ajax.InPlaceEditor(                  delete editors[id];
                 id, url + '.json', {          }
                     cols: 80,  
                     rows: 1,          editors[id] = new Ajax.InPlaceEditor( id, url + '.json', {
                     callback: function(form, value) {                  cols: 80,
                         entry.oldText = entry.text;                  rows: 1,
                         entry.text = value;                  callback: function(form, value) {
                         return entry;                      entry.oldText = entry.text;
                     },                      entry.text = value;
                     onComplete: function (transport, element) {                      return entry;
                         if (transport && transport.responseJSON) {                  },
                             updateEntry(transport.responseJSON, element);                  onComplete: function (transport, element) {
                         }                      if (transport && transport.responseJSON) {
                           updateEntry( list, transport.responseJSON, element);
                     }                      }
                 }                  }
            ),              }
        };          );
     },      },
   
     updateEntry = function(entry, element) {      updateEntry = function(list, entry, element) {
         var list = editors[element.id].list;          if (!entry.id) {
               entry.id = 'entry_' + entry.line;
           }
           var liId = 'li_' + entry.id;
   
         element.update(entry.text);          if (parseInt(entry.line) !== $(liId).value) {
   
         if (parseInt(entry.line) !== element.value) {  
             for (k in editors) {              for (k in editors) {
                 if (editors.hasOwnProperty(k)) {                  if (editors.hasOwnProperty(k)) {
                     editors[k].editor.dispose();                      editors[k].dispose();
                     delete editors[k];                      delete editors[k];
                 }                  }
             }              }
             return getList(list);              return getList(list);
         }          }
   
           $(liId).update(
               new Element('span', { id: entry.id }). update(entry.text)
           ).insert({
               top: new Element('input', {
                   type: 'checkbox' ,
                   id:   'do_' + entry.line,
                   checked: entry.done,
                   disabled: true,
               })
           });
   
           makeEntryEditor(list, entry);
     },      },
   
     updateList = function (list, transport) {      updateList = function (list, transport) {
         var i,          var i,
           todo = transport.responseJSON,            todo = transport.responseJSON,
           element = new Element('ol');            element = new Element('ol'),
             entryElement;
   
         $("list").update( element );          $("list").update( element );
   
         for (i=0; i <= todo.length; i++) {          for (i=0; i <= todo.length; i++) {
             todo[i].id = 'entry_' + todo[i].line;              todo[i].id = 'entry_' + todo[i].line;
   
             element.insert( new Element('li', {              entryElement = new Element('li', {
                     id: 'entry_' + todo[i].line,                  id: 'li_' + todo[i].id,
                     value: todo[i].line                  value: todo[i].line
                 }).update(todo[i].text)              });
             );  
   
             makeEntryEditor(list, todo[i]);              element.insert(entryElement);
   
               updateEntry(list, todo[i], entryElement);
         }          }
     },      },
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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