Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
0fdf10649c
|
@ -176,12 +176,6 @@ class FilesController < ApplicationController
|
|||
|
||||
def index
|
||||
@flag = params[:flag] || false
|
||||
#sort_init 'filename', 'asc'
|
||||
# sort_init 'created_on', 'desc'
|
||||
# sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
# 'filename' => "#{Attachment.table_name}.filename",
|
||||
# 'size' => "#{Attachment.table_name}.filesize",
|
||||
# 'downloads' => "#{Attachment.table_name}.downloads"
|
||||
sort = ""
|
||||
@sort = ""
|
||||
@order = ""
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<a href="javascript:void(0)" class="upimg fl">
|
||||
<%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
|
||||
</a>
|
||||
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
|
||||
<a href="javascript:void(0)" class="upbtn fl"><%= l(:button_upload_photo) %></a>
|
||||
<a href="javascript:void(0)" class="upbtn fl" onclick="$('#upload_img').click();"><%= l(:button_upload_photo) %></a>
|
||||
<%= file_field_tag 'avatar[image]',
|
||||
:id => nil,
|
||||
:class => 'upload_file',
|
||||
:id => "upload_img",
|
||||
:class => 'undis',
|
||||
:size => "1",
|
||||
:multiple => true,
|
||||
:data => {
|
||||
|
|
|
@ -4,7 +4,7 @@ class AlterActivities < ActiveRecord::Migration
|
|||
if activity.act_type == 'JournalsForMessage'
|
||||
if activity.act
|
||||
unless activity.act.m_parent_id.nil?
|
||||
parent_act = UserActivity.where("act_id = #{activity.act.parent.id} and act_type='JournalsForMessage' and container_type='Course'").first
|
||||
parent_act = UserActivity.where("act_id = #{activity.act.m_parent_id} and act_type='JournalsForMessage' and container_type='Course'").first
|
||||
if parent_act
|
||||
parent_act.created_at = activity.act.parent.children.maximum("created_on")
|
||||
parent_act.save
|
||||
|
@ -21,7 +21,7 @@ class AlterActivities < ActiveRecord::Migration
|
|||
if activity.course_act_type == 'JournalsForMessage'
|
||||
if activity.course_act
|
||||
unless activity.course_act.m_parent_id.nil?
|
||||
parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent.id} and course_act_type='JournalsForMessage'").first
|
||||
parent_act = CourseActivity.where("course_act_id = #{activity.course_act.m_parent_id} and course_act_type='JournalsForMessage'").first
|
||||
if parent_act
|
||||
parent_act.created_at = activity.course_act.parent.children.maximum("created_on")
|
||||
parent_act.save
|
||||
|
@ -34,7 +34,7 @@ class AlterActivities < ActiveRecord::Migration
|
|||
elsif activity.course_act_type == 'Message'
|
||||
if activity.course_act
|
||||
unless activity.course_act.parent_id.nil?
|
||||
parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent.id} and course_act_type='Message'").first
|
||||
parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent_id} and course_act_type='Message'").first
|
||||
if parent_act
|
||||
parent_act.created_at = activity.course_act.parent.children.maximum("created_on")
|
||||
parent_act.save
|
||||
|
|
|
@ -446,63 +446,45 @@ function check_late_penalty(id)
|
|||
}
|
||||
|
||||
//验证匿评数量
|
||||
function regex_evaluation_num()
|
||||
{
|
||||
if($("#evaluation_num").length == 0){ return true;}
|
||||
var evaluation_num = $.trim($("#evaluation_num").val());
|
||||
var regex = /^\d+$/;
|
||||
if(evaluation_num=="")
|
||||
{
|
||||
$("#evaluation_num_notice").html("匿评分配数量不能为空");
|
||||
$("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
|
||||
return false;
|
||||
}
|
||||
else if(regex.test(evaluation_num))
|
||||
{
|
||||
if(evaluation_num > 0)
|
||||
{
|
||||
$("#evaluation_num_notice").html("每个学生将收到<span class='c_red'> "+ parseInt(evaluation_num) + " </span>份待匿评作品");
|
||||
$("#evaluation_num_notice").removeClass("c_red");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#evaluation_num_notice").html("匿评分配数量必须为大于0");
|
||||
$("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#evaluation_num_notice").html("匿评分配数量只能为数字");
|
||||
$("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//点击是否开启匿评单选框效果
|
||||
$(function(){
|
||||
//$("#homework_common_homework_type").click(function(){
|
||||
// if($("#homework_common_homework_type").attr("checked") == "checked")
|
||||
//function regex_evaluation_num()
|
||||
//{
|
||||
// $("#evaluation_setting").slideDown();
|
||||
// $("#ta_proportion").removeAttr("disabled");
|
||||
// if($("#evaluation_num").length == 0){ return true;}
|
||||
// var evaluation_num = $.trim($("#evaluation_num").val());
|
||||
// var regex = /^\d+$/;
|
||||
// if(evaluation_num=="")
|
||||
// {
|
||||
// $("#evaluation_num_notice").html("匿评分配数量不能为空");
|
||||
// $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
|
||||
// return false;
|
||||
// }
|
||||
// else if(regex.test(evaluation_num))
|
||||
// {
|
||||
// if(evaluation_num > 0)
|
||||
// {
|
||||
// $("#evaluation_num_notice").html("每个学生将收到<span class='c_red'> "+ parseInt(evaluation_num) + " </span>份待匿评作品");
|
||||
// $("#evaluation_num_notice").removeClass("c_red");
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $("#evaluation_setting").slideUp();
|
||||
// $("#ta_proportion").attr("disabled","disabled");
|
||||
// $("#evaluation_num_notice").html("匿评分配数量必须为大于0");
|
||||
// $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $("#evaluation_num_notice").html("匿评分配数量只能为数字");
|
||||
// $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
//});
|
||||
|
||||
//点击是否开启匿评单选框效果
|
||||
$(function(){
|
||||
$("#absence_penalty").change(function(){
|
||||
$("#absence_penalty_notice").html(" "+ $("#absence_penalty").val() +" ");
|
||||
});
|
||||
|
||||
//$("#ta_proportion").change(function(){
|
||||
// var ta_proportion = $("#ta_proportion").val();
|
||||
// $("#student_proportion").val((100 - parseInt(ta_proportion * 100)) + "%");
|
||||
//});
|
||||
});
|
||||
|
||||
//生成select
|
||||
|
@ -519,40 +501,100 @@ function build_selector(max_num){
|
|||
return html;
|
||||
}
|
||||
|
||||
//第一次加载时,如果未开启匿评作业,隐藏显示匿评配置信息
|
||||
//$(function(){
|
||||
// if($("#homework_common_homework_type").attr("id") != null && $("#homework_common_homework_type").val() != 2)
|
||||
//提交匿评参数设置
|
||||
function submit_set_evaluation_attr(end_time){
|
||||
if(!regex_evaluation_start(end_time)){
|
||||
$("#evaluation_start_time").focus();
|
||||
}
|
||||
else if(!regex_evaluation_end()){
|
||||
$("#evaluation_end_time").focus();
|
||||
}
|
||||
else if(!regex_evaluation_num()){
|
||||
$("#evaluation_num").focus();
|
||||
}
|
||||
else{
|
||||
$('#popbox02 form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
//验证匿评开启时间:大于截止时间,或者为空
|
||||
function regex_evaluation_start(end_time){
|
||||
var evaluation_start = $.trim($("#evaluation_start_time").val());
|
||||
if(evaluation_start == ""){
|
||||
$("#homework_evaluation_start_time").text("开启匿评日期不能为空");
|
||||
return false;
|
||||
}
|
||||
var end_time = new Date(end_time);
|
||||
var evaluation_start_time = new Date(evaluation_start);
|
||||
if(evaluation_start_time > end_time){
|
||||
$("#homework_evaluation_start_time").text("");
|
||||
return true;
|
||||
}else{
|
||||
$("#homework_evaluation_start_time").text("开启匿评日期必须大于截止日期");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//验证匿评结束时间:大于匿评开启时间,或者为空。当匿评开启时间为空时,匿评结束时间必须为空
|
||||
function regex_evaluation_end(){
|
||||
var evaluation_start = $.trim($("#evaluation_start_time").val());
|
||||
var evaluation_end = $.trim($("#evaluation_end_time").val());
|
||||
if(evaluation_end == ""){
|
||||
$("#homework_evaluation_end_time").text("关闭匿评日期不能为空");
|
||||
return true;
|
||||
}
|
||||
var evaluation_start_time = new Date(evaluation_start);
|
||||
var evaluation_end_time = new Date(evaluation_end);
|
||||
if(evaluation_end_time > evaluation_start_time){
|
||||
$("#homework_evaluation_end_time").text("");
|
||||
return true;
|
||||
}else{
|
||||
$("#homework_evaluation_end_time").text("关闭匿评日期必须大于开启匿评日期");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//验证匿评数量
|
||||
function regex_evaluation_num(){
|
||||
var evaluation_num = $.trim($("#evaluation_num").val());
|
||||
var regex = /^\d+$/;
|
||||
if(evaluation_num==""){
|
||||
$("#evaluation_num_notice").text("匿评人数不能为空");
|
||||
return false;
|
||||
}
|
||||
else if(regex.test(evaluation_num)){
|
||||
if(evaluation_num > 0){
|
||||
$("#evaluation_num_notice").html("");
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
$("#evaluation_num_notice").text("匿评人数必须为大于0");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$("#evaluation_num_notice").text("匿评人数只能为数字");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//老师提交 新建/修改 作业
|
||||
//function submit_homework(id)
|
||||
//{
|
||||
// if($("#homework_common_homework_type").attr("checked") == "checked")
|
||||
// if(!regex_homework_name())
|
||||
// {
|
||||
// $("#evaluation_setting").show();
|
||||
// $("#ta_proportion").removeAttr("disabled");
|
||||
// $("#homework_name").focus();
|
||||
// }
|
||||
// else if(!regex_evaluation_num())
|
||||
// {
|
||||
// $("#evaluation_num").focus();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $("#evaluation_setting").hide();
|
||||
// $("#ta_proportion").attr("disabled","disabled");
|
||||
// homework_description_editor.sync();
|
||||
// $("#"+id).submit();
|
||||
// }
|
||||
//}
|
||||
//});
|
||||
|
||||
//老师提交 新建/修改 作业
|
||||
function submit_homework(id)
|
||||
{
|
||||
if(!regex_homework_name())
|
||||
{
|
||||
$("#homework_name").focus();
|
||||
}
|
||||
else if(!regex_evaluation_num())
|
||||
{
|
||||
$("#evaluation_num").focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
homework_description_editor.sync();
|
||||
$("#"+id).submit();
|
||||
}
|
||||
}
|
||||
|
||||
function regexHomeworkCommonName()
|
||||
{
|
||||
|
@ -661,7 +703,7 @@ $(document).ready(function () {
|
|||
// 日历选择日期后关闭
|
||||
function regexDeadLine()
|
||||
{
|
||||
('#ui-datepicker-div').hide;
|
||||
('#ui-datepicker-div').hide();
|
||||
}
|
||||
|
||||
//新建、修改课程明码显示
|
||||
|
|
|
@ -163,7 +163,7 @@ a.f_grey:hover {color:#000000;}
|
|||
.resourcesIcon {margin-top:15px; display:block; width:25px; height:20px;}
|
||||
.nolink_btn{ background:#BCBCBC; color: #fff; padding:2px 5px;}
|
||||
.more_btn{-moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #9DCEFF; color:#9DCEFF; border-radius:3px; padding:0px 3px;}
|
||||
.upbtn{ margin:42px 0 0 10px; border:none; color:#999; width:150px;}
|
||||
/*.upbtn{ margin:42px 0 0 10px; border:none; color:#999; width:150px;}*/
|
||||
.red_btn_cir{ background:#e74c3c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
|
||||
.green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
|
||||
.grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
|
||||
|
@ -511,7 +511,7 @@ a:hover.st_add{ color:#ff8e15;}
|
|||
.upimg{ border:1px solid #eaeaea; display:block; width:60px; height:60px; padding:1px;}
|
||||
.upimg:hover{ border:1px solid #64bdd9; }
|
||||
.upbtn{ margin:40px 0 0 15px; display:block; padding:2px 5px; border:1px solid #eaeaea;}
|
||||
.upbtn:hover{border:1px solid #64bdd9; color:#64bdd9;cursor: pointer;}
|
||||
.upbtn:hover{color:#64bdd9;cursor: pointer;}
|
||||
.upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}
|
||||
/* 功能倒计时*/
|
||||
.w_img{ float:left; margin:10px 10px 15px 0px;}
|
||||
|
|
Loading…
Reference in New Issue