BUG Fixed issue where file upload via the HTML Editor media dialogue would not prompt users to overwrite existing files

This commit is contained in:
Damian Mooyman 2013-06-20 15:21:18 +12:00
parent a4189a6744
commit f47383f52e
5 changed files with 23 additions and 10 deletions

View File

@ -668,7 +668,7 @@ body.cms-dialog { overflow: auto; background: url("../images/textures/bg_cms_mai
.htmleditorfield-mediaform .htmleditorfield-from-cms .ss-uploadfield h4 { float: left; margin-top: 4px; margin-bottom: 0; } .htmleditorfield-mediaform .htmleditorfield-from-cms .ss-uploadfield h4 { float: left; margin-top: 4px; margin-bottom: 0; }
.htmleditorfield-mediaform .htmleditorfield-from-cms .ss-uploadfield .middleColumn { margin-top: 16px; margin-left: 184px; } .htmleditorfield-mediaform .htmleditorfield-from-cms .ss-uploadfield .middleColumn { margin-top: 16px; margin-left: 184px; }
.htmleditorfield-mediaform .htmleditorfield-from-cms .ss-uploadfield .field.treedropdown { border-bottom: 0; padding: 0; } .htmleditorfield-mediaform .htmleditorfield-from-cms .ss-uploadfield .field.treedropdown { border-bottom: 0; padding: 0; }
.htmleditorfield-mediaform .ss-uploadfield-editandorganize { display: none; } .htmleditorfield-mediaform .ss-assetuploadfield .ss-uploadfield-editandorganize .ss-uploadfield-files .ss-uploadfield-item-info { background-color: #9e9e9e; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzllOWU5ZSIvPjxzdG9wIG9mZnNldD0iOCUiIHN0b3AtY29sb3I9IiM5ZDlkOWQiLz48c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iIzg3ODc4NyIvPjxzdG9wIG9mZnNldD0iNTQlIiBzdG9wLWNvbG9yPSIjODY4Njg2Ii8+PHN0b3Agb2Zmc2V0PSI5NiUiIHN0b3AtY29sb3I9IiM2YjZiNmIiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2YzZjNmMiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyYWQpIiAvPjwvc3ZnPiA='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #9e9e9e), color-stop(8%, #9d9d9d), color-stop(50%, #878787), color-stop(54%, #868686), color-stop(96%, #6b6b6b), color-stop(100%, #6c6c6c)); background-image: -webkit-linear-gradient(top, #9e9e9e 0%, #9d9d9d 8%, #878787 50%, #868686 54%, #6b6b6b 96%, #6c6c6c 100%); background-image: -moz-linear-gradient(top, #9e9e9e 0%, #9d9d9d 8%, #878787 50%, #868686 54%, #6b6b6b 96%, #6c6c6c 100%); background-image: -o-linear-gradient(top, #9e9e9e 0%, #9d9d9d 8%, #878787 50%, #868686 54%, #6b6b6b 96%, #6c6c6c 100%); background-image: linear-gradient(top, #9e9e9e 0%, #9d9d9d 8%, #878787 50%, #868686 54%, #6b6b6b 96%, #6c6c6c 100%); }
/** -------------------------------------------- Search forms (used in AssetAdmin, ModelAdmin, etc) -------------------------------------------- */ /** -------------------------------------------- Search forms (used in AssetAdmin, ModelAdmin, etc) -------------------------------------------- */
.cms-search-form { margin-bottom: 16px; } .cms-search-form { margin-bottom: 16px; }

View File

@ -1535,8 +1535,13 @@ body.cms-dialog {
} }
} }
.ss-uploadfield-editandorganize { .ss-assetuploadfield .ss-uploadfield-editandorganize {
display: none; .ss-uploadfield-files {
.ss-uploadfield-item-info {
background-color: grayscale(#5db4df);
@include background-image(linear-gradient(top, grayscale(#5db4df) 0%, grayscale(#5db1dd) 8%, grayscale(#439bcb) 50%, grayscale(#3f99cd) 54%, grayscale(#207db6) 96%, grayscale(#1e7cba) 100%));
}
}
} }
} }

View File

@ -428,8 +428,6 @@ class HtmlEditorField_Toolbar extends RequestHandler {
$computerUploadField->removeExtraClass('ss-uploadfield'); $computerUploadField->removeExtraClass('ss-uploadfield');
$computerUploadField->setTemplate('HtmlEditorField_UploadField'); $computerUploadField->setTemplate('HtmlEditorField_UploadField');
$computerUploadField->setFolderName(Config::inst()->get('Upload', 'uploads_folder')); $computerUploadField->setFolderName(Config::inst()->get('Upload', 'uploads_folder'));
// @todo - Remove this once this field supports display and recovery of file upload validation errors
$computerUploadField->setOverwriteWarning(false);
$tabSet = new TabSet( $tabSet = new TabSet(
"MediaFormInsertMediaTabs", "MediaFormInsertMediaTabs",

View File

@ -808,7 +808,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
}); });
ed.repaint(); ed.repaint();
}) });
this.getDialog().close(); this.getDialog().close();
return false; return false;
@ -926,8 +926,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
var uploadedFiles = $('.ss-uploadfield-files', this).children('.ss-uploadfield-item'); var uploadedFiles = $('.ss-uploadfield-files', this).children('.ss-uploadfield-item');
uploadedFiles.each(function(){ uploadedFiles.each(function(){
var uploadedID = $(this).data('fileid'); var uploadedID = $(this).data('fileid');
if ($.inArray(uploadedID, editFieldIDs) == -1) { if (uploadedID && $.inArray(uploadedID, editFieldIDs) == -1) {
//trigger the detail view for filling out details about the file we are about to insert into TinyMCE //trigger the detail view for filling out details about the file we are about to insert into TinyMCE
$(this).remove(); // Remove successfully added item from the queue
form.showFileView(uploadedID); form.showFileView(uploadedID);
} }
}); });

View File

@ -64,13 +64,16 @@
.addClass('ui-state-warning-text'); .addClass('ui-state-warning-text');
data.context.find('.ss-uploadfield-item-progress').hide(); data.context.find('.ss-uploadfield-item-progress').hide();
data.context.find('.ss-uploadfield-item-overwrite').show(); data.context.find('.ss-uploadfield-item-overwrite').show();
data.context.find('.ss-uploadfield-item-overwrite-warning').on('click', function(){ data.context.find('.ss-uploadfield-item-overwrite-warning').on('click', function(e){
data.context.find('.ss-uploadfield-item-progress').show(); data.context.find('.ss-uploadfield-item-progress').show();
data.context.find('.ss-uploadfield-item-overwrite').hide(); data.context.find('.ss-uploadfield-item-overwrite').hide();
data.context.find('.ss-uploadfield-item-status') data.context.find('.ss-uploadfield-item-status')
.removeClass('ui-state-warning-text'); .removeClass('ui-state-warning-text');
//upload only if the "overwrite" button is clicked //upload only if the "overwrite" button is clicked
$.blueimpUI.fileupload.prototype._onSend.call(that, e, data); $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
e.preventDefault(); // Avoid a form submit
return false;
}); });
} else { //regular file upload } else { //regular file upload
return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data); return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
@ -319,12 +322,14 @@
$('div.ss-upload .ss-uploadfield-startall').entwine({ $('div.ss-upload .ss-uploadfield-startall').entwine({
onclick: function(e) { onclick: function(e) {
this.closest('.ss-upload').find('.ss-uploadfield-item-start button').click(); this.closest('.ss-upload').find('.ss-uploadfield-item-start button').click();
e.preventDefault(); // Avoid a form submit
return false; return false;
} }
}); });
$('div.ss-upload .ss-uploadfield-item-cancelfailed').entwine({ $('div.ss-upload .ss-uploadfield-item-cancelfailed').entwine({
onclick: function(e) { onclick: function(e) {
this.closest('.ss-uploadfield-item').remove(); this.closest('.ss-uploadfield-item').remove();
e.preventDefault(); // Avoid a form submit
return false; return false;
} }
}); });
@ -349,6 +354,7 @@
fileupload._trigger('destroy', e, {context: item}); fileupload._trigger('destroy', e, {context: item});
} }
e.preventDefault(); // Avoid a form submit
return false; return false;
} }
}); });
@ -371,6 +377,7 @@
} }
e.preventDefault(); // Avoid a form submit e.preventDefault(); // Avoid a form submit
return false;
} }
}); });
$( 'div.ss-upload:not(.disabled):not(.readonly) .ss-uploadfield-item-edit').entwine({ $( 'div.ss-upload:not(.disabled):not(.readonly) .ss-uploadfield-item-edit').entwine({
@ -403,6 +410,7 @@
editform.toggleEditForm(); editform.toggleEditForm();
} }
e.preventDefault(); // Avoid a form submit e.preventDefault(); // Avoid a form submit
return false;
} }
}); });
@ -486,8 +494,9 @@
}); });
$('div.ss-upload .ss-uploadfield-fromfiles').entwine({ $('div.ss-upload .ss-uploadfield-fromfiles').entwine({
onclick: function(e) { onclick: function(e) {
e.preventDefault();
this.getUploadField().openSelectDialog(this.closest('.ss-uploadfield-item')); this.getUploadField().openSelectDialog(this.closest('.ss-uploadfield-item'));
e.preventDefault(); // Avoid a form submit
return false;
} }
}); });
}); });