From 0e8ab76a24d97b63ed23673c5bb16c7265fcb74b Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Fri, 2 Jul 2010 11:49:11 +0200 Subject: [PATCH] add usereditor, use Django's jsi18n, language update --- htdocs/js/mumble.js | 171 ++++++++++++------ htdocs/js/usereditor.js | 152 ++++++++++++++++ pyweb/mumble/locale/de/LC_MESSAGES/django.mo | Bin 10050 -> 10702 bytes .../mumble/locale/de/LC_MESSAGES/djangojs.mo | Bin 0 -> 1458 bytes .../mumble/locale/de/LC_MESSAGES/djangojs.po | 108 +++++++++++ pyweb/mumble/locale/fr/LC_MESSAGES/django.mo | Bin 10574 -> 10574 bytes pyweb/mumble/locale/it/LC_MESSAGES/django.mo | Bin 10087 -> 10087 bytes pyweb/mumble/locale/ja/LC_MESSAGES/django.mo | Bin 10160 -> 10812 bytes pyweb/mumble/templates/mumble/mumble.html | 8 +- pyweb/templates/index.html | 4 +- pyweb/urls.py | 7 + 11 files changed, 389 insertions(+), 61 deletions(-) create mode 100644 htdocs/js/usereditor.js create mode 100644 pyweb/mumble/locale/de/LC_MESSAGES/djangojs.mo create mode 100644 pyweb/mumble/locale/de/LC_MESSAGES/djangojs.po diff --git a/htdocs/js/mumble.js b/htdocs/js/mumble.js index 5ba9ab1..25dd67b 100644 --- a/htdocs/js/mumble.js +++ b/htdocs/js/mumble.js @@ -6,70 +6,76 @@ Ext.ux.MumbleChannelViewer = function( config ){ Ext.apply( this, config ); Ext.applyIf( this, { - title: "Channel View", + title: gettext("Channel Viewer"), root: { - text: "ohai", + text: gettext("Loading..."), 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"); }, - }); + buttons: [{ + text: gettext("Refresh"), + handler: this.refresh, + scope: this + }], + } ); Ext.ux.MumbleChannelViewer.superclass.constructor.call( this ); + this.refresh(); } Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { - + refresh: function(){ + 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.reg( 'mumblechannelviewer', Ext.ux.MumbleChannelViewer ); -function render_mumble( divname, data_url ){ +function render_mumble( divname, urls ){ var mainpanel = new Ext.Panel({ renderTo: divname, height: 600, @@ -79,18 +85,67 @@ function render_mumble( divname, data_url ){ region: "west", width: 350, split: true, - source_url: data_url, + source_url: urls.data, }, { xtype: "tabpanel", region: "center", activeTab: 0, items: [{ - title: "fail", - html: "fail", + title: gettext("Registration"), + xtype: "form", + items: [{ + name: "username", + fieldLabel: gettext("User name"), + xtype: "textfield", + }, { + name: "password", + fieldLabel: gettext("Password"), + xtype: "textfield", + inputType: "password", + }], + }, { + title: gettext("Administration"), + xtype: "form", + items: [{ + name: "test", + fieldLabel: "testing", + xtype: "textfield", + }], + }, { + title: gettext("User texture"), + layout: "border", + items: [{ + region: "north", + layout: "hbox", + height: 200, + items: [{ + flex: 1, + title: gettext("Texture"), + html: "texture!" + }, { + flex: 1, + title: gettext("Gravatar"), + html: "gravatar!", + }], + }, { + region: "center", + xtype: "form", + items: [{ + name: "usegravatar", + fieldLabel: gettext("Use Gravatar"), + xtype: "checkbox", + }, { + name: "uploadpic", + fieldLabel: gettext("Upload Avatar"), + xtype: "textfield", + inputType: "file", + }], + }], }, { - title: "omg", - html: "omg" - }], + xtype: "userEditorPanel", + django_users_url: urls.django_users, + mumble_users_url: urls.mumble_users, + } ], }], }); } diff --git a/htdocs/js/usereditor.js b/htdocs/js/usereditor.js new file mode 100644 index 0000000..d393f84 --- /dev/null +++ b/htdocs/js/usereditor.js @@ -0,0 +1,152 @@ +// {% load mumble_extras %} +// {% load i18n %} +// {% comment %} +// kate: space-indent on; indent-width 2; replace-tabs on; +// {% endcomment %} + +Ext.namespace('Ext.ux'); + +Ext.ux.UserEditorPanel = function( config ){ + Ext.apply( this, config ); + + userRecord = Ext.data.Record.create([ + { name: 'id', type: 'int' }, + { name: 'name', type: 'string' }, + { name: 'password', type: 'string' }, + { name: 'owner', type: 'int' }, + { name: 'admin', type: 'bool' }, + { name: 'delete', type: 'bool' } + ]); + + userAdminStore = new Ext.data.Store({ + url: config.mumble_users_url, + reader: new Ext.data.JsonReader({ + root: 'objects', + fields: userRecord + }), + autoLoad: true, + remoteSort: false + }); + + adminColumn = new Ext.grid.CheckColumn({ + header: gettext("Admin on root channel"), + dataIndex: 'admin', + width: 50 + }); + + deleteColumn = new Ext.grid.CheckColumn({ + header: gettext("Delete"), + dataIndex: 'delete', + width: 50 + }); + + ownerCombo = new Ext.form.ComboBox({ + name: 'owner', + hiddenName: 'owner_id', + forceSelection: true, + triggerAction: 'all', + valueField: 'uid', + displayField: 'uname', + store: new Ext.data.Store({ + url: config.django_users_url, + reader: new Ext.data.JsonReader({ + fields: [ 'uid', 'uname' ], + root: 'objects' + }), + autoLoad: true + }) + }); + + Ext.applyIf( this, { + title: gettext("User List"), + store: userAdminStore, + viewConfig: { forceFit: true }, + + cm: new Ext.grid.ColumnModel( [ { + header: gettext("name"), + dataIndex: 'name', + sortable: true, + editor: new Ext.form.TextField({ + allowBlank: false + }) + }, { + header: gettext("Account owner"), + dataIndex: 'owner', + editor: ownerCombo, + sortable: true, + renderer: function( value ){ + if( value == '' ) return ''; + items = ownerCombo.store.data.items; + for( i = 0; i < items.length; i++ ) + if( items[i].data.uid == value ) + return items[i].data.uname; + } + }, adminColumn, { + header: gettext("Change password"), + dataIndex: 'password', + editor: new Ext.form.TextField({ + inputType: 'password' + }), + renderer: function( value ){ + ret = ''; + for( i = 0; i < value.length; i++ ) + ret += '*'; + return ret; + } + }, deleteColumn ] ), + + tbar: [{ + text: gettext("Add"), + handler : function(){ + userAdminStore.add( new userRecord( { + id: -1, + name: gettext('New User'), + admin: false, + owner: '', + password: '', + 'delete': false + } ) ); + } + }, { + text: gettext("Save"), + handler : function(){ + data = []; + for( i = 0; i < userAdminStore.data.items.length; i++ ){ + rec = userAdminStore.data.items[i]; + if( rec.dirty ){ + data.push(rec.data); + } + } + var conn = new Ext.data.Connection(); + conn.request( { + url: userAdminStore.url, + params: { data: Ext.encode( data ) }, + success: function(){ + for( i = 0; i < userAdminStore.data.items.length; i++ ){ + rec = userAdminStore.data.items[i]; + if( rec.data['delete'] == true ) + userAdminStore.remove( rec ); + else if( rec.dirty ){ + rec.commit(); + } + } + } + }); + } + }, { + text: gettext("Resync with Murmur"), + handler: function(){ + userAdminStore.reload({ + params: { 'resync': 'true' } + }); + } + }], + plugins: [ adminColumn, deleteColumn ] + }); + Ext.ux.UserEditorPanel.superclass.constructor.call( this ); +}; + +Ext.extend( Ext.ux.UserEditorPanel, Ext.grid.EditorGridPanel, { +} ); + +Ext.reg( 'userEditorPanel', Ext.ux.UserEditorPanel ); diff --git a/pyweb/mumble/locale/de/LC_MESSAGES/django.mo b/pyweb/mumble/locale/de/LC_MESSAGES/django.mo index 01e88029d3ae15db7866ba50690fccacf0fc6206..c878b28ffc08c1654db1c796eaa2be857d520c9a 100644 GIT binary patch delta 2617 zcmYk;drXye9LMqR;UJtm9D*`00fLft@KVyrKufeDK?77M@WKJSAX=Jqv|?@g(7LY6 zR;JUb8(Yw2g@1TitF7hKmbuo&tLtCwcelS`CUm!yKRcK0nPpJ9M5_h=!K*OIRa>wF)#3N38_v4+MJ%Nq zq8AMyfx52>NscYS$=HIr?`h1%9jNEMfrWU$qoNy5p=LCIy5T(Xv&$T2VHS5Q#q&|u z)nFPf$LW|v4deyX^Lm{9IGgtSsEJ-ces-BdJ$f;K>yRaCa#hdUQ_xEp6oA_tcYx#Qt z`B&vHPH0A9UVfQ}N@)VM7v`W+-GEAE8)^VsknG!2sORj()!2u+F2YXk!F<%-_y9?Y zoj^Tru+TGGK;>6XXvXD5!Gmj2?Ig~?6sm(>)cJl?rjDX!`UPs{L#Xp5Y6*^_Zuk`SntkKWpGT$eA}Y1v8-n|@QSAa$ zhjG;X6{vn{-1+9^6pUq-0hN+|u> zO#d&BxJDZ;C5i|wm&!~c;@5&DxS9G$B2()>ok|T+NRWAZjA$h8A|55Q2`h-L;!dtW?T3xTB6qF|^*vCjC-nah|34Z{Iz!1K?j`0CY*@cM$Z-Kt z9yDz}W)Mk2pJnZt^@Iwac4Oc9MQ_y%f{&qJN}c*1tRq$ulON_Vf>22WSglj&qryKu Qdookmq0&RK(KB=Z1%?ONhyVZp delta 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$lNV0s>XvmQ-;`!tF8$KNH97mabiv3EmSp2%ZQhIb z$Y)`S4*4WA(_*myb4sS_%4{S*E8LXw2ioZWG-cIMLGFKJ5^_dtliMY(C5wkawD*7X z@eo=Eozm6`&3dvxd#sQt%Di(O(RvUHo#Xw;;aJt5SQIAx*SGC4AqVH2HK>?1rX1RM em?Mi3mHJ_u&eK63|0?rU*_-pltYO6#ckl~7gJDzv literal 0 HcmV?d00001 diff --git a/pyweb/mumble/locale/de/LC_MESSAGES/djangojs.po b/pyweb/mumble/locale/de/LC_MESSAGES/djangojs.po new file mode 100644 index 0000000..eb02caa --- /dev/null +++ b/pyweb/mumble/locale/de/LC_MESSAGES/djangojs.po @@ -0,0 +1,108 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-07-02 11:38+0200\n" +"PO-Revision-Date: 2010-07-02 11:41\n" +"Last-Translator: \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: \n" +"X-Translated-Using: django-rosetta 0.5.5\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: js/mumble.js:10 +msgid "Channel Viewer" +msgstr "Serveransicht" + +#: js/mumble.js:12 +msgid "Loading..." +msgstr "Lade..." + +#: js/mumble.js:16 +msgid "Refresh" +msgstr "Aktualisieren" + +#: js/mumble.js:95 +msgid "Registration" +msgstr "Registrierung" + +#: js/mumble.js:99 +msgid "User name" +msgstr "Benutzername" + +#: js/mumble.js:103 +msgid "Password" +msgstr "Passwort" + +#: js/mumble.js:108 +msgid "Administration" +msgstr "Administration" + +#: js/mumble.js:116 +msgid "User texture" +msgstr "Benutzertextur" + +#: js/mumble.js:124 +msgid "Texture" +msgstr "Textur" + +#: js/mumble.js:128 +msgid "Gravatar" +msgstr "Gravatar" + +#: js/mumble.js:136 +msgid "Use Gravatar" +msgstr "Benutze Gravatar" + +#: js/mumble.js:140 +msgid "Upload Avatar" +msgstr "Avatar hochladen" + +#: js/usereditor.js:33 +msgid "Admin on root channel" +msgstr "Admin im Wurzelkanal" + +#: js/usereditor.js:39 +msgid "Delete" +msgstr "Löschen" + +#: js/usereditor.js:62 +msgid "User List" +msgstr "Benutzerliste" + +#: js/usereditor.js:67 +msgid "name" +msgstr "Name" + +#: js/usereditor.js:74 +msgid "Account owner" +msgstr "Accountbesitzer" + +#: js/usereditor.js:86 +msgid "Change password" +msgstr "Passwort ändern" + +#: js/usereditor.js:100 +msgid "Add" +msgstr "Hinzufügen" + +#: js/usereditor.js:104 +msgid "New User" +msgstr "Neuer Benutzer" + +#: js/usereditor.js:112 +msgid "Save" +msgstr "Speichern" + +#: js/usereditor.js:138 +msgid "Resync with Murmur" +msgstr "Aktualisieren" diff --git a/pyweb/mumble/locale/fr/LC_MESSAGES/django.mo b/pyweb/mumble/locale/fr/LC_MESSAGES/django.mo index 739ff563a5bae9591233b4328fb39e4371d91a32..bf1f60528821aae061a0f0489e65b62908656166 100644 GIT binary patch delta 23 ecmX>XbS`Lvx&)W0u7Qz)p^25T;bub#SwR3>p$1C; delta 23 ecmX>XbS`Lvx&)Vru93Ndp`n$D#b!eZSwR3>{svY6 diff --git a/pyweb/mumble/locale/it/LC_MESSAGES/django.mo b/pyweb/mumble/locale/it/LC_MESSAGES/django.mo index 63c140ec07ea367ebd49a57ed850a53dbab5d82e..6de83b602c3e646134af6f202fa3434db9579914 100644 GIT binary patch delta 23 ecmaFv_uOv-hXj|Yu7Qz)p^25T;btL;P<{Yi2?lKd delta 23 ecmaFv_uOv-hXj|2u93Ndp`n$D#bzOiP<{YiW(Ifw diff --git a/pyweb/mumble/locale/ja/LC_MESSAGES/django.mo b/pyweb/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Q2Tgc*RU3~!4_BFg^Ki$^91VEUO_E*7d8F` zDr0S^1%J8zBp!|qkcFJhN>KB{sPQ#OAfDB`hJ$WE6E0>z1j{gPsM#*8K-RXWsK7c= z3&oJW>o^E?r>{^~lgK}T{aA_$EQ%ws1(kt6n5i7b<#k7v;|!q|o`yQXGStbpp%&Wh z`j0x#Iv=2){x%$g9jHJudD(j0<$NgvwV01P(H}$MR4|gB5bl#uR5*70kWgqsQAuQb H=Ka7wT-dY@ diff --git a/pyweb/mumble/templates/mumble/mumble.html b/pyweb/mumble/templates/mumble/mumble.html index 14e8463..f83cb3a 100644 --- a/pyweb/mumble/templates/mumble/mumble.html +++ b/pyweb/mumble/templates/mumble/mumble.html @@ -11,10 +11,16 @@
{% endblock %} {% block HeadTag %} + + {% endblock %} diff --git a/pyweb/templates/index.html b/pyweb/templates/index.html index bfb063b..ff14bc7 100644 --- a/pyweb/templates/index.html +++ b/pyweb/templates/index.html @@ -11,8 +11,8 @@ - - + + {% block HeadTag %} diff --git a/pyweb/urls.py b/pyweb/urls.py index 4d0e299..5f40b39 100644 --- a/pyweb/urls.py +++ b/pyweb/urls.py @@ -26,6 +26,10 @@ from django.conf import settings handler404 = 'django.views.defaults.page_not_found' handler500 = 'django.views.defaults.server_error' +js_info_dict = { + 'packages': ('mumble',), +} + urlpatterns = patterns('', (r'^/?$', 'mumble.views.redir' ), @@ -41,6 +45,9 @@ urlpatterns = patterns('', # Uncomment the next line to enable the admin: (r'^admin/', admin.site.urls), + + (r'^i18n/', include('django.conf.urls.i18n')), + (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), ) if "rosetta" in settings.INSTALLED_APPS: