diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php index 2dfa374c..75bbcdd5 100755 --- a/code/AssetAdmin.php +++ b/code/AssetAdmin.php @@ -45,7 +45,6 @@ class AssetAdmin extends LeftAndMain { 'getfile', 'getsubtree', 'movemarked', - 'removefile', 'save', 'savefile', 'uploadiframe', @@ -110,7 +109,7 @@ JS CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder'); } - + /** * Show the content of the upload iframe. The form is specified by a template. */ @@ -609,29 +608,6 @@ JS; return $form; } - public function removefile(){ - if($fileID = $this->urlParams['ID']) { - $file = DataObject::get_by_id('File', $fileID); - // Delete the temp verions of this file in assets/_resampled - if($file instanceof Image) { - $file->deleteFormattedImages(); - } - $file->delete(); - $file->destroy(); - - if(Director::is_ajax()) { - echo <<currentPageID(); $record = ($id) ? $this->getRecord($id) : null; diff --git a/javascript/AssetTableField.js b/javascript/AssetTableField.js index 57027f7d..6f0cca19 100644 --- a/javascript/AssetTableField.js +++ b/javascript/AssetTableField.js @@ -14,7 +14,8 @@ AssetTableField.prototype = { 'ctf[ID]' : true, 'FileFilterButton' : true, 'FileFieldName' : true, - 'FileSearch' : true + 'FileSearch' : true, + 'Files[]' : true } } }); @@ -135,35 +136,4 @@ MarkingPropertiesButton.prototype = { } return false; } -} - -Behaviour.register({ - '#Form_EditForm_Files': { - removeFile : function(fileID) { - var record; - if(record = $('record-' + fileID)) { - record.parentNode.removeChild(record); - } - } - }, - - '#Form_EditForm_Files a.deletelink' : { - onclick : function(event) { - // Send request - new Ajax.Request(this.href + (this.href.indexOf("?") == -1 ? "?" : "&") + "ajax=1", { - method : 'get', - onSuccess : Ajax.Evaluator, - onFailure : function(response) {errorMessage('Server Error', response);} - }); - Event.stop(event); - return false; - } - }, - - - '#Form_EditForm' : { - changeDetection_fieldsToIgnore : { - 'Files[]' : true - } - } -}); \ No newline at end of file +} \ No newline at end of file diff --git a/templates/Includes/AssetTableField.ss b/templates/Includes/AssetTableField.ss index 2b205f1f..eaf93122 100755 --- a/templates/Includes/AssetTableField.ss +++ b/templates/Includes/AssetTableField.ss @@ -18,40 +18,15 @@ <% if Items %> <% control Items %> - - - Drag - - <% if Markable %>$MarkingCheckbox<% end_if %> - <% control Fields %> - $Value - <% end_control %> - <% if Can(show) %> - - <% _t('SHOW', 'Show asset') %> - - <% end_if %> - <% if Can(edit) %> - - <% _t('EDIT', 'Edit asset') %> - - <% end_if %> - <% if Can(delete) %> - - <% _t('DELFILE', 'Delete this file') %> - - <% end_if %> - + <% include AssetTableField_Item %> <% end_control %> <% else %> - -   - <% if Markable %> <% end_if %> - No $NamePlural found - <% if Can(show) %> <% end_if %> - <% if Can(edit) %> <% end_if %> - <% if Can(delete) %> <% end_if %> - + + + <% if Markable %> <% end_if %> + <% _t('NOITEMSFOUND','No items found') %> + <% if Can(delete) %> <% end_if %> + <% end_if %> diff --git a/templates/Includes/AssetTableField_Item.ss b/templates/Includes/AssetTableField_Item.ss new file mode 100644 index 00000000..e90ecc9e --- /dev/null +++ b/templates/Includes/AssetTableField_Item.ss @@ -0,0 +1,22 @@ + class="$HighlightClasses"<% end_if %>> + + Drag + + <% if Markable %>$MarkingCheckbox<% end_if %> + <% control Fields %> + $Value + <% end_control %> + <% control Actions %> + + <% if IsAllowed %> + + <% if Icon %>$Label<% else %>$Label<% end_if %> + + <% else %> + + <% if IconDisabled %>$Label<% else %>$Label<% end_if %> + + <% end_if %> + + <% end_control %> + \ No newline at end of file