Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
d092891b2a
|
@ -344,7 +344,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
#当前用户是不是课程的成员
|
||||
def member_of_course
|
||||
render_403 unless @course.is_public || User.current.member_of_course?(@course) || User.current.admin?
|
||||
render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin?
|
||||
end
|
||||
|
||||
def get_assigned_homeworks(student_works, n, index)
|
||||
|
|
|
@ -192,11 +192,13 @@ class UsersController < ApplicationController
|
|||
forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
|
||||
user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
|
||||
forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
|
||||
org_querys = OrgMessage.where("user_id=? and viewed=0", user)
|
||||
if User.current.id == @user.id
|
||||
course_querys.update_all(:viewed => true)
|
||||
forge_querys.update_all(:viewed => true)
|
||||
user_querys.update_all(:viewed => true)
|
||||
forum_querys.update_all(:viewed => true)
|
||||
org_querys.update_all(:viewed => true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -89,10 +89,11 @@ module UsersHelper
|
|||
def unviewed_message(user)
|
||||
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
at_count = user.at_messages.where(viewed: false).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count
|
||||
end
|
||||
|
||||
def user_mail_notification_options(user)
|
||||
|
|
|
@ -150,7 +150,7 @@ class Member < ActiveRecord::Base
|
|||
|
||||
#当前学生在指定作业内的得分
|
||||
def homework_common_score homework_common
|
||||
StudentWork.select("final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
end
|
||||
|
||||
def student_work_score_avg
|
||||
|
@ -158,7 +158,12 @@ class Member < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def student_work_score_sum
|
||||
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").sum(:final_score).try(:round, 2).to_f
|
||||
sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
AND student_works.user_id = #{self.user_id}"
|
||||
score = StudentWork.find_by_sql(sql_select)
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -345,7 +345,8 @@ class User < Principal
|
|||
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
|
||||
system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count
|
||||
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count
|
||||
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= @member_score.student_work_score_sum %></span></li>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= (@member_score.student_work_score_sum).first.score %></span></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id),
|
||||
:remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %>
|
||||
<input type="text" name="search" placeholder="输入作业关键词进行搜索" class="searchResource" />
|
||||
<input type="text" name="search" placeholder="输入作业名称进行搜索" class="searchResource" />
|
||||
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>
|
||||
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
|
||||
<% end %>
|
|
@ -57,8 +57,10 @@
|
|||
) if activity.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= delete_link(
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id},
|
||||
:method => 'post',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.org_subfield_editable_by?(User.current) %>
|
||||
|
|
|
@ -58,6 +58,11 @@
|
|||
<div class="w607 fr">http://
|
||||
<input type="text" name="organization[domain]" id="domain" value="<%= @organization.domain%>" class="orgUrlInput" />
|
||||
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
|
||||
<% if @organization.domain.present? and OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content == @organization.domain %>
|
||||
<span>(已批准)</span>
|
||||
<% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %>
|
||||
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
|
||||
<% end %>
|
||||
<p class="c_green f12" id="apply_hint" ></p></div>
|
||||
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<a href="javascript:void(0);" class="CloseBtn" title="关闭弹框"></a>
|
||||
<div class="ni_con">
|
||||
<p id="switch_homework_type_notice" class="fontGrey">
|
||||
</p>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" id="switch_type" style="margin-bottom: 20px;" >
|
||||
继 续
|
||||
</a>
|
||||
<a href="javascript:" class="tijiao" id="cancel_switch" style="margin-bottom: 20px;">
|
||||
取 消
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
|
@ -16,7 +16,7 @@
|
|||
<p class="c_red">提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计。</p>
|
||||
</div>
|
||||
<div class="courseSendSubmit">
|
||||
<a href="javascript:void(0);" class="group_btn sendSourceText">确定</a>
|
||||
<a href="javascript:void(0);" class="group_save_btn sendSourceText">确定</a>
|
||||
</div>
|
||||
<div class="courseSendCancel">
|
||||
<a href="javascript:void(0);" class="sendSourceText linkGrey6" id="cancel_group">取消</a>
|
||||
|
|
|
@ -72,11 +72,15 @@
|
|||
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr15" onclick="$('#_file').click();" title="请选择文件上传">上传附件</a>
|
||||
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%>
|
||||
<% if defined?(has_program) && has_program %>
|
||||
<a href="javascript:void(0);" class="ProBtn fl mt3" title="请设置编程语言和输入测试集">编程</a>
|
||||
<span class="fl C_lgrey mt3 program_detail_info mr15"></span>
|
||||
<div id="program_setting" class="fl">
|
||||
<a href="javascript:void(0);" class="ProBtn fl mt3"title="请设置编程语言和输入测试集">编程</a>
|
||||
<span class="fl C_lgrey mt3 program_detail_info mr15"></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if defined?(has_group) && has_group %>
|
||||
<a href="javascript:void(0);" class="groupBtn fl mt3" title="请设置分组作业的相关参数">分组</a>
|
||||
<div id="group_setting" class="fl">
|
||||
<a href="javascript:void(0);" class="groupBtn fl mt3" title="请设置分组作业的相关参数">分组</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
} else {
|
||||
$("#anonymous_comment").attr('checked',false);
|
||||
}
|
||||
$("#BluePopupBox a.BlueCirBtn").click();
|
||||
<% if edit_mode && homework.is_program_homework? %>
|
||||
$("#BluePopupBox a.BlueCirBtn").click();
|
||||
<% end %>
|
||||
<% if edit_mode && homework.is_group_homework? %>
|
||||
$("#GroupPopupBox a.group_btn").click();
|
||||
$("#GroupPopupBox a.group_save_btn").click();
|
||||
<% end %>
|
||||
});
|
||||
function checked_val() {
|
||||
|
@ -141,4 +143,10 @@
|
|||
|
||||
<div class="BluePopupBox" style="display:none;" id="GroupPopupBox">
|
||||
<%= render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework}%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% unless edit_mode %>
|
||||
<div class="BluePopupBox" style="display:none;" id="NoticePopupBox">
|
||||
<%= render :partial => 'users/homework_type_notice', :locals => {:edit_mode => edit_mode, :homework=>homework}%>
|
||||
</div>
|
||||
<% end %>
|
|
@ -42,7 +42,7 @@
|
|||
<% if activity.user == User.current || User.current.admin?%>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<li class="<%= activity.private == 1 ? 'whiteSettingIcon' : 'homepagePostSettingIcon' %>">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(l(:label_bid_respond_delete),
|
||||
|
|
|
@ -46,6 +46,7 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
member do
|
||||
get 'edit'
|
||||
get 'setting'#, :action => 'settings', :as => 'settings'
|
||||
get 'clear_org_avatar_temp'
|
||||
put 'set_homepage'
|
||||
|
|
|
@ -106,7 +106,46 @@ $(function(){
|
|||
$('a.pic_date').on('click', function(){
|
||||
$(this).parent().prev().first().focus();
|
||||
})
|
||||
|
||||
|
||||
$("#NoticePopupBox").dialog({
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
dialogClass: 'BluePopupBox',
|
||||
minWidth: 500
|
||||
});
|
||||
$('#NoticePopupBox').parent().resizable("disable");
|
||||
$('#NoticePopupBox').parent().removeClass("ui-state-disabled");
|
||||
$('#NoticePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px");
|
||||
$('a#switch_type').live('click', function(){
|
||||
if($("input[name=homework_type]").val() == "3"){
|
||||
$("#NoticePopupBox" ).dialog("close");
|
||||
$("input[name=homework_type]").val(1);
|
||||
$('span.group_detail_info').text('');
|
||||
$("#group_setting a").removeClass("fontBlue2");
|
||||
$("#BluePopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.CloseBtn").on('click', function(){
|
||||
$("#BluePopupBox" ).dialog("close");
|
||||
});
|
||||
$('#textarea_input_test').focus();
|
||||
} else if($("input[name=homework_type]").val() == "2") {
|
||||
$("#NoticePopupBox" ).dialog("close");
|
||||
$("input[name=homework_type]").val(1);
|
||||
$('span.program_detail_info').text("");
|
||||
$("span.program_detail_info").removeClass("fontBlue2");
|
||||
$("#program_setting a").removeClass("fontBlue2");
|
||||
$("#GroupPopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.popClose").on('click', function(){
|
||||
$("#GroupPopupBox" ).dialog("close");
|
||||
});
|
||||
$("#cancel_group").on('click', function(){
|
||||
$("#GroupPopupBox" ).dialog("close");
|
||||
});
|
||||
$('#min_num').focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#BluePopupBox").dialog({
|
||||
modal: true,
|
||||
|
@ -120,12 +159,25 @@ $(function(){
|
|||
$('#BluePopupBox').parent().css("position","fixed");
|
||||
|
||||
$('a.ProBtn').live('click', function(){
|
||||
$("#BluePopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.CloseBtn").on('click', function(){
|
||||
$("#BluePopupBox" ).dialog("close");
|
||||
});
|
||||
$('#textarea_input_test').focus();
|
||||
if($("input[name=homework_type]").val() == "3"){
|
||||
$("#NoticePopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.CloseBtn").on('click', function(){
|
||||
$("#NoticePopupBox" ).dialog("close");
|
||||
});
|
||||
$("#cancel_switch").on('click', function(){
|
||||
$("#NoticePopupBox" ).dialog("close");
|
||||
});
|
||||
$("#switch_homework_type_notice").text("您的作业类型将改为“分组作业”,并且您的编程设置将被清除。请问是否继续?");
|
||||
}
|
||||
else {
|
||||
$("#BluePopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.CloseBtn").on('click', function(){
|
||||
$("#BluePopupBox" ).dialog("close");
|
||||
});
|
||||
$('#textarea_input_test').focus();
|
||||
}
|
||||
});
|
||||
|
||||
var saveProgramAnswers = function() {
|
||||
|
@ -162,7 +214,9 @@ $(function(){
|
|||
|
||||
if (valid) {
|
||||
$("input[name=homework_type]").val(2);
|
||||
$('span.program_detail_info').text('('+language+','+test_numbers/2+'组测试)');
|
||||
$('span.program_detail_info').text('('+language+'语言,'+test_numbers/2+'组测试)');
|
||||
$("span.program_detail_info").addClass("fontBlue2");
|
||||
$("#program_setting a").addClass("fontBlue2");
|
||||
//保存js值
|
||||
var data = {
|
||||
language_type: $('select.language_type').val(),
|
||||
|
@ -213,15 +267,28 @@ $(function(){
|
|||
$('#GroupPopupBox').parent().css("border","3px solid #269ac9").css("padding","10px");
|
||||
|
||||
$('a.groupBtn').live('click', function(){
|
||||
$("#GroupPopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.popClose").on('click', function(){
|
||||
$("#GroupPopupBox" ).dialog("close");
|
||||
});
|
||||
$("#cancel_group").on('click', function(){
|
||||
$("#GroupPopupBox" ).dialog("close");
|
||||
});
|
||||
$('#min_num').focus();
|
||||
if($("input[name=homework_type]").val() == "2"){
|
||||
$("#NoticePopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.CloseBtn").on('click', function(){
|
||||
$("#NoticePopupBox" ).dialog("close");
|
||||
});
|
||||
$("#cancel_switch").on('click', function(){
|
||||
$("#NoticePopupBox" ).dialog("close");
|
||||
});
|
||||
$("#switch_homework_type_notice").text("您的作业类型将改为“编程作业”,并且您的分组设置将被清除。请问是否继续?");
|
||||
}
|
||||
else {
|
||||
$("#GroupPopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.popClose").on('click', function () {
|
||||
$("#GroupPopupBox").dialog("close");
|
||||
});
|
||||
$("#cancel_group").on('click', function () {
|
||||
$("#GroupPopupBox").dialog("close");
|
||||
});
|
||||
$('#min_num').focus();
|
||||
}
|
||||
});
|
||||
|
||||
var saveGroupAttr = function() {
|
||||
|
@ -245,6 +312,7 @@ $(function(){
|
|||
if (valid) {
|
||||
$("input[name=homework_type]").val(3);
|
||||
$('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人');
|
||||
$("#group_setting a").addClass("fontBlue2");
|
||||
//保存js值
|
||||
var data = {
|
||||
base_on_project: base_on_project,
|
||||
|
@ -259,7 +327,7 @@ $(function(){
|
|||
return valid;
|
||||
};
|
||||
|
||||
$("#GroupPopupBox a.group_btn").live('click', function(){
|
||||
$("#GroupPopupBox a.group_save_btn").live('click', function(){
|
||||
if(saveGroupAttr()){
|
||||
if($( "#GroupPopupBox" ).dialog( "isOpen" )){
|
||||
$("#GroupPopupBox").dialog( "close" );
|
||||
|
|
|
@ -195,6 +195,7 @@ a.c_green{ color:#28be6c;}
|
|||
.fontBlue {color:#3498db;}
|
||||
a.underline {text-decoration:underline;}
|
||||
a.fontBlue {color:#297fb8;}
|
||||
.fontBlue2 {color:#269ac9 !important;}
|
||||
a.fontGrey {color:#cecece;}
|
||||
a.fontGrey2 {color:#888888;}
|
||||
a.linkOrange {color:#ff7143;}
|
||||
|
@ -1458,3 +1459,6 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
|
|||
.subjectContent {color:#888888; line-height:18px; font-size:12px;}
|
||||
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
|
||||
.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;}
|
||||
|
||||
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
|
||||
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
|
||||
|
|
|
@ -225,6 +225,7 @@ a.c_green{ color:#28be6c;}
|
|||
.fontGrey3 {color:#484848;}
|
||||
.fontGrey4{color:#999999;}
|
||||
.fontBlue {color:#3498db;}
|
||||
.fontBlue2 {color:#269ac9 !important;}
|
||||
a.underline {text-decoration:underline;}
|
||||
a.fontBlue {color:#297fb8;}
|
||||
a.fontGrey {color:#cecece;}
|
||||
|
@ -1042,3 +1043,6 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
|
|||
.subjectContent {color:#888888; line-height:18px; font-size:12px;}
|
||||
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
|
||||
.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;}
|
||||
|
||||
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
|
||||
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
|
||||
|
|
Loading…
Reference in New Issue