Mercurial > public > sg101
annotate gpp/messages/static/js/box.js @ 360:2e90b63520b8
Trying to fix #180 again. Changed the syntax for strikethrough to 3 dashes to make it less harder to do accidently.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 Mar 2011 02:30:53 +0000 |
parents | 88b2b9cb8c1f |
children |
rev | line source |
---|---|
bgneal@312 | 1 function messages_master_click() |
bgneal@312 | 2 { |
bgneal@312 | 3 var state = document.getElementById('master_select').checked |
bgneal@312 | 4 for (i = 0; i < document.messages_box_form.length; ++i) |
bgneal@312 | 5 { |
bgneal@312 | 6 if (document.messages_box_form.elements[i].type == 'checkbox') |
bgneal@312 | 7 { |
bgneal@312 | 8 document.messages_box_form.elements[i].checked = state; |
bgneal@312 | 9 } |
bgneal@312 | 10 } |
bgneal@312 | 11 } |
bgneal@312 | 12 |
bgneal@312 | 13 function messages_set_master() |
bgneal@312 | 14 { |
bgneal@312 | 15 var count = 0; |
bgneal@312 | 16 var numChkBoxes = 0; |
bgneal@312 | 17 for (i = 0; i < document.messages_box_form.length; ++i) |
bgneal@312 | 18 { |
bgneal@312 | 19 if (document.messages_box_form.elements[i].type == 'checkbox' && |
bgneal@312 | 20 document.messages_box_form.elements[i].id != 'master_select') |
bgneal@312 | 21 { |
bgneal@312 | 22 ++numChkBoxes; |
bgneal@312 | 23 if (document.messages_box_form.elements[i].checked) |
bgneal@312 | 24 { |
bgneal@312 | 25 ++count; |
bgneal@312 | 26 } |
bgneal@312 | 27 } |
bgneal@312 | 28 } |
bgneal@312 | 29 document.getElementById('master_select').checked = count == numChkBoxes; |
bgneal@312 | 30 } |
bgneal@312 | 31 |
bgneal@312 | 32 function messages_count_selected() |
bgneal@312 | 33 { |
bgneal@312 | 34 var count = 0; |
bgneal@312 | 35 for (i = 0; i < document.messages_box_form.length; ++i) |
bgneal@312 | 36 { |
bgneal@312 | 37 if (document.messages_box_form.elements[i].type == 'checkbox' && |
bgneal@312 | 38 document.messages_box_form.elements[i].checked && |
bgneal@312 | 39 document.messages_box_form.elements[i].id != 'master_select') |
bgneal@312 | 40 { |
bgneal@312 | 41 ++count; |
bgneal@312 | 42 } |
bgneal@312 | 43 } |
bgneal@312 | 44 return count; |
bgneal@312 | 45 } |
bgneal@312 | 46 |
bgneal@312 | 47 function messages_confirm_delete() |
bgneal@312 | 48 { |
bgneal@312 | 49 var count = messages_count_selected(); |
bgneal@312 | 50 if (count == 0) |
bgneal@312 | 51 { |
bgneal@312 | 52 alert("No messages selected."); |
bgneal@312 | 53 return false; |
bgneal@312 | 54 } |
bgneal@312 | 55 return confirm('Really delete selected messages?'); |
bgneal@312 | 56 } |
bgneal@312 | 57 |
bgneal@312 | 58 function messages_confirm_undelete() |
bgneal@312 | 59 { |
bgneal@312 | 60 var count = messages_count_selected(); |
bgneal@312 | 61 if (count == 0) |
bgneal@312 | 62 { |
bgneal@312 | 63 alert("No messages selected."); |
bgneal@312 | 64 return false; |
bgneal@312 | 65 } |
bgneal@312 | 66 return confirm('Really undelete selected messages?'); |
bgneal@312 | 67 } |