1 | <?php |
---|
2 | include("../inc/inc.Settings.php"); |
---|
3 | include("../inc/inc.AccessUtils.php"); |
---|
4 | include("../inc/inc.ClassAccess.php"); |
---|
5 | include("../inc/inc.ClassDocument.php"); |
---|
6 | include("../inc/inc.ClassFolder.php"); |
---|
7 | include("../inc/inc.ClassGroup.php"); |
---|
8 | include("../inc/inc.ClassUser.php"); |
---|
9 | include("../inc/inc.DBAccess.php"); |
---|
10 | include("../inc/inc.FileUtils.php"); |
---|
11 | include("../inc/inc.Language.php"); |
---|
12 | include("../inc/inc.OutUtils.php"); |
---|
13 | include("../inc/inc.Authentication.php"); |
---|
14 | |
---|
15 | $groups = getAllGroups(); |
---|
16 | $allUsers = getAllUsers(); |
---|
17 | |
---|
18 | |
---|
19 | printHTMLHead( getMLText("group_management") ); |
---|
20 | ?> |
---|
21 | <script language="JavaScript"> |
---|
22 | |
---|
23 | function checkForm1(num) { |
---|
24 | msg = ""; |
---|
25 | eval("var formObj = document.form" + num + "_1;"); |
---|
26 | |
---|
27 | if (formObj.name.value == "") msg += "<?php printMLText("js_no_name");?>\n"; |
---|
28 | if (formObj.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n"; |
---|
29 | if (msg != "") |
---|
30 | { |
---|
31 | alert(msg); |
---|
32 | return false; |
---|
33 | } |
---|
34 | else |
---|
35 | return true; |
---|
36 | } |
---|
37 | |
---|
38 | function checkForm2(num) { |
---|
39 | msg = ""; |
---|
40 | eval("var formObj = document.form" + num + "_2;"); |
---|
41 | |
---|
42 | if (formObj.userid.options[formObj.userid.selectedIndex].value == -1) msg += "<?php printMLText("js_select_user");?>\n"; |
---|
43 | |
---|
44 | if (msg != "") |
---|
45 | { |
---|
46 | alert(msg); |
---|
47 | return false; |
---|
48 | } |
---|
49 | else |
---|
50 | return true; |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | obj = -1; |
---|
55 | function showUser(selectObj) { |
---|
56 | if (obj != -1) |
---|
57 | obj.style.display = "none"; |
---|
58 | |
---|
59 | id = selectObj.options[selectObj.selectedIndex].value; |
---|
60 | if (id == -1) |
---|
61 | return; |
---|
62 | |
---|
63 | obj = document.getElementById("keywords" + id); |
---|
64 | obj.style.display = ""; |
---|
65 | } |
---|
66 | |
---|
67 | </script> |
---|
68 | <?php |
---|
69 | printTitleBar(getFolder($settings->_rootFolderID)); |
---|
70 | printCenterStart(); |
---|
71 | |
---|
72 | printStartBox(getMLText("add_group")); |
---|
73 | ?> |
---|
74 | <form action="../op/op.GroupMgr.php" name="form0_1" onsubmit="return checkForm1('0');"> |
---|
75 | <input type="Hidden" name="action" value="addgroup"> |
---|
76 | <table> |
---|
77 | <tr> |
---|
78 | <td class="inputDescription" valign="top"><?php printMLText("name");?>:</td> |
---|
79 | <td><input name="name"></td> |
---|
80 | </tr> |
---|
81 | <tr> |
---|
82 | <td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td> |
---|
83 | <td><textarea name="comment" rows="4" cols="30"></textarea></td> |
---|
84 | </tr> |
---|
85 | <tr> |
---|
86 | <td colspan="2"><br><input type="Submit"></td> |
---|
87 | </tr> |
---|
88 | </table> |
---|
89 | </form> |
---|
90 | |
---|
91 | <?php |
---|
92 | printNextBox(getMLText("edit_group")); |
---|
93 | ?> |
---|
94 | <table> |
---|
95 | <tr> |
---|
96 | <td class="inputDescription"><?php echo getMLText("name")?>:</td> |
---|
97 | <td> |
---|
98 | <select onchange="showUser(this)"> |
---|
99 | <option value="-1"><?php echo getMLText("choose_group")?> |
---|
100 | <?php |
---|
101 | foreach ($groups as $group) { |
---|
102 | print "<option value=\"".$group->getID()."\">" . $group->getName(); |
---|
103 | } |
---|
104 | ?> |
---|
105 | </select> |
---|
106 | </td> |
---|
107 | </tr> |
---|
108 | <?php |
---|
109 | foreach ($groups as $group) { |
---|
110 | ?> |
---|
111 | <tr id="keywords<?php echo $group->getID()?>" style="display : none;"> |
---|
112 | <td colspan="2"> |
---|
113 | |
---|
114 | <form action="../op/op.GroupMgr.php" name="form<?php print $group->getID();?>_1" onsubmit="return checkForm1('<?php print $group->getID();?>');"> |
---|
115 | <input type="Hidden" name="groupid" value="<?php print $group->getID();?>"> |
---|
116 | <input type="Hidden" name="action" value="editgroup"> |
---|
117 | <table border="0"> |
---|
118 | <tr> |
---|
119 | <td colspan="2"><hr size="1" width="100%" color="#000080" noshade></td> |
---|
120 | </tr> |
---|
121 | <tr> |
---|
122 | <td class="inputDescription" valign="top"><?php printMLText("name");?>:</td> |
---|
123 | <td class="standardText"><input name="name" value="<?php print $group->getName();?>"></td> |
---|
124 | </tr> |
---|
125 | <tr> |
---|
126 | <td class="inputDescription" valign="top"><?php printMLText("comment");?>:</td> |
---|
127 | <td class="standardText"><textarea name="comment" rows="4" cols="30"><?php print $group->getComment();?></textarea></td> |
---|
128 | </tr> |
---|
129 | <tr> |
---|
130 | <td colspan="2"><br><input type="Submit"></td> |
---|
131 | </tr> |
---|
132 | </table> |
---|
133 | </form> |
---|
134 | <hr size="1" width="100%" color="#000080" noshade> |
---|
135 | <table border="0" cellpadding="5" cellspacing="0"> |
---|
136 | <?php |
---|
137 | $members = $group->getUsers(); |
---|
138 | if (count($members) == 0) |
---|
139 | print "<tr><td class=\"groupMembers\">".getMLText("no_group_members")."</td></tr>"; |
---|
140 | else |
---|
141 | { |
---|
142 | print "<tr>\n"; |
---|
143 | print " <td style=\"border-bottom: 1pt solid #000080;\"> </td>\n"; |
---|
144 | print " <td style=\"border-bottom: 1pt solid #000080;\" class=\"groupMembers\"><i>".getMLText("name")."</i></td>\n"; |
---|
145 | print " <td style=\"border-bottom: 1pt solid #000080;\"> </td>\n"; |
---|
146 | print "</tr>\n"; |
---|
147 | foreach ($members as $member) |
---|
148 | { |
---|
149 | print "<tr>"; |
---|
150 | print "<td><img src=\"images/usericon.gif\" width=16 height=16></td>"; |
---|
151 | print "<td class=\"groupMembers\">" . $member->getFullName() . "</td>"; |
---|
152 | print "<td><a href=\"../op/op.GroupMgr.php?groupid=". $group->getID() . "&userid=".$member->getID()."&action=rmmember\"><img src=\"images/del.gif\" width=15 height=15 border=0></a>"; |
---|
153 | print "</tr>"; |
---|
154 | } |
---|
155 | } |
---|
156 | ?> |
---|
157 | </table> |
---|
158 | <form action="../op/op.GroupMgr.php" name="form<?php print $group->getID();?>_2" onsubmit="return checkForm2('<?php print $group->getID();?>');"> |
---|
159 | <input type="Hidden" name="action" value="addmember"> |
---|
160 | <input type="Hidden" name="groupid" value="<?php print $group->getID();?>"> |
---|
161 | <table> |
---|
162 | <tr> |
---|
163 | <td class="inputDescription"><?php printMLText("add_member");?>:</td> |
---|
164 | <td> |
---|
165 | <select name="userid"> |
---|
166 | <option value="-1"><?php printMLText("select_one");?> |
---|
167 | <option value="-1">------------------------------- |
---|
168 | <?php |
---|
169 | foreach ($allUsers as $currUser) |
---|
170 | if (!$group->isMember($currUser)) |
---|
171 | print "<option value=\"".$currUser->getID()."\">" . $currUser->getFullName() . "\n"; |
---|
172 | ?> |
---|
173 | </select> |
---|
174 | </td> |
---|
175 | </tr> |
---|
176 | <tr> |
---|
177 | <td colspan="2"><br><input type="Submit"></td> |
---|
178 | </tr> |
---|
179 | </table> |
---|
180 | </form> |
---|
181 | </div> |
---|
182 | <hr size="1" width="100%" color="#000080" noshade> |
---|
183 | <a class="standardText" href="../op/op.GroupMgr.php?groupid=<?php print $group->getID();?>&action=removegroup"><img src="images/del.gif" width="15" height="15" border="0" align="absmiddle" alt=""> <?php printMLText("rm_group");?></a> |
---|
184 | |
---|
185 | </td> |
---|
186 | </tr> |
---|
187 | <?php } ?> |
---|
188 | </table> |
---|
189 | |
---|
190 | <?php |
---|
191 | printEndBox(); |
---|
192 | |
---|
193 | printCenterEnd(); |
---|
194 | printHTMLFoot(); |
---|
195 | ?> |
---|