Mercurial > prosody-modules
comparison mod_admin_web/admin_web/www_files/js/main.js @ 573:c9955858dc7e
mod_adhoc_web: Redesign adhoc command pane
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Wed, 18 Jan 2012 01:24:41 +0100 |
parents | f0ef6e285d69 |
children | 950e23318bbc |
comparison
equal
deleted
inserted
replaced
572:f22a569fcf86 | 573:c9955858dc7e |
---|---|
8 | 8 |
9 var localJID = null; | 9 var localJID = null; |
10 var connection = null; | 10 var connection = null; |
11 | 11 |
12 var adminsubHost = null; | 12 var adminsubHost = null; |
13 var adhocControl = new Adhoc('#adhocDisplay', function() {}); | |
13 | 14 |
14 function log(msg) { | 15 function log(msg) { |
15 var entry = $('<div></div>').append(document.createTextNode(msg)); | 16 var entry = $('<div></div>').append(document.createTextNode(msg)); |
16 $('#log').append(entry); | 17 $('#log').append(entry); |
17 } | 18 } |
121 for (i = 0; i < items.length; i++) { | 122 for (i = 0; i < items.length; i++) { |
122 $('#host').append('<option>' + $(items[i]).text() + '</option>'); | 123 $('#host').append('<option>' + $(items[i]).text() + '</option>'); |
123 } | 124 } |
124 showDisconnect(); | 125 showDisconnect(); |
125 adminsubHost = $(items[0]).text(); | 126 adminsubHost = $(items[0]).text(); |
126 Adhoc.checkFeatures('#adhoc', adminsubHost); | 127 adhocControl.checkFeatures(adminsubHost, |
128 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').append(result); }) }, | |
129 function () { $('#adhocCommands').empty(); $('#adhocDisplay').html('<p>This host does not support commands</p>'); }); | |
127 connection.addHandler(_cbAdminSub, Strophe.NS.ADMINSUB + '#event', 'message'); | 130 connection.addHandler(_cbAdminSub, Strophe.NS.ADMINSUB + '#event', 'message'); |
128 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) | 131 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) |
129 .c('subscribe', {node: Strophe.NS.C2SSTREAM})); | 132 .c('subscribe', {node: Strophe.NS.C2SSTREAM})); |
130 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) | 133 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) |
131 .c('subscribe', {node: Strophe.NS.S2SSTREAM})); | 134 .c('subscribe', {node: Strophe.NS.S2SSTREAM})); |
196 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) | 199 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) |
197 .c('unsubscribe', {node: Strophe.NS.C2SSTREAM})); | 200 .c('unsubscribe', {node: Strophe.NS.C2SSTREAM})); |
198 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) | 201 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) |
199 .c('unsubscribe', {node: Strophe.NS.S2SSTREAM})); | 202 .c('unsubscribe', {node: Strophe.NS.S2SSTREAM})); |
200 adminsubHost = $(this).val(); | 203 adminsubHost = $(this).val(); |
201 Adhoc.checkFeatures('#adhoc', adminsubHost); | 204 adhocControl.checkFeatures(adminsubHost, |
205 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').append(result); }) }, | |
206 function () { $('#adhocCommands').empty(); $('#adhocDisplay').html('<p>This host does not support commands</p>'); }); | |
202 $('#s2sin').empty(); | 207 $('#s2sin').empty(); |
203 $('#s2sout').empty(); | 208 $('#s2sout').empty(); |
204 $('#c2s').empty(); | 209 $('#c2s').empty(); |
205 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) | 210 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) |
206 .c('subscribe', {node: Strophe.NS.C2SSTREAM})); | 211 .c('subscribe', {node: Strophe.NS.C2SSTREAM})); |