root/modules/branches/2.4/callback/page.callback.php

Revision 5287, 5.5 kB (checked in by p_lindheimer, 5 years ago)

added callback_getdest() and callback_getdestinfo() and feedback on destination usage

  • 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 = "callback"; //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       callback_add($_POST);
26       needreload();
27       redirect_standard();
28     break;
29     case "delete":
30       callback_del($itemid);
31       needreload();
32       redirect_standard();
33     break;
34     case "edit":
35       callback_edit($itemid,$_POST);
36       needreload();
37       redirect_standard('itemid');
38     break;
39   }
40 }
41
42 //get list of time conditions
43 $callbacks = callback_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 Callback")?></a></li>
51 <?php
52 if (isset($callbacks)) {
53   foreach ($callbacks as $callback) {
54     echo "<li><a id=\"".($itemid==$callback['callback_id'] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&itemid=".urlencode($callback['callback_id'])."\">{$callback['description']}</a></li>";
55   }
56 }
57 ?>
58 </ul></div>
59
60 <div class="content">
61 <?php
62 if ($action == 'delete') {
63   echo '<br><h3>'._("Callback ").' '.$itemid.' '._("deleted").'!</h3>';
64 } else {
65   if ($itemid){
66     //get details for this time condition
67     $thisItem = callback_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 Callback")."\">
77       </form>";
78  
79 ?>
80
81   <h2><?php echo ($itemid ? _("Callback:")." ". $itemid : _("Add Callback")); ?></h2>
82  
83   <p><?php echo ($itemid ? '' : _("A callback will hang up on the caller and then call them back, directing them to the selected destination. This is useful for reducing mobile phone charges as well as other applications. Outbound calls will proceed according to the dial patterns in Outbound Routes.")); ?></p>
84
85 <?php   if ($itemid) {
86           echo $delButton; 
87           $usage_list = framework_display_destination_usage(callback_getdest($itemid));
88           if (!empty($usage_list)) {
89 ?>
90             <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a>
91 <?php
92           }
93         }
94 ?>
95
96
97 <form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();">
98   <input type="hidden" name="display" value="<?php echo $dispnum?>">
99   <input type="hidden" name="action" value="<?php echo ($itemid ? 'edit' : 'add') ?>">
100   <input type="hidden" name="deptname" value="<?php echo $_SESSION["AMP_user"]->_deptname ?>">
101   <table>
102   <tr><td colspan="2"><h5><?php echo ($itemid ? _("Edit Callback") : _("Add Callback")) ?><hr></h5></td></tr>
103
104 <?php   if ($itemid){ ?>
105     <input type="hidden" name="account" value="<?php echo $itemid; ?>">
106 <?php   }?>
107
108   <tr>
109     <td><a href="#" class="info"><?php echo _("Callback Description:")?><span><?php echo _("Enter a description for this callback.")?></span></a></td>
110     <td><input type="text" name="description" value="<?php echo (isset($thisItem['description']) ? $thisItem['description'] : ''); ?>"></td>
111   </tr>
112   <tr>
113     <td><a href="#" class="info"><?php echo _("Callback Number:")?><span><?php echo _("Optional: Enter the number to dial for the callback.  Leave this blank to just dial the incoming Caller ID Number")?></span></a></td>
114     <td><input type="text" name="callbacknum" value="<?php echo (isset($thisItem['callbacknum']) ? $thisItem['callbacknum'] : ''); ?>"></td>
115   </tr>
116   <tr>
117     <td><a href="#" class="info"><?php echo _("Delay Before Callback:")?><span><?php echo _("Optional: Enter the number of seconds the system should wait before calling back.")?></span></a></td>
118     <td><input size="3" type="text" name="sleep" value="<?php echo (isset($thisItem['sleep']) ? $thisItem['sleep'] : ''); ?>"></td>
119   </tr>
120   <tr><td colspan="2"><br><h5><?php echo _("Destination after Callback")?>:<hr></h5></td></tr>
121
122 <?php
123 //draw goto selects
124 if (isset($thisItem)) {
125   echo drawselects($thisItem['destination'],0);
126 } else {
127   echo drawselects(null, 0);
128 }
129 ?>
130
131   <tr>
132     <td colspan="2"><br><h6><input name="submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td>   
133   </tr>
134   </table>
135 <script language="javascript">
136 <!--
137
138 var theForm = document.edit;
139 theForm.description.focus();
140
141 function edit_onsubmit() {
142   setDestinations(edit,1);
143  
144   defaultEmptyOK = false;
145   if (!isAlphanumeric(theForm.description.value))
146     return warnInvalid(theForm.description, "Please enter a valid Description");
147    
148   if (!validateDestinations(edit,1,true))
149     return false;
150  
151   return true;
152 }
153
154
155 -->
156 </script>
157
158
159   </form>
160 <?php   
161 } //end if action == delete
162 ?>
Note: See TracBrowser for help on using the browser.