复制课程报500
This commit is contained in:
parent
b1a58ecfb8
commit
d9bd13c2fc
|
@ -1,17 +1,17 @@
|
|||
<script type="text/javascript">
|
||||
function submit_copy_course() {
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
||||
if(regex_course_name('new')&®ex_course_class_period('new')&®ex_time_term('new')&®ex_course_password('new'))
|
||||
{
|
||||
$("#new_course").submit();
|
||||
document.getElementById("submit_copy_course").onclick = "";
|
||||
}
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$("#time").change(function(){
|
||||
document.getElementById("end_time").options[document.getElementById("time").selectedIndex].selected = true;
|
||||
$("#new_time").change(function(){
|
||||
document.getElementById("new_end_time").options[document.getElementById("new_time").selectedIndex].selected = true;
|
||||
});
|
||||
$("#term").change(function(){
|
||||
document.getElementById("end_term").options[document.getElementById("term").selectedIndex].selected = true;
|
||||
$("#new_term").change(function(){
|
||||
document.getElementById("new_end_term").options[document.getElementById("new_term").selectedIndex].selected = true;
|
||||
});
|
||||
|
||||
var popupHeight = $(".referenceResourcesPopup").outerHeight(true);
|
||||
|
@ -56,35 +56,35 @@
|
|||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="course_name" class="courses_input grey_border" maxlength="100" onkeyup="regex_course_name();" value="<%=@course.name %>">
|
||||
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
<input type="text" name="course[name]" id="new_course_name" class="courses_input grey_border" maxlength="100" onkeyup="regex_course_name('new');" value="<%=@course.name %>">
|
||||
<span class="c_red" id="new_course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
<input type="text" name="class_period" id="class_period" class="hwork_input02 grey_border" onkeyup="regex_course_class_period();" maxlength="6" value="<%=@course.class_period %>">
|
||||
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||
<input type="text" name="class_period" id="new_class_period" class="hwork_input02 grey_border" onkeyup="regex_course_class_period('new');" maxlength="6" value="<%=@course.class_period %>">
|
||||
<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@new_course.time),@new_course.time), {} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@new_course.term || cur_course_term),{} %>
|
||||
<span class="c_red" id="course_time_term_notice"></span>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@new_course.time),@new_course.time), {:id=>"new_time"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@new_course.term || cur_course_term),{:id=>"new_term"} %>
|
||||
<span class="c_red" id="new_course_time_term_notice"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> 结束学期 :</label>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@new_course.end_time),@new_course.end_time), {} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@new_course.end_term || cur_course_term),{} %>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@new_course.end_time),@new_course.end_time), {:id=>"new_end_time"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@new_course.end_term || cur_course_term),{:id=>"new_end_term"} %>
|
||||
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" style="display: none;">
|
||||
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02 grey_border" onkeyup="regex_course_password();" value="<%=@course.password %>">
|
||||
<input type="text" name="course[password]" id="new_course_course_password" class="hwork_input02 grey_border" onkeyup="regex_course_password('new');" value="<%=@course.password %>">
|
||||
<!--<a id="psw_btn" href="javascript:void(0)">显示明码</a>-->
|
||||
<span class="c_red" id="course_course_password_notice"></span>
|
||||
<span class="c_red" id="new_course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="ml95 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
|
|
|
@ -8,36 +8,36 @@
|
|||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();">
|
||||
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
|
||||
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name('new');">
|
||||
<span class="c_red" id="new_course_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6">
|
||||
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||
<input type="text" name="class_period" id="new_class_period" class="hwork_input02" onkeyup="regex_course_class_period('new');" maxlength="6">
|
||||
<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
|
||||
<span class="c_red" id="course_time_term_notice"></span>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"new_time"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"new_term"} %>
|
||||
<span class="c_red" id="new_course_time_term_notice"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> 结束学期 :</label>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{} %>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"new_end_time"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"new_end_term"} %>
|
||||
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" style="display: none;">
|
||||
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" onkeyup="regex_course_password();">
|
||||
<input type="password" name="course[password]" id="new_course_course_password" class="hwork_input02" onkeyup="regex_course_password('new');">
|
||||
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
|
||||
<span class="c_red" id="course_course_password_notice"></span>
|
||||
<span class="c_red" id="new_course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="ml80 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
|
@ -75,11 +75,11 @@
|
|||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
$("#time").change(function(){
|
||||
document.getElementById("end_time").options[document.getElementById("time").selectedIndex].selected = true;
|
||||
$("#new_time").change(function(){
|
||||
document.getElementById("new_end_time").options[document.getElementById("new_time").selectedIndex].selected = true;
|
||||
});
|
||||
$("#term").change(function(){
|
||||
document.getElementById("end_term").options[document.getElementById("term").selectedIndex].selected = true;
|
||||
$("#new_term").change(function(){
|
||||
document.getElementById("new_end_term").options[document.getElementById("new_term").selectedIndex].selected = true;
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -33,35 +33,35 @@
|
|||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>">
|
||||
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
<input type="text" name="course[name]" id="edit_course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name('edit');" value="<%= @course.name%>">
|
||||
<span class="c_red" id="edit_course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
<input type="password" style="top: -100000px;position: fixed;">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6" value="<%= @course.class_period%>">
|
||||
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||
<input type="text" name="class_period" id="edit_class_period" class="hwork_input02" onkeyup="regex_course_class_period('edit');" maxlength="6" value="<%= @course.class_period%>">
|
||||
<span class="c_red" id="edit_course_class_period_notice" style="display: none;"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term"} %>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"edit_time"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"edit_term"} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> 结束学期 :</label>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term"} %>
|
||||
<span class="c_red" id="course_time_term_notice"></span>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"edit_end_time"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"edit_end_term"} %>
|
||||
<span class="c_red" id="edit_course_time_term_notice"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" value="<%= @course.password%>" onkeyup="regex_course_password();">
|
||||
<input type="password" name="course[password]" id="edit_course_course_password" class="hwork_input02" value="<%= @course.password%>" onkeyup="regex_course_password('edit');">
|
||||
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
|
||||
<span class="c_red" id="course_course_password_notice"></span>
|
||||
<span class="c_red" id="edit_course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
|
|
|
@ -73,79 +73,79 @@ function hidden_homework_score_form()
|
|||
///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////新建课程相关
|
||||
//验证课程名称
|
||||
function regex_course_name()
|
||||
function regex_course_name(str)
|
||||
{
|
||||
var name = $.trim($("#course_name").val());
|
||||
var name = $.trim($("#"+str+"_course_name").val());
|
||||
if(name.length < 2)
|
||||
{
|
||||
$("#course_name_notice").show();
|
||||
$("#"+str+"_course_name_notice").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_name_notice").hide();
|
||||
$("#"+str+"_course_name_notice").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//验证课程学时
|
||||
function regex_course_class_period()
|
||||
function regex_course_class_period(str)
|
||||
{
|
||||
var class_period = $.trim($("#class_period").val());
|
||||
var class_period = $.trim($("#"+str+"_class_period").val());
|
||||
var regex = /^\d*$/;
|
||||
if(class_period.length == 0)
|
||||
{
|
||||
$("#course_class_period_notice").html("学时总数不能为空");
|
||||
$("#course_class_period_notice").show();
|
||||
$("#"+str+"_course_class_period_notice").html("学时总数不能为空");
|
||||
$("#"+str+"_course_class_period_notice").show();
|
||||
return false;
|
||||
}
|
||||
else if (regex.test(class_period)) {
|
||||
if(parseInt(class_period) > 0)
|
||||
{
|
||||
$("#course_class_period_notice").html("");
|
||||
$("#course_class_period_notice").hide();
|
||||
$("#"+str+"_course_class_period_notice").html("");
|
||||
$("#"+str+"_course_class_period_notice").hide();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_class_period_notice").html("学时总数必须大于0");
|
||||
$("#course_class_period_notice").show();
|
||||
$("#"+str+"_course_class_period_notice").html("学时总数必须大于0");
|
||||
$("#"+str+"_course_class_period_notice").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_class_period_notice").html("学时总数必须为正整数");
|
||||
$("#course_class_period_notice").show();
|
||||
$("#"+str+"_course_class_period_notice").html("学时总数必须为正整数");
|
||||
$("#"+str+"_course_class_period_notice").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//验证开始学期和结束学期
|
||||
function regex_time_term(){
|
||||
var obj_time = document.getElementById("time");
|
||||
var obj_end_time = document.getElementById("end_time");
|
||||
var obj_term = document.getElementById("term");
|
||||
var obj_end_term = document.getElementById("end_term");
|
||||
function regex_time_term(str){
|
||||
var obj_time = document.getElementById(str+"_time");
|
||||
var obj_end_time = document.getElementById(str+"_end_time");
|
||||
var obj_term = document.getElementById(str+"_term");
|
||||
var obj_end_term = document.getElementById(str+"_end_term");
|
||||
var time = obj_time.options[obj_time.selectedIndex];
|
||||
var end_time = obj_end_time.options[obj_end_time.selectedIndex];
|
||||
var term = obj_term.options[obj_term.selectedIndex];
|
||||
var end_term = obj_end_term.options[obj_end_term.selectedIndex];
|
||||
if(time.value == end_time.value) {
|
||||
if(set_term_val(term.value) > set_term_val(end_term.value)) {
|
||||
$("#course_time_term_notice").html("开始学期不能晚于结束学期");
|
||||
$("#course_time_term_notice").show();
|
||||
$("#"+str+"_course_time_term_notice").html("开始学期不能晚于结束学期");
|
||||
$("#"+str+"_course_time_term_notice").show();
|
||||
return false;
|
||||
} else {
|
||||
$("#course_time_term_notice").html("");
|
||||
$("#course_time_term_notice").hide();
|
||||
$("#"+str+"_course_time_term_notice").html("");
|
||||
$("#"+str+"_course_time_term_notice").hide();
|
||||
return true;
|
||||
}
|
||||
} else if(time.value < end_time.value) {
|
||||
$("#course_time_term_notice").html("");
|
||||
$("#course_time_term_notice").hide();
|
||||
$("#"+str+"_course_time_term_notice").html("");
|
||||
$("#"+str+"_course_time_term_notice").hide();
|
||||
return true;
|
||||
} else {
|
||||
$("#course_time_term_notice").html("开始学期不能晚于结束学期");
|
||||
$("#course_time_term_notice").show();
|
||||
$("#"+str+"_course_time_term_notice").html("开始学期不能晚于结束学期");
|
||||
$("#"+str+"_course_time_term_notice").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -160,32 +160,32 @@ function set_term_val(val) {
|
|||
}
|
||||
}
|
||||
//验证密码
|
||||
function regex_course_password()
|
||||
function regex_course_password(str)
|
||||
{
|
||||
var class_period = $.trim($("#course_course_password").val());
|
||||
var class_period = $.trim($("#"+str+"_course_course_password").val());
|
||||
var regex = /^\w+$/;
|
||||
if(class_period.length == 0)
|
||||
{
|
||||
$("#course_course_password_notice").html("课程密码不能为空");
|
||||
$("#course_course_password_notice").show();
|
||||
$("#"+str+"_course_course_password_notice").html("课程密码不能为空");
|
||||
$("#"+str+"_course_course_password_notice").show();
|
||||
return false;
|
||||
}
|
||||
else if (regex.test(class_period)) {
|
||||
$("#course_course_password_notice").html("");
|
||||
$("#course_course_password_notice").hide();
|
||||
$("#"+str+"_course_course_password_notice").html("");
|
||||
$("#"+str+"_course_course_password_notice").hide();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_course_password_notice").html("课程密码有非法字符");
|
||||
$("#course_course_password_notice").show();
|
||||
$("#"+str+"_course_course_password_notice").html("课程密码有非法字符");
|
||||
$("#"+str+"_course_course_password_notice").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//提交新建课程
|
||||
function submit_new_course()
|
||||
{
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
||||
if(regex_course_name('new')&®ex_course_class_period('new')&®ex_time_term('new')&®ex_course_password('new'))
|
||||
{
|
||||
$("#new_course").submit();
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ function submit_new_course()
|
|||
|
||||
function submit_edit_course(id)
|
||||
{
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
||||
if(regex_course_name('edit')&®ex_course_class_period('edit')&®ex_time_term('edit')&®ex_course_password('edit'))
|
||||
{
|
||||
$("#edit_course_"+id).submit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue