|
|
@ -4,12 +4,7 @@ |
|
|
|
{% endcomment %} |
|
|
|
{% load mumble_extras %} |
|
|
|
{% load i18n %} |
|
|
|
{% block Headline %} |
|
|
|
{{ MumbleServer.name }} |
|
|
|
{% endblock %} |
|
|
|
{% block ContentMaster %} |
|
|
|
<div id="ext_container"></div> |
|
|
|
{% endblock %} |
|
|
|
{% block body %}{% endblock %} |
|
|
|
{% block HeadTag %} |
|
|
|
<script type="text/javascript" src="/jsi18n/"></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/usereditor.js"></script> |
|
|
|
<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.QuickTips.init(); |
|
|
|
|
|
|
|
viewsize = { |
|
|
|
width: Ext.lib.Dom.getViewWidth(), |
|
|
|
height: Ext.lib.Dom.getViewHeight() |
|
|
|
}; |
|
|
|
var mainpanel = new Ext.Panel({ |
|
|
|
renderTo: "ext_container", |
|
|
|
height: 600, |
|
|
|
renderTo: document.body, |
|
|
|
height: viewsize.height, |
|
|
|
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: [{ |
|
|
|
xtype: "mumblechannelviewer", |
|
|
|
region: "west", |
|
|
@ -39,15 +158,20 @@ |
|
|
|
items: [{ |
|
|
|
title: gettext("Registration"), |
|
|
|
xtype: "{{ RegForm|lower }}", |
|
|
|
pk: {{ MumbleAccount.id }}, |
|
|
|
pk: {% if MumbleAccount %}{{ MumbleAccount.id }}{% else %}-1{% endif %}, |
|
|
|
labelWidth: 150, |
|
|
|
submit: function(){ |
|
|
|
this.getForm().submit({ params: {serverid: {{MumbleServer.id}}, pk: this.pk } }); |
|
|
|
}, |
|
|
|
}, { |
|
|
|
}, |
|
|
|
{% if MumbleAccount %} |
|
|
|
{% if IsAdmin %} { |
|
|
|
title: gettext("Administration"), |
|
|
|
pk: {{ MumbleServer.id }}, |
|
|
|
labelWidth: 150, |
|
|
|
xtype: 'mumbleform', |
|
|
|
}, { |
|
|
|
}, {% endif %} |
|
|
|
{ |
|
|
|
title: gettext("User texture"), |
|
|
|
layout: "border", |
|
|
|
items: [{ |
|
|
@ -69,6 +193,7 @@ |
|
|
|
}, { |
|
|
|
region: "center", |
|
|
|
xtype: "form", |
|
|
|
labelWidth: 150, |
|
|
|
fileUpload: true, |
|
|
|
url: "{% url mumble.views.update_avatar MumbleAccount.id %}", |
|
|
|
items: [{ |
|
|
@ -82,13 +207,15 @@ |
|
|
|
inputType: "file", |
|
|
|
}], |
|
|
|
buttons: [{ |
|
|
|
text: 'Submit', |
|
|
|
text: gettext('Submit'), |
|
|
|
handler: function(){ this.ownerCt.ownerCt.getForm().submit(); }, |
|
|
|
}], |
|
|
|
}], |
|
|
|
}, { |
|
|
|
}, |
|
|
|
{% if IsAdmin %} { |
|
|
|
xtype: "userEditorPanel", |
|
|
|
} ], |
|
|
|
} {% endif %} |
|
|
|
{% endif %} ], |
|
|
|
}], |
|
|
|
}); |
|
|
|
} ); |
|
|
|