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

Revision 12445, 23.2 kB (checked in by mbrevda, 2 years ago)

closes #5342 - update skin

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
Line 
1 <?php /* $Id: page.findmefollow.php 1197 2006-03-19 17:59:02Z mheydon1973 $ */
2 //Copyright (C) 2006 Philippe Lindheimer (p_lindheimer at yahoo dot com)
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 $tabindex = 0;
15
16 $dispnum = 'findmefollow'; //used for switch on config.php
17
18 isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action='';
19 //the extension we are currently displaying
20 isset($_REQUEST['extdisplay'])?$extdisplay=$_REQUEST['extdisplay']:$extdisplay='';
21 isset($_REQUEST['account'])?$account = $_REQUEST['account']:$account='';
22 isset($_REQUEST['grptime'])?$grptime = $_REQUEST['grptime']:$grptime='';
23 isset($_REQUEST['grppre'])?$grppre = $_REQUEST['grppre']:$grppre='';
24 isset($_REQUEST['strategy'])?$strategy = $_REQUEST['strategy']:$strategy='';
25 isset($_REQUEST['annmsg_id'])?$annmsg_id = $_REQUEST['annmsg_id']:$annmsg_id='';
26 isset($_REQUEST['dring'])?$dring = $_REQUEST['dring']:$dring='';
27 isset($_REQUEST['needsconf'])?$needsconf = $_REQUEST['needsconf']:$needsconf='';
28 isset($_REQUEST['remotealert_id'])?$remotealert_id = $_REQUEST['remotealert_id']:$remotealert_id='';
29 isset($_REQUEST['toolate_id'])?$toolate_id = $_REQUEST['toolate_id']:$toolate_id='';
30 isset($_REQUEST['ringing'])?$ringing = $_REQUEST['ringing']:$ringing='';
31 isset($_REQUEST['pre_ring'])?$pre_ring = $_REQUEST['pre_ring']:$pre_ring='0';
32 isset($_REQUEST['ddial'])?$ddial = $_REQUEST['ddial']:$ddial='';
33 isset($_REQUEST['changecid'])?$changecid = $_REQUEST['changecid']:$changecid='default';
34 isset($_REQUEST['fixedcid'])?$fixedcid = $_REQUEST['fixedcid']:$fixedcid='';
35
36
37 if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) {
38         $goto = $_REQUEST[$_REQUEST['goto0']."0"];
39 } else {
40         $goto = '';
41 }
42
43
44 if (isset($_REQUEST["grplist"])) {
45   $grplist = explode("\n",$_REQUEST["grplist"]);
46
47   if (!$grplist) {
48     $grplist = null;
49   }
50  
51   foreach (array_keys($grplist) as $key) {
52     //trim it
53     $grplist[$key] = trim($grplist[$key]);
54     
55     // remove invalid chars
56     $grplist[$key] = preg_replace("/[^0-9#*]/", "", $grplist[$key]);
57
58     if ($grplist[$key] == ltrim($extdisplay,'GRP-').'#')
59       $grplist[$key] = rtrim($grplist[$key],'#');
60     
61     // remove blanks
62     if ($grplist[$key] == "") unset($grplist[$key]);
63   }
64  
65   // check for duplicates, and re-sequence
66   $grplist = array_values(array_unique($grplist));
67 }
68
69 // do if we are submitting a form
70 if(isset($_POST['action'])){
71   //check if the extension is within range for this user
72   if (isset($account) && !checkRange($account)){
73     echo "<script>javascript:alert('". _("Warning! Extension")." ".$account." "._("is not allowed for your account").".');</script>";
74   } else {
75     //add group
76     if ($action == 'addGRP') {
77       findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid,$fixedcid);
78
79       needreload();
80       redirect_standard();
81     }
82     
83     //del group
84     if ($action == 'delGRP') {
85       findmefollow_del($account);
86       needreload();
87       redirect_standard();
88     }
89     
90     //edit group - just delete and then re-add the extension
91     if ($action == 'edtGRP') {
92       findmefollow_del($account);
93       findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid,$fixedcid);
94
95       needreload();
96       redirect_standard('extdisplay');
97     }
98   }
99 }
100 ?>
101
102
103 <div class="rnav"><ul>
104 <?php
105 //get unique ring groups
106 $gresults = findmefollow_allusers();
107 $set_users = findmefollow_list();
108
109 if (isset($gresults)) {
110   foreach ($gresults as $gresult) {
111     $defined = is_array($set_users) ? (in_array($gresult[0], $set_users) ? "(edit)" : "(add)") : "add";
112                 echo "<li><a class=\"".($extdisplay=='GRP-'.$gresult[0] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&extdisplay=".urlencode("GRP-".$gresult[0])."\">"._("$gresult[1]")." <{$gresult[0]}> $defined  </a></li>";
113
114   }
115 }
116 ?>
117 </ul></div>
118
119 <?php
120
121 if ($extdisplay == "") {
122   echo '<br><h2>'._("Follow Me").'</h2><br><h3>'._('Choose a user/extension:').'</h3><br><br><br><br><br><br><br>';
123   }
124 elseif ($action == 'delGRP') {
125   echo '<br><h3>'._("Follow Me").' '.$account.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>';
126 } else {
127   if ($extdisplay != "") {
128     // We need to populate grplist with the existing extension list.
129     $extdisplay = ltrim($extdisplay,'GRP-');
130
131     $thisgrp = findmefollow_get($extdisplay, 1);
132     $grpliststr = isset($thisgrp['grplist']) ? $thisgrp['grplist'] : '';
133     $grplist = explode("-", $grpliststr);
134
135     $strategy    = isset($thisgrp['strategy'])    ? $thisgrp['strategy']    : '';
136     $grppre      = isset($thisgrp['grppre'])      ? $thisgrp['grppre']      : '';
137     $grptime     = isset($thisgrp['grptime'])     ? $thisgrp['grptime']     : '';
138     $annmsg_id   = isset($thisgrp['annmsg_id'])      ? $thisgrp['annmsg_id']      : '';
139     $dring       = isset($thisgrp['dring'])       ? $thisgrp['dring']       : '';
140     $remotealert_id = isset($thisgrp['remotealert_id']) ? $thisgrp['remotealert_id'] : '';
141     $needsconf   = isset($thisgrp['needsconf'])   ? $thisgrp['needsconf']   : '';
142     $toolate_id  = isset($thisgrp['toolate_id'])     ? $thisgrp['toolate_id']     : '';
143     $ringing     = isset($thisgrp['ringing'])     ? $thisgrp['ringing']     : '';
144     $pre_ring    = isset($thisgrp['pre_ring'])    ? $thisgrp['pre_ring']    : '';
145     $ddial       = isset($thisgrp['ddial'])       ? $thisgrp['ddial']       : '';
146     $changecid   = isset($thisgrp['changecid'])   ? $thisgrp['changecid']   : 'default';
147     $fixedcid    = isset($thisgrp['fixedcid'])    ? $thisgrp['fixedcid']    : '';
148     $goto = isset($thisgrp['postdest'])?$thisgrp['postdest']:((isset($thisgrp['voicemail']) && $thisgrp['voicemail'] != 'novm')?"ext-local,vmu$extdisplay,1":'');
149     unset($grpliststr);
150     unset($thisgrp);
151     
152     $delButton = "
153       <form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST>
154         <input type=\"hidden\" name=\"display\" value=\"{$dispnum}\">
155         <input type=\"hidden\" name=\"account\" value=\"{$extdisplay}\">
156         <input type=\"hidden\" name=\"action\" value=\"delGRP\">
157         <input type=submit value=\""._("Delete Entries")."\">
158       </form>";
159       
160     echo "<h2>"._("Follow Me").": ".$extdisplay."</h2>";
161
162
163     // Copied straight out of old code,let's see if it works?
164     //
165     if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) {
166       $editURL = $_SERVER['PHP_SELF'].'?display=users&extdisplay='.$extdisplay;
167       $EXTorUSER = _("User");
168     }
169     else {
170       $editURL = $_SERVER['PHP_SELF'].'?display=extensions&extdisplay='.$extdisplay;
171       $EXTorUSER = _("Extension");
172     }
173
174     $label = '<span><img width="16" height="16" border="0" title="'.sprintf(_("Edit %s"),$EXTorUSER).'" alt="" src="images/user_edit.png"/>&nbsp;'.sprintf(_("Edit %s %s"),$EXTorUSER, $extdisplay).'</span>';
175     echo "<p><a href=".$editURL.">".$label."</a></p>";
176     echo "<p>".$delButton."</p>";
177   }
178   ?>
179       <form name="editGRP" action="<?php  $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkGRP(editGRP);">
180       <input type="hidden" name="display" value="<?php echo $dispnum?>">
181       <input type="hidden" name="action" value="<?php echo (($extdisplay != "") ? 'edtGRP' : 'addGRP'); ?>">
182       <table>
183       <tr><td colspan="2"><h5><?php  echo (($extdisplay != "") ? _("Edit Follow Me") : _("Add Follow Me")) ?><hr></h5></td></tr>
184       <tr>
185 <?php
186   if ($extdisplay != "") {
187
188 ?>
189         <input size="5" type="hidden" name="account" value="<?php  echo $extdisplay; ?>">
190 <?php     } else { ?>
191         <td><a href="#" class="info"><?php echo _("group number")?>:<span><?php echo _("The number users will dial to ring extensions in this ring group")?></span></a></td>
192         <td><input size="5" type="text" name="account" value="<?php  echo $gresult[0] + 1; ?>"></td>
193 <?php     } ?>
194       </tr>
195
196       <tr>
197         <td><a href="#" class="info"><?php echo _("Disable")?><span><?php echo _('By default (not checked) any call to this extension will go to this Follow-Me instead, including directory calls by name from IVRs. If checked, calls will go only to the extension.<BR>However, destinations that specify FollowMe will come here.<BR>Checking this box is often used in conjunction with VmX Locater, where you want a call to ring the extension, and then only if the caller chooses to find you do you want it to come here.')?></span></a>:</td>
198         <td><input type="checkbox" name="ddial" value="CHECKED" <?php echo $ddial ?>   tabindex="<?php echo ++$tabindex;?>"/></td>
199       </tr>
200
201       <tr>
202         <td><a href="#" class="info"><?php echo _("Initial Ring Time:")?>
203         <span><?php echo _("This is the number of seconds to ring the primary extension prior to proceeding to the follow-me list. The extension can also be included in the follow-me list. A 0 setting will bypass this.")?>
204         </span></a>
205         </td>
206         <td>
207           <select name="pre_ring" tabindex="<?php echo ++$tabindex;?>">
208           <?php
209             $default = (isset($pre_ring) ? $pre_ring : 0);
210             for ($i=0; $i <= 60; $i++) {
211               echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.$i.'</option>';
212             }
213           ?>
214           </select>
215         </td>
216       </tr>
217
218       <tr>
219         <td>
220         <a href="#" class="info"><?php echo _("Ring Strategy:")?>
221         <span>
222           <b><?php echo _("ringallv2")?></b><?php echo _("ring primary extension for initial ring time followed by all additional extensions until one answers")?><br>
223           <b><?php echo _("ringall")?></b><?php echo _("ring all available channels until one answers (default)")?><br>
224           <b><?php echo _("hunt")?></b>: <?php echo _("take turns ringing each available extension")?><br>
225           <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>
226           <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>
227           <b><?php echo _("firstavailable")?></b><?php echo _("ring only the first available channel")?><br>
228           <b><?php echo _("firstnotonphone")?></b><?php echo _("ring only the first channel which is not off hook - ignore CW")?><br>
229         </span>
230         </a>
231         </td>
232         <td>
233           <select name="strategy" tabindex="<?php echo ++$tabindex;?>">
234           <?php
235             $default = (isset($strategy) ? $strategy : 'ringall');
236                                                 $items = array('ringallv2','ringallv2-prim','ringall','ringall-prim','hunt','hunt-prim','memoryhunt','memoryhunt-prim','firstavailable','firstnotonphone');
237             foreach ($items as $item) {
238               echo '<option value="'.$item.'" '.($default == $item ? 'SELECTED' : '').'>'._($item);
239             }
240           ?>   
241           </select>
242         </td>
243       </tr>
244
245       <tr>
246         <td>
247           <a href=# class="info"><?php echo _("Ring Time (max 60 sec)")?>
248             <span>
249               <?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")?>
250             </span>
251           </a>
252         </td>
253         <td><input size="4" type="text" name="grptime" value="<?php  echo $grptime?$grptime:20 ?>" tabindex="<?php echo ++$tabindex;?>"></td>
254       </tr>
255
256       <tr>
257         <td valign="top"><a href="#" class="info"><?php echo _("Follow-Me List")?>:<span><br><?php echo _("List extensions to ring, one per line, or use the Extension Quick Pick below.<br><br>You can include an extension on a remote system, or an external number by suffixing a number with a pound (#).  ex:  2448089# would dial 2448089 on the appropriate trunk (see Outbound Routing).")?><br><br></span></a></td>
258         <td valign="top">
259 <?php
260     $rows = count($grplist)+1;
261     if ($rows <= 2 && trim($grplist[0]) == "") {
262       $grplist[0] = $extdisplay;
263     }
264     ($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows);
265 ?>
266           <textarea id="grplist" cols="15" rows="<?php  echo $rows ?>" name="grplist" tabindex="<?php echo ++$tabindex;?>"><?php echo implode("\n",$grplist);?></textarea>
267         </td>
268       </tr>
269
270       <tr>
271         <td>
272         <a href=# class="info"><?php echo _("Extension Quick Pick")?>
273           <span>
274             <?php echo _("Choose an extension to append to the end of the extension list above.")?>
275           </span>
276         </a>
277         </td>
278         <td>
279           <select onChange="insertExten();" id="insexten" tabindex="<?php echo ++$tabindex;?>">
280             <option value=""><?php echo _("(pick extension)")?></option>
281   <?php
282             $results = core_users_list();
283             foreach ($results as $result) {
284               echo "<option value='".$result[0]."'>".$result[0]." (".$result[1].")</option>\n";
285             }
286   ?>
287           </select>
288         </td>
289       </tr>
290
291 <?php if(function_exists('recordings_list')) { //only include if recordings is enabled?>
292       <tr>
293         <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>
294         <td>
295           <select name="annmsg_id" tabindex="<?php echo ++$tabindex;?>">
296           <?php
297             $tresults = recordings_list();
298             $default = (isset($annmsg_id) ? $annmsg_id : '');
299             echo '<option value="">'._("None");
300             if (isset($tresults)) {
301               foreach ($tresults as $tresult) {
302                 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n";
303               }
304             }
305           ?>   
306           </select>   
307         </td>
308       </tr>
309 <?php } else { ?>
310       <tr>
311         <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>
312         <td>
313           <?php
314             $default = (isset($annmsg_id) ? $annmsg_id : '');
315           ?>
316           <input type="hidden" name="annmsg_id" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?>
317         </td>
318       </tr>
319
320 <?php } if (function_exists('music_list')) { ?>
321       <tr>
322         <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>
323         <td>
324           <select name="ringing" tabindex="<?php echo ++$tabindex;?>">
325           <?php
326             $tresults = music_list();
327             $cur = (isset($ringing) ? $ringing : 'Ring');
328             echo '<option value="Ring">'._("Ring")."</option>";
329             if (isset($tresults[0])) {
330               foreach ($tresults as $tresult) {
331                 echo '<option value="'.$tresult.'"'.($tresult == $cur ? ' SELECTED' : '').'>'.$tresult."</option>\n";
332               }
333             }
334           ?>
335           </select>
336           </td>
337         </tr>
338 <?php } ?>
339
340       <tr>
341         <td><a href="#" class="info"><?php echo _("CID Name Prefix")?>:<span><?php echo _('You can optionally prefix the Caller ID 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>
342         <td><input size="4" type="text" name="grppre" value="<?php  echo $grppre ?>" tabindex="<?php echo ++$tabindex;?>"></td>
343       </tr>
344
345       <tr>
346         <td><a href="#" class="info"><?php echo _("Alert Info")?>:<span><?php echo _('You can optionally include an Alert Info which can create distinctive rings on SIP phones.')?></span></a></td>
347         <td><input size="30" type="text" name="dring" value="<?php  echo $dring ?>" tabindex="<?php echo ++$tabindex;?>"></td>
348       </tr>
349
350       <tr><td colspan="2"><h5><?php echo _("Call Confirmation Configuration") ?><hr></h5></td></tr>
351
352       <tr>
353         <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/ringall-prim  ring strategy')?></span></a>:</td>
354         <td>
355           <input type="checkbox" name="needsconf" value="CHECKED" <?php echo $needsconf ?>   tabindex="<?php echo ++$tabindex;?>"/>
356         </td>
357       </tr>
358
359 <?php if(function_exists('recordings_list')) { //only include if recordings is enabled?>
360       <tr>
361         <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>
362         <td>
363           <select name="remotealert_id" tabindex="<?php echo ++$tabindex;?>">
364           <?php
365             $tresults = recordings_list();
366             $default = (isset($remotealert_id) ? $remotealert_id : '');
367             echo '<option value="">'._("Default")."</option>";
368             if (isset($tresults[0])) {
369               foreach ($tresults as $tresult) {
370                 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n";
371               }
372             }
373           ?>
374           </select>
375         </td>
376       </tr>
377       <tr>
378         <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>
379         <td>
380         <select name="toolate_id" tabindex="<?php echo ++$tabindex;?>">
381           <?php
382             $tresults = recordings_list();
383             $default = (isset($toolate_id) ? $toolate_id : '');
384             echo '<option value="">'._("Default")."</option>";
385             if (isset($tresults[0])) {
386               foreach ($tresults as $tresult) {
387                 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n";
388               }
389             }
390           ?>
391           </select>
392         </td>
393       </tr>
394 <?php } ?>
395
396       <tr><td colspan="2"><h5><?php echo _("Change External CID Configuration") ?><hr></h5></td></tr>
397       <tr>
398         <td>
399         <a href="#" class="info"><?php echo _("Mode")?>:
400         <span>
401           <b><?php echo _("Default")?></b><?php echo _("Transmits the Callers CID if allowed by the trunk.")?><br>
402           <b><?php echo _("Fixed CID Value")?></b><?php echo _("Always transmit the Fixed CID Value below.")?><br>
403           <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>
404           <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>
405           <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>
406         </span>
407         </a>
408         </td>
409         <td>
410           <select name="changecid" id="changecid" tabindex="<?php echo ++$tabindex;?>">
411           <?php
412             $default = (isset($changecid) ? $changecid : 'default');
413             echo '<option value="default" '.($default == 'default' ? 'SELECTED' : '').'>'._("Default");
414             echo '<option value="fixed" '.($default == 'fixed' ? 'SELECTED' : '').'>'._("Fixed CID Value");
415             echo '<option value="extern" '.($default == 'extern' ? 'SELECTED' : '').'>'._("Outside Calls Fixed CID Value");
416             echo '<option value="did" '.($default == 'did' ? 'SELECTED' : '').'>'._("Use Dialed Number");
417             echo '<option value="forcedid" '.($default == 'forcedid' ? 'SELECTED' : '').'>'._("Force Dialed Number");
418             $fixedcid_disabled = ($default != 'fixed' && $default != 'extern') ? 'disabled = "disabled"':'';
419           ?>   
420           </select>
421         </td>
422       </tr>
423
424       <tr>
425         <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>
426         <td><input size="30" type="text" name="fixedcid" id="fixedcid" value="<?php  echo $fixedcid ?>" tabindex="<?php echo ++$tabindex;?>" <?php echo $fixedcid_disabled ?>></td>
427       </tr>
428      
429       <tr><td colspan="2"><br><h5><?php echo _("Destination if no answer")?>:<hr></h5></td></tr>
430
431 <?php
432 //draw goto selects
433 echo drawselects($goto,0);
434 ?>
435      
436       <tr>
437       <td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td>   
438      
439       </tr>
440       </table>
441       </form>
442 <?php     
443     } //end if action == delGRP
444     
445 ?>
446 <script language="javascript">
447 <!--
448
449 $(document).ready(function(){
450   $("#changecid").change(function(){
451     state = (this.value == "fixed" || this.value == "extern") ? "" : "disabled";
452     $("#fixedcid").attr("disabled",state);
453   });
454 });
455
456 function insertExten() {
457   exten = document.getElementById('insexten').value;
458
459   grpList=document.getElementById('grplist');
460   if (grpList.value[ grpList.value.length - 1 ] == "\n") {
461     grpList.value = grpList.value + exten;
462   } else {
463     grpList.value = grpList.value + '\n' + exten;
464   }
465
466   // reset element
467   document.getElementById('insexten').value = '';
468 }
469
470 function checkGRP(theForm) {
471   var msgInvalidExtList = "<?php echo _('Please enter an extension list.'); ?>";
472   var msgInvalidTime = "<?php echo _('Invalid time specified'); ?>";
473   var msgInvalidGrpTimeRange = "<?php echo _('Time must be between 1 and 60 seconds'); ?>";
474   var msgInvalidRingStrategy = "<?php echo _('Only ringall, ringallv2, hunt and the respective -prim versions are supported when confirmation is checked'); ?>";
475   var msgInvalidCID = "<?php echo _('Invalid CID Number. Must be in a format of digits only with an option of E164 format using a leading "+"'); ?>";
476
477   // set up the Destination stuff
478   setDestinations(theForm, 1);
479
480   // form validation
481   defaultEmptyOK = false;
482   if (isEmpty(theForm.grplist.value))
483     return warnInvalid(theForm.grplist, msgInvalidExtList);
484
485   if (!theForm.fixedcid.disabled) {
486     fixedcid = $.trim(theForm.fixedcid.value);
487     if (!fixedcid.match('^[+]{0,1}[0-9]+$')) {
488       return warnInvalid(theForm.fixedcid, msgInvalidCID);
489     }
490   }
491
492   if (!isInteger(theForm.grptime.value)) {
493     return warnInvalid(theForm.grptime, msgInvalidTime);
494   } else {
495     var grptimeVal = theForm.grptime.value;
496     if (grptimeVal < 1 || grptimeVal > 60)
497       return warnInvalid(theForm.grptime, msgInvalidGrpTimeRange);
498   }
499
500   if (theForm.needsconf.checked && (theForm.strategy.value.substring(0,7) != "ringall" && theForm.strategy.value.substring(0,4) != "hunt")) {
501     return warnInvalid(theForm.needsconf, msgInvalidRingStrategy);
502   }
503
504   defaultEmptyOK = true;
505
506   if (!validateDestinations(theForm, 1, true))
507     return false;
508
509   return true;
510 }
511 //-->
512 </script>
Note: See TracBrowser for help on using the browser.