corrade-nucleus-nucleons – Diff between revs 17 and 18

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 17 Rev 18
Line 25... Line 25...
25 </script> 25 </script>
26 </head> 26 </head>
Line 27... Line 27...
27   27  
28 <body> 28 <body>
29 <!-- Bootstrap Modal --> 29 <!-- Bootstrap Modal -->
30 <div id="popup" class="modal fade bs-example-modal-lg" role="dialog"> 30 <div id="item-info-modal" class="modal fade bs-example-modal-lg" role="dialog">
31 <div class="modal-dialog modal-lg"> 31 <div class="modal-dialog modal-lg">
Line 32... Line 32...
32 <!-- Modal content--> 32 <!-- Modal content-->
33   33  
Line 55... Line 55...
55 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 55 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
56 </div> 56 </div>
57 </div> 57 </div>
58 </div> 58 </div>
59 </div> 59 </div>
-   60
-   61 <!-- Give Inventory Item Destination Dialog -->
-   62 <div id="avatar-select-modal" class="modal fade bs-example-modal-lg" role="dialog">
-   63 <div class="modal-dialog modal-lg">
-   64 <!-- Modal content-->
-   65  
-   66 <div class="modal-content">
-   67 <div class="modal-header">
-   68 <button type="button" class="close" data-dismiss="modal">&times;</button>
-   69  
-   70 <h1 id="title" class="modal-title">Avatar Selection</h1>
-   71 </div>
-   72  
-   73 <form id="avatar-select-form" class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();">
-   74 <div id="content" class="modal-body">
-   75 <p>Please enter the avatar firstname and lastname to send the script to.</p>
-   76 <div class="form-group has-feedback">
-   77 <label for="avatar-firstname">First Name</label>
-   78 <input id="avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required>
-   79 <label for="avatar-lastname">Last Name</label>
-   80 <input id="avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required>
-   81 </div>
-   82 </div>
-   83 <div class="modal-footer">
-   84 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-   85 <button id="send-script" type="submit" class="btn btn-primary">Confirm</button>
-   86 </div>
-   87 </form>
-   88 </div>
-   89 </div>
-   90 </div>
-   91
-   92 <!-- Texture Download Dialog -->
-   93 <div id="texture-download-modal" class="modal fade bs-example-modal-lg" role="dialog">
-   94 <div class="modal-dialog modal-lg">
-   95 <!-- Modal content-->
-   96  
-   97 <div class="modal-content">
-   98 <div class="modal-header">
-   99 <button type="button" class="close" data-dismiss="modal">&times;</button>
-   100  
-   101 <h1 id="title" class="modal-title">Avatar Selection</h1>
-   102 </div>
-   103
-   104 <div id="content" class="modal-body">
-   105 <img src="" align="middle" id="texture">
-   106 </div>
-   107
-   108 <div class="modal-footer">
-   109 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-   110 </div>
-   111 </div>
-   112 </div>
-   113 </div>
Line 60... Line 114...
60   114  
61 <div class="container"> 115 <div class="container">
62 <div class="jumbotron"> 116 <div class="jumbotron">
63 <h1>Corrade Pack Rat</h1> 117 <h1>Corrade Pack Rat</h1>
Line 120... Line 174...
120 'Description', 174 'Description',
121 'Permissions', 175 'Permissions',
122 'UUID' // part of InventoryBase 176 'UUID' // part of InventoryBase
123 ]) 177 ])
124 } 178 }
-   179 }).done(function(response) {
-   180 if(response.success !== 'True') {
-   181 alert('Error moving item: ' + response.error);
-   182 return;
-   183 }
125 $('#info').bootstrapTable({ 184 $('#info').bootstrapTable({
126 data: [ wasKeyValueObjectify(wasCSVToArray(response.data)) ] 185 data: [ wasKeyValueObjectify(wasCSVToArray(response.data)) ]
127 }); 186 });
128 $('#popup').modal('show'); 187 $('#item-info-modal').modal('show');
129 }); 188 });
130 } 189 }
131 } 190 }
132 }; 191 };
Line 138... Line 197...
138 if (node.data.type != "folder") { 197 if (node.data.type != "folder") {
139 $.extend(items, { 198 $.extend(items, {
140 giveItem: { 199 giveItem: {
141 label: "Give", 200 label: "Give",
142 action: function(obj) { 201 action: function(obj) {
143 $("#content").html('<form><fieldset class="ui-helper-reset"><label for="firstname">Firstname</label><input type="text" name="firstname" id="firstname" value="" class="ui-widget-content ui-corner-all"><br/><label for="lastname">Lastname</label><input type="text" name="lastname" id="lastname" value="" class="ui-widget-content ui-corner-all"></fieldset></form>'); 202 $('#avatar-select-modal')
144 $("#popup").dialog({ 203 .modal('show')
-   204 .on('click', '#send-script', function(e) {
-   205 $('#avatar-select-modal').modal('hide');
145 width: 320, 206 $.ajax({
146 height: 180, 207 type: 'POST',
147 modal: true, 208 url: '/',
148 resizable: false, 209 data: {
-   210 command: 'give',
-   211 entity: 'avatar',
-   212 item: node.id,
-   213 firstname: $('#avatar-firstname').val(),
-   214 lastname: $('#avatar-lastname').val()
149 buttons: { 215 },
-   216 dataType: 'json'
150 Select: function() { 217 }).done(function(response) {
151 if ($.trim($("#firstname").val()) == '' || 218 if(response.success !== 'True') {
152 $.trim($("#lastname").val()) == '') 219 alert('Error sending item: ' + response.error);
153 return; 220 return;
154 var firstName = $("#firstname").val(); -  
155 var lastName = $("#lastname").val(); -  
156 $.ajax({ -  
157 type: 'POST', -  
158 url: "giveInventoryItem.php?t=" + Math.random(), -  
159 data: { -  
160 uuid: node.id.split(/[\/]+/).pop(), -  
161 firstname: firstName, -  
162 lastname: lastName -  
163 } -  
164 }).done(function(data) { -  
165 $("#popup").dialog("close"); -  
166 if ($.trim(data) != '') -  
167 alert(data); -  
168 }); 221 }
169 }, 222 });
170 Cancel: function() { -  
171 $("#popup").dialog("close"); -  
172 } -  
173 } 223 });
174 }).on('dialogclose', function(event) { -  
175 $('#content').html(''); -  
176 $('#popup').dialog('option', 'buttons', {}); -  
177 }); -  
178 } 224 }
179 } 225 }
180 }); 226 });
181 } 227 }
Line 184... Line 230...
184 if (node.data.type == "texture" || node.data.type == "snapshot") { 230 if (node.data.type == "texture" || node.data.type == "snapshot") {
185 $.extend(items, { 231 $.extend(items, {
186 downloadItem: { 232 downloadItem: {
187 label: "Download", 233 label: "Download",
188 "action": function(obj) { 234 "action": function(obj) {
189 $('#texture').attr('src', 'images/loader.gif'); 235 $('#texture').attr('src', '/pack-rat/img/loader.gif');
190 $('#popup').dialog({ -  
191 width: 800, -  
192 height: 600, -  
193 modal: true, -  
194 resizable: false, -  
195 dialogClass: 'no-close texture-dialog' -  
196 }).on('dialogclose', function(event) { -  
197 $('#content').html(''); 236 $('#texture-download-modal').modal('show');
198 }); -  
199 $.ajax({ 237 $.ajax({
200 type: 'POST', 238 type: 'POST',
201 url: "downloadTexture.php?t=" + Math.random(), 239 url: '/',
202 data: { 240 data: {
-   241 command: 'download',
203 uuid: node.id.split(/[\/]+/).pop() 242 item: node.id,
-   243 format: 'Png',
-   244 type: 'Texture'
204 } 245 },
205 }).done(function(data) { 246 dataType: 'json'
206 $('#content').html('<img src="" align="middle" id="texture">'); 247 }).done(function(response) {
207 $('#texture').attr('src', "data:image/png;base64," + data); 248 $('#texture').attr('src', "data:image/png;base64," + response.data);
208 }); 249 });
209 } 250 }
210 } 251 }
211 }); 252 });
212 } 253 }