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

Revision 5745, 30.7 kB (checked in by p_lindheimer, 5 years ago)

add oldstyle module hook so other modules can hook these

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
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 //used for switch on config.php
15 $dispnum = 'queues';
16
17 isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action='';
18 //the extension we are currently displaying
19 isset($_REQUEST['extdisplay'])?$extdisplay=$_REQUEST['extdisplay']:$extdisplay='';
20 isset($_REQUEST['account'])?$account = $_REQUEST['account']:$account='';
21 isset($_REQUEST['name'])?$name = $_REQUEST['name']:$name='';
22 isset($_REQUEST['password'])?$password = $_REQUEST['password']:$password='';
23 isset($_REQUEST['agentannounce'])?$agentannounce = $_REQUEST['agentannounce']:$agentannounce='';
24 isset($_REQUEST['prefix'])?$prefix = $_REQUEST['prefix']:$prefix='';
25 isset($_REQUEST['alertinfo'])?$alertinfo = $_REQUEST['alertinfo']:$alertinfo='';
26 isset($_REQUEST['joinannounce'])?$joinannounce = $_REQUEST['joinannounce']:$joinannounce='';
27 $maxwait = isset($_REQUEST['maxwait'])?$_REQUEST['maxwait']:'';
28 $cwignore = isset($_REQUEST['cwignore'])?$_REQUEST['cwignore']:'0';
29 $rtone = isset($_REQUEST['rtone'])?$_REQUEST['rtone']:'0';
30
31 if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) {
32     $goto = $_REQUEST[$_REQUEST['goto0']."0"];
33 } else {
34     $goto = '';
35 }
36 if (isset($_REQUEST["members"])) {
37     $members = explode("\n",$_REQUEST["members"]);
38
39     if (!$members) {
40         $members = null;
41     }
42     
43     foreach (array_keys($members) as $key) {
44         //trim it
45         $members[$key] = trim($members[$key]);
46
47         // check if an agent (starts with a or A)
48
49         if (strtoupper(substr($members[$key],0,1)) == "A") {
50             // remove invalid chars
51             $members[$key] = "A".preg_replace("/[^0-9#\,*]/", "", $members[$key]);
52             $agent = 1;
53         } else {
54             // remove invalid chars
55             $members[$key] = preg_replace("/[^0-9#\,*]/", "", $members[$key]);
56             $agent = 0;
57         }
58
59         $penalty_pos = strrpos($members[$key], ",");
60         if ( $penalty_pos === false ) {
61                 $penalty_val = 0;
62         } else {
63                 $penalty_val = substr($members[$key], $penalty_pos+1); // get penalty
64                 $members[$key] = substr($members[$key],0,$penalty_pos); // clean up ext
65                 $members[$key] = preg_replace("/[^0-9#*]/", "", $members[$key]); //clean out other ,'s
66                 $penalty_val = preg_replace("/[^0-9*]/", "", $penalty_val); // get rid of #'s if there
67                 $penalty_val = ($penalty_val == "") ? 0 : $penalty_val;
68         }
69
70         // remove blanks // prefix with the channel
71         if (empty($members[$key])) 
72             unset($members[$key]);
73         elseif ($agent) {
74             $members[$key] = "Agent/".ltrim($members[$key],"aA").",".$penalty_val;
75         } else {
76             $members[$key] = "Local/".$members[$key]."@from-internal/n,".$penalty_val;
77         }
78     }
79     
80     // check for duplicates, and re-sequence
81     // $members = array_values(array_unique($members));
82 }
83
84 // do if we are submitting a form
85 if(isset($_POST['action'])){
86     //check if the extension is within range for this user
87     if (isset($account) && !checkRange($account)){
88         echo "<script>javascript:alert('"._("Warning! Extension")." $account "._("is not allowed for your account.")."');</script>";
89     } else {
90         
91         //if submitting form, update database
92         switch ($action) {
93             case "add":
94                 $conflict_url = array();
95                 $usage_arr = framework_check_extension_usage($account);
96                 if (!empty($usage_arr)) {
97                     $conflict_url = framework_display_extension_usage_alert($usage_arr);
98                 } else {
99                     queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo,$cwignore);
100                     needreload();
101                     redirect_standard();
102                 }
103             break;
104             case "delete":
105                 queues_del($account);
106                 needreload();
107                 redirect_standard();
108             break;
109             case "edit"//just delete and re-add
110                 queues_del($account);
111                 queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo,$cwignore);
112                 needreload();
113                 redirect_standard('extdisplay');
114             break;
115         }
116     }
117 }
118
119 //get unique queues
120 $queues = queues_list();
121     
122 ?>
123 </div>
124
125 <div class="rnav"><ul>
126     <li><a id="<?php echo ($extdisplay=='' ? 'current':'') ?>" href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Queue")?></a></li>
127 <?php
128 if (isset($queues)) {
129     foreach ($queues as $queue) {
130         echo "<li><a id=\"".($extdisplay==$queue[0] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&extdisplay=".urlencode($queue[0])."\">{$queue[0]}:{$queue[1]}</a></li>";
131     }
132 }
133 ?>
134 </ul>
135 </div>
136
137 <div class="content">
138 <?php
139 if ($action == 'delete') {
140     echo '<br><h3>'._("Queue").' '.$account.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>';
141 } else {
142     $member = array();
143     //get members in this queue
144     $thisQ = queues_get($extdisplay);
145     //create variables
146     extract($thisQ);
147     
148     $delButton = "
149                 <form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST>
150                     <input type=\"hidden\" name=\"display\" value=\"{$dispnum}\">
151                     <input type=\"hidden\" name=\"account\" value=\"{$extdisplay}\">
152                     <input type=\"hidden\" name=\"action\" value=\"delete\">
153                     <input type=submit value=\""._("Delete Queue")."\">
154                 </form>";
155 ?>
156
157 <?php if (!empty($conflict_url)) {
158           echo "<h5>"._("Conflicting Extensions")."</h5>";
159           echo implode('<br .>',$conflict_url);
160       }
161 ?>
162 <?php if ($extdisplay != '') { ?>
163     <h2><?php echo _("Queue:")." ". $extdisplay; ?></h2>
164 <?php } else { ?>
165     <h2><?php echo _("Add Queue"); ?></h2>
166 <?php } ?>
167
168 <?php        if ($extdisplay != '') {
169                     echo $delButton;
170                     $usage_list = framework_display_destination_usage(queues_getdest($extdisplay));
171                     if (!empty($usage_list)) {
172 ?>
173                         <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a>
174 <?php
175                     }
176                 }
177 ?>
178     <form autocomplete="off" name="editQ" action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
179     <input type="hidden" name="display" value="<?php echo $dispnum?>">
180     <input type="hidden" name="action" value="<?php echo (($extdisplay != '') ? 'edit' : 'add') ?>">
181     <table>
182     <tr><td colspan="2"><h5><?php echo ($extdisplay ? _("Edit Queue") : _("Add Queue")) ?><hr></h5></td></tr>
183     <tr>
184 <?php        if ($extdisplay != ''){ ?>
185         <input type="hidden" name="account" value="<?php echo $extdisplay; ?>">
186 <?php        } else { ?>
187         <td><a href="#" class="info"><?php echo _("Queue Number:")?><span><?php echo _("Use this number to dial into the queue, or transfer callers to this number to put them into the queue.<br><br>Agents will dial this queue number plus * to log onto the queue, and this queue number plus ** to log out of the queue.<br><br>For example, if the queue number is 123:<br><br><b>123* = log in<br>123** = log out</b>")?></span></a></td>
188         <td><input type="text" name="account" value=""></td>
189 <?php        } ?>
190     </tr>
191
192     <tr>
193         <td><a href="#" class="info"><?php echo _("Queue Name:")?><span><?php echo _("Give this queue a brief name to help you identify it.")?></span></a></td>
194         <td><input type="text" name="name" value="<?php echo (isset($name) ? $name : ''); ?>"></td>
195     </tr>
196
197     <tr>
198         <td><a href="#" class="info"><?php echo _("Queue Password:")?><span><?php echo _("You can require agents to enter a password before they can log in to this queue.<br><br>This setting is optional.")?></span></a></td>
199         <td><input type="text" name="password" value="<?php echo (isset($password) ? $password : ''); ?>"></td>
200     </tr>
201
202     <tr>
203         <td><a href="#" class="info"><?php echo _("CID Name Prefix:")?><span><?php echo _("You can optionally prefix the Caller ID name of callers to the queue. ie: If you prefix with \"Sales:\", a call from John Doe would display as \"Sales:John Doe\" on the extensions that ring.")?></span></a></td>
204         <td><input size="4" type="text" name="prefix" value="<?php echo (isset($prefix) ? $prefix : ''); ?>"></td>
205     </tr>
206
207     <tr>
208         <td><a href="#" class="info"><?php echo _("Alert Info")?><span><?php echo _('ALERT_INFO can be used for distinctive ring with SIP devices.')?></span></a>:</td>
209         <td><input type="text" name="alertinfo" size="30" value="<?php echo (isset($alertinfo)?$alertinfo:'') ?>"></td>
210     </tr>
211
212     <tr>
213         <td valign="top"><a href="#" class="info"><?php echo _("Static Agents") ?>:<span><br><?php echo _("Static agents are extensions that are assumed to always be on the queue.  Static agents do not need to 'log in' to the queue, and cannot 'log out' of the queue.<br><br>List extensions to ring, one per line.<br><br>You can include an extension on a remote system, or an external number (Outbound Routing must contain a valid route for external numbers).<br><br>You can list agents defined in agents.conf by preceding the agent number with A, so agent 4002 would be listed as A4002. This is experimental and not supported. There are known issues, such as the inability for an agents.conf agent to do subsequent transfers to voicemail<br><br>In all cases, you can put a \",\" after the agent followed by a penalty value. Use penalties at your own risk, they are very broken in asterisk.") ?><br><br></span></a></td>
214         <td valign="top">
215             <textarea id="members" cols="15" rows="<?php  $rows = count($member)+1; echo (($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows) ); ?>" name="members"><?php foreach ($member as $mem) { $premem = ""; if (substr($mem,0,5) == "Agent") {$premem = "A";}; $mem = $premem.rtrim(ltrim(strstr($mem,"/"),"/"),"@from-internal");echo substr($mem,0,(strpos($mem,"@")!==false?strpos($mem,"@"):strpos($mem,","))).substr($mem,strrpos($mem, ","))."\n"; }?></textarea>
216         </td>
217     </tr>
218
219     <tr>
220         <td>
221         <a href=# class="info"><?php echo _("Extension Quick Pick")?>
222             <span>
223                 <?php echo _("Choose an extension to append to the end of the static agents list above.")?>
224             </span>
225         </a>
226         </td>
227         <td>
228             <select onChange="insertExten();" id="insexten">
229                 <option value=""><?php echo _("(pick extension)")?></option>
230     <?php
231                 $results = core_users_list();
232                 foreach ($results as $result) {
233                     echo "<option value='".$result[0]."'>".$result[0]." (".$result[1].")</option>\n";
234                 }
235     ?>
236             </select>
237         </td>
238     </tr>
239
240     <tr><td colspan="2"><br><h5><?php echo _("Queue Options")?><hr></h5></td></tr>
241 <?php if(function_exists('recordings_list')) { //only include if recordings is enabled?>
242     <tr>
243         <td><a href="#" class="info"><?php echo _("Agent Announcement:")?><span><?php echo _("Announcement played to the Agent prior to bridging in the caller <br><br> Example: \"the Following call is from the Sales Queue\" or \"This call is from the Technical Support Queue\".<br><br>To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td>
244         <td>
245             <select name="agentannounce"/>
246             <?php
247                 $tresults = recordings_list();
248                 $default = (isset($agentannounce) ? $agentannounce : 'None');
249
250                 $compound_recordings = false;
251                 $is_error = false;
252
253                 echo '<option value="None">'._("None").'</option>';
254                 if (isset($tresults[0])) {
255                     foreach ($tresults as $tresult) {
256                         if (strpos($tresult[2],"&") === false) {
257                             echo '<option value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]."</option>\n";
258                         } else {
259                             $compound_recordings = true;
260                             echo '<option style="color:red" value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]." (**)</option>\n";
261                             if ($tresult[2] == $default) {
262                                 $is_error = true;
263                             }
264                         }
265                     }
266                 }
267             ?>       
268             </select>       
269             <?php
270             if ($compound_recordings) {
271             ?>
272                 <small><a style="color:red"  href="#" class="info"><?php echo ($is_error ? _("(**) ERRORS") : _("(**) Warning Potential Errors"))?>
273                     <span>
274                         <?php
275                             if ($is_error) {
276                                 echo _("ERROR: You have configured a compound annoucement in your selection. These are annoucements composed of multiple concatenated sound files. The Queue system is not able to play such sound files. Your announcement file will be concatentated and only the first sound file will be played.");
277                             } else {
278                                 echo _("There are compound annoucements in your selection. These are annoucements composed of multiple concatenated sound files. The Queue system is not able to play such sound files. If you choose one of these annoucements your announcement will be concatentated and only the first sound file will be played.");
279                             }
280                         ?>
281                     </span></small>
282                 </a>
283             <?php
284             }
285             ?>
286         </td>
287     </tr>
288
289 <?php } else { ?>
290     <tr>
291         <td><a href="#" class="info"><?php echo _("Agent Announcement:")?><span><?php echo _("Announcement played to the Agent prior to bridging in the caller <br><br> Example: \"the Following call is from the Sales Queue\" or \"This call is from the Technical Support Queue\".<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option")?></span></a></td>
292         <td>
293             <?php
294                 $default = (isset($agentannounce) ? $agentannounce : '');
295             ?>
296             <input type="hidden" name="agentannounce" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?>
297         </td>
298     </tr>
299 <?php } ?>
300
301 <?php if(function_exists('music_list')) { //only include if music module is enabled?>
302     <tr>
303         <td><a href="#" class="info"><?php echo _("Music on Hold Class:")?><span><?php echo _("Music (or Commercial) played to the caller while they wait in line for an available agent. Choose \"inherit\" if you want the MoH class to be what is currently selected, such as by the inbound route.<br><br>  This music is defined in the \"Music on Hold\" Menu to the left.")?></span></a></td>
304         <td>
305             <select name="music"/>
306             <?php
307                 $tresults = music_list($amp_conf['ASTVARLIBDIR']."/mohmp3");
308                 array_unshift($tresults,'inherit');
309                 $default = (isset($music) ? $music : 'inherit');
310                 if (isset($tresults)) {
311                     foreach ($tresults as $tresult) {
312                         $searchvalue="$tresult";   
313                         echo '<option value="'.$tresult.'" '.($searchvalue == $default ? 'SELECTED' : '').'>'.$tresult;
314                     }
315                 }
316             ?>       
317             </select>       
318         </td>
319     </tr>
320 <?php } ?>
321
322     <tr>
323         <td><a href="#" class="info"><?php echo _("Ringing Instead of MoH:")?><span><?php echo _("Enabling this option make callers hear a ringing tone instead of Music on Hold.<br/>If this option is enabled, settings of the previous drop down are ignored.")?></span></a></td>
324         <td>
325             <input name="rtone" type="checkbox" value="1" <?php echo (isset($rtone) && $rtone == 1 ? 'checked' : ''); ?> />
326         </td>
327     </tr>
328
329     <tr>
330         <td><a href="#" class="info"><?php echo _("Max Wait Time:")?><span><?php echo _("The maximum number of seconds a caller can wait in a queue before being pulled out.  (0 for unlimited).")?></span></a></td>
331         <td>
332             <select name="maxwait"/>
333             <?php
334                 $default = (isset($maxwait) ? $maxwait : 0);
335                 for ($i=0; $i < 60; $i+=10) {
336                     if ($i == 0)
337                         echo '<option value="">'._("Unlimited").'</option>';
338                     else
339                         echo '<option value="'.$i.'"'.($i == $maxwait ? ' SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
340                 }
341                 for ($i=60; $i < 300; $i+=30) {
342                     echo '<option value="'.$i.'"'.($i == $maxwait ? ' SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
343                 }
344                 for ($i=300; $i < 1200; $i+=60) {
345                     echo '<option value="'.$i.'"'.($i == $maxwait ? ' SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
346                 }
347                 for ($i=1200; $i <= 3600; $i+=300) {
348                     echo '<option value="'.$i.'"'.($i == $maxwait ? ' SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
349                 }
350             ?>       
351             </select>       
352         </td>
353     </tr>
354
355     <tr>
356         <td><a href="#" class="info"><?php echo _("Max Callers:")?><span><?php echo _("Maximum number of people waiting in the queue (0 for unlimited)")?></span></a></td>
357         <td>
358             <select name="maxlen"/>
359             <?php
360                 $default = (isset($maxlen) ? $maxlen : 0);
361                 for ($i=0; $i <= 50; $i++) {
362                     echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.$i.'</option>';
363                 }
364             ?>       
365             </select>       
366         </td>
367     </tr>
368
369     <tr>
370         <td><a href="#" class="info"><?php echo _("Join Empty:")?><span><?php echo _("If you wish to allow callers to join queues that currently have no agents, set this to yes. Set to strict if callers cannot join a queue with no members or only unavailable members")?></span></a></td>
371         <td>
372             <select name="joinempty"/>
373             <?php
374                 $default = (isset($joinempty) ? $joinempty : 'yes');
375                 $items = array('yes'=>_("Yes"),'strict'=>_("Strict"),'no'=>_("No"));
376                 foreach ($items as $item=>$val) {
377                     echo '<option value="'.$item.'" '. ($default == $item ? 'SELECTED' : '').'>'.$val;
378                 }
379             ?>       
380             </select>       
381         </td>
382     </tr>
383
384     <tr>
385         <td><a href="#" class="info"><?php echo _("Leave When Empty:")?><span><?php echo _("If you wish to remove callers from the queue if there are no agents present, set this to yes. Set to strict if callers cannot join a queue with no members or only unavailable members")?></span></a></td>
386         <td>
387             <select name="leavewhenempty"/>
388             <?php
389                 $default = (isset($leavewhenempty) ? $leavewhenempty : 'no');
390                 $items = array('yes'=>_("Yes"),'strict'=>_("Strict"),'no'=>_("No"));
391                 foreach ($items as $item=>$val) {
392                     echo '<option value="'.$item.'" '. ($default == $item ? 'SELECTED' : '').'>'.$val;
393                 }
394             ?>       
395             </select>       
396         </td>
397     </tr>
398
399     <tr>
400         <td>
401             <a href="#" class="info"><?php echo _("Ring Strategy:")?>
402                 <span>
403                     <b><?php echo _("ringall")?></b>:  <?php echo _("ring all available agents until one answers (default)")?><br>
404                     <b><?php echo _("roundrobin")?></b>: <?php echo _("take turns ringing each available agent")?><br>
405                     <b><?php echo _("leastrecent")?></b>: <?php echo _("ring agent which was least recently called by this queue")?><br>
406                     <b><?php echo _("fewestcalls")?></b>: <?php echo _("ring the agent with fewest completed calls from this queue")?><br>
407                     <b><?php echo _("random")?></b>: <?php echo _("ring random agent")?><br>
408                     <b><?php echo _("rrmemory")?></b>: <?php echo _("round robin with memory, remember where we left off last ring pass")?><br>
409                 </span>
410             </a>
411         </td>
412         <td>
413             <select name="strategy"/>
414             <?php
415                 $default = (isset($strategy) ? $strategy : 'ringall');
416                 $items = array('ringall','roundrobin','leastrecent','fewestcalls','random','rrmemory');
417                 foreach ($items as $item) {
418                     echo '<option value="'.$item.'" '.($default == $item ? 'SELECTED' : '').'>'._($item);
419                 }
420             ?>       
421             </select>
422         </td>
423     </tr>
424
425     <tr>
426         <td><a href="#" class="info"><?php echo _("Agent Timeout:")?><span><?php echo _("The number of seconds an agent's phone can ring before we consider it a timeout. Unlimited or other timeout values may still be limited by system ringtime or individual extension defaults.")?></span></a></td>
427         <td>
428             <select name="timeout"/>
429             <?php
430                 $default = (isset($timeout) ? $timeout : 15);
431                 echo '<option value="0" '.(0 == $default ? 'SELECTED' : '').'>'."Unlimited".'</option>';
432                 for ($i=1; $i <= 60; $i++) {
433                     echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
434                 }
435             ?>       
436             </select>       
437         </td>
438     </tr>
439
440     <tr>
441         <td><a href="#" class="info"><?php echo _("retry:")?><span><?php echo _("The number of seconds we wait before trying all the phones again")?></span></a></td>
442         <td>
443             <select name="retry"/>
444             <?php
445                 $default = (isset($retry) ? $retry : 5);
446                 for ($i=0; $i <= 20; $i++) {
447                     echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
448                 }
449             ?>       
450             </select>       
451         </td>
452     </tr>
453
454     <tr>
455         <td><a href="#" class="info"><?php echo _("Wrap-Up-Time:")?><span><?php echo _("After a successful call, how many seconds to wait before sending a potentially free agent another call (default is 0, or no delay)")?></span></a></td>
456         <td>
457             <select name="wrapuptime"/>
458             <?php
459                 $default = (isset($wrapuptime) ? $wrapuptime : 0);
460                 for ($i=0; $i <= 60; $i++) {
461                     echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
462                 }
463             ?>       
464             </select>       
465         </td>
466     </tr>
467
468     <tr>
469         <td><a href="#" class="info"><?php echo _("Call Recording:")?><span><?php echo _("Incoming calls to agents can be recorded. (saved to /var/spool/asterisk/monitor)")?></span></a></td>
470         <td>
471             <select name="monitor-format"/>
472             <?php
473                 $default = (empty($thisQ['monitor-format']) ? "no" : $thisQ['monitor-format']); 
474                 echo '<option value="wav49" '.($default == "wav49" ? 'SELECTED' : '').'>'._("wav49").'</option>';
475                 echo '<option value="wav" '.($default == "wav" ? 'SELECTED' : '').'>'._("wav").'</option>';
476                 echo '<option value="gsm" '.($default == "gsm" ? 'SELECTED' : '').'>'._("gsm").'</option>';
477                 echo '<option value="" '.($default == "no" ? 'SELECTED' : '').'>'._("No").'</option>';
478             ?>   
479             </select>       
480         </td>
481     </tr>
482
483     <tr>
484         <td><a href="#" class="info"><?php echo _("Event When Called:")?><span><?php echo _("When this option is set to YES, the following manager events will be generated: AgentCalled, AgentDump, AgentConnect and AgentComplete.")?></span></a></td>
485         <td>
486             <select name="eventwhencalled"/>
487             <?php
488                 $default = (isset($eventwhencalled) ? $eventwhencalled : 'no');
489                 $items = array('yes'=>_("Yes"),'no'=>_("No"));
490                 foreach ($items as $item=>$val) {
491                     echo '<option value="'.$item.'" '. ($default == $item ? 'SELECTED' : '').'>'.$val;
492                 }
493             ?>
494             </select>
495         </td>
496     </tr>
497
498     <tr>
499         <td><a href="#" class="info"><?php echo _("Member Status:")?><span><?php echo _("When if this is option is set to YES, the following manager event will be generated: QueueMemberStatus")?></span></a></td>
500         <td>
501             <select name="eventmemberstatus"/>
502             <?php
503                 $default = (isset($eventmemberstatus) ? $eventmemberstatus : 'no');
504                 $items = array('yes'=>_("Yes"),'no'=>_("No"));
505                 foreach ($items as $item=>$val) {
506                     echo '<option value="'.$item.'" '. ($default == $item ? 'SELECTED' : '').'>'.$val;
507                 }
508             ?>
509             </select>
510         </td>
511     </tr>
512
513     <tr>
514         <td><a href="#" class="info"><?php echo _("Skip Busy Agents:")?><span><?php echo _("When set to Yes, agents who are on an occupied phone will be skipped as if the line were returning busy. This means that Call Waiting or multi-line phones will not be presented with the call and in the various hunt style ring strategies, the next agent will be attempted.")?></span></a></td>
515         <td>
516             <select name="cwignore"/>
517             <?php
518                 $default = (isset($cwignore) ? $cwignore : 'no');
519                 $items = array('1'=>_("Yes"),'0'=>_("No"));
520                 foreach ($items as $item=>$val) {
521                     echo '<option value="'.$item.'" '. ($default == $item ? 'SELECTED' : '').'>'.$val;
522                 }
523             ?>
524             </select>
525         </td>
526     </tr>
527
528     <tr><td colspan="2"><br><h5><?php echo _("Caller Position Announcements")?><hr></h5></td></tr>
529     <tr>
530         <td><a href="#" class="info"><?php echo _("Frequency:")?><span><?php echo _("How often to announce queue position and estimated holdtime (0 to Disable Announcements).")?></span></a></td>
531         <td>
532             <select name="announcefreq"/>
533             <?php
534                 $default = (isset($thisQ['announce-frequency']) ? $thisQ['announce-frequency'] : 0);
535                 for ($i=0; $i <= 1200; $i+=15) {
536                     echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
537                 }
538             ?>       
539             </select>       
540         </td>
541     </tr>
542
543     <tr>
544         <td><a href="#" class="info"><?php echo _("Announce Position:")?><span><?php echo _("Announce position of caller in the queue?")?></span></a></td>
545         <td>
546             <select name="announceposition"/>
547             <?php //setting to "no" will override sounds queue-youarenext, queue-thereare, queue-callswaitingÊ
548                 $default = (isset($thisQ['announce-position']) ? $thisQ['announce-position'] : "no"); 
549                     echo '<option value=yes '.($default == "yes" ? 'SELECTED' : '').'>'._("Yes").'</option>';
550                     echo '<option value=no '.($default == "no" ? 'SELECTED' : '').'>'._("No").'</option>';
551             ?>       
552             </select>       
553         </td>
554     </tr>
555
556     <tr>
557         <td><a href="#" class="info"><?php echo _("Announce Hold Time:")?><span><?php echo _("Should we include estimated hold time in position announcements?  Either yes, no, or only once; hold time will not be announced if <1 minute")?> </span></a></td>
558         <td>
559             <select name="announceholdtime">
560             <?php
561                 $default = (isset($thisQ['announce-holdtime']) ? $thisQ['announce-holdtime'] : "no");
562                 echo '<option value=yes '.($default == "yes" ? 'SELECTED' : '').'>'._("Yes").'</option>';
563                 echo '<option value=no '.($default == "no" ? 'SELECTED' : '').'>'._("No").'</option>';
564                 echo '<option value=once '.($default == "once" ? 'SELECTED' : '').'>'._("Once").'</option>';
565             ?>       
566             </select>       
567         </td>
568     </tr>
569
570     <tr><td colspan="2"><br><h5><?php echo _("Periodic Announcements")?><hr></h5></td></tr>
571
572    
573 <?php if(function_exists('ivr_list')) { //only include if IVR module is enabled ?>
574     <tr>
575         <td><a href="#" class="info"><?php echo _("IVR Break Out Menu:")?><span> <?php echo _("You can optionally present an existing IVR as a 'break out' menu.<br><br>This IVR must only contain single-digit 'dialed options'. The Recording set for the IVR will be played at intervals specified in 'Repeat Frequency', below.")?></span></a></td>
576         <td>
577             <select name="announcemenu">
578             <?php // setting this will set the context= option
579             $default = (isset($announcemenu) ? $announcemenu : "none");
580             
581             echo '<option value=none '.($default == "none" ? 'SELECTED' : '').'>'._("None").'</option>';
582             
583             //query for exisiting aa_N contexts
584             $unique_aas = ivr_list();       
585             
586             $compound_recordings = false;
587             $is_error = false;
588             if (isset($unique_aas)) {
589                 foreach ($unique_aas as $unique_aa) {
590                     $menu_id = $unique_aa['ivr_id'];
591                     $menu_name = $unique_aa['displayname'];
592                     if (strpos($unique_aa['announcement'],"&") === false) {
593                         echo '<option value="'.$menu_id.'" '.($default == $menu_id ? 'SELECTED' : '').'>'.($menu_name ? $menu_name : _("Menu ID ").$menu_id)."</option>\n";
594                     } else {
595                         $compound_recordings = true;
596                         echo '<option style="color:red" value="'.$menu_id.'" '.($default == $menu_id ? 'SELECTED' : '').'>'.($menu_name ? $menu_name : _("Menu ID ").$menu_id)." (**)</option>\n";
597                         if ($menu_id == $default) {
598                             $is_error = true;
599                         }
600                     }
601                 }
602             }
603             ?>
604             </select>
605             <?php
606             if ($compound_recordings) {
607             ?>
608                 <small><a style="color:red"  href="#" class="info"><?php echo ($is_error ? _("(**) ERRORS") : _("(**) Warning Potential Errors"))?>
609                     <span>
610                         <?php
611                             if ($is_error) {
612                                 echo _("ERROR: You have selected an IVR's that use Announcements created from compound sound files. The Queue is not able to play these announcements. This IVR's recording will be truncated to use only the first sound file. You can correct the problem by selecting a different annoucement for this IVR that is not from a compound sound file. The IVR itself can play such files, but the Queue subsystem can not");
613                             } else {
614                                 echo _("You have IVR's that use Announcements created from compound sound files. The Queue is not able to play these announcements. If you choose one of these the recording used with be truncated to use only the first sound file. You can choose this IVR now and then correct the problem by selecting a different annoucement for your IVR that is not from a compound sound file. The IVR itself can play such files, but the Queue subsystem can not");
615                             }
616                         ?>
617                     </span></small>
618                 </a>
619             <?php
620             }
621             ?>
622
623         </td>
624     </tr>
625    
626     <tr>
627         <td><a href="#" class="info"><?php echo _("Repeat Frequency:")?><span><?php echo _("How often to announce a voice menu to the caller (0 to Disable Announcements).")?></span></a></td>
628         <td>
629             <select name="pannouncefreq"/>
630             <?php
631                 $default = (isset($thisQ['periodic-announce-frequency']) ? $thisQ['periodic-announce-frequency'] : 0);
632                 for ($i=0; $i <= 1200; $i+=15) {
633                     echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.queues_timeString($i,true).'</option>';
634                 }
635             ?>       
636             </select>       
637         </td>
638     </tr>
639
640 <?php } else {
641     echo "<input type=\"hidden\" name=\"announcemenu\" value=\"none\">";
642 }
643
644 if(function_exists('recordings_list')) { //only include if recordings is enabled ?>
645     <tr>
646         <td><a href="#" class="info"><?php echo _("Join Announcement:")?><span><?php echo _("Announcement played to callers once prior to joining the queue.<br><br>To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td>
647         <td>
648             <select name="joinannounce"/>
649             <?php
650                 $tresults = recordings_list();
651                 $default = (isset($joinannounce) ? $joinannounce : 'None');
652                 echo '<option value="None">'._("None");
653                 if (isset($tresults[0])) {
654                     foreach ($tresults as $tresult) {
655                         echo '<option value="'.$tresult[2].'" '.($tresult[2] == $default ? 'SELECTED' : '').'>'.$tresult[1]."</option>\n";;
656                     }
657                 }
658             ?>       
659             </select>       
660         </td>
661     </tr>
662 <?php } else { ?>
663     <tr>
664         <td><a href="#" class="info"><?php echo _("Join Announcement:")?><span><?php echo _("Announcement played to callers once prior to joining the queue.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option")?></span></a></td>
665         <td>
666             <?php
667                 $default = (isset($joinannounce) ? $joinannounce : '');
668             ?>
669             <input type="hidden" name="joinannounce" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?>
670         </td>
671     </tr>
672 <?php } ?>
673 <?php
674     // implementation of module hook
675     // object was initialized in config.php
676     echo $module_hook->hookHtml;
677 ?>
678
679     <tr><td colspan="2"><br><h5><?php echo _("Fail Over Destination")?><hr></h5></td></tr>
680     <?php
681     echo drawselects($goto,0);
682     ?>
683    
684     <tr>
685         <td colspan="2"><br><h6><input name="Submit" type="button" value="<?php echo _("Submit Changes")?>" onclick="checkQ(editQ);"></h6></td>       
686     </tr>
687     </table>
688
689 <script language="javascript">
690 <!--
691
692 function insertExten() {
693     exten = document.getElementById('insexten').value;
694
695     grpList=document.getElementById('members');
696     if (grpList.value[ grpList.value.length - 1 ] == "\n") {
697         grpList.value = grpList.value + exten + ',0';
698     } else {
699         grpList.value = grpList.value + '\n' + exten + ',0';
700     }
701
702     // reset element
703     document.getElementById('insexten').value = '';
704 }
705
706 function checkQ(theForm) {
707         $queuename = theForm.name.value;
708         var bad = "false";
709
710         var whichitem = 0;
711         while (whichitem < theForm.goto0.length) {
712                 if (theForm.goto0[whichitem].checked) {
713                         theForm.goto0.value=theForm.goto0[whichitem].value;
714                 }
715                 whichitem++;
716         }
717
718                 if (!isInteger(theForm.account.value)) {
719                 <?php echo "alert('"._("Queue Number must not be blank")."')"?>;
720                 bad="true";
721         }
722
723         if ($queuename == "") {
724                 <?php echo "alert('"._("Queue name must not be blank")."')"?>;
725                 bad="true";
726         } else if (!$queuename.match('^[a-zA-Z][a-zA-Z0-9]+$')) {
727                 <?php echo "alert('"._("Queue name cannot start with a number, and can only contain letters and numbers")."')"?>;
728                 bad="true";
729         }
730
731         if (bad == "false") {
732                 theForm.submit();
733         }
734 }
735
736 //-->
737 </script>
738
739     </form>
740 <?php       
741 } //end if action == delGRP
742 ?>
743
Note: See TracBrowser for help on using the browser.