Mercurial > prosody-modules
comparison mod_admin_web/admin_web/www_files/js/main.js @ 1019:7cba8be42d9e
mod_admin_web: Update to new strophejs location, and jQuery 1.9.1
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 24 May 2013 15:46:05 +0200 |
parents | 1d03dc7cf28f |
children | 9839198539c8 |
comparison
equal
deleted
inserted
replaced
1018:7e060edbb548 | 1019:7cba8be42d9e |
---|---|
113 } else if (status == Strophe.Status.CONNECTED) { | 113 } else if (status == Strophe.Status.CONNECTED) { |
114 log('Strophe is connected.'); | 114 log('Strophe is connected.'); |
115 connection.sendIQ($iq({to: connection.domain, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) | 115 connection.sendIQ($iq({to: connection.domain, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB}) |
116 .c('adminfor'), function(e) { | 116 .c('adminfor'), function(e) { |
117 var items; | 117 var items; |
118 var domainpart = Strophe.getDomainFromJid(connection.jid); | |
118 items = e.getElementsByTagName('item'); | 119 items = e.getElementsByTagName('item'); |
119 if (items.length == 0) { | 120 if (items.length == 0) { |
120 alert("You are not an administrator"); | 121 alert("You are not an administrator"); |
121 connection.disconnect(); | 122 connection.disconnect(); |
122 return false; | 123 return false; |
123 } | 124 } |
124 for (i = 0; i < items.length; i++) { | 125 for (i = 0; i < items.length; i++) { |
125 var host = $(items[i]).text(); | 126 var host = $(items[i]).text(); |
126 if (host == Strophe.getDomainFromJid(connection.jid)) { | 127 $('<option/>').text(host).prop('selected', host == domainpart).appendTo('#host'); |
127 $('#host').append('<option selected>' + host + '</option>'); | |
128 } else { | |
129 $('#host').append('<option>' + host + '</option>'); | |
130 } | |
131 } | 128 } |
132 showDisconnect(); | 129 showDisconnect(); |
133 adminsubHost = $(items[0]).text(); | 130 adminsubHost = $(items[0]).text(); |
134 adhocControl.checkFeatures(adminsubHost, | 131 adhocControl.checkFeatures(adminsubHost, |
135 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').html(result); }) }, | 132 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').html(result); }) }, |