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.

319 lines
11 KiB

16 years ago
16 years ago
16 years ago
16 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="" 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 with DBaseObject.id as serverid %}
  52. <p>You need to be <a href="/accounts/login?next=%2Fmumble%2F{{ serverid }}">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. <img src="/mumble/{{serverid}}/texture.png" alt="user texture" /><br />
  64. Hint: The texture image <b>needs</b> to be 600x60 in size. If you upload an image with
  65. a different size, it will be resized accordingly.<br />
  66. {% endblocktrans %}
  67. </p>
  68. <form action="" method="post" enctype="multipart/form-data">
  69. <table>
  70. {{ TextureForm }}
  71. </table>
  72. <input type="hidden" name="mode" value="texture" />
  73. <input type="submit" />
  74. </form>
  75. </div>
  76. {% endif %}
  77. {% if CurrentUserIsAdmin %}
  78. <div id="mumble_admin" class="mumble-ext">
  79. <h2>{% trans "Server administration" %}</h2>
  80. <form action="" method="post">
  81. <table>
  82. {{ AdminForm }}
  83. </table>
  84. <input type="hidden" name="mode" value="admin" />
  85. <input type="submit" />
  86. </form>
  87. </div>
  88. {% endif %}
  89. {% for item in ChannelTable %}
  90. {% if item.is_player %}
  91. <div id="mumble_{{ item.id }}" class="mumble-ext x-hide-display">
  92. <h2>{% trans "Player" %} {{ item.name }}</h2>
  93. <ul>
  94. <li>{% trans "Online since" %} {{item.onlinesince|time:"H:i"}}</li>
  95. <li>{% blocktrans with item.isAuthed|yesno:_("yes,no") as authed %}Authenticated: {{ authed }}{% endblocktrans %}</li>
  96. <li>{% blocktrans with item.isAdmin|yesno:_("yes,no") as admin %}Admin: {{ admin }}{% endblocktrans %}</li>
  97. <li>{% blocktrans with item.muted|yesno:_("yes,no") as muted %}Muted: {{ muted }}{% endblocktrans %}</li>
  98. <li>{% blocktrans with item.deafened|yesno:_("yes,no") as deafened %}Deafened: {{ deafened }}{% endblocktrans %}</li>
  99. <li>{% blocktrans with item.selfmuted|yesno:_("yes,no") as selfmuted %}Muted by self: {{ selfmuted }}{% endblocktrans %}</li>
  100. <li>{% blocktrans with item.selfdeafened|yesno:_("yes,no") as selfdeafened %}Deafened by self: {{ selfdeafened }}{% endblocktrans %}</li>
  101. </ul>
  102. {% if item.mumbleuser and item.mumbleuser.owner %}
  103. <h2>{% trans "User" %} {{ item.mumbleuser.owner.username|capfirst }}</h2>
  104. <ul>
  105. {% if item.mumbleuser.owner.first_name and item.mumbleuser.owner.last_name %}
  106. <li>{% trans "Full Name" %}: {{ item.mumbleuser.owner.first_name }} {{ item.mumbleuser.owner.last_name }}</li>
  107. {% endif %}
  108. <li>{% trans "Admin" %}: {% if item.mumbleuser.owner.is_staff %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</li>
  109. <li>{% trans "Sign-up date" %}: {{ item.mumbleuser.owner.date_joined }}</li>
  110. </ul>
  111. {% endif %}
  112. <h2>{% trans "User Texture" %}</h2>
  113. <img src="/mumble/{{ DBaseObject.id }}/{{ item.mumbleuser.id }}/texture.png" alt="user texture" />
  114. </div>
  115. {% else %}
  116. <div id="mumble_{{ item.id }}" class="mumble-ext x-hide-display">
  117. <h2>{% trans "Channel" %} {{ item.name }}</h2>
  118. {% if CurrentUserIsAdmin or user.is_staff %}
  119. {% trans "Channel ID" %}: {{ item.chanid }}<br />
  120. {% endif %}
  121. <a href="{{ item|chanurl:MumbleAccount }}" class="mumble">{% trans "Connect" %}</a>
  122. {% if item.description %}
  123. <fieldset>
  124. <legend>{% trans "Channel description" %}</legend>
  125. {{ item.description|safe }}
  126. </fieldset>
  127. {% endif %}
  128. </div>
  129. {% endif %}
  130. {% endfor %}
  131. {% endblock %}
  132. {% block HeadTag %}
  133. <script type="text/javascript">
  134. Ext.onReady( function(){
  135. Ext.get( 'mumble_registration' ).addClass( 'x-hide-display' );
  136. {% if Registered %}
  137. Ext.get( 'mumble_texture' ).addClass( 'x-hide-display' );
  138. {% endif %}
  139. {% if CurrentUserIsAdmin %}
  140. Ext.get( 'mumble_admin' ).addClass( 'x-hide-display' );
  141. {% endif %}
  142. {% if CurrentUserIsAdmin %}
  143. userRecord = Ext.data.Record.create([
  144. { name: 'id', type: 'int' },
  145. { name: 'name', type: 'string' },
  146. { name: 'password', type: 'string' },
  147. { name: 'owner', type: 'int' },
  148. { name: 'admin', type: 'bool' },
  149. { name: 'delete', type: 'bool' },
  150. ]);
  151. userAdminStore = new Ext.data.Store({
  152. url: '/mumble/{{ DBaseObject.id }}/users/',
  153. reader: new Ext.data.JsonReader({
  154. root: 'objects',
  155. fields: userRecord,
  156. }),
  157. autoLoad: true,
  158. remoteSort: false,
  159. });
  160. adminColumn = new Ext.grid.CheckColumn({
  161. header: '{% trans "Admin on root channel" %}',
  162. dataIndex: 'admin',
  163. width: 50,
  164. });
  165. deleteColumn = new Ext.grid.CheckColumn({
  166. header: '{% trans "Delete" %}',
  167. dataIndex: 'delete',
  168. width: 50,
  169. });
  170. ownerCombo = new Ext.form.ComboBox({
  171. name: 'owner',
  172. hiddenName: 'owner_id',
  173. forceSelection: true,
  174. triggerAction: 'all',
  175. valueField: 'uid',
  176. displayField: 'uname',
  177. store: new Ext.data.Store({
  178. url: '/mumble/djangousers',
  179. reader: new Ext.data.JsonReader({
  180. fields: [ 'uid', 'uname' ],
  181. root: 'objects',
  182. }),
  183. autoLoad: true,
  184. }),
  185. });
  186. {% endif %}
  187. var cardpanel = new Ext.Panel({
  188. renderTo: 'mumble_ext_container',
  189. layout: 'card',
  190. id: 'mumble_container',
  191. height: 570,
  192. activeItem: 0,
  193. border: false,
  194. items: [ {
  195. id: 'mumble_tabpanel',
  196. xtype: 'tabpanel',
  197. defaults: { autoheight: true },
  198. activeTab: {{ DisplayTab }},
  199. items: [
  200. { contentEl: 'mumble_motd', title: '{% trans "Server Info" %}', autoScroll: true },
  201. { contentEl: 'mumble_registration', title: '{% trans "Registration" %}', autoScroll: true },
  202. {% if CurrentUserIsAdmin %}
  203. { contentEl: 'mumble_admin', title: '{% trans "Administration" %}', autoScroll: true },
  204. {% endif %}
  205. {% if Registered %}
  206. { contentEl: 'mumble_texture',title: '{% trans "User Texture" %}', autoScroll: true },
  207. {% endif %}
  208. {% if CurrentUserIsAdmin %}
  209. {
  210. title: '{% trans "User List" %}',
  211. xtype: 'editorgrid',
  212. store: userAdminStore,
  213. cm: new Ext.grid.ColumnModel( [ {
  214. header: '{% trans "name" %}',
  215. dataIndex: 'name',
  216. sortable: true,
  217. editor: new Ext.form.TextField({
  218. allowBlank: false,
  219. }),
  220. }, {
  221. header: '{% trans "Account owner" %}',
  222. dataIndex: 'owner',
  223. editor: ownerCombo,
  224. sortable: true,
  225. renderer: function( value ){
  226. if( value == '' ) return '';
  227. items = ownerCombo.store.data.items;
  228. for( i = 0; i < items.length; i++ )
  229. if( items[i].data.uid == value )
  230. return items[i].data.uname;
  231. },
  232. }, adminColumn, {
  233. header: '{% trans "Change password" %}',
  234. dataIndex: 'password',
  235. editor: new Ext.form.TextField({
  236. inputType: 'password',
  237. }),
  238. renderer: function( value ){
  239. ret = '';
  240. for( i = 0; i < value.length; i++ )
  241. ret += '*';
  242. return ret;
  243. },
  244. }, deleteColumn ] ),
  245. tbar: [{
  246. text: '{% trans "Add" %}',
  247. handler : function(){
  248. userAdminStore.add( new userRecord( {
  249. id: -1,
  250. name: 'New User',
  251. admin: false,
  252. owner: '',
  253. password: '',
  254. 'delete': false,
  255. } ) );
  256. }
  257. }, {
  258. text: '{% trans "Save" %}',
  259. handler : function(){
  260. data = [];
  261. for( i = 0; i < userAdminStore.data.items.length; i++ ){
  262. rec = userAdminStore.data.items[i];
  263. if( rec.dirty ){
  264. data.push(rec.data);
  265. }
  266. }
  267. var conn = new Ext.data.Connection();
  268. conn.request( {
  269. url: userAdminStore.url,
  270. params: { data: Ext.encode( data ), },
  271. success: function(){
  272. for( i = 0; i < userAdminStore.data.items.length; i++ ){
  273. rec = userAdminStore.data.items[i];
  274. if( rec.data['delete'] == true )
  275. userAdminStore.remove( rec );
  276. else if( rec.dirty ){
  277. rec.commit();
  278. }
  279. }
  280. },
  281. } );
  282. }
  283. }],
  284. plugins: [ adminColumn, deleteColumn ],
  285. },
  286. {% endif %}
  287. ]
  288. },
  289. {% for item in ChannelTable %}
  290. { contentEl: 'mumble_{{ item.id }}', id: 'carditem_{{ item.id }}' },
  291. {% endfor %}
  292. ],
  293. });
  294. Ext.get( 'link_server' ).on( 'click', function( event, target ){
  295. cardpanel.layout.setActiveItem( 'mumble_tabpanel' );
  296. event.preventDefault();
  297. });
  298. {% for item in ChannelTable %}
  299. Ext.get( 'link_{{ item.id }}' ).on( 'click', function( event, target ){
  300. cardpanel.layout.setActiveItem( 'carditem_{{ item.id }}' );
  301. event.preventDefault();
  302. });
  303. {% endfor %}
  304. } );
  305. </script>
  306. <meta http-equiv="refresh" content="300" />
  307. {% endblock %}