📄 users.html
字号:
<!--
* Asterisk-GUI - an Asterisk configuration interface
*
* Create Users and assign them devices , dialplans etc
*
* Copyright (C) 2006-2007, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
* Pari Nannapaneni <pari@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*
-->
<script src="scripts/prototype.js"></script>
<script src="scripts/rico.js"></script>
<script src="scripts/astman.js"></script>
<script src="scripts/tooltip.js"></script>
<link href="stylesheets/rico.css" media="all" rel="Stylesheet" type="text/css" />
<link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
<script>
var origwidth;
var widgets = new Object;
var adstatus;
var callbacks = new Object;
var extencallbacks = new Object;
var fieldnames = ['callwaiting' ,'cancel' ,'cid_number' ,'context' ,'delete' ,'email' ,'fullname' ,'group' ,'hasagent' ,'hasdirectory' ,'hasiax' ,'hasmanager' ,'hassip' ,'hasvoicemail' ,'host' ,'mailbox' ,'name' ,'new' ,'save' ,'secret' ,'threewaycalling' ,'vmsecret' ,'zapchan', 'registeriax', 'registersip'];
var localextenlength = 4;
var allow_aliasextns = "no";
var allow_an_extns = "no" ;
extencallbacks.format = function(t, x) {
if ((t.name != specialcontext)){ return null; }
return format_extension(_$('extensions'), t, x);
}
extencallbacks.loaded = function() {
merge_extensions(_$('devices'), _$('extensions'));
parent.loadscreen(this);
}
extencallbacks.eachline = true;
callbacks.format = function(t) {
if ((t.name == 'general')){
if (t.fieldbyname['localextenlength'] && t.fieldbyname['localextenlength'].length){
localextenlength = t.fieldbyname['localextenlength'] ;
}
if ( t.fieldbyname['allow_an_extns'] && t.fieldbyname['allow_an_extns'].length ){
allow_an_extns = t.fieldbyname['allow_an_extns'] ;
if(allow_an_extns == "yes"){ $('name').setAttribute("pattern", '^[a-zA-Z0-9]*$'); }
}
if (t.fieldbyname['allow_aliasextns'] && t.fieldbyname['allow_aliasextns'].length){
allow_aliasextns = t.fieldbyname['allow_aliasextns'] ;
}
return null;
}
if ( t.fieldbyname['context'] == asterisk_guiTDPrefix + t.name ) {
return null;
}
if (t.fieldbyname['fullname'] && t.fieldbyname['fullname'].length ) {
if( sortbynames ){
return t.fieldbyname['fullname'] + " (" + t.name +")";
}else{
return t.name + " -- " + t.fieldbyname['fullname'];
}
} else{
return t.name;
}
}
callbacks.loaded = function() {
_$('devices').contentEditable = 'true';
_$('devices').disabled = 0;
parent.astmanEngine.config2list("extensions.conf", _$('extensions'), new Array(), extencallbacks);
}
callbacks.sortfunc = function(a,b) {
return (a.name < b.name) ? -1 : 1;
}
callbacks.checkparams = function(box) {
_$('mailbox').value = _$('name').value;
_$('group').value = '';
return false;
}
callbacks.newcategory = function() {
var tmp = null;
var x;
var _devices = _$('devices');
gen = _devices.stored_config.catbyname['general'];
tmp = objcopy(gen);
if (gen){
x = gen.fieldbyname['userbase'];
for( var f=0; f < _devices.options.length ; f++ ){
if( x < _devices.options[f].innerHTML.split(' -- ')[0] ){ break; }
x++;
}
}else{
try{
x = ( parseInt( _devices.options[ _devices.options.length - 1 ].innerHTML.split(' -- ')[0] ) ) + 1;
}catch(err){
x = 6000; // a default value if one is not defined in users.conf's general context
}
}
tmp.name = x
return tmp;
}
callbacks.identifier = "extension";
callbacks.beforeSaving = function(){
var _devices = _$('devices');
var _name = _$('name');
var _fullname = _$('fullname');
if(!_fullname.value.length){
gui_alert("Sorry, a User Name must be specified !");
_fullname.focus();
return false;
}
// check whether the length of extension is valid
if( localextenlength !=0 && (allow_an_extns == "no" && localextenlength != _name.value.length) ){
gui_alert( "Sorry, User Extension must be "+ localextenlength + " digits !" );
return false;
}
if (!check_patternonfields( ['name', 'fullname', 'secret','email', 'cid_number'] ) ){
return false;
}
if(allow_aliasextns == "no"){ // check whether the selected analog line is assigned to another user extension
var tmp_usedanaloglines = [] ;
for ( var i=1; i < _devices.stored_config.categories.length ; i++){
if ( _devices.stored_config.categories[i] != null ){
if ( _devices.stored_config.categories[i].fieldbyname['zapchan'] && _devices.stored_config.categories[i].fieldbyname.zapchan.length && _devices.stored_config.categories[i].name != _devices.value )
tmp_usedanaloglines.push( _devices.stored_config.categories[i].fieldbyname.zapchan);
}
}
if ( InArray(tmp_usedanaloglines,_$('zapchan').value)){
gui_alert("This Analog Phone has already been assigned to another user extension.\n Please select a different Phone");
return false;
}
}
if(_devices.value != _name.value){
for(var k=0; k<_devices.length; k++ ){
var tmp = _devices.options[k].innerHTML.split(' -- ');
if( tmp[0] == _name.value ){
gui_alert("Sorry, an entry named " + _name.value + " already exists!");
return false;
}
}
}
_$('registeriax').checked =_$('hasiax').checked ;
_$('registersip').checked =_$('hassip').checked ;
return true;
}
callbacks.postselect = function(box, val) {
if (adstatus == "hidden") {
adstatus = "shown";
togglefeatures() ;
}
parent._$('tooltip').innerHTML = parent.tooltip_default ;
if( box.selectedIndex == -1)
return true;
if(val == "reserved" ){
if( box.options[box.selectedIndex].text.toLowerCase().match("-- call queue") || box.options[box.selectedIndex].text.toLowerCase().match('call queue ') ){
//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Call Queues\' panel to edit call queues </font>";
box.selectedIndex = -1;
gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Call Queues\' panel to edit the selected entry");
return true;
}
if( box.options[box.selectedIndex].text.toLowerCase().match("-- conference bridge") || box.options[box.selectedIndex].text.toLowerCase().match('conference bridge ') ){
//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Conferencing\' panel to edit a Conference Bridge</font>";
box.selectedIndex = -1;
gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Conferencing\' panel to edit the selected entry");
return true;
}
if( box.options[box.selectedIndex].text.toLowerCase().match("-- check voicemail") || box.options[box.selectedIndex].text.toLowerCase().match('check voicemail ') ){
box.selectedIndex = -1;
//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Voicemail\' panel to edit Voicemail Preferences</font>";
gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Voicemail\' panel to edit the selected entry");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -