Cleanup of Gilbert plugins API and JavaScript.
[philo.git] / contrib / gilbert / templates / gilbert / index.html
index a4d9290..23a7e87 100644 (file)
@@ -1 +1,86 @@
-{% extends 'gilbert/base.html' %}
\ No newline at end of file
+{% load staticmedia %}<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>{% block head %}
+       <title>{% block title %}{{ gilbert.title }}{% endblock %}</title>
+       
+       {% block css %}
+       <link rel="stylesheet" type="text/css" href="{% mediaurl 'gilbert/extjs/resources/css/ext-all.css' %}" />
+       <link rel="stylesheet" type="text/css" href="{% mediaurl 'gilbert/extjs/resources/css/xtheme-gray.css' %}" />
+       <link rel="stylesheet" type="text/css" href="{% url gilbert:css %}" />
+       {% for plugin in gilbert.plugin_registry.values %}{% for css in plugin.css %}
+       <link rel="stylesheet" type="text/css" href="{{ css }}" />
+       {% endfor %}{% endfor %}
+       {% endblock %}
+       
+       {% block js %}
+       <script type="text/javascript" src="{% mediaurl 'gilbert/extjs/adapter/ext/ext-base.js' %}"></script>
+       <script type="text/javascript" src="{% mediaurl 'gilbert/extjs/ext-all.js' %}"></script>
+       <script type="text/javascript">
+               Ext.BLANK_IMAGE_URL = '{% mediaurl "gilbert/extjs/resources/images/default/s.gif" %}';
+       </script>
+       <script type="text/javascript" src="{% mediaurl 'gilbert/Gilbert.lib.js' %}"></script>
+       <script type="text/javascript" src="{% url gilbert:api %}"></script>
+       <script type="text/javascript">
+               GILBERT_LOGGED_IN = {% if logged_in %}true{% else %}false{% endif %};
+               GILBERT_PLUGINS = [];
+       </script>
+       {% for plugin in gilbert.plugin_registry.values %}{% for js in plugin.js %}
+       <script type="text/javascript" src="{{ js }}"></script>
+       {% endfor %}{% endfor %}
+       <script type="text/javascript">
+               Ext.onReady(function() {
+                       GILBERT_APPLICATION = new Gilbert.lib.Application({
+                               user: '{% filter force_escape %}{% firstof user.get_full_name user.username %}{% endfilter %}',
+                               plugins: [new (function() {
+                                       return {
+                                               init: function(application) {
+                                                       var plugin = this;
+                                                       application.mainmenu.insert(0, {
+                                                               xtype: 'button',
+                                                               text: '<span style="font-weight: bolder; text-transform: uppercase;">Gilbert</span>',
+                                                               handler: function(button, event) {
+                                                                       plugin.showAbout(button);
+                                                               },
+                                                       });
+                                                       application.mainmenu.insert(1, {
+                                                               xtype: 'tbseparator',
+                                                       });
+                                               },
+                                               showAbout: function(sender) {
+                                                       if (!this.about_window) {
+                                                               var about_window = this.about_window = new Ext.Window({
+                                                                       height: 176,
+                                                                       width: 284,
+                                                                       header: false,
+                                                                       html: '<h1>{{ gilbert.title }}</h1><h2>Version {{ gilbert.version }}</h2>',
+                                                                       bodyStyle: 'background: none; font-size: larger; line-height: 1.4em; text-align: center;',
+                                                                       modal: true,
+                                                                       closeAction: 'hide',
+                                                                       renderTo: Ext.getBody(),
+                                                                       closable: false,
+                                                                       resizable: false,
+                                                                       draggable: false,
+                                                                       fbar: [{
+                                                                               text: 'OK',
+                                                                               handler: function(button, event) {
+                                                                                       about_window.hide();
+                                                                               }
+                                                                       }],
+                                                                       defaultButton: 0,
+                                                               });
+                                                       }
+                                                       this.about_window.render(Ext.getBody());
+                                                       this.about_window.center();
+                                                       this.about_window.show();
+                                               },
+                                       }
+                               })()].concat(GILBERT_PLUGINS),
+                       });
+               });
+       </script>
+       {% endblock %}
+       
+{% endblock %}</head>
+<body style="background-image: url({% mediaurl 'gilbert/wallpaper.jpg' %});">{% block body %}{% endblock %}</body>
+</html>