|
39 | 39 | <script src="Base64.js"></script> |
40 | 40 | <script> |
41 | 41 | var viewer; |
| 42 | + var host = 'http://localhost'; |
42 | 43 | function revisionUpdate(poid) { |
43 | 44 | $('#roids').empty(); |
44 | | - $.ajax({url: '/rest/getAllRevisionsOfProject', data: 'poid='+poid, dataType: 'json', success: function(data){ |
| 45 | + $.ajax({url: host+'/rest/getAllRevisionsOfProject', data: 'poid='+poid, dataType: 'json', |
| 46 | + xhrFields: { withCredentials: true}, success: function(data){ |
45 | 47 | var select = $('#roids'); |
46 | 48 | $(data.sRevision).sort(function(r1,r2){ |
47 | 49 | return r1.id > r2.id; |
|
53 | 55 | function projectUpdate() { |
54 | 56 | $('#revision').show(); |
55 | 57 | $('#poids').empty(); |
56 | | - $.ajax({url: '/rest/getAllReadableProjects', dataType: 'json', success: function(data) { |
57 | | - var select = $('#poids'); |
58 | | - $(data.sProject).filter(function(i,project){ |
59 | | - return project.state == "ACTIVE" && project.name != "INT-Store"; |
60 | | - }).sort(function(p1,p2){ |
61 | | - return p1.name > p2.name; |
62 | | - }).each(function(i, project) { |
63 | | - $('<option />').val(project.oid).text(project.name).appendTo(select); |
| 58 | + $.ajax({url: host+'/rest/getAllReadableProjects', dataType: 'json', |
| 59 | + xhrFields: { withCredentials: true}, success: function(data) { |
| 60 | + var select = $('#poids'); |
| 61 | + $(data.sProject).filter(function(i,project){ |
| 62 | + return project.state == "ACTIVE" && project.name != "INT-Store"; |
| 63 | + }).sort(function(p1,p2){ |
| 64 | + return p1.name > p2.name; |
| 65 | + }).each(function(i, project) { |
| 66 | + $('<option />').val(project.oid).text(project.name).appendTo(select); |
| 67 | + }); |
| 68 | + revisionUpdate(select.val()); |
| 69 | + } |
64 | 70 | }); |
65 | | - revisionUpdate(select.val()); |
66 | | - }}); |
67 | 71 | } |
68 | 72 | $(document).ready(function() { |
| 73 | + $('#errors').ajaxError(function(event, xhr, settings, thrown) { |
| 74 | + $(this).text( 'Ajax error: ' + thrown.message); |
| 75 | + }); |
69 | 76 | viewer = new ThreeJsViewer(); |
70 | 77 | viewer.init($('#viewerContainer')); |
71 | 78 | projectUpdate(); |
|
75 | 82 | return; |
76 | 83 | } |
77 | 84 | $.ajax({ |
78 | | - url: '/rest/getDataObjectByGuid', dataType: 'json', |
| 85 | + url: host+'/rest/getDataObjectByGuid', dataType: 'json', |
79 | 86 | data: 'roid='+$('#roids').val()+'&guid='+id, |
| 87 | + xhrFields: { withCredentials: true}, |
80 | 88 | success: function(data){ |
81 | 89 | $('#selection').html(id + ' - ' + data.sDataObject.name + ' - ' + data.sDataObject.type); |
82 | 90 | } |
|
88 | 96 | }); |
89 | 97 | $('#revision').submit(function(){ |
90 | 98 | $.ajax({ |
91 | | - url: '/rest/download', |
| 99 | + url: host+'/rest/download', |
92 | 100 | data: 'roid='+$(this.roids).val()+'&serializerName=ThreeJs&sync=true&showOwn=true', |
| 101 | + xhrFields: { withCredentials: true}, |
93 | 102 | success: function(data) { |
94 | 103 | viewer.clearModel(); |
95 | 104 | $.ajax({ |
96 | | - url: '/rest/getDownloadData', |
| 105 | + url: host+'/rest/getDownloadData', |
97 | 106 | dataType: 'json', |
98 | 107 | data: 'actionId=' + data, |
| 108 | + xhrFields: { withCredentials: true}, |
99 | 109 | success: function(model) { |
100 | 110 | viewer.loadSerializedModel(Base64.decode(model.sCheckoutResult.file)); |
101 | 111 | } |
|
117 | 127 | </form> |
118 | 128 | </div> |
119 | 129 | <div id="viewerContainer"></div> |
| 130 | +<p id="errors"></p> |
120 | 131 | <p class="boxed"> |
121 | 132 | selected: <span id="selection">nothing</span></p> |
122 | 133 | </body> |
|
0 commit comments