|
@ -4,12 +4,7 @@ |
|
|
{% endcomment %} |
|
|
{% endcomment %} |
|
|
{% load mumble_extras %} |
|
|
{% load mumble_extras %} |
|
|
{% load i18n %} |
|
|
{% load i18n %} |
|
|
{% block Headline %} |
|
|
|
|
|
{{ MumbleServer.name }} |
|
|
|
|
|
{% endblock %} |
|
|
|
|
|
{% block ContentMaster %} |
|
|
|
|
|
<div id="ext_container"></div> |
|
|
|
|
|
{% endblock %} |
|
|
|
|
|
|
|
|
{% block body %}{% endblock %} |
|
|
{% block HeadTag %} |
|
|
{% block HeadTag %} |
|
|
<script type="text/javascript" src="/jsi18n/"></script> |
|
|
<script type="text/javascript" src="/jsi18n/"></script> |
|
|
<script type="text/javascript" src="/mumble/api/api.js"></script> |
|
|
<script type="text/javascript" src="/mumble/api/api.js"></script> |
|
@ -19,13 +14,137 @@ |
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}/js/channelviewer.js"></script> |
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}/js/channelviewer.js"></script> |
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}/js/usereditor.js"></script> |
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}/js/usereditor.js"></script> |
|
|
<script type="text/javascript"> |
|
|
<script type="text/javascript"> |
|
|
|
|
|
Ext.ux.IFrameComponent = Ext.extend(Ext.BoxComponent, { |
|
|
|
|
|
// http://www.extjs.com/forum/showthread.php?p=54416#post54416 |
|
|
|
|
|
onRender : function(ct, position){ |
|
|
|
|
|
this.el = ct.createChild({tag: 'iframe', id: 'iframe-'+ this.id, frameBorder: 0, src: this.url}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
Ext.onReady( function(){ |
|
|
Ext.onReady( function(){ |
|
|
Ext.QuickTips.init(); |
|
|
Ext.QuickTips.init(); |
|
|
|
|
|
|
|
|
|
|
|
viewsize = { |
|
|
|
|
|
width: Ext.lib.Dom.getViewWidth(), |
|
|
|
|
|
height: Ext.lib.Dom.getViewHeight() |
|
|
|
|
|
}; |
|
|
var mainpanel = new Ext.Panel({ |
|
|
var mainpanel = new Ext.Panel({ |
|
|
renderTo: "ext_container", |
|
|
|
|
|
height: 600, |
|
|
|
|
|
|
|
|
renderTo: document.body, |
|
|
|
|
|
height: viewsize.height, |
|
|
layout: "border", |
|
|
layout: "border", |
|
|
|
|
|
title: "{{ MumbleServer.name }}", |
|
|
|
|
|
buttons: [ |
|
|
|
|
|
{% if user.is_staff %}{ |
|
|
|
|
|
text: gettext('Admin'), |
|
|
|
|
|
enableToggle: true, |
|
|
|
|
|
toggleHandler: function(button, state){ |
|
|
|
|
|
if( !this.wnd ){ |
|
|
|
|
|
this.wnd = new Ext.Window({ |
|
|
|
|
|
title: gettext('Administration'), |
|
|
|
|
|
closable: false, |
|
|
|
|
|
layout: 'fit', |
|
|
|
|
|
items: new Ext.ux.IFrameComponent({ url: '/admin' }), |
|
|
|
|
|
width: viewsize.width - 200, |
|
|
|
|
|
height: viewsize.height - 100, |
|
|
|
|
|
buttons: [{ |
|
|
|
|
|
text: gettext('Open in new window'), |
|
|
|
|
|
handler: function(){ |
|
|
|
|
|
window.open( '/admin' ); |
|
|
|
|
|
this.ownerCt.ownerCt.ownerButton.toggle( false ); |
|
|
|
|
|
} |
|
|
|
|
|
}] |
|
|
|
|
|
}); |
|
|
|
|
|
this.wnd.ownerButton = this; |
|
|
|
|
|
} |
|
|
|
|
|
if( state ){ |
|
|
|
|
|
this.wnd.show(); |
|
|
|
|
|
mypos = this.getPosition(); |
|
|
|
|
|
mysize = this.getSize(); |
|
|
|
|
|
winsize = this.wnd.getSize(); |
|
|
|
|
|
this.wnd.setPosition( |
|
|
|
|
|
mypos[0] + mysize.width - winsize.width, |
|
|
|
|
|
mypos[1] - winsize.height |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
this.wnd.hide(); |
|
|
|
|
|
}, |
|
|
|
|
|
}, {% endif %} |
|
|
|
|
|
{% if user.is_authenticated %}{ |
|
|
|
|
|
text: gettext('Logout'), |
|
|
|
|
|
handler: function(){ |
|
|
|
|
|
Accounts.logout( function(provider, response){ |
|
|
|
|
|
if( response.result.success ){ |
|
|
|
|
|
window.location.reload(); |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
Ext.Msg.show({ |
|
|
|
|
|
title: gettext("Login error"), |
|
|
|
|
|
msg: gettext("Unable to log out."), |
|
|
|
|
|
icon: Ext.MessageBox.ERROR, |
|
|
|
|
|
buttons: Ext.MessageBox.OK |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} ); |
|
|
|
|
|
} |
|
|
|
|
|
} {% else %} { |
|
|
|
|
|
text: gettext('Login'), |
|
|
|
|
|
enableToggle: true, |
|
|
|
|
|
toggleHandler: function(button, state){ |
|
|
|
|
|
if( !this.wnd ){ |
|
|
|
|
|
this.wnd = new Ext.Window({ |
|
|
|
|
|
title: gettext('Login'), |
|
|
|
|
|
closable: false, |
|
|
|
|
|
items: { |
|
|
|
|
|
xtype: 'form', |
|
|
|
|
|
border: false, |
|
|
|
|
|
buttons: [{ |
|
|
|
|
|
text: gettext('Submit'), |
|
|
|
|
|
handler: function(){ |
|
|
|
|
|
form = this.ownerCt.ownerCt.getForm().getFieldValues(); |
|
|
|
|
|
Accounts.login(form.username, form.password, |
|
|
|
|
|
function(provider, response){ |
|
|
|
|
|
if( response.result.success ){ |
|
|
|
|
|
window.location.reload(); |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
Ext.Msg.show({ |
|
|
|
|
|
title: gettext("Login error"), |
|
|
|
|
|
msg: gettext("Unable to log in."), |
|
|
|
|
|
icon: Ext.MessageBox.ERROR, |
|
|
|
|
|
buttons: Ext.MessageBox.OK |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}], |
|
|
|
|
|
items: [{ |
|
|
|
|
|
xtype: "textfield", |
|
|
|
|
|
fieldLabel: gettext("User name"), |
|
|
|
|
|
name: "username" |
|
|
|
|
|
}, { |
|
|
|
|
|
xtype: 'textfield', |
|
|
|
|
|
fieldLabel: gettext("Password"), |
|
|
|
|
|
inputType: "password", |
|
|
|
|
|
name: "password" |
|
|
|
|
|
}], |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
if( state ){ |
|
|
|
|
|
this.wnd.show(); |
|
|
|
|
|
mypos = this.getPosition(); |
|
|
|
|
|
mysize = this.getSize(); |
|
|
|
|
|
winsize = this.wnd.getSize(); |
|
|
|
|
|
this.wnd.setPosition( |
|
|
|
|
|
mypos[0] + mysize.width - winsize.width, |
|
|
|
|
|
mypos[1] - winsize.height |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
this.wnd.hide(); |
|
|
|
|
|
}, |
|
|
|
|
|
} {% endif %} |
|
|
|
|
|
], |
|
|
items: [{ |
|
|
items: [{ |
|
|
xtype: "mumblechannelviewer", |
|
|
xtype: "mumblechannelviewer", |
|
|
region: "west", |
|
|
region: "west", |
|
@ -39,15 +158,20 @@ |
|
|
items: [{ |
|
|
items: [{ |
|
|
title: gettext("Registration"), |
|
|
title: gettext("Registration"), |
|
|
xtype: "{{ RegForm|lower }}", |
|
|
xtype: "{{ RegForm|lower }}", |
|
|
pk: {{ MumbleAccount.id }}, |
|
|
|
|
|
|
|
|
pk: {% if MumbleAccount %}{{ MumbleAccount.id }}{% else %}-1{% endif %}, |
|
|
|
|
|
labelWidth: 150, |
|
|
submit: function(){ |
|
|
submit: function(){ |
|
|
this.getForm().submit({ params: {serverid: {{MumbleServer.id}}, pk: this.pk } }); |
|
|
this.getForm().submit({ params: {serverid: {{MumbleServer.id}}, pk: this.pk } }); |
|
|
}, |
|
|
}, |
|
|
}, { |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
{% if MumbleAccount %} |
|
|
|
|
|
{% if IsAdmin %} { |
|
|
title: gettext("Administration"), |
|
|
title: gettext("Administration"), |
|
|
pk: {{ MumbleServer.id }}, |
|
|
pk: {{ MumbleServer.id }}, |
|
|
|
|
|
labelWidth: 150, |
|
|
xtype: 'mumbleform', |
|
|
xtype: 'mumbleform', |
|
|
}, { |
|
|
|
|
|
|
|
|
}, {% endif %} |
|
|
|
|
|
{ |
|
|
title: gettext("User texture"), |
|
|
title: gettext("User texture"), |
|
|
layout: "border", |
|
|
layout: "border", |
|
|
items: [{ |
|
|
items: [{ |
|
@ -69,6 +193,7 @@ |
|
|
}, { |
|
|
}, { |
|
|
region: "center", |
|
|
region: "center", |
|
|
xtype: "form", |
|
|
xtype: "form", |
|
|
|
|
|
labelWidth: 150, |
|
|
fileUpload: true, |
|
|
fileUpload: true, |
|
|
url: "{% url mumble.views.update_avatar MumbleAccount.id %}", |
|
|
url: "{% url mumble.views.update_avatar MumbleAccount.id %}", |
|
|
items: [{ |
|
|
items: [{ |
|
@ -82,13 +207,15 @@ |
|
|
inputType: "file", |
|
|
inputType: "file", |
|
|
}], |
|
|
}], |
|
|
buttons: [{ |
|
|
buttons: [{ |
|
|
text: 'Submit', |
|
|
|
|
|
|
|
|
text: gettext('Submit'), |
|
|
handler: function(){ this.ownerCt.ownerCt.getForm().submit(); }, |
|
|
handler: function(){ this.ownerCt.ownerCt.getForm().submit(); }, |
|
|
}], |
|
|
}], |
|
|
}], |
|
|
}], |
|
|
}, { |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
{% if IsAdmin %} { |
|
|
xtype: "userEditorPanel", |
|
|
xtype: "userEditorPanel", |
|
|
} ], |
|
|
|
|
|
|
|
|
} {% endif %} |
|
|
|
|
|
{% endif %} ], |
|
|
}], |
|
|
}], |
|
|
}); |
|
|
}); |
|
|
} ); |
|
|
} ); |
|
|