Merge branch 'szzh' into develop

This commit is contained in:
huang 2015-10-20 11:05:00 +08:00
commit fde42fd1a6
15 changed files with 438 additions and 186 deletions

View File

@ -125,16 +125,18 @@ class SchoolController < ApplicationController
end
end
if(condition == '')
@school = School.all
@school = School.page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.count
else
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").all
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
end
result = []
# @school.each do |sc|
# result << {:value=>sc.name,:data=>sc.id}
# end
render :json => @school.to_json
render :json =>{ :schools => @school,:count=>@school_count}.to_json
end
#添加学校

View File

@ -50,6 +50,8 @@ class Course < ActiveRecord::Base
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
validates_length_of :description, :maximum => 10000
before_save :self_validate
# 公开课程变成私有课程,所有资源都变成私有
after_update :update_files_public
after_create :create_board_sync, :act_as_course_activity, :act_as_course_message
before_destroy :delete_all_members
@ -213,6 +215,14 @@ class Course < ActiveRecord::Base
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
@board = self.boards.build

View File

@ -23,11 +23,12 @@
</div>
<% 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>
<%= file_field_tag 'attachments[dummy][file]',
<% if @course %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => ie8? ? '':'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this,"'+ checkBox.to_s+'");',
:onchange => 'addInputFilesCourseSource(this,"'+ checkBox.to_s+'");',
:style => ie8? ? '': 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
@ -40,6 +41,26 @@
:file_count => l(:label_file_count),
: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;">-->
<span id="upload_file_count">

View File

@ -39,7 +39,7 @@
</span>
<% else %>
<span id="is_public_<%= file.id %>">
<a class="f_l re_open c_blue">私有</a>
<span class="f_l re_open c_blue">私有</span>
</span>
<% end %>

View File

@ -542,19 +542,41 @@
});
}
var lastSearchCondition = '';
var page = 1; //唯一控制页码 变量
var count = 0; //查询结果的总量
var maxPage = 0 ;//最大页面值
$(function() {
// $("input[name='province']").keydown(function(e){
// if(e.keyCode == 13 && $("#search_school_result_list").css('display') == 'block'){
// str = $("#search_school_result_list").children().eq(0).attr('onclick').match(/\(.*\)/)[0]
//
// str = str.replace(/\(/,'').replace(/\)/,'');
// arr = str.split(',');
// id = arr[1].replace(/\'/,'')
// name = arr.replace(/\'/,'')
// changeValue(name,id);
// return false;
// }
// });
$("#search_school_result_list").scroll(function(e){
nScrollHight = $(this)[0].scrollHeight;
nScrollTop = $(this)[0].scrollTop;
var nDivHight = $(this).height();
if(nScrollTop + nDivHight >= nScrollHight) //到底部了,
{
//判断页码是否是最大值,如果是的,就不去请求了
if(page >= maxPage){
return;
}else{ //如果不是,那就请求下一页,请求数据处理
page ++;
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + $("input[name='province']").val() + '&page=' + page,
type: 'post',
success: function (data) {
schoolsResult = data.schools;
if (schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
for (; i < schoolsResult.length; i++) {
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
} else {
}
}
});
}
}
});
//查询学校
$("input[name='province']").on('input', function (e) {
throttle(shcool_search_fn,window,e);
@ -568,20 +590,25 @@
}
function shcool_search_fn(e){
$("input[name='occupation']").val(''); //一旦有输入就清空id。
if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){
if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){//如果输入框没有改变或者输入框为空就返回
return;
}
$("input[name='occupation']").val(''); //一旦有输入就清空id。
lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value,
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
type: 'post',
success: function (data) {
if(data.length != undefined && data.length != 0) {
schoolsResult = data.schools;
count = data.count;
maxPage = count % 100 + 1; //最大页码值
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < data.length; i++) {
link = '<a onclick="window.changeValue(\'' + data[i].school.name.replace(/\s/g," ") + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>';
for (; i < schoolsResult.length; i++) {
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
@ -590,7 +617,7 @@
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
$("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校');
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校');
$("#hint").show();
}else{
$("#hint").hide();
@ -610,45 +637,46 @@
$("#search_school_result_list").hide();
$("#hint").hide();
}
})
$("input[name='province']").on('focus', function (e) {
if($(e.target).val() == ''){ //
return;
}
if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在不用去找了。
return;
}
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value,
type: 'post',
success: function (data) {
if(data.length != undefined && data.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < data.length; i++) {
link = '<a onclick="window.changeValue(\'' + data[i].school.name.replace(/\s/g," ") + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
if ($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6) + "..." : e.target.value;
$("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校');
$("#hint").show();
} else {
$("#hint").hide();
}
}else {
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
$("#hint").html('没有找到包含"'+str+'"的高校,<a style="color:#64bdd9" onclick="add_school(\''+ e.target.value+'\');" href="javascript:void(0);">创建高校</a>');
$("#hint").show();
}
}
});
});
// $("input[name='province']").on('focus', function (e) {
// if($(e.target).val() == ''){ //
// return;
// }
// if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在不用去找了。
// return;
// }
//
// $.ajax({
// url: '<%#= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value,
// type: 'post',
// success: function (data) {
// if(data.length != undefined && data.length != 0) {
// var i = 0;
// $("#search_school_result_list").html('');
// for (; i < data.length; i++) {
// link = '<a onclick="window.changeValue(\'' + data[i].school.name.replace(/\s/g," ") + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>';
// $("#search_school_result_list").append(link);
// }
// $("#search_school_result_list").css('left', $(e.target).offset().left);
// $("#search_school_result_list").css('top', $(e.target).offset().top + 28);
// $("#search_school_result_list").css("position", "absolute");
// $("#search_school_result_list").show();
// if ($(e.target).val().trim() != '') {
// str = e.target.value.length > 8 ? e.target.value.substr(0, 6) + "..." : e.target.value;
// $("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校');
// $("#hint").show();
// } else {
// $("#hint").hide();
// }
// }else {
// $("#search_school_result_list").html('');
// str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
// $("#hint").html('没有找到包含"'+str+'"的高校,<a style="color:#64bdd9" onclick="add_school(\''+ e.target.value+'\');" href="javascript:void(0);">创建高校</a>');
// $("#hint").show();
// }
// }
// });
// });
// $("#province").leanModal({top: 100, closeButton: ".modal_close"});

View File

@ -61,7 +61,7 @@ function showPreview(source) {
</select>
</div>
<div style="margin-top: 10px;">
<input type="button" value="提交" onclick="submit_edit_school($(this));" class="mr5 submit_btn" />
<input type="button" value="提交" onclick="submit_edit_school($(this));" class="mr5 submit_btn_s" />
<input type="button" value="取消" onclick="history.go(-1);" class="cancel_btn" />
<%#= submit_tag('提交',:class=>'mr5') %>
<%#= submit_tag('取消') %>

View File

@ -44,10 +44,18 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了课程作业:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
<% 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))" %></a></li>
:onmouseout => "message_titile_hide($(this))" %>
<% else %>
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
<% end %>
</a></li>
<div style="display: none" class="message_title_red system_message_style">
<% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
<p>
@ -55,7 +63,7 @@
<%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
</p>
<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.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>
@ -68,7 +76,7 @@
<% else %>
<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>
(<%= 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.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>
@ -99,7 +107,7 @@
<%= 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.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>
@ -107,7 +115,7 @@
<p>请同学们抓紧时间提交自己的作品,谢谢!</p>
<% else %>
<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.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>
@ -142,7 +150,7 @@
<%= 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+"老师") %>开启了匿评,作业详情如下:
</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.homework_detail_manual.absence_penalty %>分</span></p>
<p>
@ -172,7 +180,7 @@
<%= 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+"老师") %>关闭了匿评,作业详情如下:
</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>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
@ -201,7 +209,7 @@
<p> 失败原因提交作品的人数低于2人</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.end_time%>&nbsp;&nbsp;24点</span>
@ -288,7 +296,11 @@
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li>
<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>
<% content = ma.content.gsub("作业评分:","").split("&nbsp;&nbsp;&nbsp; 评语:")%>
<p>
@ -348,13 +360,15 @@
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<div class="fl">回复人:</div>
<div class="ml36"><%= ma.course_message.user.show_name %></div>
<p>
<%= 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="ml60"><%= ma.course_message.notes %></div>
<div class="fl">您的评论:</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>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -0,0 +1,23 @@
class UpdateAttachment < ActiveRecord::Migration
def up
count = Attachment.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Attachment.page(i).per(30).each do |attachment|
if attachment.container_type == 'Course'
course = attachment.course
if course
if course.is_public == 0
attachment.is_public = 0
attachment.save
end
end
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,17 @@
class DeleteNullCourseActivity < 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|
unless activity.course_act
activity.destroy
end
end
end
end
end
def down
end
end

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.
ActiveRecord::Schema.define(:version => 20151014023806) do
ActiveRecord::Schema.define(:version => 20151020021234) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false

View File

@ -88,7 +88,7 @@ function addFile_board(inputEl, file, eagerUpload, id) {
return null;
}
function addFile(inputEl, file, eagerUpload,checkBox) {
function addFile(inputEl, file, eagerUpload) {
var attachments_frame = '#attachments_fields';
if ($(attachments_frame).children().length < 30) {
@ -99,28 +99,7 @@ function addFile(inputEl, file, eagerUpload,checkBox) {
'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',
@ -148,11 +127,11 @@ function addFile(inputEl, file, eagerUpload,checkBox) {
$('<a>&nbsp</a>').attr({
'href': "#",
'class': 'remove-upload'
}).click(function () {
}).click(function() {
if (confirm($(inputEl).data('areYouSure'))) {
removeFile();
if (!eagerUpload) {
(function (e) {
(function(e) {
reload(e);
})(fileSpan);
}
@ -164,7 +143,6 @@ function addFile(inputEl, file, eagerUpload,checkBox) {
'name': 'div_' + 'attachments_' + attachmentId
})
).appendTo('#attachments_fields');
}
if (eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl);
@ -297,9 +275,9 @@ function removeAll(containerid) {
}
}
// return false;
}
//modify by yutao 2015-5-14 <20><>1<EFBFBD><31>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>ϴ<EFBFBD><CFB4>ؼ<EFBFBD>ʱ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bug <20>ʸ<EFBFBD>֮ end
//gcm
}
//modify by yutao 2015-5-14 <20><>1<EFBFBD><31>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>ϴ<EFBFBD><CFB4>ؼ<EFBFBD>ʱ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bug <20>ʸ<EFBFBD>֮ end
//gcm
function uploadBlob(blob, uploadUrl, attachmentId, options) {
@ -335,11 +313,10 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
}
function addInputFiles(inputEl) {
checkBox = arguments[1] == 'public' ? false : true;
// var clearedFileInput = $(inputEl).clone().val('');
if (inputEl.files) {
// upload files using ajax
uploadAndAttachFiles(inputEl.files, inputEl,checkBox);
uploadAndAttachFiles(inputEl.files, inputEl);
// $(inputEl).remove();
} else {
// browser not supporting the file API, upload on form submission
@ -386,7 +363,7 @@ function addInputFiles_board(inputEl, id) {
//clearedFileInput.insertAfter('#attachments_fields');
}
function uploadAndAttachFiles(files, inputEl,checkBox) {
function uploadAndAttachFiles(files, inputEl) {
var maxFileSize = $(inputEl).data('max-file-size');
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
@ -401,7 +378,7 @@ function uploadAndAttachFiles(files, inputEl,checkBox) {
window.alert(maxFileSizeExceeded);
} else {
$.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"){
show_btn.css("float", options.float);
sideContent.css('width', 0);
show_btn.css('width', 25);
show_btn.css('width', 28);
}
//close
closeBtn.bind("click",function(){
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','','','');
});
//show

View File

@ -12,8 +12,8 @@ li{list-style-type:none;}
/*Tim 151019*/
.schoolName {border:1px solid #dddddd; outline: none; width: 180px; height: 22px;}
.provinceSelect {border: 1px solid #dddddd; outline: none; color: #888888;}
.submit_btn {background-color: #269ac9; color: #ffffff; padding: 2px 5px; border: none; border-radius: 3px; cursor: pointer;}
.submit_btn:hover {background-color:#297fb8;}
.submit_btn_s {background-color: #269ac9; color: #ffffff; padding: 2px 5px; border: none; border-radius: 3px; cursor: pointer;}
.submit_btn_s:hover {background-color:#297fb8;}
.cancel_btn {background-color: #c1c1c1; color: #ffffff; padding: 2px 5px; border: none; border-radius: 3px; cursor: pointer;}
.cancel_btn:hover {background-color:#656565; }
/*huang*/

View File

@ -292,6 +292,7 @@ a.re_open{display:block; width:46px; border:1px solid #64bdd9; color:#64bdd9;
a:hover.re_open{ background:#64bdd9; color:#fff; text-decoration:none;}
a.re_de{ color:#6883b6; margin-left:15px;}
.re_con_box{ border-bottom:1px dashed #dadada; padding-bottom:10px; margin-bottom:10px;}
span.re_open{display:block; width:46px; border:1px solid #64bdd9; color:#64bdd9; margin-left:10px;padding:1px 5px;text-align: center}
/* 作业列表 */