From 5435a0a45fdfa1bcceeb36f8531826ddc2bb3508 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Sat, 10 Aug 2013 17:15:22 +0200 Subject: Added possibility to add notes to studied batch items. --- js/liststudy.js | 33 ++++++++++++++++++++++++++++++--- js/reviewdesu.js | 24 ++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/liststudy.js b/js/liststudy.js index 820e35d..5ff6aef 100644 --- a/js/liststudy.js +++ b/js/liststudy.js @@ -66,15 +66,16 @@ function process_items() { } function show_contents_table() { - var html = ''; + var html = '
'; for (var i = 0; i < batch_data.columns.length; i++) { var c = batch_data.columns[i]; html += ''; } html += ''; for (var i = 0; i < items.length; i++) { - html += ''; - html += ''; + html += ''; + html += ''; for (var j = 0; j < items[i].info.length; j++) { html += ''; } @@ -84,6 +85,11 @@ function show_contents_table() { (items[i].score == max_score ? '#00aa00' : (items[i].score >= med_score ? '#55FF55' : (items[i].score < 0 ? '#FF7777' : '#FFFF00'))) + '">' + items[i].score + ''; + if (notes[items[i].info[0]]) { + var note = notes[items[i].info[0]]; + html += ''; + } } html += '
' + c + ' - hidewinfailscore
' + items[i].marker + '
' + items[i].marker + '' + + '' + items[i].info[j] + '
' + note + '
'; html += '

Average score : ' + avg_score + '

'; @@ -125,3 +131,24 @@ function show_reviews_table() { $("reviews").innerHTML = html; } } + + +function edit_note(id) { + var idd = items[id].info[0]; + var note = prompt("Add note for item: ", notes[idd] || ''); + if (note != null) notes[idd] = note; + if (notes[idd] == '') delete notes[idd]; + show_contents_table(); + + new Ajax.Request('index.php?p=brresults-study-' + batchid, { + method: 'post', + parameters: { + notes: Object.toJSON(notes), + }, + onSuccess: function(transport) { + // nothing... + }, + }); +} + + diff --git a/js/reviewdesu.js b/js/reviewdesu.js index 829f07a..6750b4b 100644 --- a/js/reviewdesu.js +++ b/js/reviewdesu.js @@ -84,7 +84,7 @@ function next_question() { html = '

Question ' + question_nb + ' of ' + total + '

'; html += '
'; - html += '
' + question.question + '
'; + html += '
' + question.question + '
'; html += '

'; html += '
'; $("core").innerHTML = html; @@ -95,7 +95,8 @@ function next_question() { function show_answer() { html = '

Question ' + question_nb + ' of ' + total + '

'; html += '
'; - html += '
' + question.answer + '
'; + html += '
' + question.answer + '
'; + html += '
' + (notes[question.key] || 'click to add note...') + '
'; html += '

'; html += ''; html += '

'; @@ -109,3 +110,22 @@ function answer_question(a) { score += a; next_question(); } + +function edit_note() { + var idd = question.key; + var note = prompt("Add note for item:", notes[idd] || ''); + if (note != null) notes[idd] = note; + if (notes[idd] == '') delete notes[idd]; + $("notebox").innerHTML = (notes[idd] || 'click to add note...'); + + new Ajax.Request('index.php?p=brresults-study-' + batchid, { + method: 'post', + parameters: { + notes: Object.toJSON(notes), + }, + onSuccess: function(transport) { + // nothing... + }, + }); +} + -- cgit v1.2.3