corrade-nucleus-nucleons – Diff between revs 1 and 23

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