Revision b687587e

b/ui/static/synnefo.js
1195 1195
    //console.log(machine.addresses.values[0].values[0].addr);
1196 1196
    
1197 1197
    //show_connect_dialog(machine, ip);
1198
    try {
1199
        msg_box({title:'Connect to ' + serverName,content:'loading...',extra:'',
1200
        'ajax':'machines/connect' + params_url,
1201
        parse_data:function(data){
1202
            data.title = false;
1203
            data.content = data.info;
1204
            data.extra = "<a href='"+data.link.url+"'>"+data.link.title+"</a>";
1205
            return data;
1206
        }
1207
        });
1208
    } catch (error) {
1209
        console.log(error);
1198 1210
    window.open('machines/connect' + params_url);
1199
    
1211
    }
1200 1212

  
1201 1213

  
1202 1214
    // Restore os icon in list view
b/ui/views.py
39 39
from django.utils.translation import get_language
40 40
from django.utils import simplejson as json
41 41
from django.shortcuts import render_to_response
42
from django.core.urlresolvers import reverse
42 43

  
43 44
TIMEOUT = settings.TIMEOUT
44 45
UPDATE_INTERVAL = settings.UPDATE_INTERVAL
......
88 89
def machines_connect(request):
89 90
    ip_address = request.GET.get('ip_address','')
90 91
    operating_system = request.GET.get('os','')
91
    if operating_system == 'windows': #check if we are on windows
92
    if operating_system == 'windows' and request.GET.get("rdp", False): #check if we are on windows
92 93
        rdp_file = os.path.join(os.path.dirname(__file__), "static/") + 'synnefo-windows.rdp'
93 94
        connect_data = open(rdp_file, 'r').read()
94 95
        connect_data = connect_data + 'full address:s:' + ip_address + '\n'
95 96
        response = HttpResponse(connect_data, mimetype='application/x-rdp')
96 97
        response['Content-Disposition'] = 'attachment; filename=synnefo-windows.rdp'
97 98
    else:
98
        response = HttpResponse("Try ssh maybe")  #no windows, no rdp
99
        ssh = False
100
        if (operating_system != "windows"):
101
            ssh = True
102

  
103
        info = _("Connect on windows using the following RDP shortcut file")
104
        link_title = _("Windows RDP shortcut file")
105
        link_url = "%s?ip_address=%s&os=%s&rdp=1" % (reverse("machines-connect"), ip_address, operating_system)
106

  
107
        if (operating_system != "windows"):
108
            info = _("Connect on linux machine using the following url")
109
            link_url = "ssh://%s/" % ip_address
110
            link_title = link_url
111

  
112
        response_object = {
113
                'ip': ip_address,
114
                'os': operating_system,
115
                'ssh': ssh,
116
                'info': unicode(info),
117
                'link': {'title': unicode(link_title), 'url': link_url}
118
            }
119
        response = HttpResponse(json.dumps(response_object), mimetype='application/json')  #no windows, no rdp
99 120
    return response
100 121

  
101 122

  

Also available in: Unified diff