📄 page.routing.php
字号:
// implementation of module hook // object was initialized in config.php echo $module_hook->hookHtml;?> <tr> <td><a href=# class="info"><?php echo _("Emergency Dialing")?><span><?php echo _("Optional: Selecting this option will enforce the use of a device's Emergency CID setting (if set). Select this option if this set of routes is used for emergency dialing (ie: 911).</span>")?></a>:</td> <td><input type="checkbox" name="emergency" value="yes" <?php echo ($emergency ? "CHECKED" : "") ?> /></td> </tr> <tr> <td colspan="2"> <br> <a href=# class="info"><?php echo _("Dial Patterns")?><span><?php echo _("A Dial Pattern is a unique set of digits that will select this trunk. Enter one dial pattern per line.")?><br><br><b><?php echo _("Rules:")?></b><br> <strong>X</strong> <?php echo _("matches any digit from 0-9")?><br> <strong>Z</strong> <?php echo _("matches any digit from 1-9")?><br> <strong>N</strong> <?php echo _("matches any digit from 2-9")?><br> <strong>[1237-9]</strong> <?php echo _("matches any digit or letter in the brackets (in this example, 1,2,3,7,8,9)")?><br> <strong>.</strong> <?php echo _("wildcard, matches one or more characters")?> <br> <strong>|</strong> <?php echo _("seperates a dialing prefix from the number (for example, 9|NXXXXXX would match when some dialed \"95551234\" but would only pass \"5551234\" to the trunks)")?> </span></a><br><br> </td> </tr><?php /* old code for using textboxes -- replaced by textarea code$key = -1;foreach ($dialpattern as $key=>$pattern) {?> <tr> <td><?php echo $key ?> </td><td> <input type="text" size="20" name="dialpattern[<?php echo $key ?>]" value="<?php echo $dialpattern[$key] ?>"/> </td> </tr><?php } // foreach$key += 1; // this will be the next key value?> <tr> <td><?php echo $key ?> </td><td> <input type="text" size="20" name="dialpattern[<?php echo $key ?>]" value="<?php echo $dialpattern[$key] ?>"/> </td> </tr> <tr> <td> </td> <td> <br><input type="submit" value="Add"> </td> </tr><?php */ ?> <tr> <td> </td><td> <textarea cols="20" rows="<?php $rows = count($dialpattern)+1; echo (($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows) ); ?>" id="dialpattern" name="dialpattern"><?php echo implode("\n",$dialpattern);?></textarea><br> <input type="submit" style="font-size:10px;" value="<?php echo _("Clean & Remove duplicates")?>" /> </td> </tr> <tr> <td><?php echo _("Insert:")?></td> <input id="npanxx" name="npanxx" type="hidden" /> <script language="javascript"> function populateLookup() {<?php if (function_exists("curl_init")) { // curl is installed?> //var npanxx = prompt("What is your areacode + prefix (NPA-NXX)?", document.getElementById('areacode').value); do { var npanxx = <?php echo 'prompt("'._("What is your areacode + prefix (NPA-NXX)?\\n\\n(Note: this database contains North American numbers only, and is not guaranteed to be 100% accurate. You will still have the option of modifying results.)\\n\\nThis may take a few seconds.").'")'?>; if (npanxx == null) return; } while (!npanxx.match("^[2-9][0-9][0-9][-]?[2-9][0-9][0-9]$") && <?php echo '!alert("'._("Invalid NPA-NXX. Must be of the format \'NXX-NXX\'").'")'?>); document.getElementById('npanxx').value = npanxx; document.getElementById('routeEdit').action.value = "populatenpanxx"; document.getElementById('routeEdit').submit();<?php } else { // curl is not installed?> <?php echo "alert('"._("Error: Cannot continue!\\n\\nPrefix lookup requires cURL support in PHP on the server. Please install or enable cURL support in your PHP installation to use this function. See http://www.php.net/curl for more information.")."')"?>;<?php }?> } function insertCode() { code = document.getElementById('inscode').value; insert = ''; switch(code) { case "local": insert = 'NXXXXXX\n'; break; case "local10": insert = 'NXXXXXX\n'+ 'NXXNXXXXXX\n'; break; case 'tollfree': insert = '1800NXXXXXX\n'+ '1888NXXXXXX\n'+ '1877NXXXXXX\n'+ '1866NXXXXXX\n'; break; case "ld": insert = '1NXXNXXXXXX\n'; break; case "int": insert = '011.\n'; break; case 'info': insert = '411\n'+ '311\n'; break; case 'emerg': insert = '911\n'; break; case 'lookup': populateLookup(); insert = ''; break; } dialPattern=document.getElementById('dialpattern'); if (dialPattern.value[ dialPattern.value.length - 1 ] == "\n") { dialPattern.value = dialPattern.value + insert; } else { dialPattern.value = dialPattern.value + '\n' + insert; } // reset element document.getElementById('inscode').value = ''; } --></script> <td> <select onChange="insertCode();" id="inscode"> <option value=""><?php echo _("Pick pre-defined patterns")?></option> <option value="local"><?php echo _("Local 7 digit")?></option> <option value="local10"><?php echo _("Local 7/10 digit")?></option> <option value="tollfree"><?php echo _("Toll-free")?></option> <option value="ld"><?php echo _("Long-distance")?></option> <option value="int"><?php echo _("International")?></option> <option value="info"><?php echo _("Information")?></option> <option value="emerg"><?php echo _("Emergency")?></option> <option value="lookup"><?php echo _("Lookup local prefixes")?></option> </select> </td> </tr> <tr> <td colspan="2"> <br><br> <a href=# class="info"><?php echo _("Trunk Sequence")?><span><?php echo _("The Trunk Sequence controls the order of trunks that will be used when the above Dial Patterns are matched. <br><br>For Dial Patterns that match long distance numbers, for example, you'd want to pick the cheapest routes for long distance (ie, VoIP trunks first) followed by more expensive routes (POTS lines).")?><br></span></a><br><br> </td> </tr> <input type="hidden" id="repotrunkdirection" name="repotrunkdirection" value=""> <input type="hidden" id="repotrunkkey" name="repotrunkkey" value=""> <input type="hidden" id="reporoutedirection" name="reporoutedirection" value=""> <input type="hidden" id="reporoutekey" name="reporoutekey" value=""><?php $key = -1;$positions=count($trunkpriority);foreach ($trunkpriority as $key=>$trunk) {?> <tr> <td align="right"><?php echo $key; ?> </td> <td> <select id='trunkpri<?php echo $key ?>' name="trunkpriority[<?php echo $key ?>]"> <option value=""></option> <?php foreach ($trunks as $name=>$display) { echo "<option id=\"trunk".$key."\" value=\"".$name."\" ".($name == $trunk ? "selected" : "").">".$display."</option>"; } ?> </select> <img src="images/trash.png" style="float:none; margin-left:0px; margin-bottom:0px;" title="Click here to remove this trunk" onclick="deleteTrunk(<?php echo $key ?>)"> <?php // move up if ($key > 0) {?> <img src="images/scrollup.gif" onclick="repositionTrunk('<?php echo $key ?>','up')" alt="<?php echo _("Move Up")?>" style="float:none; margin-left:0px; margin-bottom:0px;" width="9" height="11"> <?php } else { ?> <img src="images/blank.gif" style="float:none; margin-left:0px; margin-bottom:0px;" width="9" height="11"> <?php } // move down if ($key < ($positions-1)) {?> <img src="images/scrolldown.gif" onclick="repositionTrunk('<?php echo $key ?>','down')" alt="<?php echo _("Move Down")?>" style="float:none; margin-left:0px; margin-bottom:0px;" width="9" height="11"> <?php } else { ?> <img src="images/blank.gif" style="float:none; margin-left:0px; margin-bottom:0px;" width="9" height="11"> <?php } ?> </td> </tr><?php } // foreach$key += 1; // this will be the next key value$name = "";?> <tr> <td>   </td> <td> <select id='trunkpri<?php echo $key ?>' name="trunkpriority[<?php echo $key ?>]"> <option value="" SELECTED></option> <?php foreach ($trunks as $name=>$display) { echo "<option value=\"".$name."\">".ltrim($display,"AMP:")."</option>"; } ?> </select> </td> </tr> <tr> <td></td> <td> <input type="submit" value="<?php echo _("Add")?>"> </td> </tr> <tr> <td colspan="2"> <br> <h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"> </h6> </td> </tr> </table> <script language="javascript"><!--var theForm = document.routeEdit;if (theForm.routename.value == "") { theForm.routename.focus();} else { theForm.routepass.focus();}function routeEdit_onsubmit(act) { var msgInvalidRouteName = "<?php echo _('Route name is invalid, please try again'); ?>"; var msgInvalidRoutePwd = "<?php echo _('Route password must be numberic or leave blank to disable'); ?>"; var msgInvalidDialPattern = "<?php echo _('Dial pattern is invalid'); ?>"; var msgInvalidTrunkSelection = "<?php echo _('At least one trunk must be picked'); ?>"; defaultEmptyOK = false; if (isEmpty(theForm.routename.value)) return warnInvalid(theForm.routename, msgInvalidRouteName); defaultEmptyOK = true; if (!isInteger(theForm.routepass.value)) return warnInvalid(theForm.routepass, msgInvalidRoutePwd); defaultEmptyOK = false; if (!isDialpattern(theForm.dialpattern.value)) return warnInvalid(theForm.dialpattern, msgInvalidDialPattern); if (theForm.trunkpri0.value == "") { // should they all be checked ? theForm.trunkpri0.focus(); alert(msgInvalidTrunkSelection); return false; } theForm.action.value = act; return true;}function repositionTrunk(key,direction) { if(direction == "up"){ document.getElementById('repotrunkdirection').value=direction; document.getElementById('repotrunkkey').value=key; }else if(direction == "down" ){ document.getElementById('repotrunkdirection').value=direction; document.getElementById('repotrunkkey').value=key; } document.getElementById('routeEdit').submit();}function deleteTrunk(key) { document.getElementById('trunkpri'+key).value = ''; document.getElementById('routeEdit').submit();}function repositionRoute(key,direction){ if(direction == "up"){ document.getElementById('reporoutedirection').value=direction; document.getElementById('reporoutekey').value=key; }else if(direction == "down" ){ document.getElementById('reporoutedirection').value=direction; document.getElementById('reporoutekey').value=key; } document.getElementById('action').value='prioritizeroute'; document.getElementById('routeEdit').submit();}//--></script></form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -