|
43 | 43 | $('#roids').empty(); |
44 | 44 | $.ajax({url: '/rest/getAllRevisionsOfProject', data: 'poid='+poid, dataType: 'json', success: function(data){ |
45 | 45 | var select = $('#roids'); |
46 | | - $.each(data.sRevision, function(i, revision){ |
| 46 | + $(data.sRevision).sort(function(r1,r2){ |
| 47 | + return r1.id > r2.id; |
| 48 | + }).each(function(i, revision){ |
47 | 49 | $('<option />').val(revision.oid).text(revision.id).appendTo(select); |
48 | 50 | }); |
49 | 51 | }}); |
50 | 52 | } |
51 | 53 | function projectUpdate() { |
52 | 54 | $('#revision').show(); |
53 | 55 | $('#poids').empty(); |
54 | | - $.ajax({url: '/rest/getAllProjects', dataType: 'json', success: function(data) { |
| 56 | + $.ajax({url: '/rest/getAllReadableProjects', dataType: 'json', success: function(data) { |
55 | 57 | var select = $('#poids'); |
56 | | - $.each( data.sProject, function(i, project) { |
| 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) { |
57 | 63 | $('<option />').val(project.oid).text(project.name).appendTo(select); |
58 | 64 | }); |
59 | 65 | revisionUpdate(select.val()); |
|
62 | 68 | $(document).ready(function() { |
63 | 69 | viewer = new ThreeJsViewer(); |
64 | 70 | viewer.init($('#viewerContainer')); |
| 71 | + projectUpdate(); |
65 | 72 | viewer.onClick = function(id) { |
66 | 73 | if (id==null) { |
67 | 74 | $('#selection').html('nothing'); |
68 | 75 | return; |
69 | 76 | } |
70 | 77 | $.ajax({ |
71 | | - url: '/rest/getDataObjectByGuid', |
| 78 | + url: '/rest/getDataObjectByGuid', dataType: 'json', |
72 | 79 | data: 'roid='+$('#roids').val()+'&guid='+id, |
73 | 80 | success: function(data){ |
74 | 81 | $('#selection').html(id + ' - ' + data.sDataObject.name + ' - ' + data.sDataObject.type); |
75 | 82 | } |
76 | 83 | }); |
77 | 84 | }; |
78 | 85 | viewer.animate(); |
79 | | - $('#login').submit(function() { |
80 | | - var username = $('#login input[name=username]').val(); |
81 | | - var password = $('#login input[name=password]').val(); |
82 | | - var auth = Base64.encode(username+':'+password); |
83 | | - $.ajax({url: '/rest/ping', headers: {'Authorization': auth}}); |
84 | | - projectUpdate(); |
85 | | - return false; |
86 | | - }); |
87 | 86 | $('#poids').change(function() { |
88 | 87 | revisionUpdate($(this).val()); |
89 | 88 | }); |
90 | 89 | $('#revision').submit(function(){ |
91 | 90 | $.ajax({ |
92 | 91 | url: '/rest/download', |
93 | | - data: 'roid='+$(this.roids).val()+'&resultType=THREEJS', |
| 92 | + data: 'roid='+$(this.roids).val()+'&serializerName=ThreeJs&sync=true&showOwn=true', |
94 | 93 | success: function(data) { |
95 | 94 | viewer.clearModel(); |
96 | | - viewer.loadModel('/download?longActionId=' + data); |
| 95 | + $.ajax({ |
| 96 | + url: '/rest/getDownloadData', |
| 97 | + dataType: 'json', |
| 98 | + data: 'actionId=' + data, |
| 99 | + success: function(model) { |
| 100 | + viewer.loadSerializedModel(Base64.decode(model.sCheckoutResult.file)); |
| 101 | + } |
| 102 | + }); |
| 103 | + // viewer.loadModel('/rest/downloadBinary?actionId=' + data); |
97 | 104 | } |
98 | 105 | }); |
99 | 106 | return false; |
|
103 | 110 | </head> |
104 | 111 | <body> |
105 | 112 | <div> |
106 | | -<form id="login" class="boxed" style="margin-right: 20px;"> |
107 | | - User <input name="username" type="text" /> |
108 | | - PW <input name="password" type="password" /> |
109 | | - <input type="submit" value="Login"/> |
110 | | -</form> |
111 | 113 | <form id="revision" class="boxed" style="display: none;"> |
112 | 114 | <select id="poids"></select> |
113 | 115 | <select id="roids"></select> |
|
0 commit comments