Statistics
| Branch: | Tag: | Revision:

root / ui / templates / home.html @ e2ccad35

History | View | Annotate | Download (9.6 kB)

1
{% load i18n %}
2
<!DOCTYPE html>
3
<head>
4
        <title>{{ project }}</title>
5
        <!-- include the Tools -->
6
    <!-- jquery tools minified for deployment-->
7
    <script src="static/jquery.tools.min.js"></script>
8
    
9
        <!-- jquery tools source for JS debugging -->
10
    <!--
11
    <script src="http://flowplayer.org/tools/download/1.2.5/jquery-1.4.2.js"></script>   
12
        <script src="http://flowplayer.org/tools/download/1.2.5/tabs/tabs.js"></script>
13
        <script src="http://flowplayer.org/tools/download/1.2.5/scrollable/scrollable.js"></script>
14
        <script src="http://flowplayer.org/tools/download/1.2.5/overlay/overlay.js"></script>
15
        <script src="http://flowplayer.org/tools/download/1.2.5/rangeinput/rangeinput.js"></script>
16
        <script src="http://flowplayer.org/tools/download/1.2.5/toolbox/toolbox.expose.js"></script>
17
    -->
18
    
19
    <script src="static/jquery.cookie.js"></script>
20
    <script src="static/jQueryRotate.js"></script>
21
    <script src="static/jquery.dataTables.min.js"></script>
22
    <script src="static/synnefo.js"></script>
23
        <link rel="stylesheet" type="text/css" href="static/main.css"/>        
24
    <script>
25
        // timeout value from settings.py
26
        var TIMEOUT = {{timeout}};
27
        var UPDATE_INTERVAL = {{5000}};
28
        var STATUS_MESSAGES = {
29
            'BUILD'     : '{% trans "Building" %}',
30
            'REBOOT'     : '{% trans "Rebooting" %}',            
31
            'STOPPED'   : '{% trans "Stopped" %}',
32
            'ACTIVE'   : '{% trans "Running" %}',
33
            'ERROR'   : '{% trans "Error" %}'
34
        };
35
        
36
        var ERRORS = {
37
            // error message header
38
            'HEADER' : '{% trans "Error!" %}',
39
            // default
40
            'DEFAULT' : '{% trans "Could not contact the service. Please check your network connectivity and try again." %}',
41
            // bad request
42
            '400' : '{% trans "Malformed request." %}',
43
            // not found
44
            '404' : '{% trans "Your request has failed. Resource not found." %}',
45
            // internal server error
46
            '500' : '{% trans "There has been an Internal Error. Our administrators have been notified." %}',
47
            // service unavailable
48
            '501' : '{% trans "This server has not been implemented yet." %}',
49
            // service unavailable
50
            '503' : '{% trans "This service is unavailable right now, please try again later." %}',
51
            // no images found
52
            'NO_IMAGES' : '{% trans "Cannot show the Create machine wizard: No images found." %}',
53
            // no flavors found
54
            'NO_FLAVORS' : '{% trans "Cannot show the Create machine wizard: No machine configurations found." %}'
55
        };
56
        
57
        var SUCCESS = {
58
            'HEADER' : '{% trans "Success!" %}',
59
            'DEFAULT' : '{% trans "Your request has been succefully executed." %}',
60
            'CREATE_VM_SUCCESS' : '{% trans "Success!" %}',
61
            'CREATE_VM_SUCCESS_ONE' : '{% trans "Your machine is now being built." %}',
62
            'CREATE_VM_SUCCESS_TWO' : '{% trans "Please write down the following password:" %}',
63
            'CREATE_VM_SUCCESS_THREE' : '{% trans "Do not lose this! You will need it to connect to your machine, once it is ready." %}'
64
        };
65
        
66
        // ajax error checking  
67
        function ajax_error(status, serverID) {
68
            // prepare the error message
69
            $("#error-success h3").text(ERRORS['HEADER']);
70
            
71
            if (ERRORS[status] != undefined) {
72
                if (serverID == undefined){
73
                    $("#error-success p").text(ERRORS[status]);
74
                } else {
75
                    var serverName = $("#"+serverID).parent().parent().find("a.name").text();
76
                    $("#error-success p").html("<b>" + serverName + "</b>" + ": " + ERRORS[status]);
77
                }
78
            } else {
79
                $("#error-success p").text(ERRORS['DEFAULT']);   
80
            }
81
            
82
            // bring up error notification
83
            var triggers = $("a#notification").overlay({
84
                // some mask tweaks suitable for modal dialogs
85
                mask: {
86
                    color: '#ebecff',
87
                    opacity: '0.9'
88
                },
89
                top: 'center',
90
                closeOnClick: false,
91
                oneInstance: false,
92
                load: false,
93
                onClose: function(){
94
                    // With partial refresh working properly,
95
                    // it is no longer necessary to refresh the whole page
96
                    // choose_view();
97
                }
98
            });
99
            $("a#notification").data('overlay').load();
100
            return false;
101
        }
102
        
103
        // ajax success checking
104
        function ajax_success(status, password) {
105
            // prepare the error message
106
            // bring up success notification
107
            if (status != undefined && SUCCESS[status]) {
108
                if (password != undefined && status == "CREATE_VM_SUCCESS") {
109
                    $("#error-success h3").text(SUCCESS[status]);
110
                    var CREATE_VM_SUCCESS_MSG = SUCCESS["CREATE_VM_SUCCESS_ONE"] + '<br />'
111
                        + SUCCESS["CREATE_VM_SUCCESS_TWO"] + '<br /><br />' + '<b>' + password + '</b>'
112
                        + '<br /><br />' + SUCCESS["CREATE_VM_SUCCESS_THREE"] ;
113
                    $("#error-success p").html(CREATE_VM_SUCCESS_MSG);             
114
                } else {
115
                    $("#error-success h3").text(SUCCESS['HEADER']);
116
                    $("#error-success p").text(SUCCESS[status]);             
117
                }
118
            } else {
119
                $("#error-success h3").text(SUCCESS['HEADER']);
120
                $("#error-success p").text(SUCCESS['DEFAULT']);             
121

122
            }
123

124

125
            var triggers = $("a#notification").overlay({
126
                // some mask tweaks suitable for modal dialogs
127
                mask: {
128
                    color: '#ebecff',
129
                    opacity: '0.9'
130
                },
131
                top: 'center',
132
                closeOnClick: false,
133
                oneInstance: false,
134
                load: false,
135
                onClose: function(){
136
                    // With partial refresh working properly,
137
                    // it is no longer necessary to refresh the whole page
138
                    // choose_view();
139
                }
140
            });
141
            $("a#notification").data('overlay').load();
142
            return false;
143
        }
144
    </script>
145
</head>
146
<body>
147
    <div id="wrapper">
148
        <div id='user'>
149
            <a href="#">{% trans "username" %}</a> &nbsp;|&nbsp; <a href="#">{% trans "settings" %}</a>
150
            {% get_available_languages as LANGUAGES %}
151
            {% for lang in LANGUAGES %}
152
                &nbsp;|&nbsp;
153
                <a {% if  == lang.0 %}class="current_lang" {% else %}  href="/lang/?l={{lang.0}}" {% endif %}>{{lang.0}}</a> 
154
            {% endfor %}
155
        </div>
156
        <div id='header'>
157
            <a href="/" class="logo">
158
                <img src="static/nefo.png" alt="+nefo"/>
159
            </a>
160
            <div class='fatborder'></div>
161
        </div>
162
        <!-- tabs -->
163
        <ul class="css-tabs">
164
                <li><a href="machines" title="{% trans "manage  virtual " %}" class="primary" id="machines">
165
                {% trans "machines" %}</a></li>
166
                <li><a href="disks" title="{% trans "manage  storage " %}" class="primary" id="disks">
167
                {% trans "disks" %}</a></li>
168
                <li><a href="images" title="{% trans "manage  images" %}" class="primary" id="images">
169
                {% trans "images" %}</a></li>
170
                <li><a href="networks" title="{% trans "configure " %}" class="primary" id="networks">
171
                {% trans "networks" %}</a></li>
172
            <li><a href="files" title="{% trans "your " %}" class="secondary" id="files">
173
                {% trans "files" %}</a></li>
174
                <li><a href="desktops" title="{% trans "your " %}" class="secondary" id="desktops">
175
                {% trans "desktops" %}</a></li>
176
                <li><a href="apps" title="{% trans "your " %}" class="secondary" id="apps">
177
                {% trans "apps" %}</a></li>
178
        </ul>
179
        <div class="more-tabs"><img src="static/arrow.png" id="arrow"></img></div>
180
        <div class="css-panes">
181
                <div id="machines-pane" class="pane" style="display:block">{% include "machines.html" %}</div>
182
                <div id="disks-pane" class="pane"></div>
183
                <div id="images-pane" class="pane"></div>
184
                <div id="networks-pane" class="pane"></div>
185
            <div id="files-pane" class="pane"></div>
186
                <div id="desktops-pane" class="pane"></div>
187
                <div id="apps-pane" class="pane"></div>
188
        </div>
189
    </div>
190
    <!-- activate tabs with JavaScript -->
191
    <script>
192
                $(function() {
193
                    $('ul.css-tabs li').hover(function(){
194
                            $(this).find('a:not(.current)').animate({top:'0px'},{queue:false,duration:150});
195
            }, function(){
196
                $('ul.css-tabs li a:not(.current)').animate({top:'9px'},{queue:false,duration:150});
197
                    });
198
                });
199
                
200
        $(function() {
201
                $("ul.css-tabs").tabs("div.css-panes div.pane", {        
202
                        onBeforeClick: function(event, i) {
203
                    $('ul.css-tabs li a').animate({top:'9px'},{queue:false,duration:150});
204
                                // get the pane to be opened
205
                                var pane = this.getPanes().eq(i);
206
                    pane.text('');
207
                                // load it with a page specified in the tab's href attribute
208
                                pane.load(this.getTabs().eq(i).attr("href"),function(){if (!i) {choose_view()}});
209
                        }
210
                });
211
        });
212

213
        // toggle main menu
214
        $("#arrow").click(function(event){
215
                toggleMenu();
216
        });    
217
        
218
    </script>
219
</body>
220
</html>
221