rbrindley: branch rbrindley/welcome_revamp r4320 - in /team/rbrindley/welcome...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Tue Dec 9 14:23:03 CST 2008
Author: rbrindley
Date: Tue Dec 9 14:23:03 2008
New Revision: 4320
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4320
Log:
- added refresh button for queues section. This can be used to update queue's statistics
- added 'img.loadQueues' case in body's event delegator
- implemented 'sections' (analog, features, iax, and sip) for extensions
- added classes to the 'tr's in loadExtensions. This required that I no longer
use pushRow however.
- added event delegator to handle clicks on section's buttons
- added CSS for section buttons
Modified:
team/rbrindley/welcome_revamp/config/js/welcome2.js
team/rbrindley/welcome_revamp/config/welcome2.html
Modified: team/rbrindley/welcome_revamp/config/js/welcome2.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/welcome2.js?view=diff&rev=4320&r1=4319&r2=4320
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Tue Dec 9 14:23:03 2008
@@ -22,6 +22,12 @@
var REGISTRY_OUTPUT = {};
var manager_events = {};
var manager_timers = {};
+var extension_loads = {};
+extension_loads.all = true;
+extension_loads.analog = true;
+extension_loads.features = true;
+extension_loads.iax = true;
+extension_loads.sip = true;
var loadTrunks = function() {
EX_CF = config2json({filename:'extensions.conf', usf:0 });
@@ -118,15 +124,21 @@
ul.each(function(user){ // list each user in table
var ud = parent.sessionData.pbxinfo.users[user];
var tmp_usertype_a = [];
+ var new_row = $('<tr></tr>');
if( ud.getProperty('hassip').isAstTrue() && ud.getProperty('hasiax').isAstTrue() ) {
tmp_usertype_a.push( 'SIP/IAX User' );
+ new_row.addClass('iax');
+ new_row.addClass('sip');
} else if ( ud.getProperty('hasiax').isAstTrue() ) {
tmp_usertype_a.push( ' IAX User' );
+ new_row.addClass('iax');
} else if ( ud.getProperty('hassip').isAstTrue() ) {
tmp_usertype_a.push( ' SIP User' );
+ new_row.addClass('sip');
} else if( ud.getProperty('zapchan') ) {
tmp_usertype_a.push( 'Analog User (Port ' + ud['zapchan'] + ')' ) ;
+ new_row.addClass('analog');
}
var tmp_mails = ASTGUI.mailboxCount(user);
@@ -142,13 +154,13 @@
var tmp_userstring = '<u>' + user + '</u>' ;
}
- pushRow(exten_tbody, [
- $("<td></td>").html(ASTGUI.getUser_DeviceStatus_Image(user)).attr("id","exten_status_"+user),
- $("<td></td>").html(tmp_userstring),
- $("<td></td>").html(ud.getProperty('fullname')),
- $("<td></td>").html(tmp_mails_str).addClass('exten_status'),
- $("<td></td>").html(tmp_usertype_a.join(', '))
- ]);
+ $("<td></td>").html(ASTGUI.getUser_DeviceStatus_Image(user)).attr("id","exten_status_"+user).appendTo(new_row);
+ $("<td></td>").html(tmp_userstring).appendTo(new_row);
+ $("<td></td>").html(ud.getProperty('fullname')).appendTo(new_row);
+ $("<td></td>").html(tmp_mails_str).addClass('exten_status').appendTo(new_row);
+ $("<td></td>").html(tmp_usertype_a.join(', ')).appendTo(new_row);
+
+ exten_tbody.append(new_row);
//addCell( newRow ,
// { html: tmp_userstring ,
// onclickFunction: function(){
@@ -161,26 +173,28 @@
(function(){ // List all RingGroup Extensions
var c = parent.sessionData.pbxinfo.ringgroups ;
for(var d in c){if(c.hasOwnProperty(d)){
- pushRow(exten_tbody, [
- $("<td></td>").html(''),
- $("<td></td>").html(c[d]['extensions'] || '--'),
- $("<td></td>").html(c[d]['NAME'] || d),
- $("<td></td>").html(''),
- $("<td></td>").html('Ring Group')
- ]);
+ var new_row = $('<tr></tr>').addClass('feature');
+ $("<td></td>").html('').appendTo(new_row)
+ $("<td></td>").html(c[d]['extensions'] || '--').appendTo(new_row);
+ $("<td></td>").html(c[d]['NAME'] || d).appendTo(new_row);
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html('Ring Group').appendTo(new_row);
+ exten_tbody.append(new_row);
}}
})();
(function(){ // List all VoiceMenu Extensions
var c = parent.sessionData.pbxinfo.voicemenus ;
for(var d in c){if(c.hasOwnProperty(d)){
- pushRow(exten_tbody, [
- $("<td></td>").html(''),
- $("<td></td>").html(ASTGUI.parseContextLine.getExten(c[d].getProperty('alias_exten')) || '--'),
- $("<td></td>").html(c[d]['comment'] || d),
- $("<td></td>").html(''),
- $("<td></td>").html('Voice Menu'),
- ]);
+ var new_row = $('<tr></tr>').addClass('feature');
+
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html(ASTGUI.parseContextLine.getExten(c[d].getProperty('alias_exten')) || '--').appendTo(new_row);
+ $("<td></td>").html(c[d]['comment'] || d).appendTo(new_row);
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html('Voice Menu').appendTo(new_row);
+
+ exten_tbody.append(new_row);
}}
})();
@@ -196,13 +210,15 @@
var tmp_voicemails = '-- <font color=red>*No Extension assigned</font>' ;
}
- pushRow(exten_tbody, [
- $("<td></td>").html(''),
- $("<td></td>").html(tmp_voicemails),
- $("<td></td>").html('<b>Check Voicemails</b>'),
- $("<td></td>").html(''),
- $("<td></td>").html('VoiceMailMain'),
- ]);
+ var new_row = $('<tr></tr>').addClass('feature');
+
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html(tmp_voicemails).appendTo(new_row);
+ $("<td></td>").html('<b>Check Voicemails</b>').appendTo(new_row);
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html('VoiceMailMain').appendTo(new_row);
+
+ exten_tbody.append(new_row);
// addCell( newRow ,
// { html: tmp_voicemails ,
// onclickFunction: function(){
@@ -215,13 +231,15 @@
(function(){ // VoiceMail Groups
var vmgroups = parent.sessionData.pbxinfo.vmgroups.getOwnProperties();
vmgroups.each(function( this_vmg_exten ){
- pushRow(exten_tbody, [
- $("<td></td>").html(''),
- $("<td></td>").html(this_vmg_exten),
- $("<td></td>").html(parent.sessionDate.pbxinfo.vmgroups[this_vmg_exten].getProperty('label')),
- $("<td></td>").html(''),
- $("<td></td>").html('VoiceMail Group')
- ]);
+ var new_row = $('<tr></tr>').addClass('feature');
+
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html(this_vmg_exten).appendTo(new_row);
+ $("<td></td>").html(parent.sessionDate.pbxinfo.vmgroups[this_vmg_exten].getProperty('label')).appendTo(new_row);
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html('VoiceMail Group').appendTo(new_row);
+
+ exten_tbody.append(new_row);
});
})();
@@ -233,13 +251,15 @@
var tmp_dirExten = '-- <font color=red>*No Extension assigned</font>' ;
}
- pushRow(exten_tbody, [
- $("<td></td>").html(''),
- $("<td></td>").html(tmp_dirExten),
- $("<td></td>").html('<b>Dial by Names</b>'),
- $("<td></td>").html(''),
- $("<td></td>").html('Directory')
- ]);
+ var new_row = $('<tr></tr>').addClass('feature');
+
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html(tmp_dirExten).appendTo(new_row);
+ $("<td></td>").html('<b>Dial by Names</b>').appendTo(new_row);
+ $("<td></td>").html('').appendTo(new_row);
+ $("<td></td>").html('Directory').appendTo(new_row);
+
+ exten_tbody.append(new_row);
// addCell( newRow ,
// { html: tmp_dirExten ,
// onclickFunction: function(){ parent.miscFunctions.click_panel( 'directory.html'); }
@@ -257,6 +277,8 @@
queue_conts[0] = $('#queue_left_container');
queue_conts[1] = $('#queue_right_container');
var cont_index = 0;
+
+ $('.queue:not(.template)').remove();
var queue_status = ASTGUI.cliCommand('show queues');
queue_status = parent.ASTGUI.parseCLIResponse(queue_status);
Modified: team/rbrindley/welcome_revamp/config/welcome2.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/welcome2.html?view=diff&rev=4320&r1=4319&r2=4320
==============================================================================
--- team/rbrindley/welcome_revamp/config/welcome2.html (original)
+++ team/rbrindley/welcome_revamp/config/welcome2.html Tue Dec 9 14:23:03 2008
@@ -296,6 +296,33 @@
width: 1px;
}
+#extensions_sections {
+ height: 18px;
+ text-indent: 20px;
+}
+
+#extensions_sections .section {
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ background-color: #ef8700;
+ border: 1px solid #ffffff;
+ color: #ffffff;
+ cursor: pointer;
+ font-size: 10px;
+ font-weight: bold;
+ margin-left: 2px;
+ padding: 1px;
+ padding-left: 4px;
+ padding-right: 4px;
+}
+
+#extensions_sections .active {
+ background-color: #ffffff;
+ border: 1px solid #6b79a5;
+ color: #6b79a5;
+ cursor: default;
+}
+
.notinuse {
color: red;
}
@@ -308,7 +335,7 @@
display: none;
}
-img.loadTrunks {
+img.loadTrunks, img.loadQueues {
cursor: pointer;
}
@@ -334,7 +361,7 @@
/* jQuery sortable init for content sections */
$('#sysstat_right_container, #sysstat_left_container').sortable({
axis: 'y',
- cancel: '.minimaxi, .loadTrunks',
+ cancel: '.minimaxi, .loadTrunks, .loadQueues',
cursor: 'move',
forcePlaceholderSize: true,
handle: 'div.handle',
@@ -391,6 +418,50 @@
},
'img.loadTrunks': function (e) {
loadTrunks();
+ },
+ 'img.loadQueues': function (e) {
+ loadQueues();
+ }
+ }));
+ $('#extensions_sections').click( $.delegate({
+ '.section': function (e) {
+ var title;
+ if ( (title = $(e.target).attr('title')) != 'all') {
+ //set all to inactive
+ $(e.target).siblings('span:first[title=all]').removeClass('active');
+ extension_loads['all'] = false;
+
+ //toggle active for title
+ var has_class = $(e.target).toggleClass('active').hasClass('active');
+ extension_loads[title] = has_class?true:false;
+
+ //traverse sections and show or hide appropriately
+ $(e.target).siblings('[title!=all]').andSelf().each( function() {
+ var show = $(this).hasClass('active');
+ var title = $(this).attr('title');
+
+ if (show) {
+ $('#extensions_list .'+title).show();
+ } else {
+ $('#extensions_list .'+title).hide();
+ }
+ });
+
+ if (extension_loads['sip'] || extension_loads['iax']) {
+ $('#extensions_list .sip.iax').show();
+ }
+ } else {
+ $(e.target).addClass('active');
+ $(e.target).siblings('span').each( function() {
+ $(this).removeClass('active');
+ var title = $(this).attr('title');
+ extension_loads[title] = extension_loads[title]?true:false;
+ });
+ $('#extensions_list').find('.sip, .iax, .analog, .features.').show();
+ }
+
+ var title = $(e.target).attr('title');
+ extension_loads[title] = extension_loads[title]?true:false;
}
}));
@@ -478,6 +549,13 @@
</div>
<div class="clear"></div>
<div class="body">
+ <div id="extensions_sections">
+ <span title="all" class="section active"> All </span>
+ <span title="analog" class="section"> Analog </span>
+ <span title="feature" class="section"> Features </span>
+ <span title="iax" class="section"> IAX </span>
+ <span title="sip" class="section"> SIP </span>
+ </div>
<table id="extensions_list" class="list">
<thead>
<tr class="list_titles">
@@ -497,7 +575,7 @@
<div class="handle title">
<span class="minimaxi">[ - ]</span>
<img src="images/asterisk_red.gif" class="title_img" />
- Queues
+ Queues <img class="loadQueues" src="images/refresh.png" title="Refresh" border="0" />
</div>
<div class="clear"></div>
<div class="body">
More information about the asterisk-gui-commits
mailing list