From c88dcba67f9066cc9acc4493b112520ddf58af7b Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Thu, 1 Jul 2010 23:59:33 +0200 Subject: [PATCH] throw out the old master template and start coding everything in ExtJS. (Channel Viewer works already.) --- htdocs/js/mumble.js | 96 ++++++ pyweb/mumble/templates/mumble/mumble.html | 388 +--------------------- 2 files changed, 100 insertions(+), 384 deletions(-) create mode 100644 htdocs/js/mumble.js diff --git a/htdocs/js/mumble.js b/htdocs/js/mumble.js new file mode 100644 index 0000000..5ba9ab1 --- /dev/null +++ b/htdocs/js/mumble.js @@ -0,0 +1,96 @@ +// kate: space-indent on; indent-width 4; replace-tabs on; + +Ext.namespace('Ext.ux'); + +Ext.ux.MumbleChannelViewer = function( config ){ + Ext.apply( this, config ); + + Ext.applyIf( this, { + title: "Channel View", + root: { + text: "ohai", + leaf: true + } + } ); + + var conn = new Ext.data.Connection(); + conn.request({ + url: this.source_url, + scope: this, + success: function( resp, opt ){ + respdata = Ext.decode( resp.responseText ); + root = { + text: respdata.name, + id: "mumbroot", + leaf: false, + icon: '/static/mumble/mumble.16x16.png', + children: [], + }; + function populateNode( node, json ){ + subchan_users = 0; + for( var i = 0; i < json.channels.length; i++ ){ + child = { + text: json.channels[i].name, + id: ("channel_" + json.channels[i].id), + leaf: false, + icon: '/static/mumble/channel.png', + children: [], + }; + node.children.push( child ); + subchan_users += populateNode( child, json.channels[i] ); + } + for( var i = 0; i < json.users.length; i++ ){ + child = { + text: json.users[i].name, + id: ("user_" + json.users[i].id), + leaf: true, + icon: '/static/mumble/talking_off.png', + }; + node.children.push( child ); + } + if( json.id == 0 || json.users.length > 0 || subchan_users ) + node.expanded = true; + return subchan_users + json.users.length; + } + populateNode( root, respdata.root ); + this.setRootNode( root ); + }, + failure: function( resp, opt ){ + alert("fail"); + }, + }); + + Ext.ux.MumbleChannelViewer.superclass.constructor.call( this ); +} + +Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { + +} ); + +Ext.reg( 'mumblechannelviewer', Ext.ux.MumbleChannelViewer ); + +function render_mumble( divname, data_url ){ + var mainpanel = new Ext.Panel({ + renderTo: divname, + height: 600, + layout: "border", + items: [{ + xtype: "mumblechannelviewer", + region: "west", + width: 350, + split: true, + source_url: data_url, + }, { + xtype: "tabpanel", + region: "center", + activeTab: 0, + items: [{ + title: "fail", + html: "fail", + }, { + title: "omg", + html: "omg" + }], + }], + }); +} diff --git a/pyweb/mumble/templates/mumble/mumble.html b/pyweb/mumble/templates/mumble/mumble.html index 30b0596..14e8463 100644 --- a/pyweb/mumble/templates/mumble/mumble.html +++ b/pyweb/mumble/templates/mumble/mumble.html @@ -7,394 +7,14 @@ {% block Headline %} {{ DBaseObject.name }} {% endblock %} -{% block LeftColumn %} - {{ DBaseObject|chanview:MumbleAccount }} +{% block ContentMaster %} +
{% endblock %} -{% block Content %} - -
-
- -
- {% trans "Welcome message" %} - {{ DBaseObject.motd|removetags:"script link meta html head body style"|safe }} -
-
-
- {% if user.is_authenticated %} -

{% trans "Server registration" %}

-
{% csrf_token %} - {% if Registered %} - {% trans "You are registered on this server" %}.
- {% else %} - {% trans "You do not have an account on this server" %}.
- {% endif %} - - {{ RegForm }} -
- - -
- {% else %} - {% blocktrans %} -

You need to be logged in to be able to register an account on this Mumble server.

- {% endblocktrans %} - {% endif %} -
- - {% if Registered %} -
-

{% trans "User Texture" %}

- {% if DBaseObject|mmversion_eq:"1.2.2" %} - {% blocktrans %} - Sorry, due to a bug in Murmur 1.2.2, displaying and setting the Texture is disabled. - {% endblocktrans %} - {% else %} -

- {% blocktrans with DBaseObject.id as serverid %} - You can upload an image that you would like to use as your user texture here. - {% endblocktrans %}
-
-

- {% if MumbleAccount.gravatar %} - Gravatar: - your gravatar - {% endif %} -
- {% if MumbleAccount.hasTexture %} - {% trans "Your current texture is" %}:
- user texture
- {% else %} - {% trans "You don't currently have a texture set" %}.
- {% endif %} -
- {% if DBaseObject|mmversion_lt:"1.2.3" %} - {% blocktrans with DBaseObject.id as serverid %} - Hint: The texture image needs to be 600x60 in size. If you upload an image with - a different size, it will be resized accordingly.
- {% endblocktrans %} - {% endif %} -

-
{% csrf_token %} - - {{ TextureForm }} -
- - -
- {% endif %} -
- {% endif %} - - {% if CurrentUserIsAdmin %} -
-

{% trans "Server administration" %}

-
{% csrf_token %} - - {{ AdminForm }} -
- - -
-
- {% endif %} - - {% for item in ChannelTable %} - {% if item.is_player %} -
-

{% trans "Player" %} {{ item.name }}

- - {% if item.mumbleuser and item.mumbleuser.owner %} -

{% trans "User" %} {{ item.mumbleuser.owner.username|capfirst }}

- - {% endif %} - {% if item.comment %} -
- {% trans "User Comment" %} - {{ item.comment|removetags:"script link meta html head body style"|safe }} -
- {% endif %} - {% if item.mumbleuser and item.mumbleuser.gravatar %} -
- Gravatar - {{ item.name }}'s gravatar -
- {% endif %} - {% if item.mumbleuser and item.mumbleuser.hasTexture %} -
- {% trans "User Texture" %} - user texture -
- {% endif %} - {% if CurrentUserIsAdmin or user.is_staff %} -
- {% trans "Kick user" %} -
{% csrf_token %} - - -
    -
  • - - -
  • -
  • - - -
  • -
- -
-
- {% endif %} -
- {% else %} -
-

{% trans "Channel" %} {{ item.name }}

- {% if CurrentUserIsAdmin or user.is_staff %} - {% trans "Channel ID" %}: {{ item.chanid }}
- {% endif %} - {% trans "Connect" %} - {% if item.description %} -
- {% trans "Channel description" %} - {{ item.description|removetags:"script link meta html head body style"|safe }} -
- {% endif %} -
- {% endif %} - {% endfor %} -{% endblock %} - {% block HeadTag %} + - {% endblock %}