|
|
|
@ -15,7 +15,9 @@ function postUpMsg(attachmentId)
|
|
|
|
|
function addFile(inputEl, file, eagerUpload) {
|
|
|
|
|
|
|
|
|
|
if ($('#attachments_fields').children().length < 10) {
|
|
|
|
|
|
|
|
|
|
alert($(inputEl).data('description_placeholder'));
|
|
|
|
|
alert($(inputEl).data('label_public'));
|
|
|
|
|
alert($(inputEl).data('are_you_sure'));
|
|
|
|
|
var attachmentId = addFile.nextAttachmentId++;
|
|
|
|
|
|
|
|
|
|
var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' });
|
|
|
|
@ -23,7 +25,7 @@ function addFile(inputEl, file, eagerUpload) {
|
|
|
|
|
fileSpan.append(
|
|
|
|
|
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
|
|
|
|
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
|
|
|
|
|
$('<span >公开:</span>').attr({ 'class': 'ispublic-label' }) ,
|
|
|
|
|
$('<span >'+$(inputEl).data('label_public')+'</span>').attr({ 'class': 'ispublic-label' }) ,
|
|
|
|
|
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload),
|
|
|
|
|
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
|
|
|
|
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
|
|
|
@ -87,7 +89,6 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
|
|
|
|
|
|
|
|
|
var count=$('#attachments_fields>span').length;
|
|
|
|
|
$('#upload_file_count').html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
|
|
|
|
|
|
|
|
|
|
if(count>=1){
|
|
|
|
|
var add_attachs=$('.add_attachment');
|
|
|
|
|
var delete_all=$('.remove_all');
|
|
|
|
|