1
// kate: space-indent on; indent-width 4; replace-tabs on;
3
Ext.namespace('Ext.ux');
5
Ext.ux.MumbleUserEditor = Ext.extend( Ext.Component, {
6
clickHandler: function( node, ev ){
7
if( typeof node.attributes.userdata != "undefined" ){
8
this.activate(node.attributes.userdata);
12
init: function( tree ){
14
tree.on("click", this.clickHandler, this);
17
activate: function( userdata ){
19
this.userdata = userdata;
24
title: gettext("User comment"),
31
value: userdata.comment,
34
title: gettext("Avatar"),
37
afterrender: function( panel ){
38
Mumble.hasTexture( this.scope.serverid, this.scope.userdata.userid, function(provider, response){
39
if( response.result.has ){
40
panel.el.dom.children[0].children[0].innerHTML = String.format(
41
'<img src="{0}" alt="avatar" />', response.result.url
45
panel.el.dom.children[0].children[0].innerHTML =
46
gettext("This user does not have an Avatar.");
51
html: gettext("Loading..."),
53
title: gettext("Infos"),
58
fieldLabel: gettext("Authenticated"),
61
checked: (this.userdata.userid != -1)
64
fieldLabel: gettext("Self-Deafened"),
67
checked: this.userdata.selfDeaf
70
fieldLabel: gettext("Deafened"),
73
checked: this.userdata.deaf
76
fieldLabel: gettext("Self-Muted"),
79
checked: this.userdata.selfMute
82
fieldLabel: gettext("Muted"),
85
checked: this.userdata.mute
88
fieldLabel: gettext("Suppressed"),
91
checked: this.userdata.suppress
94
fieldLabel: gettext("Priority Speaker"),
97
checked: this.userdata.prioritySpeaker
100
fieldLabel: gettext("Recording"),
103
checked: this.userdata.recording
110
title: gettext("Administration"),
113
fieldLabel: gettext("Ban"),
116
xtype: "numberfield",
117
fieldLabel: gettext("Ban duration"),
122
text: gettext("Only if banning. Set to 0 for permanent ban, any other value for the ban duration in seconds."),
123
cls: "form_hint_label",
126
fieldLabel: gettext("Reason"),
131
text: gettext("Kick"),
132
handler: function(btn){
133
f = btn.ownerCt.ownerCt.getForm().getValues();
135
this.serverid, this.userdata.session, f.reason, (f.ban || false), parseInt(f.duration)
139
text: gettext("Mute"),
142
ref: '../mutebutton',
143
pressed: this.userdata.mute,
144
disabled: this.userdata.deaf,
145
toggleHandler: function(btn, state){
146
Mumble.muteUser(this.serverid, this.userdata.session, state);
149
text: gettext("Deafen"),
152
ref: '../deafenbutton',
153
pressed: this.userdata.deaf,
154
toggleHandler: function(btn, state){
155
Mumble.deafenUser(this.serverid, this.userdata.session, state);
157
btn.refOwner.mutebutton.toggle(true, true);
158
btn.refOwner.mutebutton.setDisabled(state);
164
title: gettext("Send message"),
174
text: gettext("Send message"),
175
handler: function(btn){
176
f = btn.ownerCt.ownerCt.getForm().getValues();
177
Mumble.sendMessage(this.serverid, this.userdata.session, f.message, function(provider, response){
178
if( response.type == "exception" ){
179
Ext.Msg.alert( gettext("Error"), response.message );
182
Ext.Msg.alert( gettext("Success"), gettext("Message sent successfully.") );
190
this.wnd = new Ext.Window({
191
title: this.windowTitle || gettext("User details"),
194
viewConfig: { forceFit: true },
204
beforeclose: function(){
205
this.owner.wnd = null;
209
this.wnd.owner = this;
211
if( !this.wnd.isVisible() ){
213
mypos = this.tree.getPosition();
214
mysize = this.tree.getSize();
215
this.wnd.setPosition( mypos[0] + mysize.width - 50, mypos[1] + 50 );
223
Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
224
clickHandler: function( node, ev ){
225
if( typeof node.attributes.chandata != "undefined" ){
226
this.activate(node.attributes.chandata);
230
init: function( tree ){
232
tree.on("click", this.clickHandler, this);
235
activate: function( chandata ){
237
this.chandata = chandata;
242
title: gettext("Channel description"),
243
defaults: { "anchor": "-20px" },
258
value: chandata.description
262
Ext.apply( tabitems[0], {
264
text: gettext('Add subchannel...'),
266
handler: function(btn){
267
Ext.Msg.prompt(gettext('Name'), gettext('Please enter the channel name:'), function(btn, text){
269
Mumble.addChannel( this.serverid, text, this.chandata.id, function(provider, response){
270
if( response.type == "exception" ){
271
Ext.Msg.alert( gettext("Error"), response.message );
279
text: gettext("Submit name/description"),
280
handler: function(btn){
281
f = btn.ownerCt.ownerCt.getForm().getValues();
282
Mumble.renameChannel(this.serverid, this.chandata.id, f.name, f.description, function(provider, response){
283
if( response.type == "exception" ){
284
Ext.Msg.alert( gettext("Error"), response.message );
289
text: gettext('Delete channel'),
291
handler: function(btn){
293
gettext('Confirm channel deletion'),
294
interpolate(gettext('Are you sure you want to delete channel %s?'), [this.chandata.name]),
297
Mumble.removeChannel( this.serverid, this.chandata.id );
306
title: gettext("Send message"),
307
defaults: { "anchor": "-20px" },
310
fieldLabel: gettext('Cascade to subchannels'),
320
text: gettext("Send message"),
321
handler: function(btn){
322
f = btn.ownerCt.ownerCt.getForm().getValues();
323
Mumble.sendMessageChannel(this.serverid, this.chandata.id,
324
(f.tree || false), f.message,
325
function(provider, response){
326
if( response.type == "exception" ){
327
Ext.Msg.alert( gettext("Error"), response.message );
330
Ext.Msg.alert( gettext("Success"), gettext("Message sent successfully.") );
338
this.wnd = new Ext.Window({
339
title: this.windowTitle || ( this.is_admin
340
? interpolate( gettext("Channel %s (%s)"), [chandata.name, chandata.id] )
341
: interpolate( gettext("Channel %s"), [chandata.name] ) ),
352
beforeclose: function(){
353
this.owner.wnd = null;
357
this.wnd.owner = this;
359
if( !this.wnd.isVisible() ){
361
mypos = this.tree.getPosition();
362
mysize = this.tree.getSize();
363
this.wnd.setPosition( mypos[0] + mysize.width - 50, mypos[1] + 50 );