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

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

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

Loading…
Cancel
Save