| 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 |
$dispnum = 'findmefollow'; //used for switch on config.php |
|---|
| 15 |
|
|---|
| 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'])?$annmsg = $_REQUEST['annmsg']:$annmsg=''; |
|---|
| 24 |
isset($_REQUEST['dring'])?$dring = $_REQUEST['dring']:$dring=''; |
|---|
| 25 |
isset($_REQUEST['needsconf'])?$needsconf = $_REQUEST['needsconf']:$needsconf=''; |
|---|
| 26 |
isset($_REQUEST['remotealert'])?$remotealert = $_REQUEST['remotealert']:$remotealert=''; |
|---|
| 27 |
isset($_REQUEST['toolate'])?$toolate = $_REQUEST['toolate']:$toolate=''; |
|---|
| 28 |
isset($_REQUEST['ringing'])?$ringing = $_REQUEST['ringing']:$ringing=''; |
|---|
| 29 |
isset($_REQUEST['pre_ring'])?$pre_ring = $_REQUEST['pre_ring']:$pre_ring='0'; |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { |
|---|
| 33 |
$goto = $_REQUEST[$_REQUEST['goto0']."0"]; |
|---|
| 34 |
} else { |
|---|
| 35 |
$goto = ''; |
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
if (isset($_REQUEST["grplist"])) { |
|---|
| 40 |
$grplist = explode("\n",$_REQUEST["grplist"]); |
|---|
| 41 |
|
|---|
| 42 |
if (!$grplist) { |
|---|
| 43 |
$grplist = null; |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
foreach (array_keys($grplist) as $key) { |
|---|
| 47 |
//trim it |
|---|
| 48 |
$grplist[$key] = trim($grplist[$key]); |
|---|
| 49 |
|
|---|
| 50 |
// remove invalid chars |
|---|
| 51 |
$grplist[$key] = preg_replace("/[^0-9#*]/", "", $grplist[$key]); |
|---|
| 52 |
|
|---|
| 53 |
// remove blanks |
|---|
| 54 |
if ($grplist[$key] == "") unset($grplist[$key]); |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
// check for duplicates, and re-sequence |
|---|
| 58 |
$grplist = array_values(array_unique($grplist)); |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
// do if we are submitting a form |
|---|
| 62 |
if(isset($_POST['action'])){ |
|---|
| 63 |
//check if the extension is within range for this user |
|---|
| 64 |
if (isset($account) && !checkRange($account)){ |
|---|
| 65 |
echo "<script>javascript:alert('". _("Warning! Extension")." ".$account." "._("is not allowed for your account").".');</script>"; |
|---|
| 66 |
} else { |
|---|
| 67 |
//add group |
|---|
| 68 |
if ($action == 'addGRP') { |
|---|
| 69 |
findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg,$dring,$needsconf,$remotealert,$toolate,$ringing,$pre_ring); |
|---|
| 70 |
|
|---|
| 71 |
needreload(); |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
//del group |
|---|
| 75 |
if ($action == 'delGRP') { |
|---|
| 76 |
findmefollow_del($account); |
|---|
| 77 |
needreload(); |
|---|
| 78 |
} |
|---|
| 79 |
|
|---|
| 80 |
//edit group - just delete and then re-add the extension |
|---|
| 81 |
if ($action == 'edtGRP') { |
|---|
| 82 |
findmefollow_del($account); |
|---|
| 83 |
findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg,$dring,$needsconf,$remotealert,$toolate,$ringing,$pre_ring); |
|---|
| 84 |
|
|---|
| 85 |
needreload(); |
|---|
| 86 |
} |
|---|
| 87 |
} |
|---|
| 88 |
} |
|---|
| 89 |
?> |
|---|
| 90 |
</div> |
|---|
| 91 |
|
|---|
| 92 |
<div class="rnav"><ul> |
|---|
| 93 |
<?php |
|---|
| 94 |
//get unique ring groups |
|---|
| 95 |
$gresults = findmefollow_allusers(); |
|---|
| 96 |
$set_users = findmefollow_list(); |
|---|
| 97 |
|
|---|
| 98 |
if (isset($gresults)) { |
|---|
| 99 |
foreach ($gresults as $gresult) { |
|---|
| 100 |
$defined = is_array($set_users) ? (in_array($gresult[0], $set_users) ? "(edit)" : "(add)") : "add"; |
|---|
| 101 |
echo "<li><a id=\"".($extdisplay=='GRP-'.$gresult[0] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&extdisplay=".urlencode("GRP-".$gresult[0])."\">"._("$gresult[1]")." <{$gresult[0]}> $defined </a></li>"; |
|---|
| 102 |
|
|---|
| 103 |
} |
|---|
| 104 |
} |
|---|
| 105 |
?> |
|---|
| 106 |
</ul></div> |
|---|
| 107 |
|
|---|
| 108 |
<div class="content"> |
|---|
| 109 |
<?php |
|---|
| 110 |
|
|---|
| 111 |
if (!$extdisplay) { |
|---|
| 112 |
echo '<br><h2>'._("Follow Me").'</h2><br><h3>'._('Choose a user/extension:').'</h3><br><br><br><br><br><br><br>'; |
|---|
| 113 |
} |
|---|
| 114 |
elseif ($action == 'delGRP') { |
|---|
| 115 |
echo '<br><h3>'._("Follow Me").' '.$account.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>'; |
|---|
| 116 |
} else { |
|---|
| 117 |
if ($extdisplay) { |
|---|
| 118 |
// We need to populate grplist with the existing extension list. |
|---|
| 119 |
$thisgrp = findmefollow_get(ltrim($extdisplay,'GRP-'), 1); |
|---|
| 120 |
$grpliststr = $thisgrp['grplist']; |
|---|
| 121 |
$grplist = explode("-", $grpliststr); |
|---|
| 122 |
$strategy = $thisgrp['strategy']; |
|---|
| 123 |
$grppre = $thisgrp['grppre']; |
|---|
| 124 |
$grptime = $thisgrp['grptime']; |
|---|
| 125 |
$goto = $thisgrp['postdest']; |
|---|
| 126 |
$annmsg = $thisgrp['annmsg']; |
|---|
| 127 |
$dring = $thisgrp['dring']; |
|---|
| 128 |
$remotealert = $thisgrp['remotealert']; |
|---|
| 129 |
$needsconf = $thisgrp['needsconf']; |
|---|
| 130 |
$toolate = $thisgrp['toolate']; |
|---|
| 131 |
$ringing = $thisgrp['ringing']; |
|---|
| 132 |
$pre_ring = $thisgrp['pre_ring']; |
|---|
| 133 |
unset($grpliststr); |
|---|
| 134 |
unset($thisgrp); |
|---|
| 135 |
|
|---|
| 136 |
$delButton = " |
|---|
| 137 |
<form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST> |
|---|
| 138 |
<input type=\"hidden\" name=\"display\" value=\"{$dispnum}\"> |
|---|
| 139 |
<input type=\"hidden\" name=\"account\" value=\"".ltrim($extdisplay,'GRP-')."\"> |
|---|
| 140 |
<input type=\"hidden\" name=\"action\" value=\"delGRP\"> |
|---|
| 141 |
<input type=submit value=\""._("Delete Entries")."\"> |
|---|
| 142 |
</form>"; |
|---|
| 143 |
|
|---|
| 144 |
echo "<h2>"._("Follow Me").": ".ltrim($extdisplay,'GRP-')."</h2>"; |
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
// Copied straight out of old code,let's see if it works? |
|---|
| 148 |
// |
|---|
| 149 |
if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) { |
|---|
| 150 |
$editURL = $_SERVER['PHP_SELF'].'?display=users&extdisplay='.ltrim($extdisplay,'GRP-'); |
|---|
| 151 |
$EXTorUSER = "User"; |
|---|
| 152 |
} |
|---|
| 153 |
else { |
|---|
| 154 |
$editURL = $_SERVER['PHP_SELF'].'?display=extensions&extdisplay='.ltrim($extdisplay,'GRP-'); |
|---|
| 155 |
$EXTorUSER = "Extension"; |
|---|
| 156 |
} |
|---|
| 157 |
|
|---|
| 158 |
echo "<p><a href=".$editURL."> Edit ".$EXTorUSER." ".ltrim($extdisplay,'GRP-')."</a></p>"; |
|---|
| 159 |
echo "<p>".$delButton."</p>"; |
|---|
| 160 |
} |
|---|
| 161 |
?> |
|---|
| 162 |
<form name="editGRP" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkGRP(editGRP);"> |
|---|
| 163 |
<input type="hidden" name="display" value="<?php echo $dispnum?>"> |
|---|
| 164 |
<input type="hidden" name="action" value="<?php echo ($extdisplay ? 'edtGRP' : 'addGRP'); ?>"> |
|---|
| 165 |
<table> |
|---|
| 166 |
<tr><td colspan="2"><h5><?php echo ($extdisplay ? _("Edit Follow Me") : _("Add Follow Me")) ?><hr></h5></td></tr> |
|---|
| 167 |
<tr> |
|---|
| 168 |
<?php |
|---|
| 169 |
if ($extdisplay) { |
|---|
| 170 |
|
|---|
| 171 |
?> |
|---|
| 172 |
<input size="5" type="hidden" name="account" value="<?php echo ltrim($extdisplay,'GRP-'); ?>"> |
|---|
| 173 |
<?php } else { ?> |
|---|
| 174 |
<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> |
|---|
| 175 |
<td><input size="5" type="text" name="account" value="<?php echo $gresult[0] + 1; ?>"></td> |
|---|
| 176 |
<?php } ?> |
|---|
| 177 |
</tr> |
|---|
| 178 |
|
|---|
| 179 |
<tr> |
|---|
| 180 |
<td><a href="#" class="info"><?php echo _("Initial Ring Time:")?> |
|---|
| 181 |
<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.")?> |
|---|
| 182 |
</span></a> |
|---|
| 183 |
</td> |
|---|
| 184 |
<td> |
|---|
| 185 |
|
|---|
| 186 |
<select name="pre_ring"/> |
|---|
| 187 |
<?php |
|---|
| 188 |
$default = (isset($pre_ring) ? $pre_ring : 0); |
|---|
| 189 |
for ($i=0; $i <= 60; $i++) { |
|---|
| 190 |
echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.$i.'</option>'; |
|---|
| 191 |
} |
|---|
| 192 |
?> |
|---|
| 193 |
</select> |
|---|
| 194 |
</td> |
|---|
| 195 |
</tr> |
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
<tr> |
|---|
| 199 |
<td> <a href="#" class="info"><?php echo _("ring strategy:")?> |
|---|
| 200 |
<span> |
|---|
| 201 |
<b><?php echo _("ringall")?></b>: <?php echo _("ring all available channels until one answers (default)")?><br> |
|---|
| 202 |
<b><?php echo _("hunt")?></b>: <?php echo _("take turns ringing each available extension")?><br> |
|---|
| 203 |
<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> |
|---|
| 204 |
<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 run. If the primary is freepbx CF unconditional, then all will be rung")?><br> |
|---|
| 205 |
</span> |
|---|
| 206 |
</a></td> |
|---|
| 207 |
<td> |
|---|
| 208 |
<select name="strategy"/> |
|---|
| 209 |
<?php |
|---|
| 210 |
$default = (isset($strategy) ? $strategy : 'ringall'); |
|---|
| 211 |
$items = array('ringall','ringall-prim','hunt','hunt-prim','memoryhunt','memoryhunt-prim'); |
|---|
| 212 |
foreach ($items as $item) { |
|---|
| 213 |
echo '<option value="'.$item.'" '.($default == $item ? 'SELECTED' : '').'>'._($item); |
|---|
| 214 |
} |
|---|
| 215 |
?> |
|---|
| 216 |
</select> |
|---|
| 217 |
</td> |
|---|
| 218 |
</tr> |
|---|
| 219 |
<tr> |
|---|
| 220 |
<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> |
|---|
| 221 |
<td><input size="18" type="text" name="dring" value="<?php echo $dring ?>"></td> |
|---|
| 222 |
</tr> |
|---|
| 223 |
<tr> |
|---|
| 224 |
<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> |
|---|
| 225 |
<td> <?php if (!function_exists('recordings_list')) { echo _("System Recordings not installed. Option Disabled"); } else { ?> |
|---|
| 226 |
<input type="checkbox" name="needsconf" value="CHECKED" <?php echo $needsconf ?> /></td> |
|---|
| 227 |
<?php } ?> |
|---|
| 228 |
</tr> |
|---|
| 229 |
<?php if(function_exists('recordings_list')) { //only include if recordings is enabled?> |
|---|
| 230 |
<tr> |
|---|
| 231 |
<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> |
|---|
| 232 |
<td> |
|---|
| 233 |
<select name="remotealert"/> |
|---|
| 234 |
<?php |
|---|
| 235 |
$tresults = recordings_list(); |
|---|
| 236 |
$default = (isset($remotealert) ? $remotealert : ''); |
|---|
| 237 |
echo '<option value="">'._("Default")."</option>"; |
|---|
| 238 |
if (isset($tresults[0])) { |
|---|
| 239 |
foreach ($tresults as $tresult) { |
|---|
| 240 |
echo '<option value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]."</option>\n"; |
|---|
| 241 |
} |
|---|
| 242 |
} |
|---|
| 243 |
?> |
|---|
| 244 |
</select> |
|---|
| 245 |
</td> |
|---|
| 246 |
</tr> |
|---|
| 247 |
<tr> |
|---|
| 248 |
<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> |
|---|
| 249 |
<td> |
|---|
| 250 |
<select name="toolate"/> |
|---|
| 251 |
<?php |
|---|
| 252 |
$tresults = recordings_list(); |
|---|
| 253 |
$default = (isset($toolate) ? $toolate : ''); |
|---|
| 254 |
echo '<option value="">'._("Default")."</option>"; |
|---|
| 255 |
if (isset($tresults[0])) { |
|---|
| 256 |
foreach ($tresults as $tresult) { |
|---|
| 257 |
echo '<option value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]."</option>\n"; |
|---|
| 258 |
} |
|---|
| 259 |
} |
|---|
| 260 |
?> |
|---|
| 261 |
</select> |
|---|
| 262 |
</td> |
|---|
| 263 |
</tr> |
|---|
| 264 |
<?php } ?> |
|---|
| 265 |
<tr> |
|---|
| 266 |
<td valign="top"><a href="#" class="info"><?php echo _("extension list")?>:<span><br><?php echo _("List extensions to ring, one per line.<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> |
|---|
| 267 |
<td valign="top"> |
|---|
| 268 |
<?php |
|---|
| 269 |
$rows = count($grplist)+1; |
|---|
| 270 |
if ($rows <= 2 && trim($grplist[0]) == "") { |
|---|
| 271 |
$grplist[0] = ltrim($extdisplay,'GRP-'); |
|---|
| 272 |
} |
|---|
| 273 |
($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows); |
|---|
| 274 |
?> |
|---|
| 275 |
<textarea id="grplist" cols="15" rows="<?php echo $rows ?>" name="grplist"><?php echo implode("\n",$grplist);?></textarea><br> |
|---|
| 276 |
|
|---|
| 277 |
<input type="submit" style="font-size:10px;" value="<?php echo _("Clean & Remove duplicates")?>" /> |
|---|
| 278 |
</td> |
|---|
| 279 |
</tr> |
|---|
| 280 |
<tr> |
|---|
| 281 |
<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> |
|---|
| 282 |
<td><input size="4" type="text" name="grppre" value="<?php echo $grppre ?>"></td> |
|---|
| 283 |
</tr> |
|---|
| 284 |
|
|---|
| 285 |
|
|---|
| 286 |
<tr> |
|---|
| 287 |
<td><?php echo _("ring time (max 60 sec)")?>:</td> |
|---|
| 288 |
<td><input size="4" type="text" name="grptime" value="<?php echo $grptime?$grptime:20 ?>"></td> |
|---|
| 289 |
</tr> |
|---|
| 290 |
<?php if(function_exists('recordings_list')) { //only include if recordings is enabled?> |
|---|
| 291 |
<tr> |
|---|
| 292 |
<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> |
|---|
| 293 |
<td> |
|---|
| 294 |
<select name="annmsg"/> |
|---|
| 295 |
<?php |
|---|
| 296 |
$tresults = recordings_list(); |
|---|
| 297 |
$default = (isset($annmsg) ? $annmsg : ''); |
|---|
| 298 |
echo '<option value="">'._("None"); |
|---|
| 299 |
if (isset($tresults)) { |
|---|
| 300 |
foreach ($tresults as $tresult) { |
|---|
| 301 |
echo '<option value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]; |
|---|
| 302 |
} |
|---|
| 303 |
} |
|---|
| 304 |
?> |
|---|
| 305 |
</select> |
|---|
| 306 |
</td> |
|---|
| 307 |
</tr> |
|---|
| 308 |
<?php } else { ?> |
|---|
| 309 |
<tr> |
|---|
| 310 |
<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> |
|---|
| 311 |
<td> |
|---|
| 312 |
<?php |
|---|
| 313 |
$default = (isset($annmsg) ? $annmsg : ''); |
|---|
| 314 |
?> |
|---|
| 315 |
<input type="hidden" name="annmsg" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?> |
|---|
| 316 |
</td> |
|---|
| 317 |
</tr> |
|---|
| 318 |
<?php } if (function_exists('music_list')) { ?> |
|---|
| 319 |
<tr> |
|---|
| 320 |
<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. Note this DOES NOT WORK with call confirmation, due to limitations of Asterisk")?></span></a></td> |
|---|
| 321 |
<td> |
|---|
| 322 |
<select name="ringing"/> |
|---|
| 323 |
<?php |
|---|
| 324 |
$tresults = music_list("/var/lib/asterisk/mohmp3"); |
|---|
| 325 |
$cur = (isset($ringing) ? $ringing : 'Ring'); |
|---|
| 326 |
echo '<option value="Ring">'._("Ring")."</option>"; |
|---|
| 327 |
if (isset($tresults[0])) { |
|---|
| 328 |
foreach ($tresults as $tresult) { |
|---|
| 329 |
echo '<option value="'.$tresult.'"'.($tresult == $cur ? ' SELECTED' : '').'>'.$tresult."</option>\n"; |
|---|
| 330 |
} |
|---|
| 331 |
} |
|---|
| 332 |
?> |
|---|
| 333 |
</select> |
|---|
| 334 |
</td> |
|---|
| 335 |
</tr> |
|---|
| 336 |
<?php } ?> |
|---|
| 337 |
|
|---|
| 338 |
<tr><td colspan="2"><br><h5><?php echo _("Destination if no answer")?>:<hr></h5></td></tr> |
|---|
| 339 |
|
|---|
| 340 |
<?php |
|---|
| 341 |
//draw goto selects |
|---|
| 342 |
echo drawselects($goto,0); |
|---|
| 343 |
?> |
|---|
| 344 |
|
|---|
| 345 |
<tr> |
|---|
| 346 |
<td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td> |
|---|
| 347 |
|
|---|
| 348 |
</tr> |
|---|
| 349 |
</table> |
|---|
| 350 |
</form> |
|---|
| 351 |
<?php |
|---|
| 352 |
} //end if action == delGRP |
|---|
| 353 |
|
|---|
| 354 |
?> |
|---|
| 355 |
<script language="javascript"> |
|---|
| 356 |
<!-- |
|---|
| 357 |
|
|---|
| 358 |
function checkGRP(theForm) { |
|---|
| 359 |
var msgInvalidGrpNum = "<?php echo _('Invalid Group Number specified'); ?>"; |
|---|
| 360 |
var msgInvalidGrpNumStartWithZero = "<?php echo _('Group numbers with more than one digit cannot begin with 0'); ?>"; |
|---|
| 361 |
var msgInvalidExtList = "<?php echo _('Please enter an extension list.'); ?>"; |
|---|
| 362 |
var msgInvalidGrpPrefix = "<?php echo _('Invalid prefix. Valid characters: a-z A-Z 0-9 : _ -'); ?>"; |
|---|
| 363 |
var msgInvalidTime = "<?php echo _('Invalid time specified'); ?>"; |
|---|
| 364 |
var msgInvalidGrpTimeRange = "<?php echo _('Time must be between 1 and 60 seconds'); ?>"; |
|---|
| 365 |
var msgInvalidRingStrategy = "<?php echo _('You must choose ringall or ringall-prim ring strategy when using Confirm Calls'); ?>"; |
|---|
| 366 |
|
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
// set up the Destination stuff |
|---|
| 370 |
setDestinations(theForm, 1); |
|---|
| 371 |
|
|---|
| 372 |
// form validation |
|---|
| 373 |
defaultEmptyOK = false; |
|---|
| 374 |
if (isEmpty(theForm.grplist.value)) |
|---|
| 375 |
return warnInvalid(theForm.grplist, msgInvalidExtList); |
|---|
| 376 |
|
|---|
| 377 |
defaultEmptyOK = false; |
|---|
| 378 |
if (!isInteger(theForm.grptime.value)) { |
|---|
| 379 |
return warnInvalid(theForm.grptime, msgInvalidTime); |
|---|
| 380 |
} else { |
|---|
| 381 |
var grptimeVal = theForm.grptime.value; |
|---|
| 382 |
if (grptimeVal < 1 || grptimeVal > 60) |
|---|
| 383 |
return warnInvalid(theForm.grptime, msgInvalidGrpTimeRange); |
|---|
| 384 |
} |
|---|
| 385 |
|
|---|
| 386 |
if (theForm.needsconf.checked && theForm.strategy.value.substring(0,7) != "ringall") { |
|---|
| 387 |
return warnInvalid(theForm.needsconf, msgInvalidRingStrategy); |
|---|
| 388 |
} |
|---|
| 389 |
|
|---|
| 390 |
defaultEmptyOK = true; |
|---|
| 391 |
if (!isPrefix(theForm.grppre.value)) |
|---|
| 392 |
return warnInvalid(theForm.grppre, msgInvalidGrpPrefix); |
|---|
| 393 |
|
|---|
| 394 |
if (!validateDestinations(theForm, 1, true)) |
|---|
| 395 |
return false; |
|---|
| 396 |
|
|---|
| 397 |
return true; |
|---|
| 398 |
} |
|---|
| 399 |
//--> |
|---|
| 400 |
</script> |
|---|