comparison media/js/messages/box.js @ 1:dbd703f7d63a

Initial import of sg101 stuff from private repository.
author gremmie
date Mon, 06 Apr 2009 02:43:12 +0000
parents
children
comparison
equal deleted inserted replaced
0:900ba3c7b765 1:dbd703f7d63a
1 function messages_master_click()
2 {
3 var state = document.getElementById('master_select').checked
4 for (i = 0; i < document.messages_box_form.length; ++i)
5 {
6 if (document.messages_box_form.elements[i].type == 'checkbox')
7 {
8 document.messages_box_form.elements[i].checked = state;
9 }
10 }
11 }
12
13 function messages_set_master()
14 {
15 var count = 0;
16 var numChkBoxes = 0;
17 for (i = 0; i < document.messages_box_form.length; ++i)
18 {
19 if (document.messages_box_form.elements[i].type == 'checkbox' &&
20 document.messages_box_form.elements[i].id != 'master_select')
21 {
22 ++numChkBoxes;
23 if (document.messages_box_form.elements[i].checked)
24 {
25 ++count;
26 }
27 }
28 }
29 document.getElementById('master_select').checked = count == numChkBoxes;
30 }
31
32 function messages_count_selected()
33 {
34 var count = 0;
35 for (i = 0; i < document.messages_box_form.length; ++i)
36 {
37 if (document.messages_box_form.elements[i].type == 'checkbox' &&
38 document.messages_box_form.elements[i].checked &&
39 document.messages_box_form.elements[i].id != 'master_select')
40 {
41 ++count;
42 }
43 }
44 return count;
45 }
46
47 function messages_confirm_delete()
48 {
49 var count = messages_count_selected();
50 if (count == 0)
51 {
52 alert("No messages selected.");
53 return false;
54 }
55 return confirm('Really delete selected messages?');
56 }
57
58 function messages_confirm_undelete()
59 {
60 var count = messages_count_selected();
61 if (count == 0)
62 {
63 alert("No messages selected.");
64 return false;
65 }
66 return confirm('Really undelete selected messages?');
67 }