Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-10-20 14:39:13 +08:00
commit 5da45ac806
7 changed files with 303 additions and 122 deletions

View File

@ -50,6 +50,8 @@ class Course < ActiveRecord::Base
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
validates_length_of :description, :maximum => 10000 validates_length_of :description, :maximum => 10000
before_save :self_validate before_save :self_validate
# 公开课程变成私有课程,所有资源都变成私有
after_update :update_files_public
after_create :create_board_sync, :act_as_course_activity, :act_as_course_message after_create :create_board_sync, :act_as_course_activity, :act_as_course_message
before_destroy :delete_all_members before_destroy :delete_all_members
@ -213,6 +215,14 @@ class Course < ActiveRecord::Base
end end
def update_files_public
unless self.is_public?
self.attachments.each do |a|
a.update_attributes(:is_public => false)
end
end
end
# 创建课程讨论区 # 创建课程讨论区
def create_board_sync def create_board_sync
@board = self.boards.build @board = self.boards.build

View File

@ -23,11 +23,12 @@
</div> </div>
<% checkBox = (@course.present? && @course.is_public?) ? 'public' : 'private'%> <% checkBox = (@course.present? && @course.is_public?) ? 'public' : 'private'%>
<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse) %></button> <button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse) %></button>
<% if @course %>
<%= file_field_tag 'attachments[dummy][file]', <%= file_field_tag 'attachments[dummy][file]',
:id => '_file', :id => '_file',
:class => ie8? ? '':'file_selector', :class => ie8? ? '':'file_selector',
:multiple => true, :multiple => true,
:onchange => 'addInputFiles(this,"'+ checkBox.to_s+'");', :onchange => 'addInputFilesCourseSource(this,"'+ checkBox.to_s+'");',
:style => ie8? ? '': 'display:none', :style => ie8? ? '': 'display:none',
:data => { :data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
@ -40,6 +41,26 @@
:file_count => l(:label_file_count), :file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all) :delete_all_files => l(:text_are_you_sure_all)
} %> } %>
<% else %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => ie8? ? '':'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => ie8? ? '': 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js'),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<% end %>
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">--> <!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
<span id="upload_file_count"> <span id="upload_file_count">

View File

@ -44,10 +44,18 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了课程作业:</span> <span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了课程作业:</span>
</li> </li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
<%= link_to ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
<% else %>
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)", :onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li> :onmouseout => "message_titile_hide($(this))" %>
<% end %>
</a></li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %> <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
<p> <p>
@ -55,7 +63,7 @@
<%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业: <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
</p> </p>
<p>课程名称:<%= ma.course_message.course.name %> <p>课程名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.term %>)</p> (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p> <p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;24点</span></p> <p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;24点</span></p>
@ -68,7 +76,7 @@
<% else %> <% else %>
<p><%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:</p> <p><%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:</p>
<p>课程名称:<%= ma.course_message.course.name %> <p>课程名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.term %>)</p> (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p> <p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span></p> <p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span></p>
@ -99,7 +107,7 @@
<%= User.current.lastname + User.current.firstname %>同学您好! <%= User.current.lastname + User.current.firstname %>同学您好!
<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了: <%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
</p> </p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p> <p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p> <p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span></p> <p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span></p>
@ -107,7 +115,7 @@
<p>请同学们抓紧时间提交自己的作品,谢谢!</p> <p>请同学们抓紧时间提交自己的作品,谢谢!</p>
<% else %> <% else %>
<p><%= User.current.lastname + User.current.firstname %>老师您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:</p> <p><%= User.current.lastname + User.current.firstname %>老师您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p> <p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p> <p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;24点</span></p> <p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;24点</span></p>
@ -142,7 +150,7 @@
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好! <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
<%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下: <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
</p> </p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p> <p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></p> <p>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></p>
<p> <p>
@ -172,7 +180,7 @@
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好! <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
<%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>关闭了匿评,作业详情如下: <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>关闭了匿评,作业详情如下:
</p> </p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p> <p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
@ -201,7 +209,7 @@
<p> 失败原因提交作品的人数低于2人</p> <p> 失败原因提交作品的人数低于2人</p>
</p> </p>
<p>作业详情如下:</p> <p>作业详情如下:</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p> <p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p> <p>
提交截止:<span style="color:Red;"><%= ma.course_message.end_time%>&nbsp;&nbsp;24点</span> 提交截止:<span style="color:Red;"><%= ma.course_message.end_time%>&nbsp;&nbsp;24点</span>
@ -288,7 +296,11 @@
:onmouseover =>"message_titile_show($(this),event)", :onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li> :onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style" > <div style="display: none" class="message_title_red system_message_style" >
<p>课程名称:<%= ma.course.name %>(<%= ma.course.term %>)</p> <p>
<%= User.current.show_name %>同学您好!
<%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
</p>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%=ma.course_message.student_work.homework_common.name %></span></p> <p>作业标题:<span style="color:Red;"><%=ma.course_message.student_work.homework_common.name %></span></p>
<% content = ma.content.gsub("作业评分:","").split("&nbsp;&nbsp;&nbsp; 评语:")%> <% content = ma.content.gsub("作业评分:","").split("&nbsp;&nbsp;&nbsp; 评语:")%>
<p> <p>
@ -348,13 +360,15 @@
:onmouseout => "message_titile_hide($(this))" %></a> :onmouseout => "message_titile_hide($(this))" %></a>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<div class="fl">回复人:</div> <p>
<div class="ml36"><%= ma.course_message.user.show_name %></div> <%= User.current.show_name %>老师您好!
<%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"学生"%>回复了您的作品评论。详情如下:
</p>
<div class="fl">回复内容:</div> <div class="fl">回复内容:</div>
<div class="ml60"><%= ma.course_message.notes %></div> <div class="ml60"><%= ma.course_message.notes %></div>
<div class="fl">您的评论:</div> <div class="fl">您的评论:</div>
<div class="ml60"><%= ma.course_message.jour.comment %></div> <div class="ml60"><%= ma.course_message.jour.comment %></div>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.term %>)</p> <p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%=ma.course_message.jour.student_work.homework_common.name %></span></p> <p>作业标题:<span style="color:Red;"><%=ma.course_message.jour.student_work.homework_common.name %></span></p>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -0,0 +1,23 @@
class UpdateCourseActivity < ActiveRecord::Migration
def up
count = CourseActivity.all.count / 30 + 2
transaction do
for i in 1 ... count do i
CourseActivity.page(i).per(30).each do |activity|
if activity.course_act
if activity.course_act_type == 'Poll'
if activity.course_act.polls_status == 1
activity.destroy
end
end
else
activity.destroy
end
end
end
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151020014759) do ActiveRecord::Schema.define(:version => 20151020021234) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false

View File

@ -88,7 +88,7 @@ function addFile_board(inputEl, file, eagerUpload, id) {
return null; return null;
} }
function addFile(inputEl, file, eagerUpload,checkBox) { function addFile(inputEl, file, eagerUpload) {
var attachments_frame = '#attachments_fields'; var attachments_frame = '#attachments_fields';
if ($(attachments_frame).children().length < 30) { if ($(attachments_frame).children().length < 30) {
@ -99,28 +99,7 @@ function addFile(inputEl, file, eagerUpload,checkBox) {
'id': 'attachments_' + attachmentId, 'id': 'attachments_' + attachmentId,
'class': 'attachment' 'class': 'attachment'
}); });
//alert(checkBox);
if(checkBox){
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('descriptionPlaceholder')
}).toggle(!eagerUpload),
$('<div>', {
'class': 'div_attachments',
'name': 'div_' + 'attachments_' + attachmentId
})
).appendTo('#attachments_fields');
}else {
fileSpan.append( fileSpan.append(
$('<input>', { $('<input>', {
'type': 'text', 'type': 'text',
@ -164,7 +143,6 @@ function addFile(inputEl, file, eagerUpload,checkBox) {
'name': 'div_' + 'attachments_' + attachmentId 'name': 'div_' + 'attachments_' + attachmentId
}) })
).appendTo('#attachments_fields'); ).appendTo('#attachments_fields');
}
if (eagerUpload) { if (eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl); ajaxUpload(file, attachmentId, fileSpan, inputEl);
@ -335,11 +313,10 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
} }
function addInputFiles(inputEl) { function addInputFiles(inputEl) {
checkBox = arguments[1] == 'public' ? false : true;
// var clearedFileInput = $(inputEl).clone().val(''); // var clearedFileInput = $(inputEl).clone().val('');
if (inputEl.files) { if (inputEl.files) {
// upload files using ajax // upload files using ajax
uploadAndAttachFiles(inputEl.files, inputEl,checkBox); uploadAndAttachFiles(inputEl.files, inputEl);
// $(inputEl).remove(); // $(inputEl).remove();
} else { } else {
// browser not supporting the file API, upload on form submission // browser not supporting the file API, upload on form submission
@ -386,7 +363,7 @@ function addInputFiles_board(inputEl, id) {
//clearedFileInput.insertAfter('#attachments_fields'); //clearedFileInput.insertAfter('#attachments_fields');
} }
function uploadAndAttachFiles(files, inputEl,checkBox) { function uploadAndAttachFiles(files, inputEl) {
var maxFileSize = $(inputEl).data('max-file-size'); var maxFileSize = $(inputEl).data('max-file-size');
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message'); var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
@ -401,7 +378,7 @@ function uploadAndAttachFiles(files, inputEl,checkBox) {
window.alert(maxFileSizeExceeded); window.alert(maxFileSizeExceeded);
} else { } else {
$.each(files, function() { $.each(files, function() {
addFile(inputEl, this, true,checkBox); addFile(inputEl, this, true);
}); });
} }
} }
@ -490,3 +467,139 @@ $(function() {
} }
}); });
}); });
//课程课件
function addInputFilesCourseSource(inputEl) {
checkBox = arguments[1] == 'public' ? false : true;
// var clearedFileInput = $(inputEl).clone().val('');
if (inputEl.files) {
// upload files using ajax
uploadAndAttachFilesCourseSource(inputEl.files, inputEl,checkBox);
// $(inputEl).remove();
} else {
// browser not supporting the file API, upload on form submission
var attachmentId;
var aFilename = inputEl.value.split(/\/|\\/);
var count = $('#attachments_fields>span').length;
attachmentId = addFile(inputEl, {
name: aFilename[aFilename.length - 1]
}, false);
if (attachmentId) {
$(inputEl).attr({
name: 'attachments[' + attachmentId + '][file]'
}).hide();
if (count <= 0) count = 1;
$('#upload_file_count').html("<span id=\"count\">" + count + "</span>" + $(inputEl).data('fileCount'));
}
}
//clearedFileInput.insertAfter('#attachments_fields');
}
function uploadAndAttachFilesCourseSource(files, inputEl,checkBox) {
var maxFileSize = $(inputEl).data('max-file-size');
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
var sizeExceeded = false;
$.each(files, function() {
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {
sizeExceeded = true;
}
});
if (sizeExceeded) {
window.alert(maxFileSizeExceeded);
} else {
$.each(files, function() {
addFileCourseSource(inputEl, this, true,checkBox);
});
}
}
function addFileCourseSource(inputEl, file, eagerUpload,checkBox) {
var attachments_frame = '#attachments_fields';
if ($(attachments_frame).children().length < 30) {
deleteallfiles = $(inputEl).data('deleteAllFiles');
var attachmentId = addFile.nextAttachmentId++;
var fileSpan = $('<span>', {
'id': 'attachments_' + attachmentId,
'class': 'attachment'
});
//alert(checkBox);
if(checkBox){
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('descriptionPlaceholder')
}).toggle(!eagerUpload),
$('<div>', {
'class': 'div_attachments',
'name': 'div_' + 'attachments_' + attachmentId
})
).appendTo('#attachments_fields');
}else {
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('descriptionPlaceholder')
}).toggle(!eagerUpload),
$('<span >' + $(inputEl).data('fieldIsPublic') + ':</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>&nbsp</a>').attr({
'href': "#",
'class': 'remove-upload'
}).click(function () {
if (confirm($(inputEl).data('areYouSure'))) {
removeFile();
if (!eagerUpload) {
(function (e) {
reload(e);
})(fileSpan);
}
}
}).toggle(!eagerUpload),
$('<div>', {
'class': 'div_attachments',
'name': 'div_' + 'attachments_' + attachmentId
})
).appendTo('#attachments_fields');
}
if (eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl);
}
return attachmentId;
}
return null;
}
addFileCourseSource.nextAttachmentId = 1;

View File

@ -19,12 +19,12 @@
if(options.minStatue == "true"){ if(options.minStatue == "true"){
show_btn.css("float", options.float); show_btn.css("float", options.float);
sideContent.css('width', 0); sideContent.css('width', 0);
show_btn.css('width', 25); show_btn.css('width', 28);
} }
//close //close
closeBtn.bind("click",function(){ closeBtn.bind("click",function(){
sideContent.animate({width: '0px'},"fast"); sideContent.animate({width: '0px'},"fast");
show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast"); show_btn.stop(true, true).delay(300).animate({ width: '28px'},"fast");
cookiesave('minStatue','true','','',''); cookiesave('minStatue','true','','','');
}); });
//show //show