root/modules/branches/2.10/ringgroups/page.ringgroups.php

Revision 14997, 25.4 kB (checked in by GameGamer43, 4 months ago)

closes #6249 - fixes extra open parenthesis

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php /* $Id$ */
2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
3 //Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca)
4 //
5 //This program is free software; you can redistribute it and/or
6 //modify it under the terms of the GNU General Public License
7 //as published by the Free Software Foundation; either version 2
8 //of the License, or (at your option) any later version.
9 //
10 //This program is distributed in the hope that it will be useful,
11 //but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //GNU General Public License for more details.
14
15 $dispnum = 'ringgroups'; //used for switch on config.php
16 isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action='';
17 //the extension we are currently displaying
18 isset($_REQUEST['extdisplay'])?$extdisplay=$_REQUEST['extdisplay']:$extdisplay='';
19 isset($_REQUEST['account'])?$account = $_REQUEST['account']:$account='';
20 isset($_REQUEST['grptime'])?$grptime = $_REQUEST['grptime']:$grptime='';
21 isset($_REQUEST['grppre'])?$grppre = $_REQUEST['grppre']:$grppre='';
22 isset($_REQUEST['strategy'])?$strategy = $_REQUEST['strategy']:$strategy='';
23 isset($_REQUEST['annmsg_id'])?$annmsg_id = $_REQUEST['annmsg_id']:$annmsg_id='';
24 isset($_REQUEST['description'])?$description = $_REQUEST['description']:$description='';
25 isset($_REQUEST['alertinfo'])?$alertinfo = $_REQUEST['alertinfo']:$alertinfo='';
26 isset($_REQUEST['needsconf'])?$needsconf = $_REQUEST['needsconf']:$needsconf='';
27 isset($_REQUEST['cwignore'])?$cwignore = $_REQUEST['cwignore']:$cwignore='';
28 isset($_REQUEST['cpickup'])?$cpickup = $_REQUEST['cpickup']:$cpickup='';
29 isset($_REQUEST['cfignore'])?$cfignore = $_REQUEST['cfignore']:$cfignore='';
30 isset($_REQUEST['remotealert_id'])?$remotealert_id = $_REQUEST['remotealert_id']:$remotealert_id='';
31 isset($_REQUEST['toolate_id'])?$toolate_id = $_REQUEST['toolate_id']:$toolate_id='';
32 isset($_REQUEST['ringing'])?$ringing = $_REQUEST['ringing']:$ringing='';
33
34 isset($_REQUEST['changecid'])?$changecid = $_REQUEST['changecid']:$changecid='default';
35 isset($_REQUEST['fixedcid'])?$fixedcid = $_REQUEST['fixedcid']:$fixedcid='';
36 isset($_REQUEST['recording'])?$recording = $_REQUEST['recording']:$recording='dontcare';
37
38 if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) {
39         $goto = $_REQUEST[$_REQUEST['goto0']."0"];
40 } else {
41         $goto = '';
42 }
43
44
45 if (isset($_REQUEST["grplist"])) {
46     $grplist = explode("\n",$_REQUEST["grplist"]);
47
48     if (!$grplist) {
49         $grplist = null;
50     }
51     
52     foreach (array_keys($grplist) as $key) {
53         //trim it
54         $grplist[$key] = trim($grplist[$key]);
55         
56         // remove invalid chars
57         $grplist[$key] = preg_replace("/[^0-9#*]/", "", $grplist[$key]);
58         
59         if ($grplist[$key] == ltrim($extdisplay,'GRP-').'#')
60             $grplist[$key] = rtrim($grplist[$key],'#');
61         
62         // remove blanks
63         if ($grplist[$key] == "") unset($grplist[$key]);
64     }
65     
66     // check for duplicates, and re-sequence
67     $grplist = array_values(array_unique($grplist));
68 }
69
70 // do if we are submitting a form
71 if(isset($_POST['action'])){
72     //check if the extension is within range for this user
73     if (isset($account) && !checkRange($account)){
74         echo "<script>javascript:alert('". _("Warning! Extension")." ".$account." "._("is not allowed for your account").".');</script>";
75     } else {
76         //add group
77         if ($action == 'addGRP') {
78
79             $conflict_url = array();
80             $usage_arr = framework_check_extension_usage($account);
81             if (!empty($usage_arr)) {
82                 $conflict_url = framework_display_extension_usage_alert($usage_arr);
83
84             } elseif (ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg_id,$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore,$changecid,$fixedcid,$cpickup,$recording)) {
85                 needreload();
86                 redirect_standard();
87             }
88         }
89         
90         //del group
91         if ($action == 'delGRP') {
92             ringgroups_del($account);
93             needreload();
94             redirect_standard();
95         }
96         
97         //edit group - just delete and then re-add the extension
98         if ($action == 'edtGRP') {
99             ringgroups_del($account);   
100             ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg_id,$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore,$changecid,$fixedcid,$cpickup,$recording);
101             needreload();
102             redirect_standard('extdisplay');
103         }
104     }
105 }
106 ?>
107
108 <div class="rnav"><ul>
109     <li><a class="<?php  echo ($extdisplay=='' ? 'current':'') ?>" href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Ring Group")?></a></li>
110 <?php
111 //get unique ring groups
112 $gresults = ringgroups_list();
113
114 if (isset($gresults)) {
115     foreach ($gresults as $gresult) {
116         echo "<li><a class=\"".($extdisplay=='GRP-'.$gresult[0] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&extdisplay=".urlencode("GRP-".$gresult[0])."\">".$gresult[1]." ({$gresult[0]})</a></li>";
117     }
118 }
119 ?>
120 </ul></div>
121
122 <?php
123 if ($action == 'delGRP') {
124     echo '<br><h3>'._("Ring Group").' '.$account.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>';
125 } else {
126     if ($extdisplay) {
127         // We need to populate grplist with the existing extension list.
128         $thisgrp = ringgroups_get(ltrim($extdisplay,'GRP-'));
129         $grpliststr = $thisgrp['grplist'];
130         $grplist = explode("-", $grpliststr);
131         $strategy = $thisgrp['strategy'];
132         $grppre = $thisgrp['grppre'];
133         $grptime = $thisgrp['grptime'];
134         $goto = $thisgrp['postdest'];
135         $annmsg_id = $thisgrp['annmsg_id'];
136         $description = $thisgrp['description'];
137         $alertinfo = $thisgrp['alertinfo'];
138         $remotealert_id = $thisgrp['remotealert_id'];
139         $needsconf = $thisgrp['needsconf'];
140         $cwignore = $thisgrp['cwignore'];
141         $cpickup = $thisgrp['cpickup'];
142         $cfignore = $thisgrp['cfignore'];
143         $toolate_id = $thisgrp['toolate_id'];
144         $ringing = $thisgrp['ringing'];
145         $changecid   = isset($thisgrp['changecid'])   ? $thisgrp['changecid']   : 'default';
146         $fixedcid    = isset($thisgrp['fixedcid'])    ? $thisgrp['fixedcid']    : '';
147         $recording = $thisgrp['recording'];
148         unset($grpliststr);
149         unset($thisgrp);
150         
151         $delButton = "
152             <form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST>
153                 <input type=\"hidden\" name=\"display\" value=\"{$dispnum}\">
154                 <input type=\"hidden\" name=\"account\" value=\"".ltrim($extdisplay,'GRP-')."\">
155                 <input type=\"hidden\" name=\"action\" value=\"delGRP\">
156                 <input type=submit value=\""._("Delete Group")."\">
157             </form>";
158             
159         echo "<h2>"._("Ring Group").": ".ltrim($extdisplay,'GRP-')."</h2>";
160         echo "<p>".$delButton."</p>";
161
162         $usage_list = framework_display_destination_usage(ringgroups_getdest(ltrim($extdisplay,'GRP-')));
163         if (!empty($usage_list)) {
164         ?>
165             <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a>
166         <?php
167         }
168
169     } else {
170         $grplist = explode("-", '');;
171         $strategy = '';
172         $grppre = '';
173         $grptime = '';
174         $goto = '';
175         $annmsg_id = '';
176         $alertinfo = '';
177         $remotealert_id = '';
178         $needsconf = '';
179         $cwignore = '';
180         $cpickup = '';
181         $cfignore = '';
182         $toolate_id = '';
183         $ringing = '';
184
185         if (!empty($conflict_url)) {
186             echo "<h5>"._("Conflicting Extensions")."</h5>";
187             echo implode('<br .>',$conflict_url);
188         }
189
190         echo "<h2>"._("Add Ring Group")."</h2>";
191     }
192     ?>
193             <form name="editGRP" action="<?php  $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkGRP(editGRP);">
194             <input type="hidden" name="display" value="<?php echo $dispnum?>">
195             <input type="hidden" name="action" value="<?php echo ($extdisplay ? 'edtGRP' : 'addGRP'); ?>">
196             <table>
197             <tr><td colspan="2"><h5><?php  echo ($extdisplay ? _("Edit Ring Group") : _("Add Ring Group")) ?><hr></h5></td></tr>
198             <tr>
199 <?php
200     if ($extdisplay) {
201
202 ?>
203                 <input size="5" type="hidden" name="account" value="<?php  echo ltrim($extdisplay,'GRP-'); ?>" tabindex="<?php echo ++$tabindex;?>">
204 <?php         } else { ?>
205                 <td><a href="#" class="info"><?php echo _("Ring-Group Number")?>:<span><?php echo _("The number users will dial to ring extensions in this ring group")?></span></a></td>
206                 <td><input size="5" type="text" name="account" value="<?php  if ($gresult[0]==0) { echo "600"; } else { echo $gresult[0] + 1; } ?>" tabindex="<?php echo ++$tabindex;?>"></td>
207 <?php         } ?>
208             </tr>
209
210             <tr>
211             <td> <a href="#" class="info"><?php echo _("Group Description")?>:<span><?php echo _("Provide a descriptive title for this Ring Group.")?></span></a></td>
212                 <td><input size="20" maxlength="35" type="text" name="description" value="<?php echo htmlspecialchars($description); ?>" tabindex="<?php echo ++$tabindex;?>"></td>
213             </tr>
214
215             <tr>
216                 <td> <a href="#" class="info"><?php echo _("Ring Strategy:")?>
217                 <span>
218                     <b><?php echo _("ringall")?></b>:  <?php echo _("Ring all available channels until one answers (default)")?><br>
219                     <b><?php echo _("hunt")?></b>: <?php echo _("Take turns ringing each available extension")?><br>
220                     <b><?php echo _("memoryhunt")?></b>: <?php echo _("Ring first extension in the list, then ring the 1st and 2nd extension, then ring 1st 2nd and 3rd extension in the list.... etc.")?><br>
221                     <b><?php echo _("*-prim")?></b>:  <?php echo _("These modes act as described above. However, if the primary extension (first in list) is occupied, the other extensions will not be rung. If the primary is FreePBX DND, it won't be rung. If the primary is FreePBX CF unconditional, then all will be rung")?><br>
222                     <b><?php echo _("firstavailable")?></b>:  <?php echo _("ring only the first available channel")?><br>
223                     <b><?php echo _("firstnotonphone")?></b>:  <?php echo _("ring only the first channel which is not offhook - ignore CW")?><br>
224                 </span>
225                 </a></td>
226                 <td>
227                     <select name="strategy" tabindex="<?php echo ++$tabindex;?>">
228                     <?php
229                         $default = (isset($strategy) ? $strategy : 'ringall');
230                                                 $items = array('ringall','ringall-prim','hunt','hunt-prim','memoryhunt','memoryhunt-prim','firstavailable','firstnotonphone');
231                         foreach ($items as $item) {
232                             echo '<option value="'.$item.'" '.($default == $item ? 'SELECTED' : '').'>'._($item);
233                         }
234                     ?>       
235                     </select>
236                 </td>
237             </tr>
238
239             <tr>
240                 <td>
241                     <a href=# class="info"><?php echo _("Ring Time (max 300 sec)")?>
242                         <span>
243                             <?php echo _("Time in seconds that the phones will ring. For all hunt style ring strategies, this is the time for each iteration of phone(s) that are rung")?>
244                         </span>
245                     </a>
246                 </td>
247                 <td><input size="4" type="text" name="grptime" value="<?php  echo $grptime?$grptime:20 ?>" tabindex="<?php echo ++$tabindex;?>"></td>
248             </tr>
249
250             <tr>
251                 <td valign="top"><a href="#" class="info"><?php echo _("Extension List")?>:<span><br><?php echo _("List extensions to ring, one per line, or use the Extension Quick Pick below to insert them here.<br><br>You can include an extension on a remote system, or an external number by suffixing a number with a '#'.  ex:  2448089# would dial 2448089 on the appropriate trunk (see Outbound Routing)<br><br>Extensions without a '#' will not ring a user's Follow-Me. To dial Follow-Me, Queues and other numbers that are not extensions, put a '#' at the end.")?><br><br></span></a></td>
252                 <td valign="top">
253 <?php
254         $rows = count($grplist)+1;
255         ($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows);
256 ?>
257                     <textarea id="grplist" cols="15" rows="<?php  echo $rows ?>" name="grplist" tabindex="<?php echo ++$tabindex;?>"><?php echo implode("\n",$grplist);?></textarea>
258                 </td>
259             </tr>
260
261             <tr>
262                 <td>
263                 <a href=# class="info"><?php echo _("Extension Quick Pick")?>
264                     <span>
265                         <?php echo _("Choose an extension to append to the end of the extension list above.")?>
266                     </span>
267                 </a>
268                 </td>
269                 <td>
270                     <select onChange="insertExten();" id="insexten" tabindex="<?php echo ++$tabindex;?>">
271                         <option value=""><?php echo _("(pick extension)")?></option>
272     <?php
273                         $results = core_users_list();
274                         foreach ($results as $result) {
275                             echo "<option value='".$result[0]."'>".$result[0]." (".$result[1].")</option>\n";
276                         }
277     ?>
278                     </select>
279                 </td>
280             </tr>
281
282 <?php if(function_exists('recordings_list')) { //only include if recordings is enabled?>
283             <tr>
284                 <td><a href="#" class="info"><?php echo _("Announcement:")?><span><?php echo _("Message to be played to the caller before dialing this group.<br><br>To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td>
285                 <td>
286                     <select name="annmsg_id" tabindex="<?php echo ++$tabindex;?>">
287                     <?php
288                         $tresults = recordings_list();
289                         $default = (isset($annmsg_id) ? $annmsg_id : '');
290                         echo '<option value="">'._("None")."</option>";
291                         if (isset($tresults[0])) {
292                             foreach ($tresults as $tresult) {
293                                 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n";
294                             }
295                         }
296                     ?>       
297                     </select>       
298                 </td>
299             </tr>
300 <?php }    else { ?>
301             <tr>
302                 <td><a href="#" class="info"><?php echo _("Announcement:")?><span><?php echo _("Message to be played to the caller before dialing this group.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option")?></span></a></td>
303                 <td>
304                     <?php
305                         $default = (isset($annmsg_id) ? $annmsg_id : '');
306                     ?>
307                     <input type="hidden" name="annmsg_id" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?>
308                 </td>
309             </tr>
310 <?php } if (function_exists('music_list')) { ?>
311             <tr>
312                 <td><a href="#" class="info"><?php echo _("Play Music On Hold?")?><span><?php echo _("If you select a Music on Hold class to play, instead of 'Ring', they will hear that instead of Ringing while they are waiting for someone to pick up.")?></span></a></td>
313                 <td>
314                     <select name="ringing" tabindex="<?php echo ++$tabindex;?>">
315                     <?php
316                         $tresults = music_list();
317                         $cur = (isset($ringing) ? $ringing : 'Ring');
318                         echo '<option value="Ring">'._("Ring")."</option>";
319                         if (isset($tresults[0])) {
320                             foreach ($tresults as $tresult) {
321                                 ( $tresult == 'none' ? $ttext = _("none") : $ttext = $tresult );
322                                 ( $tresult == 'default' ? $ttext = _("default") : $ttext = $tresult );
323                                 echo '<option value="'.$tresult.'"'.($tresult == $cur ? ' SELECTED' : '').'>'._($ttext)."</option>\n";
324                             }
325                         }
326                     ?>       
327                     </select>       
328                 </td>
329             </tr>
330 <?php } ?>
331            
332             <tr>
333                 <td><a href="#" class="info"><?php echo _("CID Name Prefix")?>:<span><?php echo _('You can optionally prefix the CallerID name when ringing extensions in this group. 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>
334                 <td><input size="4" type="text" name="grppre" value="<?php  echo $grppre ?>" tabindex="<?php echo ++$tabindex;?>"></td>
335             </tr>
336
337             <tr>
338                 <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>
339                 <td><input type="text" name="alertinfo" size="20" value="<?php echo ($alertinfo)?$alertinfo:'' ?>" tabindex="<?php echo ++$tabindex;?>"></td>
340             </tr>
341
342             <tr>
343         <td><a href="#" class="info"><?php echo _("Ignore CF Settings")?><span> <?php echo _("When checked, agents who attempt to Call Forward will be ignored, this applies to CF, CFU and CFB. Extensions entered with '#' at the end, for example to access the extension's Follow-Me, might not honor this setting .") ?></span></a>:</td>
344                 <td>
345                     <input type="checkbox" name="cfignore" value="CHECKED" <?php echo $cfignore ?>   tabindex="<?php echo ++$tabindex;?>"/>
346                 </td>
347             </tr>
348
349             <tr>
350         <td><a href="#" class="info"><?php echo _("Skip Busy Agent")?><span> <?php echo _("When checked, 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>
351                 <td>
352                     <input type="checkbox" name="cwignore" value="CHECKED" <?php echo $cwignore ?>   tabindex="<?php echo ++$tabindex;?>"/>
353                 </td>
354             </tr>
355
356             <tr>
357         <td><a href="#" class="info"><?php echo _("Enable Call Pickup")?><span> <?php echo _("Checking this will allow calls to the Ring Group to be picked up with the directed call pickup feature using the group number. When not checked, individual extensions that are part of the group can still be picked up by doing a directed call pickup to the ringing extension, which works whether or not this is checked.") ?></span></a>:</td>
358                 <td>
359                     <input type="checkbox" name="cpickup" value="CHECKED" <?php echo $cpickup ?>   tabindex="<?php echo ++$tabindex;?>"/>
360                 </td>
361             </tr>
362
363             <tr>
364                 <td><a href="#" class="info"><?php echo _("Confirm Calls")?><span><?php echo _('Enable this if you\'re calling external numbers that need confirmation - eg, a mobile phone may go to voicemail which will pick up the call. Enabling this requires the remote side push 1 on their phone before the call is put through. This feature only works with the ringall ring strategy')?></span></a>:</td>
365                 <td>
366                     <input type="checkbox" name="needsconf" value="CHECKED" <?php echo $needsconf ?>   tabindex="<?php echo ++$tabindex;?>"/>
367                 </td>
368             </tr>
369
370 <?php if(function_exists('recordings_list')) { //only include if recordings is enabled?>
371             <tr>
372                 <td><a href="#" class="info"><?php echo _("Remote Announce:")?><span><?php echo _("Message to be played to the person RECEIVING the call, if 'Confirm Calls' is enabled.<br><br>To add additional recordings use the \"System Recordings\" MENU to the left")?></span></a></td>
373                 <td>
374                     <select name="remotealert_id" tabindex="<?php echo ++$tabindex;?>">
375                     <?php
376                         $tresults = recordings_list();
377                         $default = (isset($remotealert_id) ? $remotealert_id : '');
378                         echo '<option value="">'._("Default")."</option>";
379                         if (isset($tresults[0])) {
380                             foreach ($tresults as $tresult) {
381                                 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n";
382                             }
383                         }
384                     ?>       
385                     </select>       
386                 </td>
387             </tr>
388
389             <tr>
390                 <td><a href="#" class="info"><?php echo _("Too-Late Announce:")?><span><?php echo _("Message to be played to the person RECEIVING the call, if the call has already been accepted before they push 1.<br><br>To add additional recordings use the \"System Recordings\" MENU to the left")?></span></a></td>
391                 <td>
392                     <select name="toolate_id" tabindex="<?php echo ++$tabindex;?>">
393                     <?php
394                         $tresults = recordings_list();
395                         $default = (isset($toolate_id) ? $toolate_id : '');
396                         echo '<option value="">'._("Default")."</option>";
397                         if (isset($tresults[0])) {
398                             foreach ($tresults as $tresult) {
399                                 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n";
400                             }
401                         }
402                     ?>       
403                     </select>       
404                 </td>
405             </tr>
406 <?php } ?>
407             <tr><td colspan="2"><h5><?php echo _("Change External CID Configuration") ?><hr></h5></td></tr>
408             <tr>
409                 <td>
410                 <a href="#" class="info"><?php echo _("Mode")?>:
411                 <span>
412                     <b><?php echo _("Default")?></b>:  <?php echo _("Transmits the Callers CID if allowed by the trunk.")?><br>
413                     <b><?php echo _("Fixed CID Value")?></b>:  <?php echo _("Always transmit the Fixed CID Value below.")?><br>
414                     <b><?php echo _("Outside Calls Fixed CID Value")?></b>: <?php echo _("Transmit the Fixed CID Value below on calls that come in from outside only. Internal extension to extension calls will continue to operate in default mode.")?><br>
415                     <b><?php echo _("Use Dialed Number")?></b>: <?php echo _("Transmit the number that was dialed as the CID for calls coming from outside. Internal extension to extension calls will continue to operate in default mode. There must be a DID on the inbound route for this. This will be BLOCKED on trunks that block foreign CallerID")?><br>
416                     <b><?php echo _("Force Dialed Number")?></b>: <?php echo _("Transmit the number that was dialed as the CID for calls coming from outside. Internal extension to extension calls will continue to operate in default mode. There must be a DID on the inbound route for this. This WILL be transmitted on trunks that block foreign CallerID")?><br>
417                 </span>
418                 </a>
419                 </td>
420                 <td>
421                     <select name="changecid" id="changecid" tabindex="<?php echo ++$tabindex;?>">
422                     <?php
423                         $default = (isset($changecid) ? $changecid : 'default');
424                         echo '<option value="default" '.($default == 'default' ? 'SELECTED' : '').'>'._("Default");
425                         echo '<option value="fixed" '.($default == 'fixed' ? 'SELECTED' : '').'>'._("Fixed CID Value");
426                         echo '<option value="extern" '.($default == 'extern' ? 'SELECTED' : '').'>'._("Outside Calls Fixed CID Value");
427                         echo '<option value="did" '.($default == 'did' ? 'SELECTED' : '').'>'._("Use Dialed Number");
428                         echo '<option value="forcedid" '.($default == 'forcedid' ? 'SELECTED' : '').'>'._("Force Dialed Number");
429             $fixedcid_disabled = ($default != 'fixed' && $default != 'extern') ? 'disabled = "disabled"':'';
430                     ?>       
431                     </select>
432                 </td>
433             </tr>
434
435             <tr>
436                 <td><a href="#" class="info"><?php echo _("Fixed CID Value")?>:<span><?php echo _('Fixed value to replace the CID with used with some of the modes above. Should be in a format of digits only with an option of E164 format using a leading "+".')?></span></a></td>
437         <td><input size="30" type="text" name="fixedcid" id="fixedcid" value="<?php  echo $fixedcid ?>" tabindex="<?php echo ++$tabindex;?>" <?php echo $fixedcid_disabled ?>></td>
438             </tr>
439            
440             <tr><td colspan="2"><h5><?php echo _("Call Recording") ?><hr></h5></td></tr>
441       <tr>
442         <td><a href="#" class="info"><?php echo _("Record Calls")?><span><?php echo _('You can always record calls that come into this ring group, never record them, or allow the extension that answers to do on-demand recording. If recording is denied then one-touch on demand recording will be blocked.')?></span></a></td>
443         <td><span class="radioset">
444           <input type="radio" id="record_always" name="recording" value="always" <?php echo ($recording=='always'?'checked':'');?>><label for="record_always"><?php echo _('Always'); ?></label>
445           <input type="radio" id="record_dontcare" name="recording" value="dontcare" <?php echo ($recording=='dontcare'?'checked':'');?>><label for="record_dontcare"><?php echo _('On Demand')?></label>
446           <input type="radio" id="record_never" name="recording" value="never" <?php echo ($recording=='never'?'checked':'');?>><label for="record_never"><?php echo _('Never'); ?></label>
447         </span></td>
448       </tr>
449
450 <?php
451             // implementation of module hook
452             // object was initialized in config.php
453             echo $module_hook->hookHtml;
454 ?>
455
456             <tr><td colspan="2"><br><h5><?php echo _("Destination if no answer")?>:<hr></h5></td></tr>
457
458 <?php
459 //draw goto selects
460 echo drawselects($goto,0);
461 ?>
462            
463             <tr>
464             <td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td>       
465            
466             </tr>
467             </table>
468             </form>
469 <?php         
470         } //end if action == delGRP
471         
472
473 ?>
474 <script language="javascript">
475 <!--
476
477 $(document).ready(function(){
478     $("#changecid").change(function(){
479         state = (this.value == "fixed" || this.value == "extern") ? "" : "disabled";
480     if (state == "disabled") {
481       $("#fixedcid").attr("disabled",state);
482     } else {
483       $("#fixedcid").removeAttr("disabled");
484     }
485     });
486 });
487
488 function insertExten() {
489     exten = document.getElementById('insexten').value;
490
491     grpList=document.getElementById('grplist');
492     if (grpList.value[ grpList.value.length - 1 ] == "\n") {
493         grpList.value = grpList.value + exten;
494     } else {
495         grpList.value = grpList.value + '\n' + exten;
496     }
497
498     // reset element
499     document.getElementById('insexten').value = '';
500 }
501
502 function checkGRP(theForm) {
503     var msgInvalidGrpNum = "<?php echo _('Invalid Group Number specified'); ?>";
504     var msgInvalidExtList = "<?php echo _('Please enter an extension list.'); ?>";
505     var msgInvalidTime = "<?php echo _('Invalid time specified'); ?>";
506     var msgInvalidGrpTimeRange = "<?php echo _('Time must be between 1 and 300 seconds'); ?>";
507     var msgInvalidDescription = "<?php echo _('Please enter a valid Group Description'); ?>";
508     var msgInvalidRingStrategy = "<?php echo _('Only ringall, ringallv2, hunt and the respective -prim versions are supported when confirmation is checked'); ?>";
509
510     // set up the Destination stuff
511     setDestinations(theForm, 1);
512
513     // form validation
514     defaultEmptyOK = false;
515     if (!isInteger(theForm.account.value)) {
516         return warnInvalid(theForm.account, msgInvalidGrpNum);
517     }
518    
519     defaultEmptyOK = false;   
520     if (!isAlphanumeric(theForm.description.value))
521         return warnInvalid(theForm.description, msgInvalidDescription);
522    
523     if (isEmpty(theForm.grplist.value))
524         return warnInvalid(theForm.grplist, msgInvalidExtList);
525
526   if (!theForm.fixedcid.disabled) {
527     fixedcid = $.trim(theForm.fixedcid.value);
528       if (!fixedcid.match('^[+]{0,1}[0-9]+$')) {
529           return warnInvalid(theForm.fixedcid, msgInvalidCID);
530     }
531   }
532
533     defaultEmptyOK = false;
534     if (!isInteger(theForm.grptime.value)) {
535         return warnInvalid(theForm.grptime, msgInvalidTime);
536     } else {
537         var grptimeVal = theForm.grptime.value;
538         if (grptimeVal < 1 || grptimeVal > 300)
539             return warnInvalid(theForm.grptime, msgInvalidGrpTimeRange);
540     }
541
542     if (theForm.needsconf.checked && (theForm.strategy.value.substring(0,7) != "ringall" && theForm.strategy.value.substring(0,4) != "hunt")) {
543         return warnInvalid(theForm.needsconf, msgInvalidRingStrategy);
544     }
545
546     if (!validateDestinations(theForm, 1, true))
547         return false;
548        
549     return true;
550 }
551 //-->
552 </script>
553
554
Note: See TracBrowser for help on using the browser.