2 global $form,$listid,$groups;
3 if (preg_match("/\/includes\//", $PHP_SELF)) {
4 die ("You can't access this file directly!");
6 $form = clean_word($form);
7 $listid = clean_int($listid);
9 <script type="text/javascript">
11 function OkButton () {
12 var parentlist = window.opener.document.<?php echo $form?>.elements[<?php echo $listid?>];
13 var thislist = document.userselform.elements[0];
17 // select/deselect all elements
18 for ( i = 0; i < parentlist.length; i++ ) {
20 for ( j = 0; j < thislist.length; j++ ) {
21 if ( thislist.options[j].value == parentlist.options[i].value ) {
22 state = thislist.options[j].selected;
23 found += " " + thislist.options[j].value;
26 parentlist.options[i].selected = state;
28 //alert ( "Found: " + found );
32 function selectAll() {
33 var list = document.userselform.elements[0];
35 for ( i = 0; i < list.options.length; i++ ) {
36 list.options[i].selected = true;
40 function selectNone() {
41 var list = document.userselform.elements[0];
43 for ( i = 0; i < list.options.length; i++ ) {
44 list.options[i].selected = false;
48 // set the state (selected or unselected) if a single
49 // user in the list of users
50 function selectByLogin ( login, state ) {
51 //alert ( "selectByLogin ( " + login + ", " + state + " )" );
52 var list = document.userselform.elements[0];
54 for ( i = 0; i < list.options.length; i++ ) {
55 //alert ( "text: " + list.options[i].text );
56 if ( list.options[i].value == login ) {
57 list.options[i].selected = state;
63 function toggleGroup ( state ) {
64 var list = document.userselform.elements[4];
65 var selNum = list.selectedIndex;
67 for ( $i = 0; $i < count ( $groups ); $i++ ) {
68 print "\n if ( selNum == $i ) {\n";
69 $res = dbi_query ( "SELECT cal_login from webcal_group_user " .
70 "WHERE cal_group_id = " . $groups[$i]["cal_group_id"] );
72 while ( $row = dbi_fetch_row ( $res ) ) {
73 print " selectByLogin ( \"$row[0]\", state );\n";
75 dbi_free_result ( $res );
82 // Select users from a group
83 function selectGroupMembers () {
87 // De-select users from a group
88 function deselectGroupMembers () {
89 toggleGroup ( false );