Revision 9ed51b7e

b/ui/static/ie.css
450 450
    margin-left: 117px;
451 451
}
452 452

  
453
.password-container {
454
    width: 415px !important;
455
}
456

  
457
.popup-body-inner {
458
    padding-bottom: 20px !important;
459
}
460

  
b/ui/static/main.css
3819 3819
#invform #fields input {
3820 3820
    margin-right: 10px;
3821 3821
}
3822

  
3823
.machine-now-building {
3824
    padding-right: 15px !important;
3825
    text-align: justify;
3826
}
3827

  
3828
.sub-text {
3829
    padding-top: 15px;
3830
    padding-right: 15px;
3831
    text-align: justify;
3832
    font-style: italic;
3833
    font-size: 0.9em;
3834
}
3835

  
3836
#notification-box a {
3837
    color: #4085A5;
3838
}
3839

  
3840
#notification-box .machine-title img {
3841
    vertical-align: middle;
3842
}
3843

  
3844
#notifiaction-box .password-header {
3845
    margin-bottom: 0 !important;
3846
}
3847

  
3848
#notification-box .password-container a {
3849
    color: #fff;
3850
    text-decoration: underline;
3851
}
3852

  
3853
#notification-box .password-container a:hover {
3854
    background-color: #fff;
3855
    color: #4085A5;
3856
}
3857

  
3858
#notification-box .password-container {
3859
    background: #4085A5;
3860
    border: none;
3861
}
3862

  
3863
#notification-box .password-container .password a {
3864
    font-weight: normal !important;
3865
}
3866

  
3867
#notification-box .cmd {
3868
    color: #fff;
3869
    font-family: monospace;
3870
    font-size: 1.6em;
3871
}
3872

  
3873
.machine-container .separator {
3874
    background-color: #B0D1E0;
3875
}
b/ui/static/synnefo.js
1207 1207
        var os = machine.metadata.values.OS;
1208 1208
    } catch(err) { var os = 'undefined'; }
1209 1209

  
1210
    var params_url = '?ip_address=' + serverIP + '&os=' + os + "&host_os=" + $.client.os;
1210
    var params_url = '?ip_address=' + serverIP + '&os=' + os + "&host_os=" + $.client.os + "&srv=" + serverID;
1211 1211
    
1212 1212
    if ($.client.os == "Windows" && os == "windows") {
1213 1213
        window.open('machines/connect' + params_url + "&rdp=1");
1214 1214
        return;
1215 1215
    }
1216
    
1217
    var title = 'Connect to: ' + '<span class="machine-title"><img src="static/icons/machines/small/'+os+'-on.png" /> '+serverName+'</span>';
1216 1218

  
1217 1219
    try {
1218
        msg_box({title:'Connect to ' + serverName,content:'loading...',extra:'',
1220
        msg_box({title:title, content:'loading...',extra:'',
1219 1221
        'ajax':'machines/connect' + params_url,
1220 1222
        parse_data:function(data){
1223
            var box_content = "<a href='"+data.link.url+"'>"+data.link.title+"</a>";
1224
            if (!data.link.url) {
1225
                box_content = "<span class='cmd'>"+data.link.title+"</span>";
1226
            }
1221 1227
            data.title = false;
1222 1228
            data.content = data.info;
1223
            data.extra = "<a href='"+data.link.url+"'>"+data.link.title+"</a>";
1229
            data.extra = box_content;
1224 1230
            return data;
1225 1231
        }
1226 1232
        });
......
2110 2116

  
2111 2117
    var sel = function(s){return $(s, box)};
2112 2118

  
2113
    sel("h3 span.header-box").text(config.title);
2119
    sel("h3 span.header-box").html(config.title);
2114 2120
    sel("div.machine-now-building").html(config.content);
2115 2121
    sel(".popup-header").removeClass("popup-header-error");
2116 2122
    box.removeClass("popup-border-error");
......
2171 2177
                        sel(".password-container .password").html(data.extra);
2172 2178
                        sel(".password-container").show();
2173 2179
                    }
2180
                    if (data.subinfo) {
2181
                        sel(".sub-text").html(data.subinfo);
2182
                    } else {
2183
                        sel(".sub-text").html("");
2184
                    }
2174 2185
                }
2175 2186

  
2176 2187
                if (user_success) {
b/ui/templates/home.html
501 501
                <div class="machine-now-building"></div>
502 502
                <div class="popup-separator"></div>
503 503
                <div class="password-container">
504
                    <div class="password-header"></div>
505 504
                    <div class="password"></div>
506 505
                </div>
506
                <div class="sub-text"></div>
507 507
            </div>
508 508
        </div>
509 509
    </div>
b/ui/views.py
88 88
    return template('machines_console', context)
89 89

  
90 90

  
91
CONNECT_LINUX_LINUX_MESSAGE = _("Trying to connect from linux to linux")
92
CONNECT_LINUX_WINDOWS_MESSAGE = _("Trying to connect from linux to windows")
93
CONNECT_WINDOWS_LINUX_MESSAGE = _("Trying to connect from windows to linux")
91
CONNECT_LINUX_LINUX_MESSAGE = _("""A direct connection to this machine can be established using the <a target="_blank"
92
href="http://en.wikipedia.org/wiki/Secure_Shell">SSH Protocol</a>.
93
To do so open a terminal and type the following at the prompt to connect to your machine:""")
94
CONNECT_LINUX_WINDOWS_MESSAGE = _("""A direct connection to this machine can be
95
established using <a target="_blank" href="http://en.wikipedia.org/wiki/Remote_Desktop_Services">Remote Desktop Service</a>.
96
To do so, open the following file with an appropriate remote desktop client.""")
97
CONNECT_LINUX_WINDOWS_SUBMESSAGE = _("""If you don't have one already
98
installed, we suggest the use of <a target="_blank" href="http://sourceforge.net/projects/tsclient/files/tsclient/tsclient-unstable/tsclient-2.0.1.tar.bz2/download">tsclient</a>.""")
99

  
100
CONNECT_WINDOWS_LINUX_MESSAGE = _("""A direct connection to this machine can be established using the <a target="_blank"
101
href="http://en.wikipedia.org/wiki/Secure_Shell">SSH Protocol</a>.
102
Open an ssh client such as PuTTY to connect to your machine at IP:""")
103
CONNECT_WINDOWS_LINUX_SUBMESSAGE = _("""If you do not have an ssh client already installed,
104
<a target="_blank" href="http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe">Download PuTTY</a>""")
94 105
CONNECT_WINDOWS_WINDOWS_MESSAGE = _("Trying to connect from windows to windows")
95 106

  
107

  
108
# info/subinfo for all os combinations
109
#
110
# [0] info gets displayed on top of the message box
111
# [1] subinfo gets displayed on the bottom as extra info
112
# provided to the user when needed
96 113
CONNECT_PROMT_MESSAGES = {
97 114
    'linux': {
98
            'linux': CONNECT_LINUX_LINUX_MESSAGE,
99
            'windows': CONNECT_LINUX_WINDOWS_MESSAGE
115
            'linux': [CONNECT_LINUX_LINUX_MESSAGE, ""],
116
            'windows': [CONNECT_LINUX_WINDOWS_MESSAGE, CONNECT_LINUX_WINDOWS_SUBMESSAGE]
100 117
        },
101 118
    'windows': {
102
            'linux': CONNECT_WINDOWS_LINUX_MESSAGE,
103
            'windows': CONNECT_WINDOWS_WINDOWS_MESSAGE
119
            'linux': [CONNECT_WINDOWS_LINUX_MESSAGE, CONNECT_WINDOWS_LINUX_SUBMESSAGE],
120
            'windows': [CONNECT_WINDOWS_WINDOWS_MESSAGE, ""]
104 121
        }
105 122
    }
106 123

  
107 124
def machines_connect(request):
108 125
    ip_address = request.GET.get('ip_address','')
109 126
    operating_system = request.GET.get('os','')
127
    server_id = request.GET.get('srv', 0)
110 128
    host_os = request.GET.get('host_os','Linux').lower()
111 129

  
112 130
    if operating_system != "windows":
113 131
        operating_system = "linux"
114 132

  
133
    # rdp param is set, the user requested rdp file
115 134
    if operating_system == 'windows' and request.GET.get("rdp", False): #check if we are on windows
116 135
        rdp_file = os.path.join(os.path.dirname(__file__), "static/") + 'synnefo-windows.rdp'
117 136
        connect_data = open(rdp_file, 'r').read()
118 137
        connect_data = connect_data + 'full address:s:' + ip_address + '\n'
119 138
        response = HttpResponse(connect_data, mimetype='application/x-rdp')
120
        response['Content-Disposition'] = 'attachment; filename=synnefo-windows.rdp'
139

  
140
        # proper filename, use server id and ip address
141
        filename = "%d-%s.rdp" % (int(server_id), ip_address)
142
        response['Content-Disposition'] = 'attachment; filename=%s' % filename
121 143
    else:
144
        # no rdp requested return json object with info on how to connect
122 145
        ssh = False
123 146
        if (operating_system != "windows"):
124 147
            ssh = True
125 148

  
126
        info = _("Connect on windows using the following RDP shortcut file")
127
        link_title = _("Windows RDP shortcut file")
128
        link_url = "%s?ip_address=%s&os=%s&rdp=1" % (reverse("machines-connect"), ip_address, operating_system)
149
        link_title = _("Remote desktop to %s") % ip_address
150
        link_url = "%s?ip_address=%s&os=%s&rdp=1&srv=%d" % (reverse("machines-connect"), ip_address, operating_system,
151
                int(server_id))
129 152

  
130 153
        if (operating_system != "windows"):
131
            info = _("Connect on linux machine using the following url")
132
            link_url = "ssh://%s/" % ip_address
133
            link_title = link_url
154
            link_title = "ssh root@%s" % ip_address
155
            link_url = None
156

  
157
            if host_os == "windows":
158
                link_title = ip_address
134 159

  
135 160
        # try to find a specific message
136 161
        try:
137
            connect_message = CONNECT_PROMT_MESSAGES[host_os][operating_system]
162
            connect_message = CONNECT_PROMT_MESSAGES[host_os][operating_system][0]
163
            subinfo = CONNECT_PROMT_MESSAGES[host_os][operating_system][1]
138 164
        except KeyError:
139 165
            connect_message = _("You are trying to connect from a %s machine to a %s machine") % (host_os, operating_system)
166
            subinfo = ""
140 167

  
141 168
        response_object = {
142 169
                'ip': ip_address,
143 170
                'os': operating_system,
144 171
                'ssh': ssh,
145 172
                'info': unicode(connect_message),
173
                'subinfo': unicode(subinfo),
146 174
                'link': {'title': unicode(link_title), 'url': link_url}
147 175
            }
148 176
        response = HttpResponse(json.dumps(response_object), mimetype='application/json')  #no windows, no rdp

Also available in: Unified diff