Browse Source

hide admin stuff for normal users in the UI

Natenom/support-murmur-13-1446181288462
Michael Ziegler 14 years ago
parent
commit
549ce65632
  1. 62
      pyweb/mumble/media/js/channelviewerplugins.js
  2. 6
      pyweb/mumble/templates/mumble/mumble.html

62
pyweb/mumble/media/js/channelviewerplugins.js

@ -17,14 +17,8 @@ Ext.ux.MumbleUserEditor = Ext.extend( Ext.Component, {
activate: function( userdata ){ activate: function( userdata ){
if( !this.wnd ){ if( !this.wnd ){
this.userdata = userdata; this.userdata = userdata;
this.wnd = new Ext.Window({
title: this.windowTitle || gettext("User details"),
layout: 'fit',
items: [{
xtype: "tabpanel",
activeTab: 0,
border: false,
items: [{
tabitems = [{
xtype: "form", xtype: "form",
border: false, border: false,
title: gettext("User comment"), title: gettext("User comment"),
@ -61,45 +55,55 @@ Ext.ux.MumbleUserEditor = Ext.extend( Ext.Component, {
items: [{ items: [{
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Authenticated"), fieldLabel: gettext("Authenticated"),
disabled: true,
name: "a", name: "a",
checked: (this.userdata.userid != -1) checked: (this.userdata.userid != -1)
}, { }, {
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Self-Deafened"), fieldLabel: gettext("Self-Deafened"),
disabled: true,
name: "sd", name: "sd",
checked: this.userdata.selfDeaf checked: this.userdata.selfDeaf
}, { }, {
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Deafened"), fieldLabel: gettext("Deafened"),
disabled: true,
name: "d", name: "d",
checked: this.userdata.deaf checked: this.userdata.deaf
}, { }, {
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Self-Muted"), fieldLabel: gettext("Self-Muted"),
disabled: true,
name: "sm", name: "sm",
checked: this.userdata.selfMute checked: this.userdata.selfMute
}, { }, {
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Muted"), fieldLabel: gettext("Muted"),
disabled: true,
name: "m", name: "m",
checked: this.userdata.mute checked: this.userdata.mute
}, { }, {
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Suppressed"), fieldLabel: gettext("Suppressed"),
disabled: true,
name: "s", name: "s",
checked: this.userdata.suppress checked: this.userdata.suppress
}, { }, {
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Priority Speaker"), fieldLabel: gettext("Priority Speaker"),
disabled: true,
name: "p", name: "p",
checked: this.userdata.prioritySpeaker checked: this.userdata.prioritySpeaker
}, { }, {
xtype: "checkbox", xtype: "checkbox",
fieldLabel: gettext("Recording"), fieldLabel: gettext("Recording"),
disabled: true,
name: "r", name: "r",
checked: this.userdata.recording checked: this.userdata.recording
}] }]
}, {
}];
if( this.is_admin ){
tabitems.push({
xtype: "form", xtype: "form",
border: false, border: false,
title: gettext("Administration"), title: gettext("Administration"),
@ -172,8 +176,18 @@ Ext.ux.MumbleUserEditor = Ext.extend( Ext.Component, {
Mumble.sendMessage(this.serverid, this.userdata.session, f.message); Mumble.sendMessage(this.serverid, this.userdata.session, f.message);
} }
}] }]
}],
}],
});
}
this.wnd = new Ext.Window({
title: this.windowTitle || gettext("User details"),
layout: 'fit',
items: {
xtype: "tabpanel",
activeTab: 0,
border: false,
items: tabitems,
},
width: 500, width: 500,
height: 300, height: 300,
scope: this, scope: this,
@ -212,13 +226,8 @@ Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
activate: function( chandata ){ activate: function( chandata ){
if( !this.wnd ){ if( !this.wnd ){
this.chandata = chandata; this.chandata = chandata;
this.wnd = new Ext.Window({
title: this.windowTitle || gettext("Channel details"),
layout: 'fit',
items: [{
xtype: "tabpanel",
activeTab: 0,
items: [{
tabitems = [{
xtype: "form", xtype: "form",
border: false, border: false,
title: gettext("Channel description"), title: gettext("Channel description"),
@ -236,6 +245,9 @@ Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
name: "description", name: "description",
value: chandata.description value: chandata.description
}], }],
}];
if( this.is_admin ){
Ext.apply( tabitems[0], {
fbar: [{ fbar: [{
text: gettext('Add subchannel...'), text: gettext('Add subchannel...'),
scope: this, scope: this,
@ -267,7 +279,8 @@ Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
}, this); }, this);
} }
}] }]
}, {
});
tabitems.push({
xtype: "form", xtype: "form",
border: false, border: false,
title: gettext("Send message"), title: gettext("Send message"),
@ -290,7 +303,16 @@ Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
Mumble.sendMessageChannel(this.serverid, this.chandata.id, (f.tree || false), f.message); Mumble.sendMessageChannel(this.serverid, this.chandata.id, (f.tree || false), f.message);
} }
}] }]
}],
});
}
this.wnd = new Ext.Window({
title: this.windowTitle || gettext("Channel details"),
layout: 'fit',
items: [{
xtype: "tabpanel",
activeTab: 0,
items: tabitems
}], }],
width: 500, width: 500,
height: 300, height: 300,

6
pyweb/mumble/templates/mumble/mumble.html

@ -79,10 +79,12 @@
enableDD: true, enableDD: true,
plugins: [ plugins: [
new Ext.ux.MumbleUserEditor({ new Ext.ux.MumbleUserEditor({
serverid: {{MumbleServer.id}}
serverid: {{MumbleServer.id}},
is_admin: {{ IsAdmin|lower }}
}), }),
new Ext.ux.MumbleChannelEditor({ new Ext.ux.MumbleChannelEditor({
serverid: {{MumbleServer.id}}
serverid: {{MumbleServer.id}},
is_admin: {{ IsAdmin|lower }}
}) })
], ],
source_url: "{% url mumble.views.cvp_json MumbleServer.id %}", source_url: "{% url mumble.views.cvp_json MumbleServer.id %}",

Loading…
Cancel
Save