root/contributed_modules/modules/usersets/page.usersets.php

Revision 6040, 5.3 kB (checked in by Nick_Lewis, 4 years ago)

New Module Usersets

Line 
1 <?php
2 //Copyright (C) ATL Telecom Ltd 2008 Nick Lewis
3 //
4 //This program is free software; you can redistribute it and/or
5 //modify it under the terms of the GNU General Public License
6 //as published by the Free Software Foundation; either version 2
7 //of the License, or (at your option) any later version.
8 //
9 //This program is distributed in the hope that it will be useful,
10 //but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //GNU General Public License for more details.
13
14 isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action='';
15
16 //the item we are currently displaying
17 isset($_REQUEST['itemid'])?$itemid=$_REQUEST['itemid']:$itemid='';
18
19 $dispnum = "usersets"; //used for switch on config.php
20
21 //if submitting form, update database
22 if(isset($_POST['action'])) {
23   switch ($action) {
24     case "add":
25       usersets_add($_POST);
26       needreload();
27       redirect_standard();
28     break;
29     case "delete":
30       usersets_del($itemid);
31       needreload();
32       redirect_standard();
33     break;
34     case "edit":
35       usersets_edit($itemid,$_POST);
36       needreload();
37       redirect_standard('itemid');
38     break;
39   }
40 }
41
42 //get list of permitted user sets
43 $usersetss = usersets_list();
44 ?>
45
46 </div> <!-- end content div so we can display rnav properly-->
47
48
49 <!-- right side menu -->
50 <div class="rnav"><ul>
51     <li><a <?php echo ($itemid=='' ? "id=\"current\"":'') ?> href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Permitted User Set")?></a></li>
52 <?php
53 if (isset($usersetss)) {
54   foreach ($usersetss as $usersets) {
55     echo "<li><a ".($itemid==$usersets['usersets_id'] ? "id=\"current\"":"")." href=\"config.php?display=".urlencode($dispnum)."&amp;itemid=".urlencode($usersets['usersets_id'])."\">{$usersets['description']}</a></li>";
56   }
57 }
58 ?>
59 </ul></div>
60
61 <div class="content">
62 <?php
63 if ($action == 'delete') {
64   echo '<br /><h3>'._("Permitted User Set ").' '.$itemid.' '._("deleted").'!</h3>';
65 } else {
66   if ($itemid){
67     //get details for this permitted user set
68     $thisItem = usersets_get($itemid);
69   }
70
71   $delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=delete';
72   $delButton = "
73       <form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">
74         <input type=\"hidden\" name=\"display\" value=\"{$dispnum}\" />
75         <input type=\"hidden\" name=\"itemid\" value=\"{$itemid}\" />
76         <input type=\"hidden\" name=\"action\" value=\"delete\" />
77         <input type=submit value=\""._("Delete User Set")."\" />
78       </form>";
79
80 ?>
81
82   <h2><?php echo ($itemid ? _("Permitted User Set:")." ". $itemid : _("Add Permitted User Set")); ?></h2>
83
84   <p><?php echo ($itemid ? '&nbsp;' : _("User Sets are used to manage lists of permitted users that can be given access to restricted features such as Outbound Routes.")); ?></p>
85
86 <?php   if ($itemid){  echo $delButton;   } ?>
87
88 <form name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();">
89   <input type="hidden" name="display" value="<?php echo $dispnum?>" />
90   <input type="hidden" name="action" value="<?php echo ($itemid ? 'edit' : 'add') ?>" />
91   <input type="hidden" name="deptname" value="<?php echo $_SESSION["AMP_user"]->_deptname ?>" />
92
93 <?php   if ($itemid){ ?>
94     <input type="hidden" name="account" value="<?php echo $itemid; ?>" />
95 <?php   }?>
96
97
98   <table>
99   <tr><td colspan="2"><div class="h5"><?php echo ($itemid ? _("Edit User Set") : _("New User Set")) ?><hr /></div></td></tr>
100
101   <tr>
102     <td><?php echo _("User Set Description:")?></td>
103     <td><input type="text" size=23 name="description" value="<?php echo (isset($thisItem['description']) ? $thisItem['description'] : ''); ?>" /></td>
104   </tr>
105 <tr><td>&nbsp;</td></tr>
106       <tr>
107         <td valign="top"><a href="#" class="info"><?php echo _("Trusted user list")?>:<span><br /><?php echo _("List of extensions that are permitted without requiring the user to enter their voicemail password.")?><br /><br /></span></a></td>
108         <td valign="top">
109           <?php $rows = 10; ?>
110           <textarea id="trustlist" cols="20" rows="<?php  echo $rows ?>" name="trustlist"><?php echo(isset($thisItem['trustlist']) ? $thisItem['trustlist'] : '');?></textarea><br />
111           <input type="submit" style="font-size:10px;" value="<?php echo _("Clean &amp; Remove duplicates")?>" />
112
113         </td>
114       </tr>
115 <tr><td>&nbsp;</td></tr>
116       <tr>
117         <td valign="top"><a href="#" class="info"><?php echo _("Authenticated user list")?>:<span><br /><?php echo _("List of extensions that are permitted once the user has entered their voicemail password.")?><br /><br /></span></a></td>
118         <td valign="top">
119           <?php $rows = 10; ?>
120           <textarea id="authlist" cols="20" rows="<?php  echo $rows ?>" name="authlist"><?php echo(isset($thisItem['authlist']) ? $thisItem['authlist'] : '');?></textarea><br />
121           <input type="submit" style="font-size:10px;" value="<?php echo _("Clean &amp; Remove duplicates")?>" />
122         </td>
123       </tr>
124 <tr><td>&nbsp;</td></tr>
125   <tr>
126     <td colspan="2"><br /><h6><input name="submit" type="submit" value="<?php echo _("Submit Changes")?>" /></h6></td>
127   </tr>
128
129   </table>
130 <script type="text/javascript">
131 <!--
132
133 var theForm = document.edit;
134 theForm.description.focus();
135
136 function edit_onsubmit() {
137
138   defaultEmptyOK = false;
139   if (!isAlphanumeric(theForm.description.value))
140     return warnInvalid(theForm.description, "Please enter a valid Description");
141
142   return true;
143 }
144
145
146 -->
147 </script>
148
149
150   </form>
151 <?php
152 } //end if action == delete
153 ?>
Note: See TracBrowser for help on using the browser.