Statistics
| Branch: | Tag: | Revision:

root / ui / templates / home.html @ eae0a59a

History | View | Annotate | Download (6.9 kB)

1
{% load i18n %}
2
<!DOCTYPE html>
3
<head>
4
        <title>{{ project }}</title>
5
        <!-- include the Tools -->
6
        <script src="static/jquery.tools.min.js"></script>
7
    <script src="static/jquery.cookie.js"></script>
8
    <script src="static/jQueryRotate.js"></script>
9
    <script src="static/jquery.dataTables.min.js"></script>
10
    <script>
11
        // timeout value from settings.py
12
        var TIMEOUT = {{timeout}};
13
        var UPDATE_INTERVAL = {{60000}};
14
        var STATUS_MESSAGES = {
15
            'BUILD'     : '{% trans "Building" %}',
16
            'REBOOT'     : '{% trans "Rebooting" %}',            
17
            'STOPPED'   : '{% trans "Stopped" %}',
18
            'ACTIVE'   : '{% trans "Running" %}',
19
            'ERROR'   : '{% trans "Error" %}'
20
        };
21
        
22
        var ERRORS = {
23
            // error message header
24
            'header' : '{% trans "Error!" %}',
25
            // default
26
            'default' : '{% trans "An error has happened. Our administrators have been notified." %}',
27
            // bad request
28
            '400' : '{% trans "Malformed request." %}',
29
            // not found
30
            '404' : '{% trans "Your request has failed. Resource not found." %}',
31
            // internal server error
32
            '501' : '{% trans "There has been an Internal Error. Our administrators have been notified." %}',
33
            // service unavailable
34
            '503' : '{% trans "This service is unavailable right now, please try again later." %}'
35
        };
36
        
37
        var SUCCESS = {
38
            'header' : '{% trans "Success!" %}',
39
            'default' : '{% trans "Your request has been succefully executed." %}',
40
        };
41
        
42
        // ajax error checking  
43
        function ajax_error(jqXHR) {
44
            // prepare the error message
45
            $("#error-success h3").text(ERRORS['header']);
46
            
47
            if (ERRORS[jqXHR.status]) {
48
                $("#error-success p").text(ERRORS[jqXHR.status]);
49
            } else {
50
                $("#error-success p").text(ERRORS['default']);   
51
            }
52
            
53
            // bring up error notification
54
            var triggers = $("a#notification").overlay({
55
                // some mask tweaks suitable for modal dialogs
56
                mask: {
57
                    color: '#ebecff',
58
                    opacity: '0.9'
59
                },
60
                top: 'center',
61
                closeOnClick: false,
62
                oneInstance: false,
63
                load: false,
64
                onClose: function(){
65
                    choose_view();
66
                }
67
            });
68
            $("a#notification").data('overlay').load();
69
            return false;
70
        }
71
        
72
        // ajax success checking
73
        function ajax_success() {          
74
            // prepare the error message
75
            $("#error-success h3").text(SUCCESS['header']);
76
            $("#error-success p").text(SUCCESS['default']);             
77
            // bring up success notification
78
            var triggers = $("a#notification").overlay({
79
                // some mask tweaks suitable for modal dialogs
80
                mask: {
81
                    color: '#ebecff',
82
                    opacity: '0.9'
83
                },
84
                top: 'center',
85
                closeOnClick: false,
86
                oneInstance: false,
87
                load: false,
88
                onClose: function(){
89
                    choose_view();
90
                }
91
            });
92
            $("a#notification").data('overlay').load();
93
            return false;
94
        }
95
    
96
    </script>
97
    <script src="static/synnefo.js"></script>
98

    
99
        <link rel="stylesheet" type="text/css" href="static/main.css"/>        
100

    
101
</head>
102
<body>
103
    <div id="wrapper">
104
        <div id='user'>
105
            <a href="#">{% trans "username" %}</a> &nbsp;|&nbsp; <a href="#">{% trans "settings" %}</a>
106
            {% get_available_languages as LANGUAGES %}
107
            {% for lang in LANGUAGES %}
108
                &nbsp;|&nbsp;
109
                <a {% if  == lang.0 %}class="current_lang" {% else %}  href="/lang/?l={{lang.0}}" {% endif %}>{{lang.0}}</a> 
110
            {% endfor %}
111
        </div>
112
        <div id='header'>
113
            <a href="/" class="logo">
114
                <img src="static/nefo.png" alt="+nefo"/>
115
            </a>
116
            <div class='fatborder'></div>
117
        </div>
118
        <!-- tabs -->
119
        <ul class="css-tabs">
120
                <li><a href="machines" title="{% trans "manage  virtual " %}" class="primary" id="machines">
121
                {% trans "machines" %}</a></li>
122
                <li><a href="disks" title="{% trans "manage  storage " %}" class="primary" id="disks">
123
                {% trans "disks" %}</a></li>
124
                <li><a href="images" title="{% trans "manage  images" %}" class="primary" id="images">
125
                {% trans "images" %}</a></li>
126
                <li><a href="networks" title="{% trans "configure " %}" class="primary" id="networks">
127
                {% trans "networks" %}</a></li>
128
            <li><a href="files" title="{% trans "your " %}" class="secondary" id="files">
129
                {% trans "files" %}</a></li>
130
                <li><a href="desktops" title="{% trans "your " %}" class="secondary" id="desktops">
131
                {% trans "desktops" %}</a></li>
132
                <li><a href="apps" title="{% trans "your " %}" class="secondary" id="apps">
133
                {% trans "apps" %}</a></li>
134
        </ul>
135
        <div class="more-tabs"><img src="static/arrow.png" id="arrow"></img></div>
136
        <div class="css-panes">
137
                <div id="machines-pane" class="pane" style="display:block">{% include "machines.html" %}</div>
138
                <div id="disks-pane" class="pane"></div>
139
                <div id="images-pane" class="pane"></div>
140
                <div id="networks-pane" class="pane"></div>
141
            <div id="files-pane" class="pane"></div>
142
                <div id="desktops-pane" class="pane"></div>
143
                <div id="apps-pane" class="pane"></div>
144
        </div>
145
    </div>
146
    <!-- activate tabs with JavaScript -->
147
    <script>
148
                $(function() {
149
                    $('ul.css-tabs li').hover(function(){
150
                            $(this).find('a:not(.current)').animate({top:'0px'},{queue:false,duration:150});
151
            }, function(){
152
                $('ul.css-tabs li a:not(.current)').animate({top:'9px'},{queue:false,duration:150});
153
                    });
154
                });
155
                
156
        $(function() {
157
                $("ul.css-tabs").tabs("div.css-panes div.pane", {        
158
                        onBeforeClick: function(event, i) {
159
                    $('ul.css-tabs li a').animate({top:'9px'},{queue:false,duration:150});
160
                                // get the pane to be opened
161
                                var pane = this.getPanes().eq(i);
162
                    pane.text('');
163
                                // load it with a page specified in the tab's href attribute
164
                                pane.load(this.getTabs().eq(i).attr("href"),function(){if (!i) {choose_view()}});
165
                        }
166
                });
167
        });
168

169
        // toggle main menu
170
        $("#arrow").click(function(event){
171
                toggleMenu();
172
        });    
173
        
174
    </script>
175
    
176
</body>
177
</html>
178