corrade-nucleus-nucleons – Blame information for rev 26

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 + "%");
23 office 26 $.ajax({
27 type: 'GET',
28 url: '/cfg/Corrade.ini.default',
29 dataType: 'text',
30 success: function(data) {
1 office 31 // Set progress.
32 $('#progressbar').css("width", 40 + "%").attr("aria-valuenow", 40).text(40 + "%");
23 office 33  
1 office 34 // Get default configuration.
35 var x2js = new X2JS();
23 office 36 var defCfg = x2js.xml2js(data);
1 office 37  
38 // Set configuration properties.
39 defCfg.Configuration.FirstName = form.firstname;
40 defCfg.Configuration.LastName = form.lastname;
23 office 41 var loginHash = forge.md.md5.create();
42 loginHash.update(form.password);
43 defCfg.Configuration.Password = "$1$" + loginHash.digest().toHex();
1 office 44 defCfg.Configuration.LoginURL = form.loginurl;
45 // Set Nucleus prefix.
46 defCfg.Configuration.NucleusServerPrefix = 'http://+:' + location.port + "/";
47 // Get first sample group.
48 var group = defCfg.Configuration.Groups.Group;
49 // Set parameters.
50 group.Name = form.groupname;
23 office 51 var groupHash = forge.md.sha1.create();
52 groupHash.update(form.grouppassword);
53 group.Password = groupHash.digest().toHex();
1 office 54 group.UUID = form.groupuuid;
55 // Set single group.
56 defCfg.Configuration.Groups.Group = [ group ];
57  
58 // Set Grid TOS acceptance.
59 defCfg.Configuration.TOSAccepted = form.tos;
60  
61 // Set progress.
62 $('#progressbar').css("width", 60 + "%").attr("aria-valuenow", 60).text(60 + "%");
63  
64 // Write the configuration.
65 $.ajax({
66 type: 'PUT',
67 url: '/cfg/Corrade.ini',
23 office 68 data: x2js.js2xml(defCfg),
1 office 69 contentType: "text/html"
70 }).done(function(data) {
71 // Set progress.
72 $('#progressbar').css("width", 80 + "%").attr("aria-valuenow", 80).text(80 + "%");
73  
74 $('#cfgform').load('bootstrap/htm/bootstrap-configuration-complete.html', function() {
75 $('#progressbar').css("width", 100 + "%").attr("aria-valuenow", 100).text(100 + "%");
76 // Hide the popup.
77 $('#popup').modal('hide');
78 });
79 });
23 office 80 }
1 office 81  
82 });
83 });