Statistics
| Branch: | Tag: | Revision:

root / ui / templates / home.html @ 8550e831

History | View | Annotate | Download (9.3 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
            '501' : '{% trans "There has been an Internal Error. Our administrators have been notified." %}',
47
            // service unavailable
48
            '503' : '{% trans "This service is unavailable right now, please try again later." %}',
49
            // no images unavailable
50
            'NO_IMAGES' : '{% trans "Cannot show the Create machine wizard: No images found." %}',
51
            // no images unavailable
52
            'NO_FLAVORS' : '{% trans "Cannot show the Create machine wizard: No machine configurations found." %}'
53
        };
54
        
55
        var SUCCESS = {
56
            'HEADER' : '{% trans "Success!" %}',
57
            'DEFAULT' : '{% trans "Your request has been succefully executed." %}',
58
            'CREATE_VM_SUCCESS' : '{% trans "Success!" %}',
59
            'CREATE_VM_SUCCESS_ONE' : '{% trans "Your machine is now being built." %}',
60
            'CREATE_VM_SUCCESS_TWO' : '{% trans "Please write down the following password:" %}',
61
            'CREATE_VM_SUCCESS_THREE' : '{% trans "Do not lose this! You will need it to connect to your machine, once it is ready." %}'
62
        };
63
        
64
        // ajax error checking  
65
        function ajax_error(status) {
66
            // prepare the error message
67
            $("#error-success h3").text(ERRORS['HEADER']);
68
            
69
            if (status != undefined && ERRORS[status]) {
70
                $("#error-success p").text(ERRORS[status]);
71
            } else {
72
                $("#error-success p").text(ERRORS['DEFAULT']);   
73
            }
74
            
75
            // bring up error notification
76
            var triggers = $("a#notification").overlay({
77
                // some mask tweaks suitable for modal dialogs
78
                mask: {
79
                    color: '#ebecff',
80
                    opacity: '0.9'
81
                },
82
                top: 'center',
83
                closeOnClick: false,
84
                oneInstance: false,
85
                load: false,
86
                onClose: function(){
87
                    // With partial refresh working properly,
88
                    // it is no longer necessary to refresh the whole page
89
                    // choose_view();
90
                }
91
            });
92
            $("a#notification").data('overlay').load();
93
            return false;
94
        }
95
        
96
        // ajax success checking
97
        function ajax_success(status, password) {
98
            // prepare the error message
99
            // bring up success notification
100
            if (status != undefined && SUCCESS[status]) {
101
                if (password != undefined && status == "CREATE_VM_SUCCESS") {
102
                    $("#error-success h3").text(SUCCESS[status]);
103
                    var CREATE_VM_SUCCESS_MSG = SUCCESS["CREATE_VM_SUCCESS_ONE"] + '<br />'
104
                        + SUCCESS["CREATE_VM_SUCCESS_TWO"] + '<br /><br />' + '<b>' + password + '</b>'
105
                        + '<br /><br />' + SUCCESS["CREATE_VM_SUCCESS_THREE"] ;
106
                    $("#error-success p").html(CREATE_VM_SUCCESS_MSG);             
107
                } else {
108
                    $("#error-success h3").text(SUCCESS['HEADER']);
109
                    $("#error-success p").text(SUCCESS[status]);             
110
                }
111
            } else {
112
                $("#error-success h3").text(SUCCESS['HEADER']);
113
                $("#error-success p").text(SUCCESS['DEFAULT']);             
114

115
            }
116

117

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

206
        // toggle main menu
207
        $("#arrow").click(function(event){
208
                toggleMenu();
209
        });    
210
        
211
    </script>
212
</body>
213
</html>
214