corrade-nucleus-nucleons – Blame information for rev 6

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 // Add the terms of service link loader.
2 $('#loginurl').change(function() {
3 switch($('#loginurl').find('option:selected').text()) {
4 case 'SecondLife':
5 $('#toslink').attr('href', 'http://www.lindenlab.com/tos');
6 break;
7 case 'OSGrid':
8 $('#toslink').attr('href', 'http://www.osgrid.org');
9 break;
10 default:
11 $('#tosaccept').innerHTML('Do you accept the terms of service of the selected grid?');
12 break;
13 }
14 });
15  
16 $('#cfgform').submit(function(evt) {
17 evt.preventDefault();
18 // Set the popup details.
19 $('#title').html('Creating initial configuration... Please wait...');
20 // Show the popup.
21 $('#popup').modal('show');
22 // Serialize the form to a Javascript object.
23 var form = formToObject('cfgform');
24 // Set progress.
25 $('#progressbar').css("width", 20 + "%").attr("aria-valuenow", 20).text(20 + "%");
26 $.ajax({
27 type: 'GET',
28 url: '/cfg/Corrade.ini.default'
29 //dataType: 'xml'
30 }).done(function(data) {
31 // Set progress.
32 $('#progressbar').css("width", 40 + "%").attr("aria-valuenow", 40).text(40 + "%");
33  
34 // Get default configuration.
35 var x2js = new X2JS();
36 var defCfg = x2js.xml2json(data);
37  
38 // Set configuration properties.
39 defCfg.Configuration.FirstName = form.firstname;
40 defCfg.Configuration.LastName = form.lastname;
41 defCfg.Configuration.Password = "$1$" + CryptoJS.MD5(form.password).toString(CryptoJS.enc.Hex);
42 defCfg.Configuration.LoginURL = form.loginurl;
43 // Set Nucleus prefix.
44 defCfg.Configuration.NucleusServerPrefix = 'http://+:' + location.port + "/";
45 // Get first sample group.
46 var group = defCfg.Configuration.Groups.Group;
47 // Set parameters.
48 group.Name = form.groupname;
49 group.Password = CryptoJS.SHA1(form.grouppassword).toString(CryptoJS.enc.Hex);
50 group.UUID = form.groupuuid;
51 // Set single group.
52 defCfg.Configuration.Groups.Group = [ group ];
53  
54 // Set Grid TOS acceptance.
55 defCfg.Configuration.TOSAccepted = form.tos;
56  
57 // Set progress.
58 $('#progressbar').css("width", 60 + "%").attr("aria-valuenow", 60).text(60 + "%");
59  
60 // Write the configuration.
61 $.ajax({
62 type: 'PUT',
63 url: '/cfg/Corrade.ini',
64 data: x2js.json2xml_str(defCfg),
65 contentType: "text/html"
66 }).done(function(data) {
67 // Set progress.
68 $('#progressbar').css("width", 80 + "%").attr("aria-valuenow", 80).text(80 + "%");
69  
70 $('#cfgform').load('bootstrap/htm/bootstrap-configuration-complete.html', function() {
71 $('#progressbar').css("width", 100 + "%").attr("aria-valuenow", 100).text(100 + "%");
72 // Hide the popup.
73 $('#popup').modal('hide');
74 });
75 });
76  
77 });
78 });