|
6 | 6 | });
|
7 | 7 | $("#tabsGeneric").show();
|
8 | 8 | $('img.tabsLoading').hide()
|
| 9 | + |
| 10 | + $('a.defaultAssetstoreLink').click(function(){ |
| 11 | + $.post(json.global.webroot+'/assetstore/defaultassetstore', {submitDefaultAssetstore: true, element: $(this).attr('element')}, |
| 12 | + function(data) { |
| 13 | + jsonResponse = jQuery.parseJSON(data); |
| 14 | + if(jsonResponse==null) |
| 15 | + { |
| 16 | + createNotive('Error',4000); |
| 17 | + return; |
| 18 | + } |
| 19 | + createNotive(jsonResponse[1],1500); |
| 20 | + window.location.replace(json.global.webroot+'/admin#tabs-assetstore'); |
| 21 | + window.location.reload(); |
| 22 | + }); |
| 23 | + }); |
| 24 | + |
| 25 | + $('a.removeAssetstoreLink').click(function() |
| 26 | + { |
| 27 | + var element = $(this).attr('element'); |
| 28 | + var html = ''; |
| 29 | + html += 'Do you really want to remove the assetstore? All the items located in it will be delete.'; |
| 30 | + html += '<br/>'; |
| 31 | + html += '<br/>'; |
| 32 | + html += '<input style="margin-left:140px;" class="globalButton deleteAssetstoreYes" element="'+element+'" type="button" value="'+json.global.Yes+'"/>'; |
| 33 | + html += '<input style="margin-left:50px;" class="globalButton deleteAssetstoreNo" type="button" value="'+json.global.No+'"/>'; |
| 34 | + showDialogWithContent('Remove Assetstore', html,false); |
| 35 | + |
| 36 | + $('input.deleteAssetstoreYes').unbind('click').click(function() |
| 37 | + { |
| 38 | + ajaxSelectRequest = $.ajax({ |
| 39 | + type: "POST", |
| 40 | + url: json.global.webroot+'/assetstore/delete', |
| 41 | + data: {assetstoreId: element}, |
| 42 | + success: function(jsonContent){ |
| 43 | + jsonResponse = jQuery.parseJSON(jsonContent); |
| 44 | + createNotive(jsonResponse[1],1500); |
| 45 | + if(jsonResponse[0]) |
| 46 | + { |
| 47 | + window.location.replace(json.global.webroot+'/admin#tabs-assetstore'); |
| 48 | + window.location.reload(); |
| 49 | + } |
| 50 | + } |
| 51 | + }); |
| 52 | + }); |
| 53 | + $('input.deleteAssetstoreNo').unbind('click').click(function() |
| 54 | + { |
| 55 | + $( "div.MainDialog" ).dialog('close'); |
| 56 | + }); |
| 57 | + }); |
| 58 | + |
| 59 | + $('a.editAssetstoreLink').click(function() |
| 60 | + { |
| 61 | + var element = $(this).attr('element'); |
| 62 | + var html = ''; |
| 63 | + html += '<form class="genericForm" onsubmit="false;">'; |
| 64 | + html += '<label>Name:</label> <input type="text" id="assetstoreName" value="'+$(this).parents('div').find('span.assetstoreName').html()+'"/><br/><br/>'; |
| 65 | + html += '<label>Path:</label> <input type="text" id="assetstorePath" value="'+$(this).parents('div').find('span.assetstorePath').html()+'"/>'; |
| 66 | + html += '<br/>'; |
| 67 | + html += '<br/>'; |
| 68 | + html += '<input type="submit" id="assetstoreSubmit" value="Save"/>'; |
| 69 | + html += '</form>'; |
| 70 | + html += '<br/>'; |
| 71 | + showDialogWithContent('Edit Assetstore', html,false); |
9 | 72 |
|
| 73 | + $('input#assetstoreSubmit').unbind('click').click(function() |
| 74 | + { |
| 75 | + ajaxSelectRequest = $.ajax({ |
| 76 | + type: "POST", |
| 77 | + url: json.global.webroot+'/assetstore/edit', |
| 78 | + data: {assetstoreId: element, assetstoreName: $('input#assetstoreName').val(), assetstorePath: $('input#assetstorePath').val()}, |
| 79 | + success: function(jsonContent){ |
| 80 | + jsonResponse = jQuery.parseJSON(jsonContent); |
| 81 | + createNotive(jsonResponse[1],1500); |
| 82 | + if(jsonResponse[0]) |
| 83 | + { |
| 84 | + window.location.replace(json.global.webroot+'/admin#tabs-assetstore'); |
| 85 | + window.location.reload(); |
| 86 | + } |
| 87 | + } |
| 88 | + }); |
| 89 | + }); |
| 90 | + $('input.deleteAssetstoreNo').unbind('click').click(function() |
| 91 | + { |
| 92 | + $( "div.MainDialog" ).dialog('close'); |
| 93 | + }); |
| 94 | + }); |
10 | 95 |
|
11 |
| - $('#configForm').ajaxForm( {beforeSubmit: validateConfig, success: successConfig} ); |
| 96 | + $('#configForm').ajaxForm( {beforeSubmit: validateConfig, success: successConfig} ); |
12 | 97 |
|
13 | 98 | // Form for the new assetstore
|
14 |
| - options = { success:assetstoreAddCallback, beforeSubmit: assetstoreSubmit, dataType:'json' }; |
| 99 | + options = {success:assetstoreAddCallback, beforeSubmit: assetstoreSubmit, dataType:'json'}; |
15 | 100 | $('#assetstoreForm').ajaxForm(options);
|
16 | 101 |
|
17 | 102 | $('a.load-newassetstore').cluetip({cluetipClass: 'jtip',
|
@@ -80,13 +165,8 @@ function assetstoreAddCallback(responseText, statusText, xhr, $form)
|
80 | 165 | // It worked, we add the assetstore to the list and we select it by default
|
81 | 166 | if(responseText.assetstore_id)
|
82 | 167 | {
|
83 |
| - var html=''; |
84 |
| - html+="<div class='assetstoreElement'> <span class='assetstoreName'><b>"+responseText.assetstore_name+"</b></span> <br/>"; |
85 |
| - html+="Total space: "+responseText.totalSpaceText+"<br/>"; |
86 |
| - html+="<b>Free space: "+responseText.freeSpaceText+"</b>"; |
87 |
| - html+="</div>"; |
88 |
| - $('div.assetstoreElement:last').after(html); |
89 |
| - console.log(html); |
| 168 | + window.location.replace(json.global.webroot+'/admin#tabs-assetstore'); |
| 169 | + window.location.reload(); |
90 | 170 | }
|
91 | 171 |
|
92 | 172 | createNotive(responseText.msg,4000);
|
|
0 commit comments