From c1b8b9ad970f406731516e7c6ee3d067e0180381 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sun, 10 Oct 2010 16:43:02 +0200 Subject: [PATCH] hide registration tab for unauthed users --- pyweb/mumble/templates/mumble/mumble.html | 143 +++++++++++----------- 1 file changed, 73 insertions(+), 70 deletions(-) diff --git a/pyweb/mumble/templates/mumble/mumble.html b/pyweb/mumble/templates/mumble/mumble.html index 967ba15..ab5a311 100644 --- a/pyweb/mumble/templates/mumble/mumble.html +++ b/pyweb/mumble/templates/mumble/mumble.html @@ -106,85 +106,88 @@ items: [{ title: gettext("Server info"), html: renderserverinfos( {{ ServerDict|safe }} ), - }, { - title: gettext("Registration"), - xtype: "{{ RegForm|lower }}", - pk: {% if MumbleAccount %}{{ MumbleAccount.id }}{% else %}-1{% endif %}, - labelWidth: 150, - baseParams: {serverid: {{MumbleServer.id}} }, }, - {% if MumbleAccount %} - {% if IsAdmin %} + {% if user.is_authenticated %} { - title: gettext("Administration"), - pk: {{ MumbleServer.id }}, + title: gettext("Registration"), + xtype: "{{ RegForm|lower }}", + pk: {% if MumbleAccount %}{{ MumbleAccount.id }}{% else %}-1{% endif %}, labelWidth: 150, - xtype: 'mumbleform', + baseParams: {serverid: {{MumbleServer.id}} }, }, - {% endif %} - { - title: gettext("User texture"), - layout: "border", - items: [{ - region: "north", - layout: "hbox", - height: 200, + {% if MumbleAccount %} + {% if IsAdmin %} + { + title: gettext("Administration"), + pk: {{ MumbleServer.id }}, + labelWidth: 150, + xtype: 'mumbleform', + }, + {% endif %} + { + title: gettext("User texture"), + layout: "border", items: [{ - flex: 1, + region: "north", + layout: "hbox", height: 200, - title: gettext("Texture"), - html: String.format('Avatar', - "{% url mumble.views.showTexture MumbleServer.id MumbleAccount.id %}"), + items: [{ + flex: 1, + height: 200, + title: gettext("Texture"), + html: String.format('Avatar', + "{% url mumble.views.showTexture MumbleServer.id MumbleAccount.id %}"), + }, { + flex: 1, + height: 200, + title: gettext("Gravatar"), + html: String.format('grAvatar', "{{ MumbleAccount.gravatar }}"), + }], }, { - flex: 1, - height: 200, - title: gettext("Gravatar"), - html: String.format('grAvatar', "{{ MumbleAccount.gravatar }}"), + region: "center", + xtype: "form", + labelWidth: 150, + fileUpload: true, + url: "{% url mumble.views.update_avatar MumbleAccount.id %}", + items: [{ + name: "usegravatar", + fieldLabel: gettext("Use Gravatar"), + xtype: "checkbox", + }, { + name: "texturefile", + fieldLabel: gettext("Upload Avatar"), + xtype: "textfield", + inputType: "file", + }], + buttons: [{ + text: gettext('Submit'), + handler: function(){ + this.ownerCt.ownerCt.getForm().submit({ + success: function(form, action){ + var now = new Date(); + var img = Ext.fly("img_avatar"); + img.dom.src = String.format("{0}?_dc={1}", + "{% url mumble.views.showTexture MumbleServer.id MumbleAccount.id %}", + now.getTime() + ); + } + }); + }, + }], }], - }, { - region: "center", - xtype: "form", - labelWidth: 150, - fileUpload: true, - url: "{% url mumble.views.update_avatar MumbleAccount.id %}", - items: [{ - name: "usegravatar", - fieldLabel: gettext("Use Gravatar"), - xtype: "checkbox", + }, + {% if IsAdmin %} + { + xtype: "userEditorPanel", + server: {{ MumbleServer.id }} }, { - name: "texturefile", - fieldLabel: gettext("Upload Avatar"), - xtype: "textfield", - inputType: "file", - }], - buttons: [{ - text: gettext('Submit'), - handler: function(){ - this.ownerCt.ownerCt.getForm().submit({ - success: function(form, action){ - var now = new Date(); - var img = Ext.fly("img_avatar"); - img.dom.src = String.format("{0}?_dc={1}", - "{% url mumble.views.showTexture MumbleServer.id MumbleAccount.id %}", - now.getTime() - ); - } - }); - }, - }], - }], - }, - {% if IsAdmin %} - { - xtype: "userEditorPanel", - server: {{ MumbleServer.id }} - }, { - xtype: 'logViewerPanel', - server: {{ MumbleServer.id }} - }, { - xtype: 'banViewerPanel', - server: {{ MumbleServer.id }} - } + xtype: 'logViewerPanel', + server: {{ MumbleServer.id }} + }, { + xtype: 'banViewerPanel', + server: {{ MumbleServer.id }} + } + {% endif %} {% endif %} {% endif %} ],