Statistics
| Branch: | Tag: | Revision:

root / ui / static / synnefo.js @ 5186eb04

History | View | Annotate | Download (21.2 kB)

1
var flavors = [], images = [], servers = [], disks = [], cpus = [], ram = [];
2
var changes_since = 0, deferred = 0, update_request = false, load_request = false, pending_actions = [];
3
var API_URL = "/api/v1.1";
4

    
5
function ISODateString(d){
6
    //return a date in an ISO 8601 format using UTC. 
7
    //do not include time zone info (Z) at the end
8
    //taken from the Mozilla Developer Center 
9
    function pad(n){ return n<10 ? '0'+n : n }
10
    return  d.getUTCFullYear()+ '-' +
11
                        pad(d.getUTCMonth()+1) + '-' +
12
                        pad(d.getUTCDate()) + 'T' +
13
                        pad(d.getUTCHours()) + ':' +
14
                        pad(d.getUTCMinutes()) + ':' +
15
                        pad(d.getUTCSeconds()) +'Z'
16
}
17

    
18
function parse_error(responseText){
19
        var errors = [];
20
        if (responseText.length == 0){
21
                errors[0] = {'code': 503};
22
        } else {
23
                responseObj = JSON.parse(responseText);
24
                //console.info(inp);
25
                for (var err in responseObj){
26
                        errors[errors.length] = responseObj[err];
27
                }
28
        }
29
        return errors;
30
}
31

    
32
// indexOf prototype for IE
33
if (!Array.prototype.indexOf) {
34
  Array.prototype.indexOf = function(elt /*, from*/) {
35
    var len = this.length;
36
    var from = Number(arguments[1]) || 0;
37
    from = (from < 0)
38
         ? Math.ceil(from)
39
         : Math.floor(from);
40
    if (from < 0)
41
      from += len;
42

    
43
    for (; from < len; from++) {
44
      if (from in this &&
45
          this[from] === elt)
46
        return from;
47
    }
48
    return -1;
49
  };
50
}
51

    
52

    
53
function update_confirmations(){
54
    // hide all confirm boxes to begin with
55
    $('div.confirm_single').hide();
56
    $('div.confirm_multiple').hide();
57
   
58
        // standard view only
59
        if ($.cookie("list") != '1') { 
60
                for (i=0;i<pending_actions.length;i++){
61
            // show single confirms
62
                        $("div.machine#"+pending_actions[i][1]+' .confirm_single').show();        
63
                }                
64
        }
65

    
66
        // if more than one pending action show multiple confirm box
67
        if (pending_actions.length>1 || $.cookie("list") == '1' && pending_actions.length == 1){ 
68
                $('div.confirm_multiple span.actionLen').text(pending_actions.length);
69
                $('div.confirm_multiple').show();
70
        }
71
}
72

    
73
function list_view() {
74
        changes_since = 0; // to reload full list
75
        pending_actions = []; // clear pending actions
76
        update_confirmations();
77
        clearTimeout(deferred);        // clear old deferred calls
78
        try {
79
                update_request.abort(); // cancel pending ajax updates
80
                load_request.abort();
81
        }catch(err){}
82
    $.cookie("list", '1'); // set list cookie
83
        
84
        uri = $("#list").attr("href");
85
    load_request = $.ajax({
86
        url: uri,
87
        type: "GET",
88
        timeout: TIMEOUT,
89
        dataType: "html",
90
        error: function(jqXHR, textStatus, errorThrown) {                                                
91
                        return false;
92
                },
93
        success: function(data, textStatus, jqXHR) {
94
                        $("a#list")[0].className += ' activelink';
95
                        $("a#standard")[0].className = '';
96
                        $("div#machinesview").html(data);
97
                }
98
        });
99
    
100
    return false;
101
}
102

    
103
function standard_view() {
104
        changes_since = 0; // to reload full list
105
        pending_actions = []; // clear pending actions
106
        update_confirmations();
107
        clearTimeout(deferred);        // clear old deferred calls
108
        try {
109
                update_request.abort() // cancel pending ajax updates
110
                load_request.abort();
111
        }catch(err){}        
112
    $.cookie("list", '0');
113
        
114
    uri = $("a#standard").attr("href");
115
    load_request = $.ajax({
116
        url: uri,
117
        type: "GET",
118
        timeout: TIMEOUT,
119
        dataType: "html",
120
        error: function(jqXHR, textStatus, errorThrown) {                                                
121
                        return false;
122
                },
123
        success: function(data, textStatus, jqXHR) {
124
                        $("a#standard")[0].className += ' activelink';
125
                        $("a#list")[0].className = '';
126
                        $("div#machinesview").html(data);
127
                }
128
        });        
129

    
130
    return false;
131
}
132

    
133
function choose_view() {
134
    if ($.cookie("list")=='1') {
135
        list_view();
136
    } else {
137
        standard_view();
138
    }
139
}
140

    
141
function toggleMenu() {
142
    var primary = $("ul.css-tabs li a.primary");
143
    var secondary = $("ul.css-tabs li a.secondary");
144
    var all = $("ul.css-tabs li a");                        
145
    var toggled = $('ul.css-tabs li a.current').hasClass('secondary');
146
    
147
    // if anything is still moving, do nothing
148
    if ($(":animated").length) {
149
        return;
150
    } 
151
    
152
    // nothing is current to begin with
153
    $('ul.css-tabs li a.current').removeClass('current');
154
    
155
    // move stuff around
156
    all.animate({top:'30px'}, {complete: function() { 
157
        $(this).hide();
158
        if (toggled) {
159
            primary.show();
160
            primary.animate({top:'9px'}, {complete: function() {
161
                $('ul.css-tabs li a.primary#machines').addClass('current');
162
                $('a#machines').click();                                   
163
            }});
164
        } else {
165
            secondary.show();
166
            secondary.animate({top:'9px'}, {complete: function() {
167
                $('ul.css-tabs li a.secondary#files').addClass('current');
168
                $('a#files').click();                                                                           
169
            }});
170
        }                                              
171
    }});
172
    
173
    // rotate arrow icon
174
    if (toggled) {
175
        $("#arrow").rotate({animateAngle: (0), bind:[{"click":function(){toggleMenu()}}]});
176
        $("#arrow").rotateAnimation(0);                    
177
    } else {
178
        $("#arrow").rotate({animateAngle: (-180), bind:[{"click":function(){toggleMenu()}}]});
179
        $("#arrow").rotateAnimation(-180);
180
    }            
181
}
182

    
183
// confirmation overlay generation
184
function confirm_action(action_string, action_function, serverIDs, serverNames) {
185
    if (serverIDs.length == 1){
186
        $("#yes-no h3").text('You are about to ' + action_string + ' vm ' + serverNames[0]);
187
    } else if (serverIDs.length > 1){
188
        $("#yes-no h3").text('You are about to ' + action_string + ' ' + serverIDs.length + ' machines');
189
    } else {
190
        return false;
191
    }
192
    // action confirmation overlay
193
    var triggers = $("a#confirmation").overlay({
194
            // some mask tweaks suitable for modal dialogs
195
            mask: {
196
                    color: '#ebecff',
197
                    opacity: '0.9'
198
            },
199
        top: 'center',
200
        load: false
201
    });
202
    // yes or no?
203
    var buttons = $("#yes-no button").click(function(e) {
204
            // get user input
205
            var yes = buttons.index(this) === 0;
206
        //close the confirmation window
207
        $("a#confirmation").overlay().close(); 
208
        // return true=yes or false=no
209
        if (yes) {
210
            action_function(serverIDs);
211
        }
212
    });
213
    $("a#confirmation").data('overlay').load();
214
    return false;
215
}
216

    
217
// get and show a list of running and terminated machines
218
function update_vms(interval) {
219
    try{ console.info('updating machines'); } catch(err){}
220
        var uri= API_URL + '/servers/detail';
221

    
222
        if (changes_since != 0)
223
                uri+='?changes-since='+changes_since
224
                
225
    update_request = $.ajax({
226
        url: uri,
227
        type: "GET",
228
        timeout: TIMEOUT,
229
        dataType: "json",
230
        error: function(jqXHR, textStatus, errorThrown) {
231
                        // don't forget to try again later
232
                        if (interval) {
233
                                clearTimeout(deferred);        // clear old deferred calls
234
                                deferred = setTimeout(update_vms,interval,interval);
235
                        }
236
                        // as for now, just show an error message
237
                        try { console.info('update_vms errback:' + jqXHR.status ) } catch(err) {}
238
                        ajax_error(jqXHR.status, undefined, 'Update VMs', jqXHR.responseText);                                                
239
                        return false;
240
                        },
241
        success: function(data, textStatus, jqXHR) {
242
                        // create changes_since string if necessary
243
                        if (jqXHR.getResponseHeader('Date') != null){
244
                                changes_since_date = new Date(jqXHR.getResponseHeader('Date'));
245
                                changes_since = ISODateString(changes_since_date);
246
                        }
247
                        
248
                        if (interval) {
249
                                clearTimeout(deferred);        // clear old deferred calls
250
                                deferred = setTimeout(update_vms,interval,interval);
251
                        }
252
                        
253
                        if (jqXHR.status == 200 || jqXHR.status == 203) {
254
                                try {
255
                                        servers = data.servers.values;
256
                                } catch(err) { ajax_error('400', undefined, 'Update VMs', jqXHR.responseText);}
257
                                update_machines_view(data);
258
                        } else if (jqXHR.status != 304){
259
                                try { console.info('update_vms callback:' + jqXHR.status ) } catch(err) {}
260
                                //ajax_error(jqXHR.status, undefined, 'Update VMs', jqXHR.responseText);                                        
261
                        }
262
                        return false;
263
        }
264
    });
265
    return false;
266
}
267

    
268
// get and show a list of available standard and custom images
269
function update_images() { 
270
    $.ajax({
271
        url: API_URL + '/images/detail',
272
        type: "GET",
273
        //async: false,
274
        dataType: "json",
275
        timeout: TIMEOUT,
276
        error: function(jqXHR, textStatus, errorThrown) { 
277
                    ajax_error(jqXHR.status, undefined, 'Update Images', jqXHR.responseText);
278
                    },
279
        success: function(data, textStatus, jqXHR) {
280
            try {
281
                                images = data.images.values;
282
                                update_wizard_images();
283
                        } catch(err){
284
                                ajax_error("NO_IMAGES");
285
                        }
286
        }
287
    });
288
    return false;
289
}
290

    
291
function update_wizard_images() {
292
        if ($("ul#standard-images li").toArray().length + $("ul#custom-images li").toArray().length == 0) {
293
                $.each(images, function(i,image){
294
                        var img = $('#image-template').clone().attr("id","img-"+image.id).fadeIn("slow");
295
                        img.find("label").attr('for',"img-radio-" + image.id);
296
                        img.find(".image-title").text(image.name);
297
            if (image.metadata) {
298
                if (image.metadata.values.description != undefined) {
299
                    img.find(".description").text(image.metadata.values.description);
300
                }
301
                if (image.metadata.values.size != undefined) {
302
                                img.find("#size").text(image.metadata.values.size);
303
                }
304
            }
305
                        img.find("input.radio").attr('id',"img-radio-" + image.id);
306
                        if (i==0) img.find("input.radio").attr("checked","checked"); 
307
            var image_logo = os_icon(image.metadata);
308
                        img.find("img.image-logo").attr('src','static/os_logos/'+image_logo+'.png');
309
            if (image.metadata) {
310
                if (image.metadata.values.serverId != undefined) {
311
                    img.appendTo("ul#custom-images");
312
                } else {
313
                    img.appendTo("ul#standard-images");
314
                }
315
            } else {
316
                img.appendTo("ul#standard-images");
317
            }
318
                });
319
        }        
320
}
321

    
322
function update_wizard_flavors(){
323
        // sliders for selecting VM flavor
324
        $("#cpu:range").rangeinput({min:0,
325
                                                           value:0,
326
                                                           step:1,
327
                                                           progress: true,
328
                                                           max:cpus.length-1});
329
        
330
        $("#storage:range").rangeinput({min:0,
331
                                                           value:0,
332
                                                           step:1,
333
                                                           progress: true,
334
                                                           max:disks.length-1});
335

    
336
        $("#ram:range").rangeinput({min:0,
337
                                                           value:0,
338
                                                           step:1,
339
                                                           progress: true,
340
                                                           max:ram.length-1});
341
        $("#small").click();
342

    
343
        // update the indicators when sliding
344
        $("#cpu:range").data().rangeinput.onSlide(function(event,value){
345
                $("#cpu-indicator")[0].value = cpus[Number(value)];
346
        $("#cpu-indicator").addClass('selectedrange');
347
        });
348
        $("#cpu:range").data().rangeinput.change(function(event,value){
349
                $("#cpu-indicator")[0].value = cpus[Number(value)];                                
350
                $("#custom").click();
351
        $("#custom input").attr('checked', 'checked');                
352
        $("#cpu-indicator").removeClass('selectedrange');                
353
        });                        
354
        $("#ram:range").data().rangeinput.onSlide(function(event,value){
355
                $("#ram-indicator")[0].value = ram[Number(value)];
356
        $("#ram-indicator").addClass('selectedrange');
357
        });
358
        $("#ram:range").data().rangeinput.change(function(event,value){
359
                $("#ram-indicator")[0].value = ram[Number(value)];                                
360
                $("#custom").click();
361
        $("#custom input").attr('checked', 'checked');
362
        $("#ram-indicator").removeClass('selectedrange');                
363
        });                        
364
        $("#storage:range").data().rangeinput.onSlide(function(event,value){
365
                $("#storage-indicator")[0].value = disks[Number(value)];
366
        $("#storage-indicator").addClass('selectedrange');
367
        });
368
        $("#storage:range").data().rangeinput.change(function(event,value){
369
                $("#storage-indicator")[0].value = disks[Number(value)];                                
370
                $("#custom").click();
371
        $("#custom input").attr('checked', 'checked');
372
        $("#storage-indicator").removeClass('selectedrange');                
373
        });                                
374
}
375

    
376
Array.prototype.unique = function () {
377
        var r = new Array();
378
        o:for(var i = 0, n = this.length; i < n; i++)
379
        {
380
                for(var x = 0, y = r.length; x < y; x++)
381
                {
382
                        if(r[x]==this[i])
383
                        {
384
                                continue o;
385
                        }
386
                }
387
                r[r.length] = this[i];
388
        }
389
        return r;
390
}
391

    
392
// get and configure flavor selection
393
function update_flavors() { 
394
    $.ajax({
395
        url: API_URL + '/flavors/detail',
396
        type: "GET",
397
        //async: false,
398
        dataType: "json",
399
        timeout: TIMEOUT,
400
        error: function(jqXHR, textStatus, errorThrown) { 
401
            try {
402
                                ajax_error(jqXHR.status, undefined, 'Update Flavors', jqXHR.responseText);
403
                        } catch (err) {
404
                                ajax_error(err);
405
                        }
406
        },
407
        success: function(data, textStatus, jqXHR) {
408
            flavors = data.flavors.values;
409
            $.each(flavors, function(i, flavor) {
410
                cpus[i] = flavor['cpu'];
411
                disks[i] = flavor['disk'];
412
                ram[i] = flavor['ram'];
413
            });
414
            cpus = cpus.unique();
415
            disks = disks.unique();
416
            ram = ram.unique();
417
                        update_wizard_flavors();
418
        }
419
    });
420
    return false;
421
}
422

    
423
// return flavorRef from cpu, disk, ram values
424
function identify_flavor(cpu, disk, ram){
425
    for (i=0;i<flavors.length;i++){
426
        if (flavors[i]['cpu'] == cpu && flavors[i]['disk']==disk && flavors[i]['ram']==ram) {
427
            return flavors[i]['id']
428
        }
429
    }
430
    return 0;
431
}
432

    
433
// return image entry from imageRef
434
function get_image(imageRef) {
435
    for (i=0;i<images.length;i++){
436
        if (images[i]['id'] == imageRef) {
437
            return images[i];
438
        }
439
    }
440
    return 0;
441
}
442

    
443
// update the actions in list view
444
function updateActions() {
445
        var states = [];
446
        var on = [];
447
        var checked = $("table.list-machines tbody input[type='checkbox']:checked");
448
        // disable all actions to begin with
449
        for (action in actions) {
450
                $("#action-" + action).removeClass('enabled');
451
        }
452

    
453
        // are there multiple machines selected?
454
        if (checked.length>1)
455
                states[0] = 'multiple';
456
        
457
        // check the states of selected machines
458
        checked.each(function(i,checkbox) {
459
                states[states.length] = checkbox.className;
460
                var ip = $("#" + checkbox.id.replace('input-','') + ".ip span.public").text();
461
                if (ip.replace('undefined','').length)
462
                        states[states.length] = 'network';
463
        });
464

    
465
        // decide which actions should be enabled
466
        for (a in actions) {
467
                var enabled = false;
468
                for (var s =0; s<states.length; s++) {
469
                        if (actions[a].indexOf(states[s]) != -1 ) {
470
                                enabled = true;
471
                        } else {
472
                                enabled = false;
473
                                break;
474
                        }
475
                }
476
                if (enabled)
477
                        on[on.length]=a;
478
        }
479
        // enable those actions
480
        for (action in on) {
481
                $("#action-" + on[action]).addClass('enabled');
482
        }
483
}
484

    
485
//create server action
486
function create_vm(machineName, imageRef, flavorRef){
487

    
488
    var image_logo = os_icon(get_image(imageRef).metadata);
489

    
490
    var payload = {
491
        "server": {
492
            "name": machineName,
493
            "imageRef": imageRef,
494
            "flavorRef" : flavorRef,
495
            "metadata" : {
496
                "OS" : image_logo
497
            }
498
        }
499
    };
500
        var uri = API_URL + '/servers';
501

    
502
    $.ajax({
503
    url: uri,
504
    type: "POST",
505
        contentType: "application/json",
506
    dataType: "json",    
507
    data: JSON.stringify(payload),
508
    timeout: TIMEOUT,
509
    error: function(jqXHR, textStatus, errorThrown) { 
510
                ajax_error(jqXHR.status, undefined, 'Create VM', jqXHR.responseText);
511
           },
512
    success: function(data, textStatus, jqXHR) {
513
                if ( jqXHR.status == '202') {
514
                    ajax_success("CREATE_VM_SUCCESS", data.server.adminPass);                   
515
                } else {
516
                    ajax_error(jqXHR.status, undefined, 'Create VM', jqXHR.responseText);
517
                }
518
            }
519
    });
520
}
521

    
522
// reboot action
523
function reboot(serverIDs){
524
        if (!serverIDs.length){
525
                //ajax_success('DEFAULT');
526
                return false;
527
        }        
528
    // ajax post reboot call
529
    var payload = {
530
        "reboot": {"type" : "HARD"}
531
    };
532
    var serverID = serverIDs.pop();
533
        
534
        $.ajax({
535
                url: API_URL + '/servers/' + serverID + '/action',
536
                type: "POST",
537
                contentType: "application/json",
538
                dataType: "json",
539
                data: JSON.stringify(payload),
540
                timeout: TIMEOUT,
541
                error: function(jqXHR, textStatus, errorThrown) {
542
                    display_failure(jqXHR.status, serverID, 'Reboot', jqXHR.responseText)
543
                                },
544
                success: function(data, textStatus, jqXHR) {
545
                                        if ( jqXHR.status == '202') {
546
                        try {
547
                            console.info('rebooted ' + serverID);
548
                        } catch(err) {}
549
                                                // indicate that the action succeeded
550
                                                display_success(serverID);
551
                                                // continue with the rest of the servers
552
                                                reboot(serverIDs);
553
                                        } else {
554
                                                ajax_error(jqXHR.status, serverID, 'Reboot', jqXHR.responseText);
555
                                        }
556
                                }
557
    });
558

    
559
    return false;
560
}
561

    
562
// shutdown action
563
function shutdown(serverIDs) {
564
        if (!serverIDs.length){
565
                //ajax_success('DEFAULT');
566
                return false;
567
        }
568
    // ajax post shutdown call
569
    var payload = {
570
        "shutdown": {"timeout" : "5"}
571
    };   
572

    
573
        var serverID = serverIDs.pop()
574
    $.ajax({
575
            url: API_URL + '/servers/' + serverID + '/action',
576
            type: "POST",
577
                contentType: "application/json",
578
            dataType: "json",
579
        data: JSON.stringify(payload),
580
        timeout: TIMEOUT,
581
        error: function(jqXHR, textStatus, errorThrown) { 
582
                    display_failure(jqXHR.status, serverID, 'Shutdown', jqXHR.responseText)
583
                    },
584
        success: function(data, textStatus, jqXHR) {
585
                    if ( jqXHR.status == '202') {
586
                                                try {
587
                            console.info('suspended ' + serverID);
588
                        } catch(err) {}
589
                                                // indicate that the action succeeded
590
                                                display_success(serverID);
591
                                                // continue with the rest of the servers                        
592
                        shutdown(serverIDs);
593
                    } else {
594
                        ajax_error(jqXHR.status, serverID, 'Shutdown', jqXHR.responseText);
595
                    }
596
                }             
597
    });
598

    
599
    return false;    
600
}
601

    
602
// destroy action
603
function destroy(serverIDs) {
604
        if (!serverIDs.length){
605
                //ajax_success('DEFAULT');
606
                return false;
607
        }
608
    // ajax post destroy call can have an empty request body
609
    var payload = {};   
610

    
611
        serverID = serverIDs.pop()
612
    $.ajax({
613
            url: API_URL + '/servers/' + serverID,
614
            type: "DELETE",
615
                contentType: "application/json",
616
            dataType: "json",
617
        data: JSON.stringify(payload),
618
        timeout: TIMEOUT,
619
        error: function(jqXHR, textStatus, errorThrown) { 
620
                    display_failure(jqXHR.status, serverID, 'Destroy', jqXHR.responseText)
621
                    },
622
        success: function(data, textStatus, jqXHR) {
623
                    if ( jqXHR.status == '204') {
624
                                                try {
625
                            console.info('destroyed ' + serverID);
626
                        } catch (err) {}
627
                                                // indicate that the action succeeded
628
                                                display_success(serverID);
629
                                                // continue with the rest of the servers
630
                        destroy(serverIDs);
631
                    } else {
632
                        ajax_error(jqXHR.status, serverID, 'Destroy', jqXHR.responseText);
633
                    }
634
                }             
635
    });
636

    
637
    return false;    
638
}
639

    
640
// start action
641
function start(serverIDs){
642
        if (!serverIDs.length){
643
                //ajax_success('DEFAULT');
644
                return false;
645
        }        
646
    // ajax post start call
647
    var payload = {
648
        "start": {"type" : "NORMAL"}
649
    };   
650

    
651
        var serverID = serverIDs.pop()
652
    $.ajax({
653
        url: API_URL + '/servers/' + serverID + '/action',
654
        type: "POST",
655
                contentType: "application/json",
656
        dataType: "json",
657
        data: JSON.stringify(payload),
658
        timeout: TIMEOUT,
659
        error: function(jqXHR, textStatus, errorThrown) { 
660
                    display_failure(jqXHR.status, serverID, 'Start', jqXHR.responseText)
661
                    },
662
        success: function(data, textStatus, jqXHR) {
663
                    if ( jqXHR.status == '202') {
664
                                            try {
665
                            console.info('started ' + serverID);
666
                        } catch(err) {}
667
                                                // indicate that the action succeeded
668
                                                display_success(serverID);
669
                                                // continue with the rest of the servers                                                
670
                        start(serverIDs);
671
                    } else {
672
                        ajax_error(jqXHR.status, serverID, 'Start', jqXHR.responseText);
673
                    }
674
                }
675
    });
676

    
677
    return false;
678
}
679

    
680
// get server metadata
681
function get_metadata(serverID) { 
682
    $.ajax({
683
        url: API_URL + '/servers/' + serverID + '/meta',
684
        type: "GET",
685
        //async: false,
686
        dataType: "json",
687
        timeout: TIMEOUT,
688
        error: function(jqXHR, textStatus, errorThrown) { 
689
            try {
690
                                ajax_error(jqXHR.status, undefined, 'Get metadata', jqXHR.responseText);
691
                        } catch (err) {
692
                                ajax_error(err);
693
                        }
694
        },
695
        success: function(data, textStatus, jqXHR) {
696
            update_metadata(data);
697
        }
698
    });
699
    return false;
700
}
701

    
702
// show the welcome screen
703
function showWelcome() {
704
    $("#view-select").fadeOut("fast");
705
    $("#createcontainer").addClass('emptycreatecontainer')
706
    $("#create").addClass('emptycreate')
707
    $("#emptymachineslist").fadeIn("fast");
708
    $("#createbody").fadeIn("fast");
709
    $("#create").css("display", "block");
710
}
711

    
712
// hide the welcome screen
713
function hideWelcome() {
714
    $("#emptymachineslist").fadeOut("fast");
715
    $("#createbody").fadeOut("fast");
716
    $("#createcontainer").removeClass('emptycreatecontainer')
717
    $("#create").removeClass('emptycreate')
718
    $("#view-select").fadeIn("fast");
719
    $("div#view-select").show();
720
    $("#create").css("display", "inline");
721
}
722