diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-12 21:17:29 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-12 21:17:29 +0200 |
commit | 8c24f8d84c338de8320596c5a9b8da72c2541080 (patch) | |
tree | 304af41ab28375dde5cd21aadaa7ed7d76a4f14e | |
parent | fac8f09c3bf40aaea5513c696af562cd9f728ea6 (diff) | |
download | Bits-8c24f8d84c338de8320596c5a9b8da72c2541080.tar.gz Bits-8c24f8d84c338de8320596c5a9b8da72c2541080.zip |
Small presentation changes.
-rw-r--r-- | design/style.css | 7 | ||||
-rw-r--r-- | js/liststudy.js | 4 | ||||
-rw-r--r-- | js/reviewdesu.js | 7 | ||||
-rw-r--r-- | lib/study/brresults.php | 1 | ||||
-rw-r--r-- | lib/study/list.php | 9 | ||||
-rw-r--r-- | schema.sql | 13 | ||||
-rw-r--r-- | tpl/general/top.php | 2 | ||||
-rw-r--r-- | tpl/study/list.php | 20 |
8 files changed, 44 insertions, 19 deletions
diff --git a/design/style.css b/design/style.css index 5111d78..bb3e2ef 100644 --- a/design/style.css +++ b/design/style.css @@ -305,6 +305,7 @@ hr { margin: auto; border: 1px solid #eeeeee; background: #ffffff; + padding: 8px; } .review_item .box { @@ -317,9 +318,8 @@ hr { .review_item .boxn { border-top: 0px; - height: 74px; + height: 64px; font-size: 0.8em; - padding-top: 6px; } .review_item .boxn em { @@ -334,7 +334,7 @@ hr { .rtk_kr_q_1, .rtk_kr_a_1, .rtk_kr_q_2, .rtk_kr_a_2 { margin: 0px; padding: 0px; padding-top: 50px; } .rtk_kr_q_1, .rtk_kr_a_2 span { font-size: 4em; font-family: "IPAMincho", serif; } -.rtk_kr_q_2, .rtk_kr_a_1 span { font-size: 1.2em; } +.rtk_kr_q_2, .rtk_kr_a_1 span { font-size: 1.3em; } /* blog */ @@ -369,3 +369,4 @@ hr { margin-bottom: 10px; font-size: 1.0em; } + diff --git a/js/liststudy.js b/js/liststudy.js index 5ff6aef..ab6eede 100644 --- a/js/liststudy.js +++ b/js/liststudy.js @@ -88,7 +88,7 @@ function show_contents_table() { if (notes[items[i].info[0]]) { var note = notes[items[i].info[0]]; html += '<tr><td class="invisible_td"></td><td class="study_note_td" colspan="' - + (items[i].info.length) + '">' + note + '</td></tr>'; + + (items[i].info.length) + '">' + note.replace(/\|\|/g, '<br/>') + '</td></tr>'; } } html += '</table>'; @@ -135,7 +135,7 @@ function show_reviews_table() { function edit_note(id) { var idd = items[id].info[0]; - var note = prompt("Add note for item: ", notes[idd] || ''); + var note = prompt("Add note for item:\n(you might want to add a long note, so I'm adding this text to make the prompt box bigger)", notes[idd] || ''); if (note != null) notes[idd] = note; if (notes[idd] == '') delete notes[idd]; show_contents_table(); diff --git a/js/reviewdesu.js b/js/reviewdesu.js index 6750b4b..d93bda4 100644 --- a/js/reviewdesu.js +++ b/js/reviewdesu.js @@ -96,7 +96,8 @@ function show_answer() { html = '<h3>Question ' + question_nb + ' of ' + total + '</h3>'; html += '<div class="review_item">'; html += '<div class="box2">' + question.answer + '</div>'; - html += '<div class="boxn" onclick="edit_note();" id="notebox">' + (notes[question.key] || '<em>click to add note...</em>') + '</div>'; + html += '<div class="boxn" onclick="edit_note();" id="notebox">' + + (notes[question.key] || '<em>click to add note...</em>').replace(/\|\|/g, '<br />') + '</div>'; html += '<p><button taborder="1" onclick="answer_question(-1);">fail</button>'; html += '<button taborder="2" id="dunnobtn" onclick="answer_question(0);">dunno</button>'; html += '<button taborder="3" id="winbtn" onclick="answer_question(1);">win</button></p>'; @@ -113,10 +114,10 @@ function answer_question(a) { function edit_note() { var idd = question.key; - var note = prompt("Add note for item:", notes[idd] || ''); + var note = prompt("Add note for item:\n(you might want to add a long note, so I'm adding this text to make the prompt box bigger)", notes[idd] || ''); if (note != null) notes[idd] = note; if (notes[idd] == '') delete notes[idd]; - $("notebox").innerHTML = (notes[idd] || '<em>click to add note...</em>'); + $("notebox").innerHTML = (notes[idd] || '<em>click to add note...</em>').replace(/\|\|/g, '<br />'); new Ajax.Request('index.php?p=brresults-study-' + batchid, { method: 'post', diff --git a/lib/study/brresults.php b/lib/study/brresults.php index 9bbafac..93ebfdf 100644 --- a/lib/study/brresults.php +++ b/lib/study/brresults.php @@ -26,6 +26,7 @@ if ($info["bsid"] == 0) { } if (isset($_POST['results']) && isset($_POST['score'])) { + sql("UPDATE batch_study SET before_last_review = last_review WHERE id = " . $info['bsid']); sql("INSERT INTO batch_review(user, batch, results, score, date) ". "VALUES(" . $user['id'] . ", $batchid, '" . escs(esca($_POST['results'])) . "', " . intval($_POST['score']) . ", NOW())"); sql("UPDATE batch_study SET last_review = " . mysql_insert_id() . " WHERE id = " . $info['bsid']); diff --git a/lib/study/list.php b/lib/study/list.php index 928e253..bebffa6 100644 --- a/lib/study/list.php +++ b/lib/study/list.php @@ -26,11 +26,16 @@ $fdefaults = array( $batches = array(); $n = sql( "SELECT batches.id AS id, batches.name AS name, ". - "batch_study.id AS bs_id, batch_review.date AS lr_date, batch_review.score AS lr_score ". + "batch_study.id AS bs_id, ba.date AS lr_date, TO_DAYS(NOW()) - TO_DAYS(ba.date) AS lr_days, ". + "ba.score AS lr_score, bc.date AS blr_date, bc.score AS blr_score, ". + "COUNT(bb.id) AS num_reviews ". "FROM batches ". "LEFT JOIN batch_study ON batch_study.batch = batches.id AND batch_study.user = " . $user['id'] . " " . - "LEFT JOIN batch_review ON batch_review.id = batch_study.last_review ". + "LEFT JOIN batch_review ba ON ba.id = batch_study.last_review ". + "LEFT JOIN batch_review bb ON bb.batch = batches.id AND bb.user = " . $user['id'] . " ". + "LEFT JOIN batch_review bc ON bc.id = batch_study.before_last_review ". "WHERE batches.list = " . $study['listid'] . " " . + "GROUP BY batches.id ". "ORDER BY " . get_filter("order") . " " . get_filter("way") ); while ($b = mysql_fetch_assoc($n)) $batches[] = $b; @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Client: localhost --- Généré le: Sam 10 Août 2013 à 15:18 +-- Généré le: Lun 12 Août 2013 à 18:25 -- Version du serveur: 5.5.32-MariaDB-log -- Version de PHP: 5.4.17 @@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `batch_study` ( `batch` int(11) NOT NULL, `last_review` int(11) NOT NULL, `notes_json` text NOT NULL, + `before_last_review` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `batch_user` (`user`,`batch`), KEY `user_idx` (`user`), @@ -157,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `cards` ( UNIQUE KEY `unique_name` (`deck`,`name`), UNIQUE KEY `unique_number` (`deck`,`number`), KEY `deck_idx` (`deck`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -173,7 +174,7 @@ CREATE TABLE IF NOT EXISTS `card_study` ( `next_review` date NOT NULL, PRIMARY KEY (`id`), KEY `deck_study` (`deck_study`,`card`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -190,7 +191,7 @@ CREATE TABLE IF NOT EXISTS `decks` ( PRIMARY KEY (`id`), UNIQUE KEY `unique_name` (`owner`,`name`), KEY `owner_idx` (`owner`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -209,7 +210,7 @@ CREATE TABLE IF NOT EXISTS `deck_study` ( UNIQUE KEY `unique_user_deck` (`user`,`deck`), KEY `user_idx` (`user`), KEY `deck_idx` (`deck`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -297,7 +298,7 @@ CREATE TABLE IF NOT EXISTS `notes` ( `public` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `owner` (`owner`,`parent`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; diff --git a/tpl/general/top.php b/tpl/general/top.php index 2eb0862..2e73057 100644 --- a/tpl/general/top.php +++ b/tpl/general/top.php @@ -18,6 +18,7 @@ global $user, $apps; //These might be hidden because this page is called from sq </head> <body<?php if (isset($onload_js)) echo ' onload="' . $onload_js . '"'; ?>> + <div class="menu"> <div class="right"> <?php @@ -47,6 +48,7 @@ if ($user['id'] != 0) { <div style="clear: both;"></div> </div> + <div class="contents-right"> <h1><?php echo $title; ?></h1> diff --git a/tpl/study/list.php b/tpl/study/list.php index c44e45e..8d240fb 100644 --- a/tpl/study/list.php +++ b/tpl/study/list.php @@ -3,11 +3,12 @@ $title = "Studying " . $study['listowner'] . ':' . $study['listname']; require("tpl/general/top.php"); + echo '<div class="small_right"><a href="listrm-study-' . $studyid . '">stop studying</a></div>'; echo '<div class="ordering_links">' . filters_html_full() . '</div>'; -echo '<table><tr><th>Batch name</th><th>actions</th><th>last test</th><th>score</th></tr>'; +echo '<table><tr><th>Batch name</th><th>actions</th><th>tests</th><th>last test</th><th>score</th></tr>'; foreach ($batches as $batch) { $color = ""; if ($batch['lr_date']) { @@ -23,12 +24,25 @@ foreach ($batches as $batch) { } if ($color != "") $color = ' style="background-color: ' . $color . '"'; + $days_color = ($batch['lr_days'] >= 30 ? "#BFBFBF" : + ($batch['lr_days'] >= 20 ? "#C7C7C7" : + ($batch['lr_days'] >= 14 ? "#CFCFCF" : + ($batch['lr_days'] >= 10 ? "#D7D7D7" : + ($batch['lr_days'] >= 7 ? "#DFDFDF" : + ($batch['lr_days'] >= 5 ? "#E7E7E7" : + ($batch['lr_days'] >= 3 ? "#EFEFEF" : + ($batch['lr_days'] >= 1 ? "#F7F7F7" : "#FFFFFF")))))))); + $dc = ($batch['lr_date'] ? ' style="background-color: ' . $days_color .'"' : ''); echo '<tr>'; echo '<td><code>' . $batch['name'] . '</code></td>'; echo '<td><a href="batch-study-' . $batch['id'] . '">view</a> | <a href="batchreview-study-' . $batch['id'] . '">test</a></td>'; - echo '<td>' . ($batch['lr_date'] ? $batch['lr_date'] : "never") . '</td>'; - echo '<td'.$color.'>' . ($batch['lr_date'] ? $batch['lr_score'] . '/100' : 'N/A') . '</td>'; + echo '<td>' . $batch['num_reviews'] . '</td>'; + echo '<td'.$dc.'>' . ($batch['lr_date'] ? $batch['lr_date'] : "never") . '</td>'; + echo '<td'.$color.'>' . ($batch['lr_date'] ? $batch['lr_score'] . '/100' : 'N/A') . + ($batch['blr_date'] ? ($batch['lr_score'] > $batch['blr_score'] ? '<span style="color: green"> ⬈</span>' : + ($batch['lr_score'] < $batch['blr_score'] ? '<span style="color: orange;"> ⬊</span>' : + '<span style="color: grey"> ➡</span>')) : '') . '</td>'; echo '</tr>'; } echo '</table>'; |