Checklist

Check-in [62e3fcb7b3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Checklist updates are working using AJAX.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 62e3fcb7b3b585115f953f0f3cae83c5d2726b5d
User & Date: drh 2018-01-29 18:16:40
Context
2018-01-29
18:40
Commit transactions from the /sql page. Improvements to the header comment. check-in: ea17699ab0 user: drh tags: trunk
18:16
Checklist updates are working using AJAX. check-in: 62e3fcb7b3 user: drh tags: trunk
07:18
Shift more of the HTML into the HTML document and avoid innerHTML within javascript. check-in: 042caeec26 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to checklist.tcl.

330
331
332
333
334
335
336


337
338
339
340
341
342
343
...
357
358
359
360
361
362
363
364
365
366
367
368




369
370
371
372
373
374
375
...
386
387
388
389
390
391
392

393
394
395
396
397
398
399





400
401
402
403
404
405
406
      xhttp.onreadystatechange = function(){
        if(xhttp.readyState!=4) return
        var jx = JSON.parse(xhttp.responseText);
        callback(jx);
      }
      if(data){
        xhttp.open("POST",uri,true);


        xhttp.send(data)
      }else{
        xhttp.open("GET",uri,true);
        xhttp.send();
      }
    }
    function cklistClr(stat){
................................................................................
        var x = jx[i];
        var name = "item-"+x.itemid
        var e = document.getElementById(name);
        if(!e) continue
        e.style.color = cklistClr(x.status);
        e = document.getElementById("stat-"+x.itemid);
        if(!e) continue;
        e.innerHTML = "(" + x.owner + "/" + x.status + ")";
        if( x.comment && x.comment.length>0 ){
          e = document.getElementById("com-"+x.itemid);
          e.innerHTML = x.comment;
        }




      }
    }
    cklistAjax('jstat',null,cklistApplyJstat);
    var userNode = document.getElementById("cklistUser");
    var userInfo = JSON.parse(userNode.textContent||userNode.innerText);
    if(userInfo.canWrite){
      var editItem = null
................................................................................
        if(e==editItem){
          editItem = null;
          return;
        }
        editBox.style.display = "block";
        editItem = e;
        editItem.appendChild(editBox);

        document.getElementById("cancelBtn").onclick = function(event){
          event.stopPropagation();
          editItem.removeChild(editBox);
          editItem = null;
        }
        document.getElementById("applyBtn").onclick = function(event){
          alert("Apply to "+editItem.id);





          editItem.removeChild(editBox);
          editItem = null;
          event.stopPropagation();
        }
        document.getElementById("editForm").onsubmit = function(){
          return false;
        }







>
>







 







|




>
>
>
>







 







>






|
>
>
>
>
>







330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
...
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
...
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
      xhttp.onreadystatechange = function(){
        if(xhttp.readyState!=4) return
        var jx = JSON.parse(xhttp.responseText);
        callback(jx);
      }
      if(data){
        xhttp.open("POST",uri,true);
        xhttp.setRequestHeader("Content-Type",
                               "application/x-www-form-urlencoded");
        xhttp.send(data)
      }else{
        xhttp.open("GET",uri,true);
        xhttp.send();
      }
    }
    function cklistClr(stat){
................................................................................
        var x = jx[i];
        var name = "item-"+x.itemid
        var e = document.getElementById(name);
        if(!e) continue
        e.style.color = cklistClr(x.status);
        e = document.getElementById("stat-"+x.itemid);
        if(!e) continue;
        e.innerHTML = "(" + x.status + " by " + x.owner + ")";
        if( x.comment && x.comment.length>0 ){
          e = document.getElementById("com-"+x.itemid);
          e.innerHTML = x.comment;
        }
        if( editItem && editItem.id==name ){
          document.getElementById("editStatus").value = x.status;
          document.getElementById("editCom").value = x.comment;
        }
      }
    }
    cklistAjax('jstat',null,cklistApplyJstat);
    var userNode = document.getElementById("cklistUser");
    var userInfo = JSON.parse(userNode.textContent||userNode.innerText);
    if(userInfo.canWrite){
      var editItem = null
................................................................................
        if(e==editItem){
          editItem = null;
          return;
        }
        editBox.style.display = "block";
        editItem = e;
        editItem.appendChild(editBox);
        cklistAjax("jstat?itemid="+e.id.substr(5),null,cklistApplyJstat);
        document.getElementById("cancelBtn").onclick = function(event){
          event.stopPropagation();
          editItem.removeChild(editBox);
          editItem = null;
        }
        document.getElementById("applyBtn").onclick = function(event){
          var data = "update=" + editItem.id.substr(5);
          var e = document.getElementById("editStatus");
          data += "&status=" + escape(e.value);
          e = document.getElementById("editCom");
          data += "&comment=" + escape(e.value);
          cklistAjax("jstat",data,cklistApplyJstat);
          editItem.removeChild(editBox);
          editItem = null;
          event.stopPropagation();
        }
        document.getElementById("editForm").onsubmit = function(){
          return false;
        }