课程通知列表更多功能bug

memcached_alan^2
guange 10 years ago
parent 7b5021c4fd
commit 689ec5cdfc

@ -36,9 +36,9 @@
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<br /> <br />
<div class="cl mb5"></div> <div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="news_description mt5"> <div id="news_description_<%= news.id %>" class="news_description mt5">
<%= news.description.html_safe %> <%= news.description.html_safe %>
</p> </div>
<div class="news_foot c_red" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"> <div class="news_foot c_red" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
<%= l(:button_more)%>... <%= l(:button_more)%>...
<span class="g-arr-down"></span> <span class="g-arr-down"></span>

@ -1,6 +1,5 @@
//配置课程信息 //配置课程信息
function course_setting(id) function course_setting(id) {
{
//alert(id); //alert(id);
$('#tb_' + id).removeClass().addClass("hwork_hovertab"); $('#tb_' + id).removeClass().addClass("hwork_hovertab");
$('#tbc_0' + id).removeClass().addClass("dis"); $('#tbc_0' + id).removeClass().addClass("dis");
@ -17,28 +16,26 @@ $(function(){
function add_group(url, course_id) { function add_group(url, course_id) {
var group_name = $('#group_name').val(); var group_name = $('#group_name').val();
$.get( $.get(
url, url, {
{ valid: "name", valid: "name",
value: group_name, value: group_name,
course_id: course_id }, course_id: course_id
},
function(data) { function(data) {
if (data.valid) { if (data.valid) {
$("#add_group_name").submit(); $("#add_group_name").submit();
} } else {
else
{
alert(data.message); alert(data.message);
} }
} }
); );
} }
//修改分班:修改分班时得考虑什么都不改但是点击确定的情况 //修改分班:修改分班时得考虑什么都不改但是点击确定的情况
function edit_group(id,url,course_id,group_id)
{ function edit_group(id, url, course_id, group_id) {
var group_name = $('#' + id).val(); var group_name = $('#' + id).val();
$.get( $.get(
url, url, {
{
valid: "name", valid: "name",
value: group_name, value: group_name,
course_id: course_id, course_id: course_id,
@ -47,104 +44,84 @@ function edit_group(id,url,course_id,group_id)
function(data) { function(data) {
if (data.valid) { if (data.valid) {
$("#update_group_" + group_id).submit(); $("#update_group_" + group_id).submit();
} } else {
else
{
alert(data.message); alert(data.message);
} }
} }
); );
} }
function hidden_homework_score_form() function hidden_homework_score_form() {
{
hideModal($("#user_score")); hideModal($("#user_score"));
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////新建课程相关 ///////////////////////////////////////////////////////////////新建课程相关
//验证课程名称 //验证课程名称
function regex_course_name()
{ function regex_course_name() {
var name = $.trim($("#course_name").val()); var name = $.trim($("#course_name").val());
if(name.length == 0) if (name.length == 0) {
{
$("#course_name_notice").show(); $("#course_name_notice").show();
return false; return false;
} } else {
else
{
$("#course_name_notice").hide(); $("#course_name_notice").hide();
return true; return true;
} }
} }
//验证课程学时 //验证课程学时
function regex_course_class_period()
{ function regex_course_class_period() {
var class_period = $.trim($("#class_period").val()); var class_period = $.trim($("#class_period").val());
var regex = /^\d*$/; var regex = /^\d*$/;
if(class_period.length == 0) if (class_period.length == 0) {
{
$("#course_class_period_notice").html("学时总数不能为空"); $("#course_class_period_notice").html("学时总数不能为空");
$("#course_class_period_notice").show(); $("#course_class_period_notice").show();
return false; return false;
} } else if (regex.test(class_period)) {
else if (regex.test(class_period)) { if (parseInt(class_period) > 0) {
if(parseInt(class_period) > 0)
{
$("#course_class_period_notice").html(""); $("#course_class_period_notice").html("");
$("#course_class_period_notice").hide(); $("#course_class_period_notice").hide();
return true; return true;
} } else {
else
{
$("#course_class_period_notice").html("学时总数必须大于0"); $("#course_class_period_notice").html("学时总数必须大于0");
$("#course_class_period_notice").show(); $("#course_class_period_notice").show();
return false; return false;
} }
} } else {
else
{
$("#course_class_period_notice").html("学时总数必须为数字"); $("#course_class_period_notice").html("学时总数必须为数字");
$("#course_class_period_notice").show(); $("#course_class_period_notice").show();
return false; return false;
} }
} }
//验证密码 //验证密码
function regex_course_password()
{ function regex_course_password() {
var class_period = $.trim($("#course_course_password").val()); var class_period = $.trim($("#course_course_password").val());
var regex = /^\w+$/; var regex = /^\w+$/;
if(class_period.length == 0) if (class_period.length == 0) {
{
$("#course_course_password_notice").html("课程密码不能为空"); $("#course_course_password_notice").html("课程密码不能为空");
$("#course_course_password_notice").show(); $("#course_course_password_notice").show();
return false; return false;
} } else if (regex.test(class_period)) {
else if (regex.test(class_period)) {
$("#course_course_password_notice").html(""); $("#course_course_password_notice").html("");
$("#course_course_password_notice").hide(); $("#course_course_password_notice").hide();
return true; return true;
} } else {
else
{
$("#course_course_password_notice").html("课程密码有非法字符"); $("#course_course_password_notice").html("课程密码有非法字符");
$("#course_course_password_notice").show(); $("#course_course_password_notice").show();
return false; return false;
} }
} }
//提交新建课程 //提交新建课程
function submit_new_course()
{ function submit_new_course() {
if(regex_course_name()&&regex_course_class_period()&&regex_course_password()) if (regex_course_name() && regex_course_class_period() && regex_course_password()) {
{
$("#new_course").submit(); $("#new_course").submit();
} }
} }
function submit_edit_course(id) function submit_edit_course(id) {
{ if (regex_course_name() && regex_course_class_period() && regex_course_password()) {
if(regex_course_name()&&regex_course_class_period()&&regex_course_password())
{
$("#edit_course_" + id).submit(); $("#edit_course_" + id).submit();
} }
} }
@ -159,14 +136,14 @@ function regexSubject(id) {
$(message).text("主题不能为空"); $(message).text("主题不能为空");
$(message).css('color', '#ff0000'); $(message).css('color', '#ff0000');
return false; return false;
} } else {
else {
$(message).text("填写正确"); $(message).text("填写正确");
$(message).css('color', '#008000'); $(message).css('color', '#008000');
return true; return true;
} }
return false; return false;
} }
function regexContent(id) { function regexContent(id) {
var contentid = "#message_content" + id; var contentid = "#message_content" + id;
var message = "#message_content_span" + id; var message = "#message_content_span" + id;
@ -175,8 +152,7 @@ function regexContent(id) {
$(message).text("描述不能为空"); $(message).text("描述不能为空");
$(message).css('color', '#ff0000'); $(message).css('color', '#ff0000');
return false; return false;
} } else {
else {
$(message).text("填写正确"); $(message).text("填写正确");
$(message).css('color', '#008000'); $(message).css('color', '#008000');
return true; return true;
@ -195,24 +171,18 @@ function submitProjectsBoard(id) {
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////// 课程通知 /////////////////////////////////////////////////////////////// 课程通知
function regexTitle() function regexTitle() {
{
var name = $("#news_title").val(); var name = $("#news_title").val();
if(name.length ==0) if (name.length == 0) {
{
$("#title_notice_span").text("标题不能为空"); $("#title_notice_span").text("标题不能为空");
$("#title_notice_span").css('color', '#ff0000'); $("#title_notice_span").css('color', '#ff0000');
$("#news_title").focus(); $("#news_title").focus();
return false; return false;
} } else if (name.length <= 60) {
else if(name.length <= 60)
{
$("#title_notice_span").text("填写正确"); $("#title_notice_span").text("填写正确");
$("#title_notice_span").css('color', '#008000'); $("#title_notice_span").css('color', '#008000');
return true; return true;
} } else {
else
{
$("#title_notice_span").text("标题超过60个字符"); $("#title_notice_span").text("标题超过60个字符");
$("#title_notice_span").css('color', '#ff0000'); $("#title_notice_span").css('color', '#ff0000');
$("#news_title").focus(); $("#news_title").focus();
@ -220,62 +190,50 @@ function regexTitle()
} }
} }
function regexDescription() function regexDescription() {
{
var name = news_description_editor.html(); var name = news_description_editor.html();
if(name.length ==0) if (name.length == 0) {
{
$("#description_notice_span").text("描述不能为空"); $("#description_notice_span").text("描述不能为空");
$("#description_notice_span").css('color', '#ff0000'); $("#description_notice_span").css('color', '#ff0000');
$("#description_notice_span").focus(); $("#description_notice_span").focus();
return false; return false;
} } else if (name.length >= 6000) {
else if(name.length >=6000){
$("#description_notice_span").text("描述最多3000个汉字(或6000个英文字符)"); $("#description_notice_span").text("描述最多3000个汉字(或6000个英文字符)");
$("#description_notice_span").css('color', '#ff0000'); $("#description_notice_span").css('color', '#ff0000');
$("#description_notice_span").focus(); $("#description_notice_span").focus();
return false; return false;
} } else {
else
{
$("#description_notice_span").text("填写正确"); $("#description_notice_span").text("填写正确");
$("#description_notice_span").css('color', '#008000'); $("#description_notice_span").css('color', '#008000');
return true; return true;
} }
} }
function submitNews() function submitNews() {
{ if (regexTitle() && regexDescription()) {
if(regexTitle() && regexDescription())
{
news_description_editor.sync(); news_description_editor.sync();
$("#news-form").submit(); $("#news-form").submit();
} }
} }
function submitFocus(obj) function submitFocus(obj) {
{
$(obj).focus(); $(obj).focus();
} }
function submitComment() function submitComment() {
{
comment_editor.sync(); comment_editor.sync();
$("#add_comment_form").submit(); $("#add_comment_form").submit();
} }
/////////////////////////////////////////////////课程讨论区 /////////////////////////////////////////////////课程讨论区
function course_board_submit_message_replay() function course_board_submit_message_replay() {
{ if (MessageReplayVevify()) {
if(MessageReplayVevify())
{
message_content_editor.sync(); //提交内容之前要sync不然服务器端取不到值 message_content_editor.sync(); //提交内容之前要sync不然服务器端取不到值
$("#message_form").submit(); $("#message_form").submit();
} }
} }
function course_board_canel_message_replay() function course_board_canel_message_replay() {
{
$("#reply").hide(200); $("#reply").hide(200);
$("#message_quote").html(""); $("#message_quote").html("");
} }
@ -286,8 +244,7 @@ function MessageReplayVevify() {
$("#message_content_span").text("回复不能为空"); $("#message_content_span").text("回复不能为空");
$("#message_content_span").css('color', '#ff0000'); $("#message_content_span").css('color', '#ff0000');
return false; return false;
} } else {
else {
$("#message_content_span").text("填写正确"); $("#message_content_span").text("填写正确");
$("#message_content_span").css('color', '#008000'); $("#message_content_span").css('color', '#008000');
return true; return true;
@ -298,70 +255,62 @@ function MessageReplayVevify() {
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
//验证搜索时输入名字 //验证搜索时输入名字
function regexName(content) function regexName(content) {
{
var name = $.trim($("#name").val()); var name = $.trim($("#name").val());
if(name.length == 0) if (name.length == 0) {
{
$("#project_name_span").text(content); $("#project_name_span").text(content);
$("#project_name_span").css('color', '#ff0000'); $("#project_name_span").css('color', '#ff0000');
$("#project_name_span").focus(); $("#project_name_span").focus();
return false; return false;
} } else {
else
{
$("#project_name_span").text(""); $("#project_name_span").text("");
return true; return true;
} }
} }
//提交搜索 //提交搜索
function submitSerch(content)
{ function submitSerch(content) {
if(regexName(content)){$("#course_search_form").submit();} if (regexName(content)) {
$("#course_search_form").submit();
}
} }
//验证搜索时输入名字 //验证搜索时输入名字
function regexQ(content) function regexQ(content) {
{
var name = $.trim($("#q").val()); var name = $.trim($("#q").val());
if(name.length == 0) if (name.length == 0) {
{
$("#course_member_name_span").text(content); $("#course_member_name_span").text(content);
$("#course_member_name_span").css('color', '#ff0000'); $("#course_member_name_span").css('color', '#ff0000');
$("#course_member_name_span").focus(); $("#course_member_name_span").focus();
return false; return false;
} } else {
else
{
$("#course_member_name_span").text(""); $("#course_member_name_span").text("");
return true; return true;
} }
} }
//提交课程成员搜索 //提交课程成员搜索
function submitMemberSerch(content)
{ function submitMemberSerch(content) {
//if(regexQ(content)){$("#course_member_search_form").submit();} //if(regexQ(content)){$("#course_member_search_form").submit();}
$("#course_member_search_form").submit(); $("#course_member_search_form").submit();
} }
//课程描述显示更多信息 //课程描述显示更多信息
function show_more_msg() function show_more_msg() {
{
$("#course_description").toggleClass("course_description_none"); $("#course_description").toggleClass("course_description_none");
} }
//作业描述显示更多信息 //作业描述显示更多信息
function news_show_more_des(id)
{ function news_show_more_des(id) {
$('#news_description_' + id).toggleClass("news_description_none"); $('#news_description_' + id).toggleClass("news_description_none");
} }
function bid_show_more_des(id)
{ function bid_show_more_des(id) {
$("#bid_description_" + id).toggleClass("news_description_none"); $("#bid_description_" + id).toggleClass("news_description_none");
} }
//课程作业结束时间倒计时 //课程作业结束时间倒计时
function show_bid_dead_line(year,month,day,divname) function show_bid_dead_line(year, month, day, divname) {
{
var now = new Date(); var now = new Date();
var endDate = new Date(year, month - 1, day); var endDate = new Date(year, month - 1, day);
var leftTime = endDate.getTime() - now.getTime(); var leftTime = endDate.getTime() - now.getTime();
@ -370,64 +319,43 @@ function show_bid_dead_line(year,month,day,divname)
var hour = Math.floor((leftsecond - day1 * 24 * 60 * 60) / 3600); var hour = Math.floor((leftsecond - day1 * 24 * 60 * 60) / 3600);
var minute = Math.floor((leftsecond - day1 * 24 * 60 * 60 - hour * 3600) / 60); var minute = Math.floor((leftsecond - day1 * 24 * 60 * 60 - hour * 3600) / 60);
var second = Math.floor(leftsecond - day1 * 24 * 60 * 60 - hour * 3600 - minute * 60); var second = Math.floor(leftsecond - day1 * 24 * 60 * 60 - hour * 3600 - minute * 60);
$("#"+divname).html("<form name='formnow' class='fr'>" $("#" + divname).html("<form name='formnow' class='fr'>" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + day1 + "' > 天" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + hour + "' > 小时" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + minute + "' > 分" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + second + "' > 秒" + "</form>" + "<p class='fr'>作品提交还剩:</p>");
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+day1+"' > 天"
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+hour+"' > 小时"
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+minute+"' > 分"
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+second+"' > 秒"
+ "</form>"
+ "<p class='fr'>作品提交还剩:</p>");
} }
//验证新建作业的名字 //验证新建作业的名字
function regex_bid_name()
{ function regex_bid_name() {
var name = $.trim($("#bid_name").val()); var name = $.trim($("#bid_name").val());
if(name=="") if (name == "") {
{
$("#bid_name_span").text("名称不能为空"); $("#bid_name_span").text("名称不能为空");
return false; return false;
} } else {
else
{
$("#bid_name_span").text(""); $("#bid_name_span").text("");
return true; return true;
} }
} }
//验证匿评数量 //验证匿评数量
function regex_evaluation_num() function regex_evaluation_num() {
{
var evaluation_num = $.trim($("#bid_evaluation_num").val()); var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/; var regex = /^\d+$/;
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") if ($("#bid_open_anonymous_evaluation").attr("checked") == "checked") {
{ if (evaluation_num == "") {
if(evaluation_num=="")
{
$("#bid_evaluation_num_span").text("匿评分配数量不能为空"); $("#bid_evaluation_num_span").text("匿评分配数量不能为空");
return false; return false;
} } else if (regex.test(evaluation_num)) {
else if(regex.test(evaluation_num)) if (evaluation_num > 0) {
{
if(evaluation_num > 0)
{
$("#bid_evaluation_num_span").text(""); $("#bid_evaluation_num_span").text("");
return true; return true;
} } else {
else
{
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0"); $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
return false; return false;
} }
} } else {
else
{
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字"); $("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
return false; return false;
} }
} } else {
else
{
return true; return true;
} }
} }
@ -435,22 +363,17 @@ function regex_evaluation_num()
//点击是否开启匿评单选框效果 //点击是否开启匿评单选框效果
$(function() { $(function() {
$("#bid_open_anonymous_evaluation").click(function() { $("#bid_open_anonymous_evaluation").click(function() {
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") if ($("#bid_open_anonymous_evaluation").attr("checked") == "checked") {
{
$("#bid_evaluation_num_li").slideDown(); $("#bid_evaluation_num_li").slideDown();
} } else {
else
{
$("#bid_evaluation_num_li").slideUp(); $("#bid_evaluation_num_li").slideUp();
} }
}); });
}); });
//老师提交新建作业 //老师提交新建作业
function submit_new_bid(id) function submit_new_bid(id) {
{ if (regex_bid_name() && regex_evaluation_num()) {
if(regex_bid_name()&&regex_evaluation_num())
{
bid_description_editor.sync(); bid_description_editor.sync();
$("#" + id).submit(); $("#" + id).submit();
} }
@ -469,15 +392,13 @@ function close_window(id1,id2){
} }
//隐藏提示狂 //隐藏提示狂
function hidden_atert_form(cur_page,cur_type) function hidden_atert_form(cur_page, cur_type) {
{
hideModal($("#popbox")); hideModal($("#popbox"));
} }
//当课程描述长度小于112px时不显示更多按钮 //当课程描述长度小于112px时不显示更多按钮
$(function() { $(function() {
if($("#course_description_content").height()>112) if ($("#course_description_content").height() > 112) {
{
$("#lg-foot").show(); $("#lg-foot").show();
} }
}); });
@ -496,15 +417,13 @@ $(document).ready(function () {
}; };
if (browser.mozilla || browser.opera) { if (browser.mozilla || browser.opera) {
$("pre").addClass("break_word_firefox"); $("pre").addClass("break_word_firefox");
} } else {
else{
$("pre").addClass("break_word"); $("pre").addClass("break_word");
} }
}); });
// 日历选择日期后关闭 // 日历选择日期后关闭
function regexDeadLine() function regexDeadLine() {
{
('#ui-datepicker-div').hide; ('#ui-datepicker-div').hide;
} }
@ -518,21 +437,28 @@ $(function(){
//课程通知更多按钮显示 //课程通知更多按钮显示
$(function() { $(function() {
$('.news_description').each(function() { $('.news_description').each(function() {
if($(this).height() >= 38) if ($(this).height() >= 38) {
{
$('#news_foot_' + $(this).attr('id').replace('news_description_', '')).css("display", "block"); $('#news_foot_' + $(this).attr('id').replace('news_description_', '')).css("display", "block");
} }
});
$(".news_description img").one('load', function() {
var node = $(this).parents('.news_description');
if (node && node.height() >= 38) {
$('#news_foot_' + node.attr('id').replace('news_description_', '')).css("display", "block");
}
}).each(function() {
if (this.complete) {
$(this).load();
} }
) });
}); });
//查找TAG资源 //查找TAG资源
function search_tag_attachment(url,tag_name,q,course_id,sort) function search_tag_attachment(url, tag_name, q, course_id, sort) {
{
//alert("111"); //alert("111");
$.get( $.get(
url, url, {
{
tag_name: tag_name, tag_name: tag_name,
q: q, q: q,
course_id: course_id course_id: course_id
@ -546,27 +472,22 @@ function search_tag_attachment(url,tag_name,q,course_id,sort)
// 课程讨论区 // 课程讨论区
function showhelpAndScrollToMessage(id, id1, count) { function showhelpAndScrollToMessage(id, id1, count) {
$('#' + id).toggle(); $('#' + id).toggle();
if(cookieget("repositories_visiable") == "true") if (cookieget("repositories_visiable") == "true") {
{
cookiesave("repositories_visiable", false, '', '', ''); cookiesave("repositories_visiable", false, '', '', '');
} } else {
else
{
cookiesave("repositories_visiable", true, '', '', ''); cookiesave("repositories_visiable", true, '', '', '');
} }
var information = $(id1); var information = $(id1);
var val = information.attr("value"); var val = information.attr("value");
if(val=="show_help") if (val == "show_help") {
{
$(id1).text("收起回复(" + count + ")"); $(id1).text("收起回复(" + count + ")");
information.attr("value", "hide_help"); information.attr("value", "hide_help");
} } else {
else
{
$(id1).text("展开回复(" + count + ")"); $(id1).text("展开回复(" + count + ")");
information.attr("value", "show_help"); information.attr("value", "show_help");
} }
} }
function show_more_reply(contentid, id2, id3) { function show_more_reply(contentid, id2, id3) {
$(contentid).toggleClass("course_description_none"); $(contentid).toggleClass("course_description_none");
var information = $(id2); var information = $(id2);
@ -576,8 +497,7 @@ function show_more_reply(contentid, id2, id3) {
$(id2).text("[收起]"); $(id2).text("[收起]");
information.attr("value", "hide_more"); information.attr("value", "hide_more");
arrow.attr("src", "/images/jiantouup.jpg") arrow.attr("src", "/images/jiantouup.jpg")
} } else {
else {
$(id2).text("[展开]"); $(id2).text("[展开]");
information.attr("value", "show_more"); information.attr("value", "show_more");
arrow.attr("src", "/images/jiantou.jpg") arrow.attr("src", "/images/jiantou.jpg")

Loading…
Cancel
Save