root/modules/branches/2.2/pinsets/page.pinsets.php

Revision 3204, 4.8 kB (checked in by gregmac, 6 years ago)

Updated for changes in r3203: only pass identifying variable on edit, and explicitly pass extdisplay if needed (as it is no longer included by default)

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 <?php /* $Id */
2 //Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca)
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 = "pinsets"; //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       pinsets_add($_POST);
26       needreload();
27       redirect_standard();
28     break;
29     case "delete":
30       pinsets_del($itemid);
31       needreload();
32       redirect_standard();
33     break;
34     case "edit":
35       pinsets_edit($itemid,$_POST);
36       needreload();
37       redirect_standard('itemid');
38     break;
39   }
40 }
41
42 //get list of time conditions
43 $pinsetss = pinsets_list();
44 ?>
45
46 </div> <!-- end content div so we can display rnav properly-->
47
48 <!-- right side menu -->
49 <div class="rnav"><ul>
50     <li><a id="<?php echo ($itemid=='' ? 'current':'') ?>" href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Password Set")?></a></li>
51 <?php
52 if (isset($pinsetss)) {
53   foreach ($pinsetss as $pinsets) {
54     echo "<li><a id=\"".($itemid==$pinsets['pinsets_id'] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&itemid=".urlencode($pinsets['pinsets_id'])."\">{$pinsets['description']}</a></li>";
55   }
56 }
57 ?>
58 </ul></div>
59
60 <div class="content">
61 <?php
62 if ($action == 'delete') {
63   echo '<br><h3>'._("PIN Set ").' '.$itemid.' '._("deleted").'!</h3>';
64 } else {
65   if ($itemid){
66     //get details for this time condition
67     $thisItem = pinsets_get($itemid);
68   }
69
70   $delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=delete';
71   $delButton = "
72       <form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST>
73         <input type=\"hidden\" name=\"display\" value=\"{$dispnum}\">
74         <input type=\"hidden\" name=\"itemid\" value=\"{$itemid}\">
75         <input type=\"hidden\" name=\"action\" value=\"delete\">
76         <input type=submit value=\""._("Delete PIN Set")."\">
77       </form>";
78  
79 ?>
80
81   <h2><?php echo ($itemid ? _("PIN Set:")." ". $itemid : _("Add PIN Set")); ?></h2>
82  
83   <p><?php echo ($itemid ? '' : _("PIN Sets are used to manage lists of PINs that can be used to access restricted features such as Outbound Routes. The PIN can also be added to the CDR record's 'accountcode' field.")); ?></p>
84
85 <?php   if ($itemid){  echo $delButton;   } ?>
86
87 <form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();">
88   <input type="hidden" name="display" value="<?php echo $dispnum?>">
89   <input type="hidden" name="action" value="<?php echo ($itemid ? 'edit' : 'add') ?>">
90   <input type="hidden" name="deptname" value="<?php echo $_SESSION["AMP_user"]->_deptname ?>">
91  
92   <table>
93   <tr><td colspan="2"><h5><?php echo ($itemid ? _("Edit PIN Set") : _("New PIN Set")) ?><hr></h5></td></tr>
94
95 <?php   if ($itemid){ ?>
96     <input type="hidden" name="account" value="<?php echo $itemid; ?>">
97 <?php   }?>
98
99   <tr>
100     <td><?php echo _("PIN Set Description:")?></td>
101     <td><input type="text" size=23 name="description" value="<?php echo (isset($thisItem['description']) ? $thisItem['description'] : ''); ?>"></td>
102   </tr>
103   <tr>
104     <td><a href="#" class="info"><?php echo _("Record In CDR?:")?><span><?php echo _("Select this box if you would like to record the PIN in the call detail records when used")?></span></a></td>
105     <td><input type="checkbox" name="addtocdr" value="1" <?php echo (isset($thisItem['addtocdr']) && $thisItem['addtocdr'] == '1' ? 'CHECKED' : ''); ?>></td>
106   </tr>
107   <tr>
108     <td><a href="#" class="info"><?php echo _("PIN List:")?><span><?php echo _("Enter a list of one or more PINs.  One PIN per line.")?></span></a></td>
109     <td>
110       <textarea rows=15 cols=20 name="passwords"><?php echo (isset($thisItem['passwords']) ? $thisItem['passwords'] : ''); ?></textarea>
111     </td>
112   </tr>
113
114   <tr>
115     <td colspan="2"><br><h6><input name="submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td>   
116   </tr>
117   </table>
118 <script language="javascript">
119 <!--
120
121 var theForm = document.edit;
122 theForm.description.focus();
123
124 function edit_onsubmit() {
125   setDestinations(edit,1);
126  
127   defaultEmptyOK = false;
128   if (!isAlphanumeric(theForm.description.value))
129     return warnInvalid(theForm.description, "Please enter a valid Description");
130    
131   if (!validateDestinations(edit,1,true))
132     return false;
133  
134   return true;
135 }
136
137
138 -->
139 </script>
140
141
142   </form>
143 <?php   
144 } //end if action == delete
145 ?>
Note: See TracBrowser for help on using the browser.