Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

323 lines
11 KiB

16 years ago
16 years ago
16 years ago
16 years ago
15 years ago
16 years ago
16 years ago
16 years ago
16 years ago
16 years ago
16 years ago
  1. {% extends "index.htm" %}
  2. {% load mumble_extras %}
  3. {% load i18n %}
  4. {% block Headline %}
  5. {{ DBaseObject.name }}
  6. {% endblock %}
  7. {% block LeftColumn %}
  8. {{ DBaseObject|chanview:MumbleAccount }}
  9. {% endblock %}
  10. {% block Content %}
  11. <noscript>
  12. <p>
  13. {% blocktrans %}
  14. <b>Hint:</b><br />
  15. This area is used to display additional information for each channel and player, but requires JavaScript to be
  16. displayed correctly. You will not see the detail pages, but you can use all links and forms
  17. that are displayed.
  18. {% endblocktrans %}
  19. </p>
  20. </noscript>
  21. <div id="mumble_ext_container"></div>
  22. <div id="mumble_motd" class="mumble-ext x-hide-display">
  23. <ul>
  24. <li>{% trans "Server Address" %}: <a href="{{ DBaseObject.connecturl }}">{{ DBaseObject.connecturl }}</a></li>
  25. {% if DBaseObject.url %}
  26. <li>{% trans "Website" %}: {{ DBaseObject.url|urlize }}</li>
  27. {% endif %}
  28. <li>{% trans "Server version" %}: {{ DBaseObject.version.0 }}.{{ DBaseObject.version.1 }}.{{ DBaseObject.version.2 }}</li>
  29. </ul>
  30. <fieldset>
  31. <legend>{% trans "Welcome message" %}</legend>
  32. {{ DBaseObject.motd|safe }}
  33. </fieldset>
  34. </div>
  35. <div id="mumble_registration" class="mumble-ext">
  36. {% if user.is_authenticated %}
  37. <h2>{% trans "Server registration" %}</h2>
  38. <form action="{% url mumble.views.show DBaseObject.id %}" method="post">
  39. {% if Registered %}
  40. {% trans "You are registered on this server" %}.<br />
  41. {% else %}
  42. {% trans "You do not have an account on this server" %}.<br />
  43. {% endif %}
  44. <table>
  45. {{ RegForm }}
  46. </table>
  47. <input type="hidden" name="mode" value="reg" />
  48. <input type="submit" />
  49. </form>
  50. {% else %}
  51. {% blocktrans %}
  52. <p>You need to be <a href="{{ login_url }}">logged in</a> to be able to register an account on this Mumble server.</p>
  53. {% endblocktrans %}
  54. {% endif %}
  55. </div>
  56. {% if Registered %}
  57. <div id="mumble_texture" class="mumble-ext">
  58. <h2>{% trans "User Texture" %}</h2>
  59. <p>
  60. {% blocktrans with DBaseObject.id as serverid %}
  61. You can upload an image that you would like to use as your user texture here.<br />
  62. Your current texture is:<br />
  63. {% endblocktrans %}
  64. <img src="{% url mumble.views.showTexture DBaseObject.id MumbleAccount.id %}" alt="user texture" /><br />
  65. {% blocktrans with DBaseObject.id as serverid %}
  66. Hint: The texture image <b>needs</b> to be 600x60 in size. If you upload an image with
  67. a different size, it will be resized accordingly.<br />
  68. {% endblocktrans %}
  69. </p>
  70. <form action="{% url mumble.views.show DBaseObject.id %}" method="post" enctype="multipart/form-data">
  71. <table>
  72. {{ TextureForm }}
  73. </table>
  74. <input type="hidden" name="mode" value="texture" />
  75. <input type="submit" />
  76. </form>
  77. </div>
  78. {% endif %}
  79. {% if CurrentUserIsAdmin %}
  80. <div id="mumble_admin" class="mumble-ext">
  81. <h2>{% trans "Server administration" %}</h2>
  82. <form action="{% url mumble.views.show DBaseObject.id %}" method="post">
  83. <table>
  84. {{ AdminForm }}
  85. </table>
  86. <input type="hidden" name="mode" value="admin" />
  87. <input type="submit" />
  88. </form>
  89. </div>
  90. {% endif %}
  91. {% for item in ChannelTable %}
  92. {% if item.is_player %}
  93. <div id="mumble_{{ item.id }}" class="mumble-ext x-hide-display">
  94. <h2>{% trans "Player" %} {{ item.name }}</h2>
  95. <ul>
  96. <li>{% trans "Online since" %} {{ item.onlinesince|time }}</li>
  97. <li>{% blocktrans with item.isAuthed|yesno as authed %}Authenticated: {{ authed }}{% endblocktrans %}</li>
  98. <li>{% blocktrans with item.isAdmin|yesno as admin %}Admin: {{ admin }}{% endblocktrans %}</li>
  99. <li>{% blocktrans with item.muted|yesno as muted %}Muted: {{ muted }}{% endblocktrans %}</li>
  100. <li>{% blocktrans with item.deafened|yesno as deafened %}Deafened: {{ deafened }}{% endblocktrans %}</li>
  101. <li>{% blocktrans with item.selfmuted|yesno as selfmuted %}Muted by self: {{ selfmuted }}{% endblocktrans %}</li>
  102. <li>{% blocktrans with item.selfdeafened|yesno as selfdeafened %}Deafened by self: {{ selfdeafened }}{% endblocktrans %}</li>
  103. </ul>
  104. {% if item.mumbleuser and item.mumbleuser.owner %}
  105. <h2>{% trans "User" %} {{ item.mumbleuser.owner.username|capfirst }}</h2>
  106. <ul>
  107. {% if item.mumbleuser.owner.first_name and item.mumbleuser.owner.last_name %}
  108. <li>{% trans "Full Name" %}: {{ item.mumbleuser.owner.first_name }} {{ item.mumbleuser.owner.last_name }}</li>
  109. {% endif %}
  110. <li>{% trans "Admin" %}: {{ item.mumbleuser.owner.is_staff|yesno }}</li>
  111. <li>{% trans "Sign-up date" %}: {{ item.mumbleuser.owner.date_joined|date }}</li>
  112. </ul>
  113. {% endif %}
  114. {% if item.mumbleuser %}
  115. <h2>{% trans "User Texture" %}</h2>
  116. <img src="{% url mumble.views.showTexture DBaseObject.id item.mumbleuser.id %}" alt="user texture" />
  117. {% endif %}
  118. </div>
  119. {% else %}
  120. <div id="mumble_{{ item.id }}" class="mumble-ext x-hide-display">
  121. <h2>{% trans "Channel" %} {{ item.name }}</h2>
  122. {% if CurrentUserIsAdmin or user.is_staff %}
  123. {% trans "Channel ID" %}: {{ item.chanid }}<br />
  124. {% endif %}
  125. <a href="{{ item|chanurl:MumbleAccount }}" class="mumble">{% trans "Connect" %}</a>
  126. {% if item.description %}
  127. <fieldset>
  128. <legend>{% trans "Channel description" %}</legend>
  129. {{ item.description|safe }}
  130. </fieldset>
  131. {% endif %}
  132. </div>
  133. {% endif %}
  134. {% endfor %}
  135. {% endblock %}
  136. {% block HeadTag %}
  137. <script type="text/javascript">
  138. Ext.onReady( function(){
  139. Ext.get( 'mumble_registration' ).addClass( 'x-hide-display' );
  140. {% if Registered %}
  141. Ext.get( 'mumble_texture' ).addClass( 'x-hide-display' );
  142. {% endif %}
  143. {% if CurrentUserIsAdmin %}
  144. Ext.get( 'mumble_admin' ).addClass( 'x-hide-display' );
  145. {% endif %}
  146. {% if CurrentUserIsAdmin %}
  147. userRecord = Ext.data.Record.create([
  148. { name: 'id', type: 'int' },
  149. { name: 'name', type: 'string' },
  150. { name: 'password', type: 'string' },
  151. { name: 'owner', type: 'int' },
  152. { name: 'admin', type: 'bool' },
  153. { name: 'delete', type: 'bool' },
  154. ]);
  155. userAdminStore = new Ext.data.Store({
  156. url: '{% url mumble.views.users DBaseObject.id %}',
  157. reader: new Ext.data.JsonReader({
  158. root: 'objects',
  159. fields: userRecord,
  160. }),
  161. autoLoad: true,
  162. remoteSort: false,
  163. });
  164. adminColumn = new Ext.grid.CheckColumn({
  165. header: '{% trans "Admin on root channel" %}',
  166. dataIndex: 'admin',
  167. width: 50,
  168. });
  169. deleteColumn = new Ext.grid.CheckColumn({
  170. header: '{% trans "Delete" %}',
  171. dataIndex: 'delete',
  172. width: 50,
  173. });
  174. ownerCombo = new Ext.form.ComboBox({
  175. name: 'owner',
  176. hiddenName: 'owner_id',
  177. forceSelection: true,
  178. triggerAction: 'all',
  179. valueField: 'uid',
  180. displayField: 'uname',
  181. store: new Ext.data.Store({
  182. url: '{% url mumble.views.djangousers %}',
  183. reader: new Ext.data.JsonReader({
  184. fields: [ 'uid', 'uname' ],
  185. root: 'objects',
  186. }),
  187. autoLoad: true,
  188. }),
  189. });
  190. {% endif %}
  191. var cardpanel = new Ext.Panel({
  192. renderTo: 'mumble_ext_container',
  193. layout: 'card',
  194. id: 'mumble_container',
  195. height: 570,
  196. activeItem: 0,
  197. border: false,
  198. items: [ {
  199. id: 'mumble_tabpanel',
  200. xtype: 'tabpanel',
  201. defaults: { autoheight: true },
  202. activeTab: {{ DisplayTab }},
  203. items: [
  204. { contentEl: 'mumble_motd', title: '{% trans "Server Info" %}', autoScroll: true },
  205. { contentEl: 'mumble_registration', title: '{% trans "Registration" %}', autoScroll: true },
  206. {% if CurrentUserIsAdmin %}
  207. { contentEl: 'mumble_admin', title: '{% trans "Administration" %}', autoScroll: true },
  208. {% endif %}
  209. {% if Registered %}
  210. { contentEl: 'mumble_texture',title: '{% trans "User Texture" %}', autoScroll: true },
  211. {% endif %}
  212. {% if CurrentUserIsAdmin %}
  213. {
  214. title: '{% trans "User List" %}',
  215. xtype: 'editorgrid',
  216. store: userAdminStore,
  217. cm: new Ext.grid.ColumnModel( [ {
  218. header: '{% trans "name" %}',
  219. dataIndex: 'name',
  220. sortable: true,
  221. editor: new Ext.form.TextField({
  222. allowBlank: false,
  223. }),
  224. }, {
  225. header: '{% trans "Account owner" %}',
  226. dataIndex: 'owner',
  227. editor: ownerCombo,
  228. sortable: true,
  229. renderer: function( value ){
  230. if( value == '' ) return '';
  231. items = ownerCombo.store.data.items;
  232. for( i = 0; i < items.length; i++ )
  233. if( items[i].data.uid == value )
  234. return items[i].data.uname;
  235. },
  236. }, adminColumn, {
  237. header: '{% trans "Change password" %}',
  238. dataIndex: 'password',
  239. editor: new Ext.form.TextField({
  240. inputType: 'password',
  241. }),
  242. renderer: function( value ){
  243. ret = '';
  244. for( i = 0; i < value.length; i++ )
  245. ret += '*';
  246. return ret;
  247. },
  248. }, deleteColumn ] ),
  249. tbar: [{
  250. text: '{% trans "Add" %}',
  251. handler : function(){
  252. userAdminStore.add( new userRecord( {
  253. id: -1,
  254. name: 'New User',
  255. admin: false,
  256. owner: '',
  257. password: '',
  258. 'delete': false,
  259. } ) );
  260. }
  261. }, {
  262. text: '{% trans "Save" %}',
  263. handler : function(){
  264. data = [];
  265. for( i = 0; i < userAdminStore.data.items.length; i++ ){
  266. rec = userAdminStore.data.items[i];
  267. if( rec.dirty ){
  268. data.push(rec.data);
  269. }
  270. }
  271. var conn = new Ext.data.Connection();
  272. conn.request( {
  273. url: userAdminStore.url,
  274. params: { data: Ext.encode( data ), },
  275. success: function(){
  276. for( i = 0; i < userAdminStore.data.items.length; i++ ){
  277. rec = userAdminStore.data.items[i];
  278. if( rec.data['delete'] == true )
  279. userAdminStore.remove( rec );
  280. else if( rec.dirty ){
  281. rec.commit();
  282. }
  283. }
  284. },
  285. } );
  286. }
  287. }],
  288. plugins: [ adminColumn, deleteColumn ],
  289. },
  290. {% endif %}
  291. ]
  292. },
  293. {% for item in ChannelTable %}
  294. { contentEl: 'mumble_{{ item.id }}', id: 'carditem_{{ item.id }}' },
  295. {% endfor %}
  296. ],
  297. });
  298. Ext.get( 'link_server' ).on( 'click', function( event, target ){
  299. cardpanel.layout.setActiveItem( 'mumble_tabpanel' );
  300. event.preventDefault();
  301. });
  302. {% for item in ChannelTable %}
  303. Ext.get( 'link_{{ item.id }}' ).on( 'click', function( event, target ){
  304. cardpanel.layout.setActiveItem( 'carditem_{{ item.id }}' );
  305. event.preventDefault();
  306. });
  307. {% endfor %}
  308. } );
  309. </script>
  310. <meta http-equiv="refresh" content="300" />
  311. {% endblock %}