Browse Source

add usereditor, use Django's jsi18n, language update

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
0e8ab76a24
  1. 171
      htdocs/js/mumble.js
  2. 152
      htdocs/js/usereditor.js
  3. BIN
      pyweb/mumble/locale/de/LC_MESSAGES/django.mo
  4. BIN
      pyweb/mumble/locale/de/LC_MESSAGES/djangojs.mo
  5. 108
      pyweb/mumble/locale/de/LC_MESSAGES/djangojs.po
  6. BIN
      pyweb/mumble/locale/fr/LC_MESSAGES/django.mo
  7. BIN
      pyweb/mumble/locale/it/LC_MESSAGES/django.mo
  8. BIN
      pyweb/mumble/locale/ja/LC_MESSAGES/django.mo
  9. 8
      pyweb/mumble/templates/mumble/mumble.html
  10. 4
      pyweb/templates/index.html
  11. 7
      pyweb/urls.py

171
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,
} ],
}],
});
}

152
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 );

BIN
pyweb/mumble/locale/de/LC_MESSAGES/django.mo

BIN
pyweb/mumble/locale/de/LC_MESSAGES/djangojs.mo

108
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 <EMAIL@ADDRESS>, 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: <diese-addy@funzt-halt.net>\n"
"Language-Team: LANGUAGE <LL@li.org>\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"

BIN
pyweb/mumble/locale/fr/LC_MESSAGES/django.mo

BIN
pyweb/mumble/locale/it/LC_MESSAGES/django.mo

BIN
pyweb/mumble/locale/ja/LC_MESSAGES/django.mo

8
pyweb/mumble/templates/mumble/mumble.html

@ -11,10 +11,16 @@
<div id="ext_container"></div>
{% endblock %}
{% block HeadTag %}
<script type="text/javascript" src="/jsi18n/"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/js/usereditor.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/js/mumble.js"></script>
<script type="text/javascript">
Ext.onReady( function(){
render_mumble( "ext_container", "{% url mumble.views.cvp_json DBaseObject.id %}" );
render_mumble( "ext_container", {
data: "{% url mumble.views.cvp_json DBaseObject.id %}",
django_users: '{% url mumble.views.djangousers %}',
mumble_users: '{% url mumble.views.users DBaseObject.id %}'
} );
} );
</script>
{% endblock %}

4
pyweb/templates/index.html

@ -11,8 +11,8 @@
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}/mumble/style.css" />
<link rel="shortcut icon" type="image/png" href="{{ MEDIA_URL }}/mumble/mumble.16x16.png" />
<script type="text/javascript" src="{{ MEDIA_URL }}/ext-3.2.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/ext-3.2.0/ext-all.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/ext-3.2.0/adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/ext-3.2.0/ext-all-debug.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/checkcolumn.js"></script>
{% block HeadTag %}

7
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:

Loading…
Cancel
Save