root/modules/branches/2.9/queueprio/page.queueprio.php

Revision 5919, 5.3 kB (checked in by mbrevda, 5 years ago)

#2845 add tabindex to all items except those called via drawlistmenu or drawselect or other hooks. also missed page.routing.php

Line 
1 <?php
2 /** Language Module for FreePBX 2.4
3  * Copyright 2006 Philippe Lindheimer - Astrogen LLC
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
15 $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'setup';
16 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] :  '';
17 if (isset($_REQUEST['delete'])) $action = 'delete';
18
19 $queueprio_id = isset($_REQUEST['queueprio_id']) ? $_REQUEST['queueprio_id'] :  false;
20 $description = isset($_REQUEST['description']) ? $_REQUEST['description'] :  '';
21 $queue_priority = isset($_REQUEST['queue_priority']) ? $_REQUEST['queue_priority'] :  '';
22 $dest = isset($_REQUEST['dest']) ? $_REQUEST['dest'] :  '';
23
24 if (isset($_REQUEST['goto0']) && $_REQUEST['goto0']) {
25     $dest = $_REQUEST[ $_REQUEST['goto0'].'0' ];
26 }
27
28 switch ($action) {
29     case 'add':
30         queueprio_add($description, $queue_priority, $dest);
31         needreload();
32         redirect_standard();
33     break;
34     case 'edit':
35         queueprio_edit($queueprio_id, $description, $queue_priority, $dest);
36         needreload();
37         redirect_standard('extdisplay');
38     break;
39     case 'delete':
40         queueprio_delete($queueprio_id);
41         needreload();
42         redirect_standard();
43     break;
44 }
45
46 ?> 
47 </div>
48
49 <div class="rnav"><ul>
50 <?php
51
52 echo '<li><a href="config.php?display=queueprio&amp;type='.$type.'">'._('Add Queue Priority').'</a></li>';
53
54 foreach (queueprio_list() as $row) {
55     echo '<li><a href="config.php?display=queueprio&amp;type='.$type.'&amp;extdisplay='.$row['queueprio_id'].'" class="">'.$row['description'].'</a></li>';
56 }
57
58 ?>
59 </ul></div>
60
61 <div class="content">
62
63 <?php
64
65 if ($extdisplay) {
66     // load
67     $row = queueprio_get($extdisplay);
68     
69     $description = $row['description'];
70     $queue_priority   = $row['queue_priority'];
71     $dest        = $row['dest'];
72
73     echo "<h2>"._("Edit: ")."$description ($queue_priority)"."</h2>";
74 } else {
75     echo "<h2>"._("Add Queue Priority")."</h2>";
76 }
77
78 $helptext = _("Queue Priority allows you to set a caller's priority in a queue. By default, a caller's priority is set to 0. Setting a higher priority will put the caller ahead of other callers already in a queue. The priority will apply to any queue that this caller is eventually directed to. You would typically set the destination to a queue, however that is not necessary. You might set the destination of a priority customer DID to an IVR that is used by other DIDs, for example, and any subsequent queue that is entered would be entered with this priority");
79 echo $helptext;
80 ?>
81
82 <form name="editQueuePriority" action="<?php  $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkQueuePriority(editQueuePriority);">
83     <input type="hidden" name="extdisplay" value="<?php echo $extdisplay; ?>">
84     <input type="hidden" name="queueprio_id" value="<?php echo $extdisplay; ?>">
85     <input type="hidden" name="action" value="<?php echo ($extdisplay ? 'edit' : 'add'); ?>">
86     <table>
87     <tr><td colspan="2"><h5><?php  echo ($extdisplay ? _("Edit Queue Priority Instance") : _("Add Queue Priority Instance")) ?><hr></h5></td></tr>
88     <tr>
89         <td><a href="#" class="info"><?php echo _("Description")?>:<span><?php echo _("The descriptive name of this Queue Priority instance.")?></span></a></td>
90         <td><input size="30" type="text" name="description" value="<?php  echo $description; ?>" tabindex="<?php echo ++$tabindex;?>"></td>
91     </tr>
92     <tr>
93         <td><a href="#" class="info"><?php echo _("Priority")?>:<span><?php echo _("The Queue Priority to set")?></span></a></td>
94         <td>
95             <select name="queue_priority" tabindex="<?php echo ++$tabindex;?>">
96             <?php
97                 $default = (isset($queue_priority) ? $queue_priority : 0);
98                 for ($i=0; $i <= 20; $i++) {
99                     echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.$i.'</option>';
100                 }
101             ?>       
102             </select>       
103         </td>
104     <tr><td colspan="2"><br><h5><?php echo _("Destination")?>:<hr></h5></td></tr>
105
106 <?php
107 //draw goto selects
108 echo drawselects($dest,0);
109 ?>
110            
111     <tr>
112         <td colspan="2"><br><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>">
113             <?php if ($extdisplay) { echo '&nbsp;<input name="delete" type="submit" value="'._("Delete").'">'; } ?>
114         </td>       
115
116         <?php
117         if ($extdisplay) {
118             $usage_list = framework_display_destination_usage(queueprio_getdest($extdisplay));
119             if (!empty($usage_list)) {
120             ?>
121                 <tr><td colspan="2">
122                 <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a>
123                 </td></tr>
124             <?php
125             }
126         }
127         ?>
128     </tr>
129 </table>
130 </form>
131
132 <script queueprio="javascript">
133 <!--
134
135 function checkQueuePriority(theForm) {
136     var msgInvalidDescription = "<?php echo _('Invalid description specified'); ?>";
137
138     // set up the Destination stuff
139     setDestinations(theForm, '_post_dest');
140
141     // form validation
142     defaultEmptyOK = false;   
143     if (isEmpty(theForm.description.value))
144         return warnInvalid(theForm.description, msgInvalidDescription);
145
146     if (!validateDestinations(theForm, 1, true))
147         return false;
148
149     return true;
150 }
151 //-->
152 </script>
153
Note: See TracBrowser for help on using the browser.