Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

prepare saving of summary checkboxes

  • Loading branch information...
commit b4c7c04f7cc1445d5a2518233e33cc87d72a7b98 1 parent b5b119f
@moritz authored
Showing with 29 additions and 2 deletions.
  1. +23 −0 cgi/summary.js
  2. +5 −1 cgi/template/day.tmpl
  3. +1 −1  cgi/template/line.tmpl
View
23 cgi/summary.js
@@ -0,0 +1,23 @@
+$(document).ready(function() {
+ $('#summary_container').html('<a href="javascript:save_summary_changes()">Save summary changes</a>');
+
+});
+
+function save_summary_changes() {
+ var newly_checked = [];
+ var was_checked = [];
+ $('.originally_checked').each(function(index, element) {
+ if (! $(element).is(':checked')) {
+ was_checked.push(
+ $(element).attr('name').split('_')[2]
+ );
+ }
+ });
+ $('.summary_checkbox:checked').each(function(index, element) {
+ if (! $(element).attr('class').match(/originally_checked/)) {
+ newly_checked.push(
+ $(element).attr('name').split('_')[2]
+ );
+ }
+ });
+}
View
6 cgi/template/day.tmpl
@@ -33,11 +33,14 @@
<TMPL_INCLUDE NAME='linkblock.tmpl'>
<p>All times shown according to <abbr title="Coordinated Universal Time">UTC</abbr>.</p>
+ <div id="summary_container" />
<TMPL_IF ADMIN>
<form method="post" action="<TMPL_VAR BASE_URL>spam.pl?date=<TMPL_VAR DATE>;channel=<TMPL_VAR CHANNEL>">
<p><input type="submit" value="Mark as spam" /></p>
<p><a href="javascript:reset_checkboxes()">Reset all Checkboxes</a></p>
<div style="clear:both"></div>
+ <TMPL_ELSE>
+ <form action="#" name="summary_form" id="summary_form">
</TMPL_IF>
<p style="display: none;" id="filter_toggle"></p>
@@ -61,8 +64,8 @@
<TMPL_IF ADMIN>
<p><input type="submit" value="Mark as spam" /></p>
<div style="clear:both"></div>
- </form>
</TMPL_IF>
+ </form>
<TMPL_INCLUDE NAME='linkblock.tmpl'>
<TMPL_VAR NAME=CHANNEL_LINKS DEFAULT="">
@@ -70,6 +73,7 @@
<TMPL_INCLUDE NAME="footer.tmpl">
<script type="text/javascript" src="<TMPL_VAR BASE_URL>nickfilter.js"></script>
+ <script type="text/javascript" src="<TMPL_VAR BASE_URL>summary.js"></script>
</body>
</html>
<!-- <TMPL_IF DEBUG> <TMPL_VAR DEBUG> </TMPL_IF> -->
View
2  cgi/template/line.tmpl
@@ -4,7 +4,7 @@
<td class="checkbox"><input type="checkbox" name="single" value="<TMPL_VAR ID>" size="1" style="width:1em"/></td>
</TMPL_IF>
<td class="time" id="i_<TMPL_VAR ID>"><a href="<TMPL_VAR BASE_URL><TMPL_VAR CHANNEL>/<TMPL_VAR DATE>#i_<TMPL_VAR ID>"><TMPL_VAR TIME></a></td>
- <td class="summary"><input type="checkbox" name="in_summary_<TMPL_VAR
+ <td class="summary"><input type="checkbox" class="summary_checkbox<TMPL_IF IN_SUMMARY> originally_checked</TMPL_IF>" name="in_summary_<TMPL_VAR
ID>" <TMPL_IF IN_SUMMARY>checked="checked"</TMPL_IF> /></td>
<td class="nick<TMPL_IF NICK_CLASS> <TMPL_VAR NICK_CLASS></TMPL_IF>"><TMPL_VAR NICK></td>
<td class="msg<TMPL_IF MSG_CLASS> <TMPL_VAR MSG_CLASS></TMPL_IF> <TMPL_VAR NAME=SEARCH_FOUND DEFAULT=''>"><TMPL_VAR NAME=MESSAGE ESCAPE=0></td>
Please sign in to comment.
Something went wrong with that request. Please try again.