7R|f|NSK{K}YOdn^uP`v}1L1)q^oKRTkOrf@O5z^v%O1bI5w1pBg1*M<7zR_n*klw`Zf3}KIb>4X3bKhgd(
zP>5wMZQ-w2L%XZ1$Kl|nKjmX9G9{KF}dPGd!;}-*iB23`HhI-~q
zFTwlz-BXXg3>j6{dE~Q^3e#oN0}p!R-aRx(03zd4)2ZYOD{%Be`U6TU-()WozS@?I
zHJAC4!|#N-&p2{4<;8$CtK1yNl_h(U^~7Y^MR;|BKeMT@b$X=+&oJUTBeC@(+z}wt
zfM@4wwJMS#RfA)g#;7I=2$;O9$@geSvTnArn4pMP;zS*y*vu2t_mHZwoW#DwHrCvj
zxk9F1tIf;CaHB3GcQD*916qE&{D{eWMrnx3fTgpR!yH*LUWIEKWZ>i)l`34RA(_B(
zJCa(G-mkm4|D6dIXdt{a_R*zDA2W2sE(Y$9K?{OXqQf;7v4KRDtG8yd6ozzbMxxh9
z8Z#QaF_V_7GFVG`DDXmSCQ+?Qux6m<8d=B73KR`pH|qt!EgsyQlg<;6CFk+vT4Qdk
zwu+FDOv!r9UvTlNztY9)c^|(ypQ3t3@V(&XBMksvnjY48=J=6i4h@aMTg+(aS0HLVA#p4K;8O%9GnQ&kVu^WLOxE|b
z=G&09o|1Vx@(M2q$qRbzh{S4`EYOTeTIjuiDFp=Q<-rmayh869Oh^M}>4GvVCWOR8
z|B@9WA~D2#XsAWw{gPs2HJT?O8r`5$
z$}mH3Rhj|jkY?@B$TEm_fj
zqjHd8Dpd~jXQmoba?;Z*%NWywZbodEuhkEYQz;b|O*xu7pJG8n1u*1hcN_%m3NbzY
z5%S&^baQfcu0jIcclsvEbvE;lPqr4oDxil}L+IKL*XrN{*?=`&w^%B;!2Jcw$t4%W
zzu?)V_x1xcIimuIh5+FmMq}zo*!ryN(R_oLlF69-gRT_i1IGRr~7ekmp
z2lII(30@G*C%=gC`le^Xvp{-`CkhG;lnI1FUU+zrFiaF4F6_jE#|cA%1@J#SP#6Z!
z5{g42cnygUThq()#90YR4Q;_(G{4E=s-n;!tzHof51U01JVHVOAw{5}M1xC<12qP3
z3x@=F#!jy!z4$zWBlJ)k@n}Aj)Z7KN&dT%$^ew=}|m^2%rMV(lp$E48Np93BJmQil}=G5%GXcKx2ejC7|`NRRzK!GSwD9jN?
zh(jaAqR5VdNU=a*CQXMnB!?dnJ|GUsv79z-My!=9^Gd!*Dwm1#w0gA^YFMe3DzMPz7!@XrOh^(&TI!lzs#4Y8
z<6#{YaT=zO%1Tl*b0i5$1!jPK6ns7j`Mk#3q%$#HD~AIU+7u5D&BD)Rc}f*5_{$MZ
zVqQU2LFJ_=4bTos8fI!XHlzVkDS4zxi={H++gUVUMpz6c=Qp60A5r?36=!By1i$ut
z){M+#25lZ*B-LYa3OGPtveMvB$!(ApeqQP@!Iy^nGg89?)ZrF;{u@#^C{va%)hIBy
za0l~0*$@|sMZ
zPc|gS^vWhGYub!e2Ht-dSK2c
zn5`j+Ffj5VCH~mV|5xS^d}4{^e`~olw`=~Y^*5JW!rIBsHhGhz@`D425cJmf24s%&kCl2Z{w8bIX;t*xFI7Hj22U{GXEe_EZ
zhiHpKw8bIX;t*|di2r^ZVq@eX@rl_Sc}S;HsWd8`Mx)!&;g8Lv)0u1zi^XQKI8Gcg
zHQdaZ53dM}wYTTkdpJ3H{M(U-FjTKG@{j@}4=bRUjHZEyfJ&pFbOba+9-=6vX=(Gw
zLlmJ9k%x2!1zu1Cf>NBRfCfVk<9gD$QW$#Z8Zu)k!_6G|R~_n}Tj!%6``A|!mOZm#
zqs*{hl;A&W*{1LoIdc5KnHx;Mads>Z&(hh6Ny|6)KHDpx<&&DHMD!tM{C18x0`U_8
zh>K#We-+A3Z+^zrMp_9ti>^yqq?i+KYB85hS
z(UVjrg`&0wOUBW9LW$`^#>@y=`g5J@zSGs-@orhU`p2O@VUn@#GqZgwWE=N03}-|)
z62`U2nFZrAJv{xw6I=Sr@m>*6mTfu^(Ee=A)6&_?H#ZkKsY%pi)1b*_GJi(o4}u%V
zZ~1Y{x`{IR;=bqo+wLgEd%k;89B^z%&F+(DZrl}lb)ElaW1Gc~rf1%TamQgp3PL8A
zcO1(axN7A}Z)0-XBLjc>^XA<7Nx3zfC)90D?o?NH%t-1Eh#
z^4j_520Rr0dD8?;rylLetbLQ5UEA%=ua$jkoWiLbKakZ&Z8CvfCZMSAY69Eu)!#P(f8oy~20o6-{=WQnm&y}wVouagK3*TQ
v)&veeh)EhX>%|Cd<=rhNuxRo9Q02vy=j&g-zj^|%k9k=6=cu#(rpx~WIwu|c
literal 0
HcmV?d00001
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index c1f105c1f..d3588d502 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -650,4 +650,78 @@ function new_student_work()
{
if(regexStudentWorkName()&®exStudentWorkDescription())
{$("#new_student_work").submit();}
-}
\ No newline at end of file
+}
+
+//滑动打分
+$.fn.peSlider = function(settings){
+ //configurable options (none so far)
+ var o = $.extend({},settings);
+ if( !$('body').is('[role]') ){ $('body').attr('role','application'); }
+ return $(this).each(function(){
+ var thisLabel = $('label[for=' + $(this).attr('id') + ']').attr('id', $(this).attr('id') + '-label').attr('id');
+ var thisUnits = $(this).attr('data-units') || '';
+ var slider = $('
');
+ if( $(this).is('input') ){
+ var input = $(this);
+ var thisUnits = input.attr('data-units');
+ var friendlyVal = input.val() + ' ' + thisUnits;
+ var sliderOptions = $.extend(o,{
+ min: parseFloat(input.attr('min')),
+ max: parseFloat(input.attr('max')),
+ value: parseFloat(input.val())
+ });
+ slider
+ .insertBefore(input)
+ .slider(sliderOptions)
+ .bind('slide', function(e, ui){
+ input.val(ui.value);
+ friendlyVal = input.val() + ' ' + thisUnits;
+ slider.find('a').attr({
+ 'aria-valuenow': ui.value,
+ 'aria-valuetext': friendlyVal,
+ 'title': friendlyVal
+ });
+ })
+ .find('a')
+ .attr({
+ 'role': 'slider',
+ 'aria-valuemin': input.attr('min'),
+ 'aria-valuemax': input.attr('max'),
+ 'aria-valuenow': input.val(),
+ 'aria-valuetext': friendlyVal,
+ 'title': friendlyVal,
+ 'aria-labelledby': thisLabel
+ });
+ input
+ .keyup(function(){
+ var inVal = parseFloat(input.val());
+ if( !isNaN(inVal) ){
+ slider.slider('value', inVal);
+ input.val(slider.slider('value'));
+ }
+ })
+ .change(function(){
+ var inVal = parseFloat(input.val());
+ if( !isNaN(inVal) ){
+ slider.slider('value', inVal);
+ input.val(slider.slider('value'));
+ }
+ })
+ .blur(function(){
+ var inVal = parseFloat(input.val());
+ if( isNaN(inVal) ){
+ input.val(0);
+ }
+ });
+ if( !settings.step ){
+ var step = Math.round( parseFloat(input.attr('max')) / slider.width());
+ if(step > 1){ slider.slider('option','step',step); }
+ }
+ }
+ });
+};
+
+$(function(){
+ //创建输入滑杆
+ $('#score').peSlider({range: 'min'});
+});
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index d27c0efbc..d29ac1a84 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -127,7 +127,7 @@ a.re_de{ color:#6883b6; margin-left:15px;}
/* 作业列表 */
.ttl{ }
-.ctt{height:820px;clear:both; }
+.ctt{clear:both; }
#contentbox{float:right;clear:both;width:670px;/*滑动门的宽度*/}
/* TAB 切换效果 */
.tb_{ background-color: #eaeaea; height:40px; }
@@ -549,6 +549,20 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px
a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; }
a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;}
+/* 20150423作业评分*/
+.ml14{ margin-left:14px;}
+.w548{ width:552px;}
+.w547{ width:544px;}
+.w196{ width:182px;}
+.w459{ width:459px;}
+.hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;}
+.hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;}
+.hwork_new_left{ width:220px; float:left; }
+.hwork_new_right{ width:350px; float:left; margin-left:40px;}
+.w305{ width:305px;}
+.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
+a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
+
/* 20150505讨论区*/
.w664{ width:664px;}
.w140{ width:140px;}
@@ -596,6 +610,58 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
.icon_add{background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
+/* 20150506上传头像*/
+.uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;}
+.showpicBox{width:133px; height:250px; background:#f2f2f5; float:left; margin-left:20px; text-align:center; padding-top:15px; color:#666;}
+.mr2{ margin-right:2px;}
+.uppic_btn{border:none; width:150px; background:none; margin-bottom:5px; color:#666; margin-top:105px;}
+
+/* 20150512作品展示*/
+.hwork_ul{ height:24px; padding-top:10px;}
+.hwork_ul li{ float:left;}
+.w300{ width:300px;}
+.w80{ width:80px;}
+.t_c{ text-align:center;}
+.hwork_tit{ width:295px; float:left; }
+.hwork_tit a{ width:285px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
+.hwork_code{ width:60px; text-align:center; margin-right:15px;}
+.hwork_code02{ width:32px; text-align:center; margin-right:10px;}
+a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;}
+a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;}
+.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
+.show_hwork ul li{ margin-bottom:5px;}
+.show_hwork_arrow{ position:relative; top:2px; left:25px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;}
+.tit_fb{ font-weight:bold; width:66px; text-align:right; display:block; float:left;}
+.ml160{ margin-left:160px;}
+.show_hwork_p{ width:580px; float:left;}
+.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:568px; height:35px;}
+.ping_box{ width:626px; padding:10px; background:#f5f3f3; }
+a.ping_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3;}
+a:hover.ping_pic{border:1px solid #64bdd9;}
+.ping_box_tit{ float:left; width:575px; margin-left:10px;}
+.ping_box_ul{}
+.ping_line{ border-bottom:1px dashed #CCCCCC; padding-bottom:8px; margin-bottom:8px;}
+.ping_text{border:1px solid #CCCCCC; margin:5px; padding:5px; width:560px; height:20px; }
+.ping_back_tit{ float:left; width:523px; margin-left:10px; }
+a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;}
+a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
+.fr{ float:right;}
+.min_search{ width:200px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; cursor:pointer;}
+.li_min_search{ float:right; margin-right:-10px;}
+.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;}
+
+
+
+/* 评分插件 */
+input#score{ width:40px;}
+.ui-slider{position:relative;width:200px;float:left;margin-right:10px;height:14px; margin-top:2px;background:#e2e2e2; }
+.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:0.5em;height:1.6em;top:-.2em;margin-left:-.5em;cursor:pointer;background:#64bdd9;}
+.ui-slider .ui-slider-handle:hover,.ui-slider .ui-slider-handle:focus{background:#64bdd9;}
+.ui-slider .ui-slider-handle:active{background-image:none;}
+.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;}
+
+
+
From 8c72df74d682643d3eb16ccfa73ff0279b2fc91a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 21 May 2015 17:17:54 +0800
Subject: [PATCH 018/187] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E8=BF=94?=
=?UTF-8?q?=E5=9B=9E=E9=A1=B6=E9=83=A8=E5=8A=9F=E8=83=BD=202=E3=80=81?=
=?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BD=9C=E5=93=81=E5=90=8D=E7=A7=B0=EF=BC=8C?=
=?UTF-8?q?=E5=BC=B9=E5=87=BA=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=203?=
=?UTF-8?q?=E3=80=81=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E7=94=9F=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 5 +-
app/views/student_work/_show.html.erb | 186 ++++++++++-----------
app/views/student_work/index.html.erb | 140 +++++++++-------
app/views/student_work/show.js.erb | 7 +
public/javascripts/course.js | 53 +++++-
public/stylesheets/courses.css | 4 +-
6 files changed, 235 insertions(+), 160 deletions(-)
create mode 100644 app/views/student_work/show.js.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 896e29053..df2513782 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -6,6 +6,7 @@ class StudentWorkController < ApplicationController
before_filter :author_of_work, :only => [:edit, :update, :destroy]
def index
+ @stundet_works = @homework.student_works.order("final_score desc")
respond_to do |format|
format.html
end
@@ -55,7 +56,9 @@ class StudentWorkController < ApplicationController
end
def show
-
+ respond_to do |format|
+ format.js
+ end
end
def destroy
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 747cfecf8..cb3f0181a 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -1,96 +1,94 @@
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
jacknudt (教辅)
+
评分: 85分
+
删除
+
回复
+
一小时前
+
+
作品非常好,格式不正确,继续努力!
+
+
+
+
程梦雯
+
删除
+
一小时前
+
+
谢谢老师!
+
+
+
+
+
+
+
程梦雯
+
删除
+
一小时前
+
+
谢谢老师!
+
+
+
+
+
+
+
+
+
收起
+
+
\ No newline at end of file
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 44ac58bf7..258d26cf9 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -13,6 +13,12 @@
+
+
+ 返 回 顶 部
+
+
+
@@ -25,75 +31,87 @@
- 学号
- 学生姓名
- 作品名称
- 教师评分
- 教辅评分
- 匿评
- 成绩
+
+ 学号
+
+
+
+ 学生姓名
+
+
+ 作品名称
+
+
+ 教师评分
+
+
+
+ 教辅评分
+
+
+
+ 匿评
+
+
+
+ 成绩
+
+
-
+ <% @stundet_works.each do |student_work|%>
+
+
+
+ <% end%>
-
-
-
-
diff --git a/app/views/student_work/show.js.erb b/app/views/student_work/show.js.erb
new file mode 100644
index 000000000..1f7e98e48
--- /dev/null
+++ b/app/views/student_work/show.js.erb
@@ -0,0 +1,7 @@
+if($("#about_hwork_<%= @work.id%>").children().length > 0)
+ {$("#about_hwork_<%= @work.id%>").html("");}
+else
+ {
+ $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => @work}) %>");
+ $('#score_<%= @work.id%>').peSlider({range: 'min'});
+ }
\ No newline at end of file
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index d3588d502..63d20fefd 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -721,7 +721,56 @@ $.fn.peSlider = function(settings){
});
};
+//返回顶部
+$(function(){goTopEx();});
+
+var Sys = {};
+var ua = navigator.userAgent.toLowerCase();
+var s;
+(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
+ (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
+ (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
+ (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
+ (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
+
+function goTopEx() {
+ var obj = document.getElementById("goTopBtn");
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
+ function getScrollTop() {
+ var xsun = document.documentElement.scrollTop;
+ if (Sys.chrome) {
+ xsun=document.body.scrollTop;
+ }
+ return xsun;
+ }
+ function setScrollTop(value) {
+ if (Sys.chrome) {
+ document.body.scrollTop = value;
+ }
+ else {
+ document.documentElement.scrollTop = value;
+ }
+ }
+ window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
+ obj.onclick = function () {
+ var goTop = setInterval(scrollMove, 10);
+ function scrollMove() {
+ setScrollTop(getScrollTop() / 1.1);
+ if (getScrollTop() < 1) clearInterval(goTop);
+ }
+ }
+}
+
+//匿评评分提示
$(function(){
- //创建输入滑杆
- $('#score').peSlider({range: 'min'});
+ $(".student_score_info").bind("mouseover",function(e){
+ //alert($(this).html());
+ $(this).find("div").show();
+ $(this).find("div").css("top",e.pageY);
+ $(this).find("div").css("left",e.pageX);
+ });
+ $(".student_score_info").bind("mouseout",function(e){
+ //alert($(this).html());
+ $(this).find("div").hide();
+ });
});
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index d29ac1a84..e1d314c53 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -649,8 +649,8 @@ a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.min_search{ width:200px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; cursor:pointer;}
.li_min_search{ float:right; margin-right:-10px;}
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;}
-
-
+/*返回顶部*/
+.to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;}
/* 评分插件 */
input#score{ width:40px;}
From bf63ca785491d62d1de0c69ad9aea7dda121dbc2 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 21 May 2015 17:28:38 +0800
Subject: [PATCH 019/187] =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=88=9B=E5=BB=BA?=
=?UTF-8?q?=E8=BF=87=E4=BD=9C=E5=93=81=E7=9A=84=E7=94=A8=E6=88=B7=E4=B8=8D?=
=?UTF-8?q?=E5=85=81=E8=AE=B8=E9=87=8D=E5=A4=8D=E5=88=9B=E5=BB=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index df2513782..d619b1cd7 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -13,9 +13,14 @@ class StudentWorkController < ApplicationController
end
def new
- @stundet_work = StudentWork.new
- respond_to do |format|
- format.html
+ student_work = @homework.student_works.where("user_id = ?",User.current.id).first
+ if student_work.nil?
+ @stundet_work = StudentWork.new
+ respond_to do |format|
+ format.html
+ end
+ else
+ render_403
end
end
From 289fb393bfa8b63bddc65c7a3afe13ef537f6bc4 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 21 May 2015 17:33:54 +0800
Subject: [PATCH 020/187] =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=EF=BC=9A=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7=E4=B8=BA=E4=BD=9C?=
=?UTF-8?q?=E5=93=81=E7=9A=84=E4=BD=9C=E8=80=85=20&&=20=EF=BC=88=E6=9C=AA?=
=?UTF-8?q?=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84=20||=20=E6=9C=AA=E5=90=AF?=
=?UTF-8?q?=E7=94=A8=E5=8C=BF=E8=AF=84=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index d619b1cd7..f9d393ca3 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -81,7 +81,8 @@ class StudentWorkController < ApplicationController
#获取作品
def find_work
@work = StudentWork.find params[:id]
- @course = @work.homework_common.course
+ @homework = @work.homework_common
+ @course = @homework.course
rescue
render_404
end
@@ -95,6 +96,6 @@ class StudentWorkController < ApplicationController
#判断是不是当前作品的提交者
#提交者可以编辑作品
def author_of_work
- render_403 unless User.current.id == @work.user_id
+ render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
end
\ No newline at end of file
From 95a48b7da0fa0be4ffa02cc2fd72ee4a23c7a76c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 22 May 2015 14:45:01 +0800
Subject: [PATCH 021/187] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E5=93=81show?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=E8=AF=A6=E7=BB=86=E5=86=85=E5=AE=B9=E5=A1=AB?=
=?UTF-8?q?=E5=85=85=202=E3=80=81=E6=9B=B4=E6=96=B0public.css=203=E3=80=81?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BD=9C=E5=93=81=E9=99=84=E4=BB=B6=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 5 +
app/views/student_work/_show.html.erb | 121 +++++++++---------
.../student_work/_work_attachments.html.erb | 5 +
app/views/student_work/index.html.erb | 3 -
public/stylesheets/public.css | 7 +
5 files changed, 75 insertions(+), 66 deletions(-)
create mode 100644 app/views/student_work/_work_attachments.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index f9d393ca3..98de01eab 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -70,6 +70,11 @@ class StudentWorkController < ApplicationController
end
+ #评分
+ def add_score
+
+ end
+
private
#获取作业
def find_homework
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index cb3f0181a..df6b00a9d 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -1,13 +1,41 @@
- 上交时间: 2015-05-07
- 参与人员: 程梦雯 王强
- 关联项目: Trustie Forge
- 内容: 我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就所以它的验证号码速度比一般的方式快。
- 附件: socket实验-123456-王强.zip (123KB)
- 评价:
-
+
+ 上交时间:
+ <%=format_time work.created_at %>
+
+
+
+
+
+ <% if work.project%>
+
+ 关联项目:
+ <%= link_to( work.project.name, project_path(work.project.id), :class => "c_blue02" )%>
+
+ <% end%>
+
+ 内容:
+
+ <%= work.description%>
+
+
+
+
+ 附件:
+ <% if work.attachments.empty?%>
+ 尚未提交附件
+ <% else%>
+ <%= render :partial => 'work_attachments', :locals => {:attachments => work.attachments} %>
+ <% end%>
+
+
+
+ 评价:
+
+
+
评分:
@@ -15,32 +43,24 @@
批阅结果:
-
- -文件不超过200MB
+
+ <%= render :partial => 'attachments/form' %>
+
提交
+
-
-
-
-
-
-
-
jacknudt (教辅)
-
评分: 85分
-
删除
-
回复
-
一小时前
-
-
作品非常好,格式不正确,继续努力!
-
-
-
-
程梦雯
-
删除
-
一小时前
-
-
谢谢老师!
-
-
-
-
-
-
-
程梦雯
-
删除
-
一小时前
-
-
谢谢老师!
-
-
-
-
-
-
-
-
收起
+
收起
\ No newline at end of file
diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb
new file mode 100644
index 000000000..638644fdf
--- /dev/null
+++ b/app/views/student_work/_work_attachments.html.erb
@@ -0,0 +1,5 @@
+<% for attachment in attachments %>
+ <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
+
(<%= number_to_human_size attachment.filesize %>)
+
+<% end -%>
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 258d26cf9..2a7396ae2 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -84,9 +84,6 @@
<%= link_to student_work.user.show_name,user_path(student_work.user),:class => "c_blue02 hwork_name"%>
-
-
-
<%= link_to student_work.name, student_work_path(student_work),:remote => true%>
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 255536e9c..e7421d1fe 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -34,6 +34,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.fmYh{font-family:"MicroSoft Yahei";}
.font999{ color:#999;}
.fontRed{color:#770000;}
+.text_c{ text-align:center;}
/* Float & Clear */
.cl{ clear:both; overflow:hidden; }
@@ -77,6 +78,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.mt5{ margin-top:5px;}
.mt8{ margin-top:8px;}
.mt10{ margin-top:10px;}
+.mt30{ margin-top: 30px;}
.mb5{ margin-bottom:5px;}
.mb10{ margin-bottom:10px;}
.mb20{ margin-bottom:20px;}
@@ -133,6 +135,7 @@ a.c_green{ color:#28be6c;}
.b_grey{ background: #F5F5F5;}
.b_dgrey{ background: #CCC;}
.c_orange{color:#e8770d;}
+.c_dark{ color:#2d2d2d;}
.c_lorange{ color:#ff9900;}
.c_purple{color: #6883b6;}
.c_blue{ color:#15bccf;}
@@ -169,6 +172,9 @@ a:hover.bgreen_u_btn{background:#1abc9c; color:#fff;}
.blue_u_btn{border:1px solid #64bdd9; padding:2px 10px; color:#64bdd9;}
a.blue_u_btn{border:1px solid #64bdd9; padding:2px 10px; color:#64bdd9;}
a:hover.blue_u_btn{background:#64bdd9; color:#fff;}
+.blue_n_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;}
+a.blue_n_btn{background:#64bdd9;color:#fff;font-weight:normal; padding:2px 10px; text-align:center;}
+a:hover.blue_n_btn{ background:#329cbd;}
.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;}
@@ -184,6 +190,7 @@ a:hover.blue_u_btn{background:#64bdd9; color:#fff;}
.pic_mes{ display:block; background:url(../images/new_project/public_icon.png) 0px -376px no-repeat; width:20px; height:15px; padding-left:18px;}
.pic_img{ display:block; background:url(../images/new_project/public_icon.png) -31px -419px no-repeat; width:20px; height:15px; }
.pic_del{ display:block; background:url(../images/new_project/public_icon.png) 0px -235px no-repeat; width:20px; height:15px; }
+.pic_del:hover{ background:url(../images/new_project/public_icon.png) -32px -235px no-repeat; }
.pic_stats{display:block; background:url(../images/new_project/public_icon.png) 0px -548px no-repeat; width:20px; height:15px;}
.pic_files{display:block; background:url(../images/new_project/public_icon.png) 0px -578px no-repeat; width:20px; height:15px;}
.pic_text{display:block; background:url(../images/new_project/public_icon.png) 0px -609px no-repeat; width:20px; height:18px;}
From c289af2e7c36ff1f074832f632cf69c37d834b87 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Sat, 23 May 2015 11:24:24 +0800
Subject: [PATCH 022/187] =?UTF-8?q?=E8=AF=84=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 13 +++++++++++--
app/views/student_work/add_score.js.erb | 0
config/routes.rb | 2 +-
3 files changed, 12 insertions(+), 3 deletions(-)
create mode 100644 app/views/student_work/add_score.js.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 98de01eab..a008414f3 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -1,8 +1,8 @@
class StudentWorkController < ApplicationController
layout "base_courses"
before_filter :find_homework, :only => [:new, :index, :create]
- before_filter :find_work, :only => [:edit, :update, :show, :destroy]
- before_filter :member_of_course, :only => [:index, :new, :create, :show]
+ before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score]
+ before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
def index
@@ -72,7 +72,16 @@ class StudentWorkController < ApplicationController
#评分
def add_score
+ respond_to do |format|
+ format.js
+ end
+ end
+ #评分的回复
+ def add_score_reply
+ respond_to do |format|
+ format.js
+ end
end
private
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/config/routes.rb b/config/routes.rb
index ba0ad11fb..dba1e8340 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -93,7 +93,7 @@ RedmineApp::Application.routes.draw do
resources :student_work do
member do
-
+ post 'add_score'
end
collection do
From e3379cf205e30bbea62146f0ba9b796b4c63e567 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 26 May 2015 09:07:32 +0800
Subject: [PATCH 023/187] =?UTF-8?q?=E6=AF=8F=E9=A1=B5=E6=98=BE=E7=A4=BA20?=
=?UTF-8?q?=E4=BB=BD=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index bc0f68e88..3aeb37101 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -8,7 +8,7 @@ class HomeworkCommonController < ApplicationController
homeworks = @course.homework_commons
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
- @homeworks = paginateHelper homeworks,10
+ @homeworks = paginateHelper homeworks,20
respond_to do |format|
format.html
end
From f3597d9aa56d2a099a3987c5a17f89048edaf8fe Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 26 May 2015 10:00:37 +0800
Subject: [PATCH 024/187] =?UTF-8?q?=E5=BC=80=E5=90=AF/=E5=85=B3=E9=97=AD?=
=?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=BC=B9=E6=A1=86=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 13 +++++-
app/helpers/courses_helper.rb | 3 +-
app/helpers/homework_common_helper.rb | 11 +++++
.../homework_common/_alert_anonyoms.html.erb | 42 +++++++++++++++++++
.../alert_anonymous_comment.js.erb | 8 +++-
public/javascripts/course.js | 17 +++++++-
public/stylesheets/courses.css | 12 ++++++
7 files changed, 101 insertions(+), 5 deletions(-)
create mode 100644 app/views/homework_common/_alert_anonyoms.html.erb
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 3aeb37101..3c2321ae2 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -1,7 +1,7 @@
class HomeworkCommonController < ApplicationController
layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create]
- before_filter :find_homework, :only => [:edit,:update]
+ before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
def index
@@ -135,6 +135,17 @@ class HomeworkCommonController < ApplicationController
#提示
def alert_anonymous_comment
+ @cur_size = 0
+ @totle_size = 0
+ if @homework_detail_manual.comment_status == 1
+ @totle_size = @course.student.count
+ @cur_size = @homework.student_works.size
+ elsif @homework_detail_manual.comment_status == 2
+ @homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
+ @cur_size = 0
+ @homework.student_works.map { |work| @cur_size += work.student_works_scores.count}
+ end
+ @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
respond_to do |format|
format.js
end
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 8b13f507b..d0de1690a 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -201,14 +201,13 @@ module CoursesHelper
end
members
end
+
def searchStudent project
#searchPeopleByRoles(project, StudentRoles)
members = []
-
project.members.each do |m|
if m && m.user && m.user.allowed_to?(:as_student,project)
members << m
-
end
end
members
diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb
index 3fcd0a890..4b9a44c07 100644
--- a/app/helpers/homework_common_helper.rb
+++ b/app/helpers/homework_common_helper.rb
@@ -95,4 +95,15 @@ module HomeworkCommonHelper
end
type
end
+
+ #根据传入作业确定跳转到开启匿评还是关闭匿评功能
+ def alert_anonyoms_path homework,homework_detail_manual
+ link = ""
+ if homework_detail_manual.comment_status == 1
+ link = start_anonymous_comment_homework_common_url homework.id
+ elsif homework_detail_manual.comment_status == 2
+ link = stop_anonymous_comment_homework_common_url homework.id
+ end
+ link
+ end
end
\ No newline at end of file
diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb
new file mode 100644
index 000000000..3b199e0d8
--- /dev/null
+++ b/app/views/homework_common/_alert_anonyoms.html.erb
@@ -0,0 +1,42 @@
+
+
+ <% if @homework_detail_manual.comment_status == 1%>
+
开启匿评功能
+
+ 开启匿评后学生将不能对作品进行
+ 修改、删除
+ 等操作,目前有
+ <%= @totle_size%>个
+ 学生,共提交了
+ <%= @cur_size %>
+ 份作品,占
+ <%= @percent %>% ,
+ 是否确定开启匿评?
+
+ <% elsif @homework_detail_manual.comment_status == 2 %>
+
关闭匿评功能
+
+ 关闭匿评后学生将不能对作品进行
+ 匿评
+ ,且作品列表将会
+ 公开 ,
+ 目前分配了
+ <%= @totle_size%>份
+ 匿评作品,已评了
+ <%= @cur_size %>
+ 份作品,占
+ <%= @percent %>% ,
+ 是否确定关闭匿评?
+
+ <% end %>
+
+
+
+
diff --git a/app/views/homework_common/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb
index f1f6527c1..2b3248dc2 100644
--- a/app/views/homework_common/alert_anonymous_comment.js.erb
+++ b/app/views/homework_common/alert_anonymous_comment.js.erb
@@ -1 +1,7 @@
-alert(1111);
\ No newline at end of file
+$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>');
+showModal('ajax-modal', '500px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before("" +
+" ");
+$('#ajax-modal').parent().css("top","").css("left","");
+$('#ajax-modal').parent().addClass("anonymos");
\ No newline at end of file
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 63d20fefd..6eb213eef 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -773,4 +773,19 @@ $(function(){
//alert($(this).html());
$(this).find("div").hide();
});
-});
\ No newline at end of file
+});
+
+//匿评弹框取消按钮
+function clickCanel(){hideModal("#popbox02");}
+//匿评弹框确定按钮
+function clickOK(path)
+{
+ clickCanel();
+ $.ajax({
+ type: "GET",
+ url: path,
+ data: 'text',
+ success: function (data) {
+ }
+ });
+}
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index e1d314c53..93a8da41f 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -288,6 +288,18 @@ a:hover.member_btn{ background:#329cbd;}
.ni_con p{ color:#808181;}
.ni_con a:hover{ text-decoration:none;}
a.xls{ margin-left:5px; color:#136b3b;}
+
+/* 开启匿评弹框 */
+.anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
+.ni_con { width:425px; margin:25px 30px;}
+.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;}
+.ni_con p{ color:#808181; }
+.ni_con a:hover{ text-decoration:none;}
+.ni_btn{ width:190px; margin:15px auto; line-height:1.9;}
+a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:15px;}
+a:hover.tijiao{ background:#0f99a9;}
+.c_pink{ color:#e65d5e;}
+
/* 学生列表*/
.st_list{ width:670px;}
.st_search{ }
From 96354a1c0073a0259fdbafad67508a38c71bead4 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 26 May 2015 10:22:16 +0800
Subject: [PATCH 025/187] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=BC=80=E5=90=AF?=
=?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 31 +++++++++++++++++--
.../start_anonymous_comment.js.erb | 10 ++++++
2 files changed, 39 insertions(+), 2 deletions(-)
create mode 100644 app/views/homework_common/start_anonymous_comment.js.erb
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 3c2321ae2..d1c2b4bac 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -1,7 +1,7 @@
class HomeworkCommonController < ApplicationController
layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create]
- before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment]
+ before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
def index
@@ -124,8 +124,30 @@ class HomeworkCommonController < ApplicationController
end
#开启匿评
+ #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
def start_anonymous_comment
-
+ @statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
+ if @homework_detail_manual.comment_status == 1
+ student_works = @homework.student_works
+ if student_works && student_works.size >=2
+ student_works.each_with_index do |work, index|
+ user = work.user
+ n = @homework_detail_manual.evaluation_num
+ n = n < student_works.size ? n : student_works.size - 1
+ assigned_homeworks = get_assigned_homeworks(student_works, n, index)
+ assigned_homeworks.each do |h|
+ student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
+ student_works_evaluation_distributions.save
+ end
+ end
+ @homework_detail_manual.update_column('comment_status', 2)
+ @statue = 1
+ else
+ @statue = 2
+ end
+ else
+ @statue = 3
+ end
end
#关闭匿评
@@ -170,4 +192,9 @@ class HomeworkCommonController < ApplicationController
def teacher_of_course
render_403 unless User.current.allowed_to?(:as_teacher,@course)
end
+
+ def get_assigned_homeworks(student_works, n, index)
+ student_works += student_works
+ student_works[index + 1 .. index + n]
+ end
end
\ No newline at end of file
diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb
new file mode 100644
index 000000000..cd4dafde8
--- /dev/null
+++ b/app/views/homework_common/start_anonymous_comment.js.erb
@@ -0,0 +1,10 @@
+<% if @statue == 1%>
+alert('启动成功');
+$("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "fr mr10 work_edit")%>');
+<% elsif @statue == 2 %>
+alert('启动失败\n作业总数大于等于2份时才能启动匿评');
+<% elsif @statue == 3%>
+alert("已开启匿评,请务重复开启");
+<% elsif @statue == 3%>
+alert("您没有权限开启匿评");
+<% end %>
\ No newline at end of file
From f3246b99c9eaa36e2f8c2ae3a123f8d2addfb0f9 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 26 May 2015 11:24:48 +0800
Subject: [PATCH 026/187] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 7 +++++--
app/views/homework_common/stop_anonymous_comment.js.erb | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
create mode 100644 app/views/homework_common/stop_anonymous_comment.js.erb
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index d1c2b4bac..fb22d6378 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -1,7 +1,7 @@
class HomeworkCommonController < ApplicationController
layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create]
- before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment]
+ before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
def index
@@ -152,7 +152,10 @@ class HomeworkCommonController < ApplicationController
#关闭匿评
def stop_anonymous_comment
-
+ @homework_detail_manual.update_column('comment_status', 3)
+ respond_to do |format|
+ format.js
+ end
end
#提示
diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb
new file mode 100644
index 000000000..9a6131c64
--- /dev/null
+++ b/app/views/homework_common/stop_anonymous_comment.js.erb
@@ -0,0 +1,2 @@
+$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('匿评结束 ');
+alert('关闭成功');
\ No newline at end of file
From 1ae8c7d234f30e666600f909b5f0ca2de99d21ab Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 26 May 2015 17:51:56 +0800
Subject: [PATCH 027/187] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=AF=84=E5=88=86?=
=?UTF-8?q?=E3=80=81=E4=B8=8A=E4=BC=A0=E8=AF=84=E9=98=85=E7=BB=93=E6=9E=9C?=
=?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8A=E4=B8=8A=E4=BC=A0=E7=BB=93=E6=9E=9C?=
=?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 1 +
app/views/attachments/upload.js.erb | 3 --
app/views/layouts/base_courses.html.erb | 2 +-
app/views/student_work/_show.html.erb | 39 ++++++++++---------
.../_student_work_attachment_form.html.erb | 34 ++++++++++++++++
app/views/student_work/add_score.js.erb | 1 +
public/stylesheets/courses.css | 2 +
public/stylesheets/public.css | 1 +
8 files changed, 61 insertions(+), 22 deletions(-)
create mode 100644 app/views/student_work/_student_work_attachment_form.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index a008414f3..d3a4be17d 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -72,6 +72,7 @@ class StudentWorkController < ApplicationController
#评分
def add_score
+
respond_to do |format|
format.js
end
diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb
index c3e7fc3ff..970c5b22d 100644
--- a/app/views/attachments/upload.js.erb
+++ b/app/views/attachments/upload.js.erb
@@ -11,7 +11,4 @@ fileSpan.find('a.remove-upload')
})
.off('click');
$(' ', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
-
-//var divattach = fileSpan.find('div.div_attachments');
-//divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>');
<% end %>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 6849f1f13..09844778c 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -18,7 +18,7 @@
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2', 'courses'%>
- <%= javascript_include_tag "course","header" %>
+ <%= javascript_include_tag "course","header","attachments" %>
<%= yield :header_tags -%>
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index df6b00a9d..b2eabc536 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -31,24 +31,27 @@
<% end%>
-
- 评价:
-
-
-
-
- 评分:
-
- 分
-
-
- 批阅结果:
-
- <%= render :partial => 'attachments/form' %>
-
- 提交
-
-
+
+ <%= form_for('new_form', :remote => true, :method => :post,:url => add_score_student_work_path(work.id)) do |f|%>
+
+ 评价:
+ <%= f.text_area 'user_message', :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
+
+
+
+ 评分:
+
+ 分
+
+
+ 批阅结果:
+
+ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:id => work.id} %>
+
+ 提交
+
+
+ <% end%>
diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb
new file mode 100644
index 000000000..f56d70f36
--- /dev/null
+++ b/app/views/student_work/_student_work_attachment_form.html.erb
@@ -0,0 +1,34 @@
+
+
+
+
+ <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
+ <%= file_field_tag 'attachments[dummy][file]',
+ :id => "_file#{id}",
+ :class => 'file_selector',
+ :multiple => true,
+ :onchange => "addInputFiles_board(this, '#{id}');",
+ :style => '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),
+ :containerid => "#{id}"
+ } %>
+
+ <%= l(:label_no_file_uploaded) %>
+
+ (<%= l(:label_max_size) %>:
+ <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
+
+ <% content_for :header_tags do %>
+ <%= javascript_include_tag 'attachments' %>
+ <% end %>
+
+
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index e69de29bb..6f0d25876 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -0,0 +1 @@
+alert("评分成功");
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 93a8da41f..b503fd88d 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -672,6 +672,8 @@ input#score{ width:40px;}
.ui-slider .ui-slider-handle:active{background-image:none;}
.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;}
+.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px;}
+
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index e7421d1fe..b995c6d5c 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -6,6 +6,7 @@ table,tr,td{border:0;cellspacing:0; cellpadding:0;}
ol,ul,li{ list-style-type:none}
a:link,a:visited{color:#7f7f7f;text-decoration:none;}
a:hover,a:active{color:#000;}
+textarea {resize: none;}
/*常用*/
select,input,textarea{ border:1px solid #64bdd9; background:#fff; color:#000; padding-left:5px; }
From a006e2e46256d6aaf53074dc0dc9c7c0f20d65f1 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 26 May 2015 18:14:53 +0800
Subject: [PATCH 028/187] =?UTF-8?q?1=E3=80=81=E5=AE=9E=E7=8E=B0=E6=89=93?=
=?UTF-8?q?=E5=88=86=E5=8A=9F=E8=83=BD=202=E3=80=81=E6=89=93=E5=88=86?=
=?UTF-8?q?=E4=B9=8B=E5=90=8E=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0=203?=
=?UTF-8?q?=E3=80=81=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A=E7=94=A8=E6=88=B7?=
=?UTF-8?q?=E5=AF=B9=E6=9F=90=E4=B8=80=E4=BD=9C=E4=B8=9A=E7=9A=84=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E7=BB=93=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 26 +++++++++++++++++--
app/helpers/student_work_helper.rb | 6 +++++
app/views/student_work/_add_score.html.erb | 20 ++++++++++++++
app/views/student_work/_show.html.erb | 23 +++-------------
.../_student_work_attachment_form.html.erb | 12 ++++-----
app/views/student_work/add_score.js.erb | 2 ++
6 files changed, 61 insertions(+), 28 deletions(-)
create mode 100644 app/views/student_work/_add_score.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index d3a4be17d..5e09c5460 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -1,5 +1,6 @@
class StudentWorkController < ApplicationController
layout "base_courses"
+ include StudentWorkHelper
before_filter :find_homework, :only => [:new, :index, :create]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score]
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score]
@@ -72,9 +73,30 @@ class StudentWorkController < ApplicationController
#评分
def add_score
+ score = student_work_score @work,User.current
+ if score
+ if params[:new_form] && params[:new_form][:user_message]
+ score.score = params[:score]
+ score.comment = params[:new_form][:user_message]
+ end
+ else
+ if params[:new_form] && params[:new_form][:user_message]
+ score = StudentWorksScore.new
+ score.score = params[:score]
+ score.comment = params[:new_form][:user_message]
+ score.user_id = User.current.id
+ score.student_work_id = @work.id
+ score.reviewer_role = 1
+ end
+ end
- respond_to do |format|
- format.js
+ score.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(score)
+
+ if score.save
+ respond_to do |format|
+ format.js
+ end
end
end
diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb
index 467cbcdce..e4a9bceba 100644
--- a/app/helpers/student_work_helper.rb
+++ b/app/helpers/student_work_helper.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
module StudentWorkHelper
def user_projects_option
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
@@ -18,4 +19,9 @@ module StudentWorkHelper
end
type
end
+
+ #获取指定用户对某一作业的评分结果
+ def student_work_score work,user
+ StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).first
+ end
end
\ No newline at end of file
diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb
new file mode 100644
index 000000000..66aeee68c
--- /dev/null
+++ b/app/views/student_work/_add_score.html.erb
@@ -0,0 +1,20 @@
+<%= form_for('new_form', :remote => true, :method => :post,:url => add_score_student_work_path(work.id)) do |f|%>
+
+ 评价:
+ <%= f.text_area 'user_message', :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
+
+
+
+ 评分:
+
+ 分
+
+
+ 批阅结果:
+
+ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work} %>
+
+ 提交
+
+
+<% end%>
\ No newline at end of file
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index b2eabc536..ea9f9a420 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -32,26 +32,9 @@
- <%= form_for('new_form', :remote => true, :method => :post,:url => add_score_student_work_path(work.id)) do |f|%>
-
- 评价:
- <%= f.text_area 'user_message', :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
-
-
-
- 评分:
-
- 分
-
-
- 批阅结果:
-
- <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:id => work.id} %>
-
- 提交
-
-
- <% end%>
+
+ <%= render :partial => 'add_score',:locals => {:work => work}%>
+
diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb
index f56d70f36..00028f481 100644
--- a/app/views/student_work/_student_work_attachment_form.html.erb
+++ b/app/views/student_work/_student_work_attachment_form.html.erb
@@ -1,13 +1,13 @@
-
+
- <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
+ <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
<%= file_field_tag 'attachments[dummy][file]',
- :id => "_file#{id}",
+ :id => "_file#{work.id}",
:class => 'file_selector',
:multiple => true,
- :onchange => "addInputFiles_board(this, '#{id}');",
+ :onchange => "addInputFiles_board(this, '#{work.id}');",
:style => 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
@@ -19,9 +19,9 @@
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all),
- :containerid => "#{id}"
+ :containerid => "#{work.id}"
} %>
-
+
<%= l(:label_no_file_uploaded) %>
(<%= l(:label_max_size) %>:
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index 6f0d25876..fa58c3739 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -1 +1,3 @@
+$("#add_student_score").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work}) %>");
+$('#score_<%= @work.id%>').peSlider({range: 'min'});
alert("评分成功");
\ No newline at end of file
From fa3b9e2af09d14321fb8a297fe6d0e37860468c4 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 08:55:33 +0800
Subject: [PATCH 029/187] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E8=AF=84=E5=88=86=E7=95=8C=E9=9D=A2=EF=BC=8C=E8=AF=84=E5=88=86?=
=?UTF-8?q?=E7=AD=89=E6=95=B0=E6=8D=AE=E7=9A=84=E5=88=9D=E5=A7=8B=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 1 +
app/views/student_work/_add_score.html.erb | 4 ++--
app/views/student_work/_show.html.erb | 2 +-
app/views/student_work/_student_work_attachment_form.html.erb | 4 +++-
app/views/student_work/show.js.erb | 2 +-
5 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 5e09c5460..7e3bab1d6 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -62,6 +62,7 @@ class StudentWorkController < ApplicationController
end
def show
+ @score = student_work_score @work,User.current
respond_to do |format|
format.js
end
diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb
index 66aeee68c..68f4185b4 100644
--- a/app/views/student_work/_add_score.html.erb
+++ b/app/views/student_work/_add_score.html.erb
@@ -6,13 +6,13 @@
评分:
-
+
分
批阅结果:
- <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work} %>
+ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
提交
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index ea9f9a420..5506a9951 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -33,7 +33,7 @@
- <%= render :partial => 'add_score',:locals => {:work => work}%>
+ <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb
index 00028f481..5290ad9bb 100644
--- a/app/views/student_work/_student_work_attachment_form.html.erb
+++ b/app/views/student_work/_student_work_attachment_form.html.erb
@@ -1,5 +1,7 @@
-
+
+
+
<%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
diff --git a/app/views/student_work/show.js.erb b/app/views/student_work/show.js.erb
index 1f7e98e48..f208aa52e 100644
--- a/app/views/student_work/show.js.erb
+++ b/app/views/student_work/show.js.erb
@@ -2,6 +2,6 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0)
{$("#about_hwork_<%= @work.id%>").html("");}
else
{
- $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => @work}) %>");
+ $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => @work,:score => @score}) %>");
$('#score_<%= @work.id%>').peSlider({range: 'min'});
}
\ No newline at end of file
From 1fe7c709555cf4871c7364b1e103c86f32407c1a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 09:29:27 +0800
Subject: [PATCH 030/187] =?UTF-8?q?1=E3=80=81=E8=AF=84=E4=BB=B7=E4=BD=9C?=
=?UTF-8?q?=E5=93=81=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=98=85=E7=BB=93=E6=9E=9C?=
=?UTF-8?q?=E7=9A=84=E5=88=A0=E9=99=A4=E4=B8=8E=E6=98=BE=E7=A4=BA=202?=
=?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=98=B5?=
=?UTF-8?q?=E7=A7=B0=E4=B8=8B=E6=8B=89=E6=A1=86=E6=97=A0=E6=B3=95=E6=AD=A3?=
=?UTF-8?q?=E5=B8=B8=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../_student_work_attachment_form.html.erb | 23 +++++++++-
public/javascripts/course.js | 43 ++++++++++---------
2 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb
index 5290ad9bb..dd1793034 100644
--- a/app/views/student_work/_student_work_attachment_form.html.erb
+++ b/app/views/student_work/_student_work_attachment_form.html.erb
@@ -1,6 +1,27 @@
-
+ <% if defined?(score) && score && score.saved_attachments %>
+ <% score.attachments.each_with_index do |attachment, i| %>
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= l(:field_is_public)%>:
+ <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+ <% score.saved_attachments.each_with_index do |attachment, i| %>
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= l(:field_is_public)%>:
+ <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+ <% end %>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 6eb213eef..5ed25ab6c 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -735,28 +735,31 @@ var s;
function goTopEx() {
var obj = document.getElementById("goTopBtn");
- var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
- function getScrollTop() {
- var xsun = document.documentElement.scrollTop;
- if (Sys.chrome) {
- xsun=document.body.scrollTop;
+ if(obj != null)
+ {
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
+ function getScrollTop() {
+ var xsun = document.documentElement.scrollTop;
+ if (Sys.chrome) {
+ xsun=document.body.scrollTop;
+ }
+ return xsun;
}
- return xsun;
- }
- function setScrollTop(value) {
- if (Sys.chrome) {
- document.body.scrollTop = value;
+ function setScrollTop(value) {
+ if (Sys.chrome) {
+ document.body.scrollTop = value;
+ }
+ else {
+ document.documentElement.scrollTop = value;
+ }
}
- else {
- document.documentElement.scrollTop = value;
- }
- }
- window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
- obj.onclick = function () {
- var goTop = setInterval(scrollMove, 10);
- function scrollMove() {
- setScrollTop(getScrollTop() / 1.1);
- if (getScrollTop() < 1) clearInterval(goTop);
+ window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
+ obj.onclick = function () {
+ var goTop = setInterval(scrollMove, 10);
+ function scrollMove() {
+ setScrollTop(getScrollTop() / 1.1);
+ if (getScrollTop() < 1) clearInterval(goTop);
+ }
}
}
}
From a0324f5e396ec2d0865b870f82eeee660f24a5a3 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 11:25:32 +0800
Subject: [PATCH 031/187] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=84=E5=88=86?=
=?UTF-8?q?=E5=9B=9E=E5=A4=8D=EF=BC=8C=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=20=E8=AF=84=E5=88=86=E5=9B=9E=E5=A4=8D?=
=?UTF-8?q?=E7=9C=9F=E5=AE=9E=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA=20?=
=?UTF-8?q?=E8=AF=84=E5=88=86=E5=9B=9E=E5=A4=8D=E4=BB=A5=E5=8F=8A=E5=9B=9E?=
=?UTF-8?q?=E5=A4=8D=E5=88=A0=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 11 ++-
app/helpers/student_work_helper.rb | 12 +++
app/models/student_works_score.rb | 2 +
app/views/student_work/_add_score.html.erb | 2 +-
app/views/student_work/_show.html.erb | 92 +++++++++++--------
.../_student_work_attachment_form.html.erb | 22 -----
app/views/student_work/show.js.erb | 2 +-
config/routes.rb | 3 +-
8 files changed, 82 insertions(+), 64 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 7e3bab1d6..a1ea891a5 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -72,7 +72,7 @@ class StudentWorkController < ApplicationController
end
- #评分
+ #添加评分,已评分则为修改评分
def add_score
score = student_work_score @work,User.current
if score
@@ -101,13 +101,20 @@ class StudentWorkController < ApplicationController
end
end
- #评分的回复
+ #添加评分的回复
def add_score_reply
respond_to do |format|
format.js
end
end
+ #删除评分的回复
+ def destroy_score_reply
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
#获取作业
def find_homework
diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb
index e4a9bceba..20a85f19e 100644
--- a/app/helpers/student_work_helper.rb
+++ b/app/helpers/student_work_helper.rb
@@ -24,4 +24,16 @@ module StudentWorkHelper
def student_work_score work,user
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).first
end
+
+ #获取指定评分的角色
+ def student_work_score_role score
+ case score.reviewer_role
+ when 1
+ role = "教师"
+ when 2
+ role = "教辅"
+ when 3
+ role = "学生"
+ end
+ end
end
\ No newline at end of file
diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb
index a4592dd3e..e44cef6ac 100644
--- a/app/models/student_works_score.rb
+++ b/app/models/student_works_score.rb
@@ -1,8 +1,10 @@
class StudentWorksScore < ActiveRecord::Base
+ #reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role
belongs_to :user
belongs_to :student_work
+ has_many :journals_for_messages, :dependent => :destroy
acts_as_attachable
end
diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb
index 68f4185b4..a1406902f 100644
--- a/app/views/student_work/_add_score.html.erb
+++ b/app/views/student_work/_add_score.html.erb
@@ -6,7 +6,7 @@
评分:
-
+
分
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 5506a9951..50d988403 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -3,73 +3,91 @@
上交时间:
- <%=format_time work.created_at %>
+ <%=format_time @work.created_at %>
- <% if work.project%>
+ <% if @work.project%>
关联项目:
- <%= link_to( work.project.name, project_path(work.project.id), :class => "c_blue02" )%>
+ <%= link_to( @work.project.name, project_path(@work.project.id), :class => "c_blue02" )%>
<% end%>
内容:
- <%= work.description%>
+ <%= @work.description%>
附件:
- <% if work.attachments.empty?%>
+ <% if @work.attachments.empty?%>
尚未提交附件
<% else%>
- <%= render :partial => 'work_attachments', :locals => {:attachments => work.attachments} %>
+ <%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %>
<% end%>
- <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
+ <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
+<% unless @work.student_works_scores.empty?%>
-
-
-
-
-
-
jacknudt
-
(教辅)
-
评分:
-
85分
-
删除
-
回复
-
一小时前
-
-
作品非常好,格式不正确,继续努力!
-
-
回复
-
-
-
-
-
程梦雯
-
删除
-
一小时前
+ <%@work.student_works_scores.each do |score|%>
+
+ <%= link_to image_tag(url_to_avatar(score.user), :width => "34", :height => "34"), user_path(score.user),:class => "ping_pic fl" %>
+
+ <%= link_to score.user.show_name, user_path(score.user), :title => score.user.show_name, :class => "c_blue fl" %>
+
(<%= student_work_score_role score%>)
+
评分:
+
<%= score.score%>分
+
回复
+
+ <%=format_time score.created_at %>
+
-
谢谢老师!
-
+
+ <%= score.comment%>
+
+
+ <%form_for "", add_score_reply_student_work_path(@work)%>
+
+ 回复
+
+ <% score.journals_for_messages.each do |jour|%>
+
+ <%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
+
+
+
+ <% end%>
+
-
-
-
-
+
+ <% end%>
-收起
+<%end%>
+收起
\ No newline at end of file
diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb
index dd1793034..7802f6eb6 100644
--- a/app/views/student_work/_student_work_attachment_form.html.erb
+++ b/app/views/student_work/_student_work_attachment_form.html.erb
@@ -1,27 +1,5 @@
- <% if defined?(score) && score && score.saved_attachments %>
- <% score.attachments.each_with_index do |attachment, i| %>
-
- <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
- <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
- <%= l(:field_is_public)%>:
- <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
- <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
- <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
-
- <% end %>
- <% score.saved_attachments.each_with_index do |attachment, i| %>
-
- <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
- <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
- <%= l(:field_is_public)%>:
- <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
- <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
- <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
-
- <% end %>
- <% end %>
diff --git a/app/views/student_work/show.js.erb b/app/views/student_work/show.js.erb
index f208aa52e..fa12e097d 100644
--- a/app/views/student_work/show.js.erb
+++ b/app/views/student_work/show.js.erb
@@ -2,6 +2,6 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0)
{$("#about_hwork_<%= @work.id%>").html("");}
else
{
- $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => @work,:score => @score}) %>");
+ $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
$('#score_<%= @work.id%>').peSlider({range: 'min'});
}
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index dba1e8340..0bb3f6bed 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -94,9 +94,10 @@ RedmineApp::Application.routes.draw do
resources :student_work do
member do
post 'add_score'
+ post 'add_score_reply'
end
collection do
-
+ delete 'destroy_score_reply'
end
end
From 2bb59ffd79e74fc78002f7e8064502b0b392ee35 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 14:58:55 +0800
Subject: [PATCH 032/187] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E5=93=81=E8=AF=84?=
=?UTF-8?q?=E8=AE=BA=E5=9B=9E=E5=A4=8D=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=88=B7=E6=96=B0=202=E3=80=81=E8=B0=83?=
=?UTF-8?q?=E6=95=B4=E5=9B=9E=E5=A4=8D=E6=A1=86=E5=AE=BD=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 9 +++--
app/models/journals_for_message.rb | 1 +
app/models/student_works_score.rb | 2 +-
.../student_work/_add_score_reply.html.erb | 4 +++
app/views/student_work/_jour_replay.html.erb | 20 +++++++++++
app/views/student_work/_show.html.erb | 35 ++++++-------------
app/views/student_work/add_score_reply.js.erb | 2 ++
public/stylesheets/courses.css | 2 +-
8 files changed, 46 insertions(+), 29 deletions(-)
create mode 100644 app/views/student_work/_add_score_reply.html.erb
create mode 100644 app/views/student_work/_jour_replay.html.erb
create mode 100644 app/views/student_work/add_score_reply.js.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index a1ea891a5..98ebc0705 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -103,13 +103,18 @@ class StudentWorkController < ApplicationController
#添加评分的回复
def add_score_reply
- respond_to do |format|
- format.js
+ @score = StudentWorksScore.find params[:id]
+ @jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
+ if @jour.save
+ respond_to do |format|
+ format.js
+ end
end
end
#删除评分的回复
def destroy_score_reply
+
respond_to do |format|
format.js
end
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 239a15881..b15c9b2d1 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -29,6 +29,7 @@ class JournalsForMessage < ActiveRecord::Base
belongs_to :jour, :polymorphic => true
belongs_to :user
belongs_to :homework_attach
+ belongs_to :student_works_score
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb
index e44cef6ac..8fa14f8de 100644
--- a/app/models/student_works_score.rb
+++ b/app/models/student_works_score.rb
@@ -4,7 +4,7 @@ class StudentWorksScore < ActiveRecord::Base
belongs_to :user
belongs_to :student_work
- has_many :journals_for_messages, :dependent => :destroy
+ has_many :journals_for_messages, :as => :jour, :dependent => :destroy
acts_as_attachable
end
diff --git a/app/views/student_work/_add_score_reply.html.erb b/app/views/student_work/_add_score_reply.html.erb
new file mode 100644
index 000000000..99e9c3793
--- /dev/null
+++ b/app/views/student_work/_add_score_reply.html.erb
@@ -0,0 +1,4 @@
+<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_path(score.id)) do |f|%>
+ <%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
+ 回复
+<% end%>
\ No newline at end of file
diff --git a/app/views/student_work/_jour_replay.html.erb b/app/views/student_work/_jour_replay.html.erb
new file mode 100644
index 000000000..d673fb8b0
--- /dev/null
+++ b/app/views/student_work/_jour_replay.html.erb
@@ -0,0 +1,20 @@
+
+ <%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
+
+
+
\ No newline at end of file
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 50d988403..205b3106f 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -56,32 +56,17 @@
<%= score.comment%>
- <%form_for "", add_score_reply_student_work_path(@work)%>
-
- 回复
+
+
+ <%= render :partial => 'add_score_reply',:locals => {:score => score}%>
+
+
- <% score.journals_for_messages.each do |jour|%>
-
- <%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
-
-
-
- <% end%>
+
+ <% score.journals_for_messages.order("created_on desc").each do |jour|%>
+ <%= render :partial => 'jour_replay',:locals => {:jour => jour}%>
+ <% end%>
+
diff --git a/app/views/student_work/add_score_reply.js.erb b/app/views/student_work/add_score_reply.js.erb
new file mode 100644
index 000000000..7b53b54d8
--- /dev/null
+++ b/app/views/student_work/add_score_reply.js.erb
@@ -0,0 +1,2 @@
+$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score}) %>");
+$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index b503fd88d..a4c19e0e4 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -653,7 +653,7 @@ a:hover.ping_pic{border:1px solid #64bdd9;}
.ping_box_tit{ float:left; width:575px; margin-left:10px;}
.ping_box_ul{}
.ping_line{ border-bottom:1px dashed #CCCCCC; padding-bottom:8px; margin-bottom:8px;}
-.ping_text{border:1px solid #CCCCCC; margin:5px; padding:5px; width:560px; height:20px; }
+.ping_text{border:1px solid #CCCCCC; margin:5px; padding:5px; width:560px; height:50px; }
.ping_back_tit{ float:left; width:523px; margin-left:10px; }
a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;}
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
From fea784cbccd82c6b474b5b63d758475549391d5d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 15:11:11 +0800
Subject: [PATCH 033/187] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E5=9B=9E=E5=A4=8D=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8F=98?=
=?UTF-8?q?=202=E3=80=81=E5=88=A0=E9=99=A4=E5=9B=9E=E5=A4=8D=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=8F=8A=E7=95=8C=E9=9D=A2=E5=88=B7=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 10 ++++++----
app/views/student_work/_add_score_reply.html.erb | 2 +-
app/views/student_work/_jour_replay.html.erb | 2 +-
app/views/student_work/destroy_score_reply.js.erb | 1 +
config/routes.rb | 4 ++--
public/stylesheets/courses.css | 2 +-
6 files changed, 12 insertions(+), 9 deletions(-)
create mode 100644 app/views/student_work/destroy_score_reply.js.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 98ebc0705..63ab4d0f0 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -103,7 +103,7 @@ class StudentWorkController < ApplicationController
#添加评分的回复
def add_score_reply
- @score = StudentWorksScore.find params[:id]
+ @score = StudentWorksScore.find params[:score_id]
@jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
if @jour.save
respond_to do |format|
@@ -114,9 +114,11 @@ class StudentWorkController < ApplicationController
#删除评分的回复
def destroy_score_reply
-
- respond_to do |format|
- format.js
+ @jour = JournalsForMessage.find params[:jour_id]
+ if @jour.destroy
+ respond_to do |format|
+ format.js
+ end
end
end
diff --git a/app/views/student_work/_add_score_reply.html.erb b/app/views/student_work/_add_score_reply.html.erb
index 99e9c3793..2866b2da6 100644
--- a/app/views/student_work/_add_score_reply.html.erb
+++ b/app/views/student_work/_add_score_reply.html.erb
@@ -1,4 +1,4 @@
-<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_path(score.id)) do |f|%>
+<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_index_path(:score_id => score.id)) do |f|%>
<%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
回复
<% end%>
\ No newline at end of file
diff --git a/app/views/student_work/_jour_replay.html.erb b/app/views/student_work/_jour_replay.html.erb
index d673fb8b0..77fb476bf 100644
--- a/app/views/student_work/_jour_replay.html.erb
+++ b/app/views/student_work/_jour_replay.html.erb
@@ -1,4 +1,4 @@
-
+
<%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
diff --git a/app/views/student_work/destroy_score_reply.js.erb b/app/views/student_work/destroy_score_reply.js.erb
new file mode 100644
index 000000000..895e501bf
--- /dev/null
+++ b/app/views/student_work/destroy_score_reply.js.erb
@@ -0,0 +1 @@
+$("#jour_replay_<%= @jour.id%>").remove();
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 0bb3f6bed..ecdaac48c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -94,10 +94,10 @@ RedmineApp::Application.routes.draw do
resources :student_work do
member do
post 'add_score'
- post 'add_score_reply'
end
collection do
- delete 'destroy_score_reply'
+ post 'add_score_reply'
+ get 'destroy_score_reply'
end
end
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index a4c19e0e4..f32387c19 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -646,7 +646,7 @@ a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;}
.tit_fb{ font-weight:bold; width:66px; text-align:right; display:block; float:left;}
.ml160{ margin-left:160px;}
.show_hwork_p{ width:580px; float:left;}
-.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:568px; height:35px;}
+.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:568px; height:50px;}
.ping_box{ width:626px; padding:10px; background:#f5f3f3; }
a.ping_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3;}
a:hover.ping_pic{border:1px solid #64bdd9;}
From bdb0f638dab2563d95576369e837192533f26b0e Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 15:18:53 +0800
Subject: [PATCH 034/187] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=98=85?=
=?UTF-8?q?=E7=BB=93=E6=9E=9C=E7=9A=84=E4=B8=8B=E8=BD=BD=EF=BC=8C=E8=A7=A3?=
=?UTF-8?q?=E5=86=B3=E6=89=B9=E9=98=85=E7=BB=93=E6=9E=9C=E4=B8=8B=E5=91=A8?=
=?UTF-8?q?=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 2 +-
app/views/student_work/_show.html.erb | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index d880ebe35..076082d93 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -428,7 +428,7 @@ private
@attachment.container.board.course)
@course = @attachment.container.board.course
else
- unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion'
+ unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type = 'StudentWorksScore'
@project = @attachment.project
end
end
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 205b3106f..f7a01f309 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -47,7 +47,7 @@
(<%= student_work_score_role score%>)
评分:
<%= score.score%>分
-
回复
+
回复
<%=format_time score.created_at %>
@@ -55,9 +55,10 @@
<%= score.comment%>
-
-
+ <%= render :partial => 'work_attachments', :locals => {:attachments => score.attachments} %>
+
+
<%= render :partial => 'add_score_reply',:locals => {:score => score}%>
From d80ade96c847e12a39f4df408b1a81f5bad14533 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 16:01:00 +0800
Subject: [PATCH 035/187] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E5=90=8E=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0=202?=
=?UTF-8?q?=E3=80=81=E5=A6=82=E6=9E=9C=E5=8F=AA=E5=A1=AB=E5=86=99=E4=BA=86?=
=?UTF-8?q?=E8=AF=84=E5=88=86=E5=B0=B1=E5=8F=AA=E6=9B=B4=E6=96=B0=E8=AF=84?=
=?UTF-8?q?=E5=88=86=EF=BC=8C=E4=B8=8D=E5=AF=B9=E8=AF=84=E8=AE=BA=E8=BF=9B?=
=?UTF-8?q?=E8=A1=8C=E4=BF=AE=E6=94=B9=203=E3=80=81=E5=A6=82=E6=9E=9C?=
=?UTF-8?q?=E5=B7=B2=E7=BB=8F=E8=AF=84=E5=88=86=E8=BF=87=EF=BC=8C=E7=BB=A7?=
=?UTF-8?q?=E7=BB=AD=E8=AF=84=E5=88=86=E4=B8=BA=E4=BF=AE=E6=94=B9=EF=BC=8C?=
=?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=AA=E8=BF=9B=E8=A1=8C=E8=BF=87=E8=AF=84?=
=?UTF-8?q?=E5=88=86=EF=BC=8C=E5=B0=B1=E6=98=AF=E6=B7=BB=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 32 +++++++--------
app/views/student_work/_show.html.erb | 40 +++----------------
.../student_work/_student_work_score.html.erb | 31 ++++++++++++++
app/views/student_work/add_score.js.erb | 9 ++++-
4 files changed, 58 insertions(+), 54 deletions(-)
create mode 100644 app/views/student_work/_student_work_score.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 63ab4d0f0..d5bbd6586 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -74,27 +74,25 @@ class StudentWorkController < ApplicationController
#添加评分,已评分则为修改评分
def add_score
- score = student_work_score @work,User.current
- if score
- if params[:new_form] && params[:new_form][:user_message]
- score.score = params[:score]
- score.comment = params[:new_form][:user_message]
- end
+ @score = student_work_score @work,User.current
+ if @score
+ @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
+ @score.score = params[:score] if params[:score]
+ @is_new = false
else
- if params[:new_form] && params[:new_form][:user_message]
- score = StudentWorksScore.new
- score.score = params[:score]
- score.comment = params[:new_form][:user_message]
- score.user_id = User.current.id
- score.student_work_id = @work.id
- score.reviewer_role = 1
- end
+ @score = StudentWorksScore.new
+ @score.score = params[:score] if params[:score]
+ @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
+ @score.user_id = User.current.id
+ @score.student_work_id = @work.id
+ @score.reviewer_role = 1
+ @is_new = true
end
- score.save_attachments(params[:attachments])
- render_attachment_warning_if_needed(score)
+ @score.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(@score)
- if score.save
+ if @score.save
respond_to do |format|
format.js
end
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index f7a01f309..fae1c1e89 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -32,48 +32,18 @@
-
+
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
-<% unless @work.student_works_scores.empty?%>
-
+
<%@work.student_works_scores.each do |score|%>
-
- <%= link_to image_tag(url_to_avatar(score.user), :width => "34", :height => "34"), user_path(score.user),:class => "ping_pic fl" %>
-
- <%= link_to score.user.show_name, user_path(score.user), :title => score.user.show_name, :class => "c_blue fl" %>
-
(<%= student_work_score_role score%>)
-
评分:
-
<%= score.score%>分
-
回复
-
- <%=format_time score.created_at %>
-
-
-
- <%= score.comment%>
-
-
- <%= render :partial => 'work_attachments', :locals => {:attachments => score.attachments} %>
-
-
- <%= render :partial => 'add_score_reply',:locals => {:score => score}%>
-
-
-
-
- <% score.journals_for_messages.order("created_on desc").each do |jour|%>
- <%= render :partial => 'jour_replay',:locals => {:jour => jour}%>
- <% end%>
-
-
-
-
+
+ <%= render :partial => 'student_work_score',:locals => {:score => score}%>
+
<% end%>
-<%end%>
收起
\ No newline at end of file
diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb
new file mode 100644
index 000000000..c1536df98
--- /dev/null
+++ b/app/views/student_work/_student_work_score.html.erb
@@ -0,0 +1,31 @@
+
+ <%= link_to image_tag(url_to_avatar(score.user), :width => "34", :height => "34"), user_path(score.user),:class => "ping_pic fl" %>
+
+ <%= link_to score.user.show_name, user_path(score.user), :title => score.user.show_name, :class => "c_blue fl" %>
+
(<%= student_work_score_role score%>)
+
评分:
+
<%= score.score%>分
+
回复
+
+ <%=format_time score.created_at %>
+
+
+
+ <%= score.comment%>
+
+
+ <%= render :partial => 'work_attachments', :locals => {:attachments => score.attachments} %>
+
+
+ <%= render :partial => 'add_score_reply',:locals => {:score => score}%>
+
+
+
+
+ <% score.journals_for_messages.order("created_on desc").each do |jour|%>
+ <%= render :partial => 'jour_replay',:locals => {:jour => jour}%>
+ <% end%>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index fa58c3739..22f31a6c3 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -1,3 +1,8 @@
-$("#add_student_score").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work}) %>");
+$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @score}) %>");
$('#score_<%= @work.id%>').peSlider({range: 'min'});
-alert("评分成功");
\ No newline at end of file
+
+<% if @is_new%>
+ $("#score_list_<%= @work.id%>").prepend("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
+<% else %>
+ $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
+<% end%>
From 52834d8fa96a19737a2f7763a99ce0729c32d0fb Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 16:21:59 +0800
Subject: [PATCH 036/187] =?UTF-8?q?=E6=89=93=E5=88=86=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E6=89=93=E5=88=86=E8=A7=92=E8=89=B2=E7=9A=84=E5=88=A4=E5=AE=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 3 ++-
app/helpers/student_work_helper.rb | 16 +++++++++++++++-
app/views/student_work/_show.html.erb | 2 +-
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index d5bbd6586..66ccfc8c0 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -85,7 +85,8 @@ class StudentWorkController < ApplicationController
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
@score.user_id = User.current.id
@score.student_work_id = @work.id
- @score.reviewer_role = 1
+ role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
+ @score.reviewer_role = get_role_by_name(role)
@is_new = true
end
diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb
index 20a85f19e..94da5f152 100644
--- a/app/helpers/student_work_helper.rb
+++ b/app/helpers/student_work_helper.rb
@@ -31,9 +31,23 @@ module StudentWorkHelper
when 1
role = "教师"
when 2
- role = "教辅"
+ role = "助教"
when 3
role = "学生"
end
end
+
+ def get_role_by_name role
+ case role
+ when "Teacher"
+ result = 1
+ when "Manager"
+ result = 1
+ when "TeachingAsistant"
+ result = 2
+ when "Student"
+ result = 3
+ end
+ result
+ end
end
\ No newline at end of file
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index fae1c1e89..ab41eda65 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -38,7 +38,7 @@
- <%@work.student_works_scores.each do |score|%>
+ <%@work.student_works_scores.order("created_at desc").each do |score|%>
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
From 4783bad9242014971abb6ed091c4ed19df14d01c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 17:32:14 +0800
Subject: [PATCH 037/187] =?UTF-8?q?1=E3=80=81=E6=89=93=E5=88=86=E5=90=8E?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E7=9A=84=E5=90=84=E9=A1=B9=E5=BE=97=E5=88=86?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=B7=E6=96=B0=202=E3=80=81=E4=BD=9C?=
=?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 30 ++++++++++++++--
app/views/student_work/_student_work.html.erb | 36 +++++++++++++++++++
app/views/student_work/add_score.js.erb | 2 ++
app/views/student_work/index.html.erb | 36 ++-----------------
.../20150519022200_create_student_works.rb | 8 ++---
public/stylesheets/courses.css | 6 ++--
6 files changed, 76 insertions(+), 42 deletions(-)
create mode 100644 app/views/student_work/_student_work.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 66ccfc8c0..51f9a5856 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -94,8 +94,34 @@ class StudentWorkController < ApplicationController
render_attachment_warning_if_needed(@score)
if @score.save
- respond_to do |format|
- format.js
+ case @score.reviewer_role
+ when 1 #教师评分:最后一个教师评分为最终评分
+ @work.teacher_score = @score.score
+ @work.final_score = @score.score
+ when 2 #教辅评分 教辅评分显示平均分
+ @work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
+ if @work.teacher_score.nil?
+ if @work.student_score.nil?
+ @work.final_score = @work.teaching_asistant_score
+ else
+ @work.final_score = format("%.2f",@work.teaching_asistant_score * @homework.homework_detail_manual.ta_proportion + @work.student_score * (1 - @homework.homework_detail_manual.ta_proportion))
+ end
+ end
+ when 3 #学生评分 学生评分显示平均分
+ @work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
+ if @work.teacher_score.nil?
+ if @work.teaching_asistant_score.nil?
+ @work.final_score = @work.student_score
+ else
+ @work.final_score = format("%.2f",@work.teaching_asistant_score * @homework.homework_detail_manual.ta_proportion + @work.student_score * (1 - @homework.homework_detail_manual.ta_proportion))
+ end
+ end
+ end
+
+ if @work.save
+ respond_to do |format|
+ format.js
+ end
end
end
end
diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb
new file mode 100644
index 000000000..7e01af5b6
--- /dev/null
+++ b/app/views/student_work/_student_work.html.erb
@@ -0,0 +1,36 @@
+
+
\ No newline at end of file
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index 22f31a6c3..b7b59c075 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -6,3 +6,5 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
<% else %>
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
<% end%>
+
+$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 2a7396ae2..8ec8c2b76 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -63,11 +63,11 @@
教辅评分
-
+
匿评
-
+
成绩
@@ -75,37 +75,7 @@
<% @stundet_works.each do |student_work|%>
-
-
+ <%= render :partial => 'student_work',:locals => {:student_work => student_work}%>
<% end%>
diff --git a/db/migrate/20150519022200_create_student_works.rb b/db/migrate/20150519022200_create_student_works.rb
index adcc21b0b..4ae0449e0 100644
--- a/db/migrate/20150519022200_create_student_works.rb
+++ b/db/migrate/20150519022200_create_student_works.rb
@@ -5,10 +5,10 @@ class CreateStudentWorks < ActiveRecord::Migration
t.text :description
t.integer :homework_common_id
t.integer :user_id
- t.float :final_score, default: 0
- t.float :teacher_score, default: 0
- t.float :student_score, default: 0
- t.float :teaching_asistant_score, default: 0
+ t.float :final_score
+ t.float :teacher_score
+ t.float :student_score
+ t.float :teaching_asistant_score
t.integer :project_id, default: 0
t.timestamps
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index f32387c19..875c6ff12 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -634,10 +634,10 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.w300{ width:300px;}
.w80{ width:80px;}
.t_c{ text-align:center;}
-.hwork_tit{ width:295px; float:left; }
-.hwork_tit a{ width:285px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
+.hwork_tit{ width:240px; float:left; }
+.hwork_tit a{ width:255px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_code{ width:60px; text-align:center; margin-right:15px;}
-.hwork_code02{ width:32px; text-align:center; margin-right:10px;}
+.hwork_code02{ width:60px; text-align:center; margin-right:10px;}
a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;}
a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;}
.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
From 378907d68cb4c724840c4a4d29a86ea9f097214c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 17:34:44 +0800
Subject: [PATCH 038/187] =?UTF-8?q?=E6=89=93=E5=88=86=E5=90=8E=E5=8C=BF?=
=?UTF-8?q?=E8=AF=84=E6=82=AC=E6=B5=AE=E7=9A=84=E8=AF=A6=E7=BB=86=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E4=B8=8D=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/add_score.js.erb | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index b7b59c075..d5e0f7cd3 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -8,3 +8,15 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
<% end%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
+$(function(){
+ $(".student_score_info").bind("mouseover",function(e){
+ //alert($(this).html());
+ $(this).find("div").show();
+ $(this).find("div").css("top",e.pageY);
+ $(this).find("div").css("left",e.pageX);
+ });
+ $(".student_score_info").bind("mouseout",function(e){
+ //alert($(this).html());
+ $(this).find("div").hide();
+ });
+});
From a218015e57b6dff424eafefb9319f9f27498e23a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 17:51:26 +0800
Subject: [PATCH 039/187] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E4=B8=9A=E9=99=84?=
=?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE=202?=
=?UTF-8?q?=E3=80=81=E6=B2=A1=E5=AD=A6=E5=8F=B7=E6=97=B6=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_show.html.erb | 6 ++++--
app/views/student_work/_student_work.html.erb | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index ab41eda65..15c62d204 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -17,7 +17,7 @@
<% end%>
内容:
-
+
<%= @work.description%>
@@ -27,7 +27,9 @@
<% if @work.attachments.empty?%>
尚未提交附件
<% else%>
- <%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %>
+
+ <%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %>
+
<% end%>
diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb
index 7e01af5b6..568172970 100644
--- a/app/views/student_work/_student_work.html.erb
+++ b/app/views/student_work/_student_work.html.erb
@@ -1,6 +1,6 @@
" id="student_work_<%= student_work.id%>">
-
+
<%= link_to student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id,user_path(student_work.user),:class => "c_blue02 hwork_center"%>
From 7537aa4a1a7d11684f68b6158a1f8c3fe6ab6cbc Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 09:03:01 +0800
Subject: [PATCH 040/187] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=89=B9=E6=AC=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 1 +
app/views/student_work/index.html.erb | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 51f9a5856..b69aec2e1 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -8,6 +8,7 @@ class StudentWorkController < ApplicationController
def index
@stundet_works = @homework.student_works.order("final_score desc")
+ @homework_commons = @course.homework_commons.order("created_at desc")
respond_to do |format|
format.html
end
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 8ec8c2b76..be2cbbcb1 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -3,11 +3,11 @@
From 1fdd3b0b92584f27c81874cca38bc3725ea9af7c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 09:19:49 +0800
Subject: [PATCH 041/187] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E7=9A=84=E5=90=84=E7=A7=8D=E6=8E=92=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 4 ++-
app/views/student_work/index.html.erb | 29 ++++++++++++++--------
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index b69aec2e1..3bbadea64 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -7,8 +7,10 @@ class StudentWorkController < ApplicationController
before_filter :author_of_work, :only => [:edit, :update, :destroy]
def index
- @stundet_works = @homework.student_works.order("final_score desc")
+ @order,sort = params[:order] || "final_score",params[:sort] || "desc"
+ @stundet_works = @homework.student_works.order("#{@order} #{sort}")
@homework_commons = @course.homework_commons.order("created_at desc")
+ @score = sort == "desc" ? "asc" : "desc"
respond_to do |format|
format.html
end
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index be2cbbcb1..ff5da8889 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -46,8 +46,7 @@
- 学号
-
+ 学号
学生姓名
@@ -56,20 +55,28 @@
作品名称
- 教师评分
-
+ <%= link_to "教师评分",student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <% if @order == "teacher_score"%>
+
+ <% end%>
- 教辅评分
-
+ <%= link_to "教辅评分",student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <% if @order == "teaching_asistant_score"%>
+
+ <% end%>
- 匿评
-
+ <%= link_to "匿评",student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <% if @order == "student_score"%>
+
+ <% end%>
-
- 成绩
-
+
+ <%= link_to "成绩",student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <% if @order == "final_score"%>
+
+ <% end%>
From a1e28bcd9ef9ca667bdb8333c6805d5f967c485b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 09:46:35 +0800
Subject: [PATCH 042/187] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=89=E5=AD=A6?=
=?UTF-8?q?=E7=94=9Flogin=E3=80=81=E5=AD=A6=E5=8F=B7=E3=80=81=E7=9C=9F?=
=?UTF-8?q?=E5=AE=9E=E5=A7=93=E5=90=8D=E6=8E=92=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 12 ++++++++++--
app/views/student_work/index.html.erb | 10 +++++-----
public/javascripts/course.js | 8 ++++++++
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 3bbadea64..5a3c8c026 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -7,8 +7,8 @@ class StudentWorkController < ApplicationController
before_filter :author_of_work, :only => [:edit, :update, :destroy]
def index
- @order,sort = params[:order] || "final_score",params[:sort] || "desc"
- @stundet_works = @homework.student_works.order("#{@order} #{sort}")
+ @order,sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
+ @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{sort}"),@name
@homework_commons = @course.homework_commons.order("created_at desc")
@score = sort == "desc" ? "asc" : "desc"
respond_to do |format|
@@ -178,4 +178,12 @@ class StudentWorkController < ApplicationController
def author_of_work
render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
+
+ #根据条件过滤作业结果
+ def search_homework_member homeworks,name
+ select_homework = homeworks.select{ |homework|
+ homework.user[:login].to_s.downcase.include?(name) || homework.user.user_extensions[:student_id].to_s.downcase.include?(name) || (homework.user[:lastname].to_s.downcase + homework.user[:firstname].to_s.downcase).include?(name)
+ }
+ select_homework
+ end
end
\ No newline at end of file
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index ff5da8889..e7c6e77e7 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -36,7 +36,7 @@
所有作品(
<%= @stundet_works.count%> )
-
+
附件
列表
@@ -55,25 +55,25 @@
作品名称
- <%= link_to "教师评分",student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <%= link_to "教师评分",student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
<% if @order == "teacher_score"%>
<% end%>
- <%= link_to "教辅评分",student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <%= link_to "教辅评分",student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
<% if @order == "teaching_asistant_score"%>
<% end%>
- <%= link_to "匿评",student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <%= link_to "匿评",student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
<% if @order == "student_score"%>
<% end%>
- <%= link_to "成绩",student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score),:class => "c_dark f14 fb fl"%>
+ <%= link_to "成绩",student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
<% if @order == "final_score"%>
<% end%>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 5ed25ab6c..87566f795 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -791,4 +791,12 @@ function clickOK(path)
success: function (data) {
}
});
+}
+
+function SearchByName(obj,url,event)
+{
+ var keycode = (event.keyCode ? event.keyCode : event.which);
+ if(keycode == '13'){
+ location.href = url + "&name=" + obj.val();
+ }
}
\ No newline at end of file
From ff4dae56d1dbc30304697136157b4e88ed937cbc Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 10:30:10 +0800
Subject: [PATCH 043/187] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=89=80=E6=9C=89?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E9=99=84=E4=BB=B6=E6=89=93=E5=8C=85=E4=B8=8B?=
=?UTF-8?q?=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/zipdown_controller.rb | 82 +++++++++++++++++----------
app/views/student_work/index.html.erb | 8 ++-
2 files changed, 58 insertions(+), 32 deletions(-)
diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb
index 06d69f72e..9b0b97ff2 100644
--- a/app/controllers/zipdown_controller.rb
+++ b/app/controllers/zipdown_controller.rb
@@ -29,26 +29,25 @@ class ZipdownController < ApplicationController
render file: 'public/no_file_found.html'
return
end
+ elsif params[:obj_class] == "HomeworkCommon"
+ homework = HomeworkCommon.find params[:obj_id]
+ render_403 if User.current.allowed_to?(:as_teacher,homework.course)
+ file_count = 0
+ homework.student_works.map { |work| file_count += work.attachments.count}
+ if file_count > 0
+ zipfile = zip_homework_common homework
+ else
+ render file: 'public/no_file_found.html'
+ return
+ end
else
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
end
-
- # if zipfile
- # if zipfile.length > 1
- # @mut_down_files = zipfile #zipfile.each{|x| File.basename(x)}
- # else
- # send_file zipfile.first[:real_file], :filename => bid.name + ".zip", :type => detect_content_type(zipfile.first[:real_file])
- # return
- # end
- # end
-
respond_to do |format|
format.json {
render json: zipfile.to_json
}
end
- #rescue Exception => e
- # render file: 'public/no_file_found.html'
end
#下载某一学生的作业的所有文件
@@ -98,29 +97,34 @@ class ZipdownController < ApplicationController
digests << out_file.file_digest
end
end
-
homework_id = bid.id
user_id = bid.author_id
-
-
out_file = find_or_pack(homework_id, user_id, digests.sort){
zipping("#{Time.now.to_i}_#{bid.name}.zip",
bid_homework_path, OUTPUT_FOLDER)
}
+ [{files:[out_file.file_path], count: 1, index: 1,
+ real_file: out_file.file_path, file: File.basename(out_file.file_path),
+ size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
+ }]
+ end
-
- # zips = split_pack_files(bid_homework_path, Setting.pack_attachment_max_size.to_i*1024)
- # x = 0
- #
- #
- # zips.each { |o|
- # x += 1
- # file = zipping "#{Time.now.to_i}_#{bid.name}_#{x}.zip", o[:files], OUTPUT_FOLDER
- # o[:real_file] = file
- # o[:file] = File.basename(file)
- # o[:size] = (File.size(file) / 1024.0 / 1024.0).round(2)
- # }
-
+ def zip_homework_common homework_common
+ bid_homework_path = []
+ digests = []
+ homework_common.student_works.each do |work|
+ unless work.attachments.empty?
+ out_file = zip_student_work_by_user(work)
+ bid_homework_path << out_file.file_path
+ digests << out_file.file_digest
+ end
+ end
+ homework_id = homework_common.id
+ user_id = homework_common.user_id
+ out_file = find_or_pack(homework_id, user_id, digests.sort){
+ zipping("#{Time.now.to_i}_#{homework_common.name}.zip",
+ bid_homework_path, OUTPUT_FOLDER)
+ }
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path, file: File.basename(out_file.file_path),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
@@ -131,8 +135,6 @@ class ZipdownController < ApplicationController
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
-
-
digests = []
homework_attach.attachments.each do |attach|
if File.exist?(attach.diskfile)
@@ -143,12 +145,30 @@ class ZipdownController < ApplicationController
digests << 'not_exist_file'
end
end
-
out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){
zipping("#{homework_attach.user.lastname}#{homework_attach.user.firstname}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
+ end
+ def zip_student_work_by_user work
+ homeworks_attach_path = []
+ not_exist_file = []
+ # 需要将所有homework.attachments遍历加入zip
+ digests = []
+ work.attachments.each do |attach|
+ if File.exist?(attach.diskfile)
+ homeworks_attach_path << attach.diskfile
+ digests << attach.digest
+ else
+ not_exist_file << attach.filename
+ digests << 'not_exist_file'
+ end
+ end
+ out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
+ zipping("#{work.user.lastname}#{work.user.firstname}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
+ homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
+ }
end
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index e7c6e77e7..0309e2d72 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -38,7 +38,13 @@
-
附件
+ <% if @homework.student_works.empty?%>
+ <%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
+ <% else%>
+ <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
+ remote: true, class: "down_btn fr" %>
+ <% end%>
+
列表
导出全部:
From b182feb988c670a5bf661035164775fbb2506c73 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 10:47:40 +0800
Subject: [PATCH 044/187] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=85=A8=E9=83=A8?=
=?UTF-8?q?=E9=99=84=E4=BB=B6=E6=89=93=E5=8C=85=E4=B8=8B=E5=91=A8=E6=97=A0?=
=?UTF-8?q?=E6=B3=95=E4=B8=8B=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/index.html.erb | 2 +-
public/javascripts/application.js | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 0309e2d72..42d85d480 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -42,7 +42,7 @@
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
- remote: true, class: "down_btn fr" %>
+ remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
<% end%>
列表
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 828be910d..d9100b0bb 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -897,8 +897,31 @@ $(function(){
}
}
+ });
+ $('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) {
+ if(status == 'success'){
+ var res = JSON.parse(data.responseText);
+ if(res.length<1){
+ return;
+ }
+ if(res.length==1){
+ location.href = '/zipdown/download?file='+res[0].file;return;
+ }
+ document.getElementById('light').style.display='block';
+ $container = $('#light .upload_box_ul');
+ $container.empty();
+ for(var i = 0; i 1){
+ des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载';
+ } else {
+ des = '第'+res[i].index+'个学生的作品下载';
+ }
+ $(''+(i+1)+'. '+des+' (共'+res[i].size+'M) ').appendTo($container);
- })
+ }
+ }
+ });
});
From e1a3ed4b820fdd98fda433416a417456595aff15 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 11:07:28 +0800
Subject: [PATCH 045/187] =?UTF-8?q?=E5=88=B0=E5=A4=84Excel?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 37 ++++++++++++++++++++--
app/views/student_work/index.html.erb | 2 +-
config/locales/zh.yml | 2 ++
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 5a3c8c026..206cf0c1b 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -7,12 +7,16 @@ class StudentWorkController < ApplicationController
before_filter :author_of_work, :only => [:edit, :update, :destroy]
def index
- @order,sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
- @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{sort}"),@name
+ @order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
+ @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
@homework_commons = @course.homework_commons.order("created_at desc")
- @score = sort == "desc" ? "asc" : "desc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
respond_to do |format|
format.html
+ format.xls {
+ send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
+ :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}(#{l(:excel_not_rated)}).xls")
+ }
end
end
@@ -186,4 +190,31 @@ class StudentWorkController < ApplicationController
}
select_homework
end
+
+ def homework_to_xls items
+ xls_report = StringIO.new
+ book = Spreadsheet::Workbook.new
+ sheet1 = book.create_worksheet :name => "homework"
+ blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
+ sheet1.row(0).default_format = blue
+ sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),
+ l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)])
+ count_row = 1
+ items.each do |homework|
+ sheet1[count_row,0]=homework.user.id
+ sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s
+ sheet1[count_row,2] = homework.user.login
+ sheet1[count_row,3] = homework.user.user_extensions.student_id
+ sheet1[count_row,4] = homework.user.mail
+ sheet1[count_row,5] = homework.name
+ sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
+ sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score)
+ sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)
+ sheet1[count_row,9] = homework.final_score.nil? ? l(:label_without_score) : format("%.2f",homework.final_score)
+ sheet1[count_row,10] = format_time(homework.created_at)
+ count_row += 1
+ end
+ book.write xls_report
+ xls_report.string
+ end
end
\ No newline at end of file
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 42d85d480..2e96635fe 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -45,7 +45,7 @@
remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
<% end%>
- 列表
+ <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
导出全部:
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index e4ac63854..67be22e19 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1798,7 +1798,9 @@ zh:
excel_mail: 电子邮箱
excel_homework_name: 作品名
excel_t_score: 教师评分
+ excel_ta_score: 教辅评分
excel_n_score: 匿名评分
+ excel_f_score: 成绩
excel_commit_time: 提交时间
excel_homework_score: 作业积分
excel_class: "班级:"
From ee0a9093d36c1e713533ece84fd47c432c17387f Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 11:37:08 +0800
Subject: [PATCH 046/187] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E9=99=84=E4=BB=B6=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E4=BB=A5?=
=?UTF-8?q?=E5=8F=8A=E9=97=B4=E8=B7=9D=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_show.html.erb | 2 +-
public/stylesheets/courses.css | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 15c62d204..bce3aa5a0 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -34,7 +34,7 @@
-
+
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 875c6ff12..adfc4128e 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -404,7 +404,7 @@ span.add_attachment {font-size: 80%;line-height: 2.5em;}
.ui-progressbar-value{margin:-1px;height:100%}
.ui-widget-header{border:1px solid #628db6;background:#759fcf url(jquery/images/ui-bg_gloss-wave_35_759fcf_500x100.png) 50% 50% repeat-x;color:#fff;font-weight:bold}
.ui-corner-left,.ui-corner-tl{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;-khtml-border-top-left-radius:4px;border-top-left-radius:4px}
-.link_file{ background:url(../images/pic_file.png) 0 7px no-repeat !important; padding-left:20px !important; color:#64bdd9 !important; }
+.link_file{ background:url(../images/pic_file.png) 0 3px no-repeat !important; padding-left:20px !important; color:#64bdd9 !important; }
a:hover.link_file_board{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !important; padding-left:20px !important; color:#64bdd9 !important; }
From 8c6ea885044b9758a19454166bc56bd09c620330 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 12:02:26 +0800
Subject: [PATCH 047/187] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E5=93=81=E5=88=97?=
=?UTF-8?q?=E8=A1=A8TAB=E5=88=87=E6=8D=A2=202=E3=80=81=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BD=9C=E4=B8=9A=E8=AF=A6=E7=BB=86=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=203=E3=80=81=E5=88=B0=E5=A4=84Excel=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 2 +-
app/helpers/application_helper.rb | 21 +++++++++
app/helpers/homework_common_helper.rb | 21 ---------
app/views/student_work/index.html.erb | 53 ++++++++++------------
public/javascripts/course.js | 2 +-
public/stylesheets/courses.css | 2 +-
6 files changed, 47 insertions(+), 54 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 206cf0c1b..4ef64da90 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -15,7 +15,7 @@ class StudentWorkController < ApplicationController
format.html
format.xls {
send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
- :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}(#{l(:excel_not_rated)}).xls")
+ :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls")
}
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 571886e17..d05926979 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2270,4 +2270,25 @@ module ApplicationHelper
tag_list = attachment_tag_list all_attachments
tag_list
end
+
+ #获取匿评相关连接代码
+ def homework_anonymous_comment homework
+ if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
+ if homework.student_works.count >= 2 #作业份数大于2
+ case homework.homework_detail_manual.comment_status
+ when 1
+ link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
+ when 2
+ link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
+ when 3
+ link = "
匿评结束 ".html_safe
+ end
+ else
+ link = "
启动匿评 ".html_safe
+ end
+ else
+ link = "
启动匿评 ".html_safe
+ end
+ link
+ end
end
diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb
index 4b9a44c07..f90e14610 100644
--- a/app/helpers/homework_common_helper.rb
+++ b/app/helpers/homework_common_helper.rb
@@ -1,26 +1,5 @@
# encoding: utf-8
module HomeworkCommonHelper
- #获取匿评相关连接代码
- def homework_anonymous_comment homework
- if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
- if homework.student_works.count >= 2 #作业份数大于2
- case homework.homework_detail_manual.comment_status
- when 1
- link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
- when 2
- link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
- when 3
- link = "
匿评结束 ".html_safe
- end
- else
- link = "
启动匿评 ".html_safe
- end
- else
- link = "
启动匿评 ".html_safe
- end
- link
- end
-
def student_new_homework homework
work = cur_user_works_for_homework homework
if work.nil?
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 2e96635fe..b904e3b68 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -22,8 +22,8 @@
- 全部作品
- 作业信息
+ 全部作品
+ 作业信息
@@ -97,43 +97,36 @@
-
+ <%= link_to(image_tag(url_to_avatar(@homework.user), :width => "42", :height => "42"), user_path(@homework.user), :class => "problem_pic fl") %>
-
请以下同学重新提交作业ppt,只要更新附件,不要删除作否则否则否则评分就丢了
-
编辑
-
开启匿评
+
+ <%= @homework.name%>
+
+ <%= homework_anonymous_comment(@homework)%>
+ <%= link_to(l(:button_edit),edit_homework_common_path(@homework), :class => "fr mr10 work_edit") %>
-
项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
-
[展开]
+
+ <%= @homework.description.html_safe %>
+
-
截止时间:2015-04-02
+
截止时间:<%= @homework.end_time%>
-
-
作业提交还剩:
+ <% if betweentime(@homework.end_time) < 0 %>
+
+ <%= l(:label_commit_limit)%>
+
+ <% else %>
+
+
+
+ <% end %>
-
-
-
-
-
请以下同学重新提交作业ppt,只要更新附件,不要删除作否则否则否则评分就丢了
-
编辑
-
关闭匿评
-
-
项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显题个数显示问题 创建时间 : 2014-11-26 10:19
-
已截止,但可补交。
-
-
-
-
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 87566f795..97ee2bd93 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -792,7 +792,7 @@ function clickOK(path)
}
});
}
-
+//查询
function SearchByName(obj,url,event)
{
var keycode = (event.keyCode ? event.keyCode : event.which);
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index adfc4128e..cb47abb09 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -355,7 +355,7 @@ a:hover.st_add{ color:#ff8e15;}
.upload_box{ width:430px; margin:15px auto;}
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
-.r_txt_tit{width:500px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
+.r_txt_tit{max-width:480px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;word-break: break-all;word-wrap: break-word;}
.respond-form{display: none;margin: auto;clear: both;}
From 3f9855f25cd969cf5bffe9e796a6db8bc49c507e Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 14:13:47 +0800
Subject: [PATCH 048/187] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 8 ++++++--
app/views/homework_common/index.html.erb | 1 +
config/locales/zh.yml | 1 -
public/stylesheets/courses.css | 1 -
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index fb22d6378..cac8eaf0a 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -1,7 +1,7 @@
class HomeworkCommonController < ApplicationController
layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create]
- before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment]
+ before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
def index
@@ -120,7 +120,11 @@ class HomeworkCommonController < ApplicationController
end
def destroy
-
+ if @homework.destroy
+ respond_to do |format|
+ format.html {redirect_to homework_common_index_path(:course => @course.id)}
+ end
+ end
end
#开启匿评
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index e97938633..015df90c5 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -26,6 +26,7 @@
<% if @is_teacher%>
<%= homework_anonymous_comment(homework)%>
+ <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
<%= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %>
<% elsif @is_student%>
<%= student_anonymous_comment homework %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 67be22e19..8adf7d492 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -878,7 +878,6 @@ zh:
button_copy_and_follow: 复制并转到新问题
button_annotate: 追溯
- button_edit: 编辑
button_configure: 配置
button_quote: 引用
button_duplicate: 副本
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index cb47abb09..9d88470c9 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -147,7 +147,6 @@ a:hover.work_edit{color: #fff; background: #64bdd9;}
.hovertab a{color:#fff; background-color:#64bdd9; text-decoration:none;}
.dis{display:block; }
.undis{display:none;}
-.c_red{ color:#de030d;}
.f_12{ font-size:12px;}
.w_40{ width:40px; border:1px solid red;}
.dis_ul{ height:70px; border-bottom:1px dashed #d4d4d4; margin-bottom:10px;}
From 70f14f851d7a7b13d2053df2071e3c1772ec4e9c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 15:54:42 +0800
Subject: [PATCH 049/187] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=B1=BB=E5=9E=8B=E3=80=81=E4=B8=8D=E5=90=8C?=
=?UTF-8?q?=E9=98=B6=E6=AE=B5=E3=80=81=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7?=
=?UTF-8?q?=E8=BA=AB=E4=BB=BD=E5=AF=B9=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E8=BF=9B=E8=A1=8C=E8=BF=87=E6=BB=A4=EF=BC=8C=E4=BB=A5=E5=8F=8A?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=95=8C=E9=9D=A2=E5=8A=9F=E8=83=BD=E7=9A=84?=
=?UTF-8?q?=E8=BF=87=E6=BB=A4=20=E9=83=A8=E5=88=86=E7=95=8C=E9=9D=A2?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 14 ++++++++-
app/helpers/application_helper.rb | 35 ++++++++++++++++++++++
app/helpers/homework_common_helper.rb | 35 ----------------------
app/views/student_work/_add_score.html.erb | 10 ++++---
app/views/student_work/_show.html.erb | 29 ++++++++++++++----
app/views/student_work/add_score.js.erb | 1 +
app/views/student_work/index.html.erb | 35 ++++++++++++++--------
public/stylesheets/courses.css | 8 ++---
8 files changed, 105 insertions(+), 62 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 4ef64da90..78ab33477 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -8,7 +8,18 @@ class StudentWorkController < ApplicationController
def index
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
- @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
+ @is_teacher = User.current.allowed_to?(:as_teacher,@course)
+ #老师 || 非匿评作业 || 匿评结束 显示所有的作品
+ if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
+ @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
+ else #学生
+ if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
+ @stundet_works = @homework.student_works.where(:user_id => User.current.id)
+ elsif @homework.homework_detail_manual.comment_status == 2 #开启匿评,显示匿评作品和我的作品
+ my_work = @homework.student_works.where(:user_id => User.current.id)
+ @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
+ end
+ end
@homework_commons = @course.homework_commons.order("created_at desc")
@score = @b_sort == "desc" ? "asc" : "desc"
respond_to do |format|
@@ -70,6 +81,7 @@ class StudentWorkController < ApplicationController
def show
@score = student_work_score @work,User.current
+ @is_teacher = User.current.allowed_to?(:as_teacher,@course)
respond_to do |format|
format.js
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d05926979..3d178e28e 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2291,4 +2291,39 @@ module ApplicationHelper
end
link
end
+ #学生根据传入作业确定显示为编辑作品还是新建作品
+ def student_new_homework homework
+ work = cur_user_works_for_homework homework
+ if work.nil?
+ link_to l(:label_commit_homework), new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit'
+ else
+ if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
+ "
#{l(:label_edit_homework)} ".html_safe
+ else
+ link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
+ end
+ end
+ end
+
+ def student_anonymous_comment homework
+ if homework.homework_type == 1 && homework.homework_detail_manual
+ case homework.homework_detail_manual.comment_status
+ when 1
+ "
未开启匿评 ".html_safe
+ when 2
+ "
正在匿评中 ".html_safe
+ when 3
+ "
匿评已结束 ".html_safe
+ end
+ elsif homework.homework_type == 0
+ "
未启用匿评 ".html_safe
+ elsif homework.homework_type == 2
+ "
编程作业 ".html_safe
+ end
+ end
+
+ #获取当前用户在指定作业下提交的作业的集合
+ def cur_user_works_for_homework homework
+ homework.student_works.where("user_id = ?",User.current).first
+ end
end
diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb
index f90e14610..5399fd5bf 100644
--- a/app/helpers/homework_common_helper.rb
+++ b/app/helpers/homework_common_helper.rb
@@ -1,40 +1,5 @@
# encoding: utf-8
module HomeworkCommonHelper
- def student_new_homework homework
- work = cur_user_works_for_homework homework
- if work.nil?
- link_to l(:label_commit_homework), new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit'
- else
- if homework.homework_type == 2 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
- "
#{l(:label_edit_homework)} ".html_safe
- else
- link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
- end
- end
- end
-
- def student_anonymous_comment homework
- if homework.homework_type == 1 && homework.homework_detail_manual
- case homework.homework_detail_manual.comment_status
- when 1
- "
未开启匿评 ".html_safe
- when 2
- "
正在匿评中 ".html_safe
- when 3
- "
匿评已结束 ".html_safe
- end
- elsif homework.homework_type == 0
- "
未启用匿评 ".html_safe
- elsif homework.homework_type == 2
- "
编程作业 ".html_safe
- end
- end
-
- #获取当前用户在指定作业下提交的作业的集合
- def cur_user_works_for_homework homework
- homework.student_works.where("user_id = ?",User.current).first
- end
-
#迟交扣分下拉框
def late_penalty_option
type = []
diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb
index a1406902f..e091e507d 100644
--- a/app/views/student_work/_add_score.html.erb
+++ b/app/views/student_work/_add_score.html.erb
@@ -10,10 +10,12 @@
分
- 批阅结果:
-
- <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
-
+ <% if @is_teacher%>
+ 批阅结果:
+
+ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
+
+ <%end%>
提交
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index bce3aa5a0..fd5396b7f 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -1,10 +1,26 @@
-
+
上交时间:
<%=format_time @work.created_at %>
+
+ <% if @work.user == User.current %>
+
+
+
+
+
+
+ <% end%>
+ <% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
+
+ 赞(10)
+
+ <% end%>
+
+
@@ -34,12 +50,15 @@
-
- <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
-
+ <% if @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
+
+
+ <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
+
+ <% end%>
-
+
<%@work.student_works_scores.order("created_at desc").each do |score|%>
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index d5e0f7cd3..cb68155d8 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -6,6 +6,7 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
<% else %>
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
<% end%>
+$("#score_list_<%= @work.id%>").removeAttr("style");
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
$(function(){
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index b904e3b68..2a6afca76 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -36,18 +36,22 @@
所有作品(
<%= @stundet_works.count%> )
-
-
- <% if @homework.student_works.empty?%>
- <%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
- <% else%>
- <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
- remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
- <% end%>
+ <% if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3%>
+
+ <% end%>
+ <% if @is_teacher%>
+
+ <% if @homework.student_works.empty?%>
+ <%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
+ <% else%>
+ <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
+ remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
+ <% end%>
- <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
- 导出全部:
-
+ <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
+
导出全部:
+
+ <% end%>
@@ -102,8 +106,13 @@
<%= @homework.name%>
- <%= homework_anonymous_comment(@homework)%>
- <%= link_to(l(:button_edit),edit_homework_common_path(@homework), :class => "fr mr10 work_edit") %>
+ <% if @is_teacher%>
+ <%= homework_anonymous_comment(@homework)%>
+ <%= link_to(l(:button_edit),edit_homework_common_path(@homework), :class => "fr mr10 work_edit") %>
+ <% else%>
+ <%= student_anonymous_comment @homework %>
+ <%= student_new_homework @homework %>
+ <% end %>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 9d88470c9..4dc925519 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -147,6 +147,7 @@ a:hover.work_edit{color: #fff; background: #64bdd9;}
.hovertab a{color:#fff; background-color:#64bdd9; text-decoration:none;}
.dis{display:block; }
.undis{display:none;}
+.c_red{ color:#de030d;}
.f_12{ font-size:12px;}
.w_40{ width:40px; border:1px solid red;}
.dis_ul{ height:70px; border-bottom:1px dashed #d4d4d4; margin-bottom:10px;}
@@ -354,7 +355,6 @@ a:hover.st_add{ color:#ff8e15;}
.upload_box{ width:430px; margin:15px auto;}
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
-.r_txt_tit{max-width:480px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;word-break: break-all;word-wrap: break-word;}
.respond-form{display: none;margin: auto;clear: both;}
@@ -505,7 +505,7 @@ a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: ce
a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; color:#64bdd9; }
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
-.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
+.r_txt_tit{max-width:450px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
/*日历选择图*/
img.ui-datepicker-trigger {
@@ -637,8 +637,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.hwork_tit a{ width:255px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_code{ width:60px; text-align:center; margin-right:15px;}
.hwork_code02{ width:60px; text-align:center; margin-right:10px;}
-a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;}
-a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;}
+a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;overflow: hidden;}
+a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;overflow: hidden;}
.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
.show_hwork ul li{ margin-bottom:5px;}
.show_hwork_arrow{ position:relative; top:2px; left:25px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;}
From 4d43cd276516ff5facb22e18c58d807388ad6ca8 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 16:10:40 +0800
Subject: [PATCH 050/187] =?UTF-8?q?=E7=82=B9=E8=B5=9E=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 20 +++++++++++++++++--
app/helpers/student_work_helper.rb | 10 ++++++++++
app/views/student_work/_show.html.erb | 4 ++--
.../_student_work_praise.html.erb | 5 +++++
.../student_work/praise_student_work.js.erb | 1 +
config/routes.rb | 1 +
6 files changed, 37 insertions(+), 4 deletions(-)
create mode 100644 app/views/student_work/_student_work_praise.html.erb
create mode 100644 app/views/student_work/praise_student_work.js.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 78ab33477..7e7126173 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -2,8 +2,8 @@ class StudentWorkController < ApplicationController
layout "base_courses"
include StudentWorkHelper
before_filter :find_homework, :only => [:new, :index, :create]
- before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score]
- before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score]
+ before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
+ before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
def index
@@ -166,6 +166,22 @@ class StudentWorkController < ApplicationController
end
end
+ #为作品点赞
+ def praise_student_work
+ pt = PraiseTread.new
+ pt.user_id = User.current.id
+ pt.praise_tread_object_id = @work.id
+ pt.praise_tread_object_type = "StudentWork"
+ pt.praise_or_tread = 1
+ if pt.save
+ respond_to do |format|
+ format.js
+ end
+ else
+ render_404
+ end
+ end
+
private
#获取作业
def find_homework
diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb
index 94da5f152..990a563c4 100644
--- a/app/helpers/student_work_helper.rb
+++ b/app/helpers/student_work_helper.rb
@@ -50,4 +50,14 @@ module StudentWorkHelper
end
result
end
+
+ #获取赞的总数
+ def praise_homework_count obj_id
+ PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").count
+ end
+
+ #判断指定用户是不是已经赞过该作业
+ def is_praise_homework user_id, obj_id
+ PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").empty?
+ end
end
\ No newline at end of file
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index fd5396b7f..97c6125f7 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -15,8 +15,8 @@
<% end%>
<% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
-
- 赞(10)
+
+ <%= render :partial => 'student_work_praise' %>
<% end%>
diff --git a/app/views/student_work/_student_work_praise.html.erb b/app/views/student_work/_student_work_praise.html.erb
new file mode 100644
index 000000000..4cabfd631
--- /dev/null
+++ b/app/views/student_work/_student_work_praise.html.erb
@@ -0,0 +1,5 @@
+<% if is_praise_homework User.current.id,@homework.id %>
+ <%= link_to "赞(#{praise_homework_count @homework.id})",praise_student_work_student_work_path(@homework), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
+<% else %>
+ <%= link_to "赞(#{praise_homework_count @homework.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
+<% end %>
\ No newline at end of file
diff --git a/app/views/student_work/praise_student_work.js.erb b/app/views/student_work/praise_student_work.js.erb
new file mode 100644
index 000000000..dc6d57481
--- /dev/null
+++ b/app/views/student_work/praise_student_work.js.erb
@@ -0,0 +1 @@
+$('#student_work_praise_<%= @homework.id%>').html('<%= escape_javascript(render :partial => 'student_work_praise')%>');
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index ecdaac48c..1d57a091b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -94,6 +94,7 @@ RedmineApp::Application.routes.draw do
resources :student_work do
member do
post 'add_score'
+ get 'praise_student_work'
end
collection do
post 'add_score_reply'
From 19bf8ef50dc85a0c7475adaa1a8168b62e753020 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 17:09:38 +0800
Subject: [PATCH 051/187] =?UTF-8?q?=E4=BD=9C=E5=93=81=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 26 ++++-
app/helpers/application_helper.rb | 2 +-
app/views/student_work/_show.html.erb | 2 +-
app/views/student_work/edit.html.erb | 106 +++++++--------------
app/views/student_work/new.html.erb | 4 +-
public/javascripts/course.js | 12 ++-
6 files changed, 72 insertions(+), 80 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 7e7126173..710811960 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -72,11 +72,31 @@ class StudentWorkController < ApplicationController
end
def edit
-
+ respond_to do |format|
+ format.html
+ end
end
def update
-
+ if params[:student_work]
+ @work.name = params[:student_work][:name]
+ @work.description = params[:student_work][:description]
+ @work.project_id = params[:student_work][:project]
+ @work.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(@work)
+ if @work.save
+ respond_to do |format|
+ format.html {
+ flash[:notice] = l(:notice_successful_edit)
+ redirect_to student_work_index_url(:homework => @homework.id)
+ }
+ end
+ return
+ end
+ end
+ respond_to do |format|
+ format.html{redirect_to edit_student_work_url(@work)}
+ end
end
def show
@@ -208,7 +228,7 @@ class StudentWorkController < ApplicationController
#判断是不是当前作品的提交者
#提交者可以编辑作品
def author_of_work
- render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
+ # render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
#根据条件过滤作业结果
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 3d178e28e..446ad994b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2298,7 +2298,7 @@ module ApplicationHelper
link_to l(:label_commit_homework), new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit'
else
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
- "
#{l(:label_edit_homework)} ".html_safe
+ "
#{l(:label_edit_homework)} ".html_safe
else
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
end
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 97c6125f7..de14c0cb1 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -11,7 +11,7 @@
-
+ <%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%>
<% end%>
<% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb
index a9bb9760e..e4ae4c6a5 100644
--- a/app/views/student_work/edit.html.erb
+++ b/app/views/student_work/edit.html.erb
@@ -2,98 +2,58 @@
编辑作品
-
+
+
+
+
+
+
+
+
+ <%= labelled_form_for @work do |f|%>
* 作品名称 :
-
- 项目信息
+
+ 项目信息
+
+
+
+
-
+
+
关联项目 :
-
- 没有可选项目,请直接为本作品创建一个项目
- M
-
- 快速创建
+ <%= f.select :project,options_for_select(user_projects_option,@work.project_id), {},{:class => "bo02 mb10"} %>
+
+
+
+
+
+ *
+ 作品描述 :
+
+
+
- * 作品描述 :
-
-
-
-
- 添加附件 :
- -文件不超过200MB
+ 添加附件 :
+ <%= render :partial => 'attachments/new_form',:locals => {:container => @work} %>
- 提交作品 重 置
+ 提交作品
+ <%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
+ <% end%>
-
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb
index fc645c26d..ff5bbf1aa 100644
--- a/app/views/student_work/new.html.erb
+++ b/app/views/student_work/new.html.erb
@@ -14,7 +14,9 @@
* 作品名称 :
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
- 项目信息
+ 项目信息
+
+
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 97ee2bd93..a718db944 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -652,6 +652,12 @@ function new_student_work()
{$("#new_student_work").submit();}
}
+function edit_student_work(id)
+{
+ if(regexStudentWorkName()&®exStudentWorkDescription())
+ {$("#edit_student_work_" + id).submit();}
+}
+
//滑动打分
$.fn.peSlider = function(settings){
//configurable options (none so far)
@@ -799,4 +805,8 @@ function SearchByName(obj,url,event)
if(keycode == '13'){
location.href = url + "&name=" + obj.val();
}
-}
\ No newline at end of file
+}
+
+$(function(){
+ $("#about_project label").eq(1).remove();
+});
\ No newline at end of file
From 2293ef66d1b6c69c655a1014123eaf2bc76fddb5 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 17:18:37 +0800
Subject: [PATCH 052/187] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BD=9C=E5=93=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 12 +++++++++---
app/views/student_work/_show.html.erb | 2 +-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 710811960..abf7e24d1 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -108,7 +108,13 @@ class StudentWorkController < ApplicationController
end
def destroy
-
+ if @work.destroy
+ respond_to do |format|
+ format.html {
+ redirect_to student_work_index_url(:homework => @homework.id)
+ }
+ end
+ end
end
#添加评分,已评分则为修改评分
@@ -226,9 +232,9 @@ class StudentWorkController < ApplicationController
end
#判断是不是当前作品的提交者
- #提交者可以编辑作品
+ #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品
def author_of_work
- # render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
+ render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
#根据条件过滤作业结果
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index de14c0cb1..b9ebf3269 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -8,7 +8,7 @@
<% if @work.user == User.current %>
-
+ <%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
<%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%>
From 4aa18ee1a1e642b328f5e596884aaec6195b54cc Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 17:50:26 +0800
Subject: [PATCH 053/187] =?UTF-8?q?1=C2=B7=E3=80=81=20=E8=80=81=E5=B8=88?=
=?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=82=B9=E8=B5=9E=202=E3=80=81=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E5=9C=A8=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84=E3=80=81?=
=?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E9=98=B6=E6=AE=B5=E5=8F=96?=
=?UTF-8?q?=E6=B6=88=E6=98=BE=E7=A4=BA=E7=BC=96=E8=BE=91=E5=92=8C=E5=88=A0?=
=?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_show.html.erb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index b9ebf3269..93f38cbac 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -6,7 +6,8 @@
<%=format_time @work.created_at %>
- <% if @work.user == User.current %>
+ <% if !@is_teacher && @work.user == User.current && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1) %>
+
<%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
@@ -14,7 +15,8 @@
<%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%>
<% end%>
- <% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
+ <% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
+
<%= render :partial => 'student_work_praise' %>
From 5b576c0c94aac84e28f0710d7de26cc0a5f5ef46 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 08:56:07 +0800
Subject: [PATCH 054/187] =?UTF-8?q?1=E3=80=81=E6=89=80=E6=9C=89=E4=BD=9C?=
=?UTF-8?q?=E5=93=81=E9=93=BE=E6=8E=A5=202=E3=80=81=E6=96=B0=E5=BB=BA?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E4=BC=9A=E6=96=B0=E6=89=93=E5=BC=80=E4=B8=80?=
=?UTF-8?q?=E4=B8=AA=E7=A9=BA=E7=99=BD=E7=9A=84=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/index.html.erb | 4 +---
app/views/student_work/new.html.erb | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 2a6afca76..27dee3f91 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -32,9 +32,7 @@
-
- 所有作品(<%= @stundet_works.count%> )
-
+ <%= link_to "所有作品(#{@stundet_works.count} )".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%>
<% if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3%>
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb
index ff5bbf1aa..7d685131f 100644
--- a/app/views/student_work/new.html.erb
+++ b/app/views/student_work/new.html.erb
@@ -39,7 +39,7 @@
- 提交作品
+ 提交作品
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
From a8b26715d4106439b4d8b1b621b85a13cf149dfb Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 09:09:22 +0800
Subject: [PATCH 055/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E4=BC=9A=E8=B7=B3=E8=BD=AC=E5=88=B0=E4=B8=80=E4=B8=AA=E7=A9=BA?=
=?UTF-8?q?=E7=99=BD=E7=9A=84=E9=94=99=E8=AF=AF=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/edit.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb
index e4ae4c6a5..f63c1792b 100644
--- a/app/views/student_work/edit.html.erb
+++ b/app/views/student_work/edit.html.erb
@@ -46,7 +46,7 @@
- 提交作品
+ 提交作品
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
From 837fbe74e83f96cba9698caf8e1bed98484c75ac Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 09:38:59 +0800
Subject: [PATCH 056/187] =?UTF-8?q?1=E3=80=81=E8=80=81=E5=B8=88=E5=92=8C?=
=?UTF-8?q?=E5=90=8C=E8=AF=BE=E7=A8=8B=E7=9A=84=E5=AD=A6=E7=94=9F=E6=9C=89?=
=?UTF-8?q?=E6=9D=83=E9=99=90=E4=B8=8B=E5=91=A8=E4=BD=9C=E5=93=81=E9=99=84?=
=?UTF-8?q?=E4=BB=B6=202=E3=80=81=E4=BD=9C=E5=93=81=E9=99=84=E4=BB=B6?=
=?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=88=90=E5=8A=9F=E4=B9=8B=E5=90=8E=E6=B6=88?=
=?UTF-8?q?=E5=A4=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 2 +-
app/helpers/application_helper.rb | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 076082d93..532fbb51e 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -428,7 +428,7 @@ private
@attachment.container.board.course)
@course = @attachment.container.board.course
else
- unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type = 'StudentWorksScore'
+ unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWorks'
@project = @attachment.project
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 446ad994b..268781df3 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1844,7 +1844,11 @@ module ApplicationHelper
attachment.container.board.course
course = attachment.container.board.course
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
- elsif attachment.container.class.to_s=="HomeworkAttach" && attachment.container.bid.reward_type == 3
+ elsif attachment.container.class.to_s=="HomeworkAttach"
+ candown = true
+ elsif attachment.container.class.to_s=="StudentWorksScore"
+ candown = true
+ elsif attachment.container.class.to_s=="StudentWork"
candown = true
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
course = attachment.container.courses.first
From f2ea879b9b9cad9ab987369cbf27cb275bcd1584 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 10:21:49 +0800
Subject: [PATCH 057/187] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=92=8C=E5=90=8C?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E5=AD=A6=E7=94=9F=E6=9C=89=E6=9D=83?=
=?UTF-8?q?=E9=99=90=E4=B8=8B=E5=91=A8=E4=BD=9C=E5=93=81=E9=99=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 268781df3..7f3d2c1a2 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1824,7 +1824,7 @@ module ApplicationHelper
def attachment_candown attachment
candown = false
if attachment.container
- if attachment.container.class.to_s != "HomeworkAttach" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
+ if attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
project = attachment.container.project
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
elsif attachment.container.is_a?(Project)
From 27de2246938b0277bf70ad01ff5f7e12c78b15f4 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 10:22:16 +0800
Subject: [PATCH 058/187] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84?=
=?UTF-8?q?=E6=97=B6=E5=8C=BF=E8=AF=84=E6=AF=94=E4=BE=8B=E8=AE=A1=E7=AE=97?=
=?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index cac8eaf0a..58c959512 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -172,7 +172,7 @@ class HomeworkCommonController < ApplicationController
elsif @homework_detail_manual.comment_status == 2
@homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
@cur_size = 0
- @homework.student_works.map { |work| @cur_size += work.student_works_scores.count}
+ @homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
end
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
respond_to do |format|
From fe3b7158291fdb0afeca33ecd94ca312cd944cb3 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 10:33:29 +0800
Subject: [PATCH 059/187] =?UTF-8?q?=E8=80=81=E5=B8=88=E8=AF=84=E5=88=86?=
=?UTF-8?q?=E4=B9=8B=E5=90=8E=EF=BC=8C=E6=8F=90=E4=BA=A4=E6=89=B9=E9=98=85?=
=?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=8C=89=E9=92=AE=E6=B6=88=E5=A4=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index abf7e24d1..d3cb437ee 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -120,6 +120,7 @@ class StudentWorkController < ApplicationController
#添加评分,已评分则为修改评分
def add_score
@score = student_work_score @work,User.current
+ @is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @score
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
@score.score = params[:score] if params[:score]
From 9f09270aed0f54959e809758adde117267b64621 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 10:48:19 +0800
Subject: [PATCH 060/187] =?UTF-8?q?=E7=82=B9=E8=B5=9E=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_student_work_praise.html.erb | 6 +++---
app/views/student_work/praise_student_work.js.erb | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/views/student_work/_student_work_praise.html.erb b/app/views/student_work/_student_work_praise.html.erb
index 4cabfd631..f03bbdcc1 100644
--- a/app/views/student_work/_student_work_praise.html.erb
+++ b/app/views/student_work/_student_work_praise.html.erb
@@ -1,5 +1,5 @@
-<% if is_praise_homework User.current.id,@homework.id %>
- <%= link_to "赞(#{praise_homework_count @homework.id})",praise_student_work_student_work_path(@homework), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
+<% if is_praise_homework User.current.id,@work.id %>
+ <%= link_to "赞(#{praise_homework_count @work.id})",praise_student_work_student_work_path(@work), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
<% else %>
- <%= link_to "赞(#{praise_homework_count @homework.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
+ <%= link_to "赞(#{praise_homework_count @work.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
<% end %>
\ No newline at end of file
diff --git a/app/views/student_work/praise_student_work.js.erb b/app/views/student_work/praise_student_work.js.erb
index dc6d57481..8a070ccee 100644
--- a/app/views/student_work/praise_student_work.js.erb
+++ b/app/views/student_work/praise_student_work.js.erb
@@ -1 +1 @@
-$('#student_work_praise_<%= @homework.id%>').html('<%= escape_javascript(render :partial => 'student_work_praise')%>');
\ No newline at end of file
+$('#student_work_praise_<%= @homework.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise')%>');
\ No newline at end of file
From c8a4970f73b8df71e06ad07e6c8356d03506102c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 10:54:03 +0800
Subject: [PATCH 061/187] =?UTF-8?q?=E5=B1=95=E5=BC=80=E5=A4=9A=E4=B8=AA?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E6=97=B6=E7=82=B9=E8=B5=9E=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_show.html.erb | 2 +-
app/views/student_work/praise_student_work.js.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 93f38cbac..3758ffedd 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -17,7 +17,7 @@
<% end%>
<% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
-
+
<%= render :partial => 'student_work_praise' %>
<% end%>
diff --git a/app/views/student_work/praise_student_work.js.erb b/app/views/student_work/praise_student_work.js.erb
index 8a070ccee..c58eb5a2f 100644
--- a/app/views/student_work/praise_student_work.js.erb
+++ b/app/views/student_work/praise_student_work.js.erb
@@ -1 +1 @@
-$('#student_work_praise_<%= @homework.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise')%>');
\ No newline at end of file
+$('#student_work_praise_<%= @work.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise')%>');
\ No newline at end of file
From 23a457af9ef2602c58b5c3d942562ba72d08d4d6 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 11:00:35 +0800
Subject: [PATCH 062/187] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=9B=9E=E5=A4=8D?=
=?UTF-8?q?=E4=B8=8D=E8=83=BD=E4=B8=BA=E7=A9=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 9 ++++++---
app/views/student_work/add_score_reply.js.erb | 6 +++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index d3cb437ee..9f0cc1d4d 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -177,9 +177,12 @@ class StudentWorkController < ApplicationController
@score = StudentWorksScore.find params[:score_id]
@jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
if @jour.save
- respond_to do |format|
- format.js
- end
+ @status = 1
+ else
+ @status = 2
+ end
+ respond_to do |format|
+ format.js
end
end
diff --git a/app/views/student_work/add_score_reply.js.erb b/app/views/student_work/add_score_reply.js.erb
index 7b53b54d8..2c6f1c9bf 100644
--- a/app/views/student_work/add_score_reply.js.erb
+++ b/app/views/student_work/add_score_reply.js.erb
@@ -1,2 +1,6 @@
$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score}) %>");
-$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
\ No newline at end of file
+<% if @status && @status == 1%>
+ $("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
+<% else%>
+ alert("回复内容不能为空");
+<% end%>
\ No newline at end of file
From 91b17ea91f726061a4b773e2972d3e11abff0dea Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 11:26:39 +0800
Subject: [PATCH 063/187] =?UTF-8?q?float=E7=B1=BB=E5=9E=8B=E5=BE=97?=
=?UTF-8?q?=E5=88=86=E8=AE=A1=E7=AE=97=E6=9C=80=E7=BB=88=E5=BE=97=E5=88=86?=
=?UTF-8?q?=E6=97=B6=E7=B2=BE=E5=BA=A6=E6=8D=9F=E5=A4=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 9f0cc1d4d..49e54a273 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -1,6 +1,7 @@
class StudentWorkController < ApplicationController
layout "base_courses"
include StudentWorkHelper
+ require 'bigdecimal'
before_filter :find_homework, :only => [:new, :index, :create]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
@@ -150,7 +151,10 @@ class StudentWorkController < ApplicationController
if @work.student_score.nil?
@work.final_score = @work.teaching_asistant_score
else
- @work.final_score = format("%.2f",@work.teaching_asistant_score * @homework.homework_detail_manual.ta_proportion + @work.student_score * (1 - @homework.homework_detail_manual.ta_proportion))
+ final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")
+ final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}"))
+ final_score = final_ta_score + final_s_score
+ @work.final_score = format("%.2f",final_score.to_f)
end
end
when 3 #学生评分 学生评分显示平均分
@@ -159,7 +163,10 @@ class StudentWorkController < ApplicationController
if @work.teaching_asistant_score.nil?
@work.final_score = @work.student_score
else
- @work.final_score = format("%.2f",@work.teaching_asistant_score * @homework.homework_detail_manual.ta_proportion + @work.student_score * (1 - @homework.homework_detail_manual.ta_proportion))
+ final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")
+ final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}"))
+ final_score = final_ta_score + final_s_score
+ @work.final_score = format("%.2f",final_score.to_f)
end
end
end
From d4b3afb54e0830cfe89fd235bef3e46fcfbe9210 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 14:06:16 +0800
Subject: [PATCH 064/187] =?UTF-8?q?1=E3=80=81=E5=AD=A6=E7=94=9F=E5=8C=BF?=
=?UTF-8?q?=E8=AF=84=E5=88=97=E8=A1=A8=E3=80=81=E6=88=91=E7=9A=84=E4=BD=9C?=
=?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E5=8F=96=E6=B6=88=E6=8E=92=E5=BA=8F?=
=?UTF-8?q?=202=E3=80=81=E6=89=93=E5=88=86=E7=9A=84=E6=9D=83=E9=99=90?=
=?UTF-8?q?=E8=AE=BE=E5=AE=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 8 ++++++--
app/views/student_work/index.html.erb | 18 +++++++++---------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 49e54a273..2cef3f40c 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -11,7 +11,8 @@ class StudentWorkController < ApplicationController
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
- if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
+ @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
+ if @show_all
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
else #学生
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
@@ -120,8 +121,11 @@ class StudentWorkController < ApplicationController
#添加评分,已评分则为修改评分
def add_score
- @score = student_work_score @work,User.current
+ render_403 and return if User.current == @work.user #不可以匿评自己的作品
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
+ #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
+ render_403 and return unless @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2)
+ @score = student_work_score @work,User.current
if @score
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
@score.score = params[:score] if params[:score]
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 27dee3f91..a0612fd53 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -34,7 +34,7 @@
<%= link_to "所有作品(#{@stundet_works.count} )".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%>
- <% if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3%>
+ <% if @show_all%>
<% end%>
<% if @is_teacher%>
@@ -63,26 +63,26 @@
作品名称
- <%= link_to "教师评分",student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
- <% if @order == "teacher_score"%>
+ <%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "teacher_score"%>
<% end%>
- <%= link_to "教辅评分",student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
- <% if @order == "teaching_asistant_score"%>
+ <%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "teaching_asistant_score"%>
<% end%>
- <%= link_to "匿评",student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
- <% if @order == "student_score"%>
+ <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "student_score"%>
<% end%>
- <%= link_to "成绩",student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
- <% if @order == "final_score"%>
+ <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "final_score"%>
<% end%>
From 8522140182b7c65d0a3d712d447402a987bf67df Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 14:37:38 +0800
Subject: [PATCH 065/187] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BD=93=E5=89=8D?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E4=B8=BA=E5=8C=BF=E8=AF=84=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 2 ++
app/views/student_work/_student_work.html.erb | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 2cef3f40c..a9733c2d4 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -12,6 +12,8 @@ class StudentWorkController < ApplicationController
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
+ #当前列表为匿评列表
+ @is_evaluation = !@is_teacher && @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2
if @show_all
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
else #学生
diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb
index 568172970..3d288c302 100644
--- a/app/views/student_work/_student_work.html.erb
+++ b/app/views/student_work/_student_work.html.erb
@@ -1,4 +1,4 @@
-
+
" id="student_work_<%= student_work.id%>">
<%= link_to student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id,user_path(student_work.user),:class => "c_blue02 hwork_center"%>
From a9235bef2f5c0574ee77fc1e1b837edfaae922ca Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 15:37:23 +0800
Subject: [PATCH 066/187] =?UTF-8?q?1=E3=80=81=E5=8C=BF=E8=AF=84=E4=BD=9C?=
=?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=EF=BC=8C=E5=BE=97=E5=88=86=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E4=B8=BA=E6=88=91=E7=9A=84=E8=AF=84=E5=88=86=202?=
=?UTF-8?q?=E3=80=81=E5=8C=BF=E8=AF=84=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=EF=BC=8C=E4=B8=8D=E6=98=AF=E6=88=91=E7=9A=84=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=E6=98=BE=E7=A4=BA=E4=B8=BA=E5=8C=BF?=
=?UTF-8?q?=E5=90=8D=EF=BC=8C=E5=AD=A6=E5=8F=B7=E4=B8=8D=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 5 +--
.../student_work/_evaluation_work.html.erb | 26 ++++++++++++
.../_evaluation_work_title.html.erb | 12 ++++++
.../student_work/_student_work_title.html.erb | 33 +++++++++++++++
app/views/student_work/index.html.erb | 40 +++----------------
public/stylesheets/courses.css | 2 +
6 files changed, 81 insertions(+), 37 deletions(-)
create mode 100644 app/views/student_work/_evaluation_work.html.erb
create mode 100644 app/views/student_work/_evaluation_work_title.html.erb
create mode 100644 app/views/student_work/_student_work_title.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index a9733c2d4..9def1c630 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -12,14 +12,13 @@ class StudentWorkController < ApplicationController
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
- #当前列表为匿评列表
- @is_evaluation = !@is_teacher && @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2
if @show_all
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
else #学生
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
@stundet_works = @homework.student_works.where(:user_id => User.current.id)
- elsif @homework.homework_detail_manual.comment_status == 2 #开启匿评,显示匿评作品和我的作品
+ elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品
+ @is_evaluation = true
my_work = @homework.student_works.where(:user_id => User.current.id)
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
end
diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb
new file mode 100644
index 000000000..2e12ae5a8
--- /dev/null
+++ b/app/views/student_work/_evaluation_work.html.erb
@@ -0,0 +1,26 @@
+
+" id="student_work_<%= student_work.id%>">
+ <% is_my_work = student_work.user == User.current%>
+
+ <% if is_my_work%>
+ <%= link_to student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id,user_path(student_work.user),:class => "c_blue02 hwork_center"%>
+ <% else%>
+ <%= link_to "--", "javascript:void(0)",:class => "c_blue02 hwork_center"%>
+ <% end%>
+
+
+ <% if is_my_work%>
+ <%= link_to student_work.user.show_name,user_path(student_work.user),:class => "c_blue02 hwork_name"%>
+ <% else%>
+ <%= link_to "匿名","javascript:void(0)",:class => "c_blue02 hwork_name"%>
+ <% end%>
+
+
+ <%= link_to student_work.name, student_work_path(student_work),:remote => true%>
+
+
+ <% my_score = student_work_score(student_work,User.current) %>
+ <%= my_score.nil? ? "--" : format("%.2f",my_score.score)%>
+
+
+
\ No newline at end of file
diff --git a/app/views/student_work/_evaluation_work_title.html.erb b/app/views/student_work/_evaluation_work_title.html.erb
new file mode 100644
index 000000000..a3b1cda41
--- /dev/null
+++ b/app/views/student_work/_evaluation_work_title.html.erb
@@ -0,0 +1,12 @@
+
+ 学号
+
+
+ 学生姓名
+
+
+ 作品名称
+
+
+ <%= link_to "我的评分","javascript:void(0)",:class => "c_dark f14 fb fl"%>
+
\ No newline at end of file
diff --git a/app/views/student_work/_student_work_title.html.erb b/app/views/student_work/_student_work_title.html.erb
new file mode 100644
index 000000000..7cf5e5d01
--- /dev/null
+++ b/app/views/student_work/_student_work_title.html.erb
@@ -0,0 +1,33 @@
+
+ 学号
+
+
+ 学生姓名
+
+
+ 作品名称
+
+
+ <%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "teacher_score"%>
+
+ <% end%>
+
+
+ <%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "teaching_asistant_score"%>
+
+ <% end%>
+
+
+ <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "student_score"%>
+
+ <% end%>
+
+
+ <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
+ <% if @show_all && @order == "final_score"%>
+
+ <% end%>
+
\ No newline at end of file
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index a0612fd53..92f6cdaa2 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -53,44 +53,16 @@
-
- 学号
-
-
- 学生姓名
-
-
- 作品名称
-
-
- <%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
- <% if @show_all && @order == "teacher_score"%>
-
- <% end%>
-
-
- <%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
- <% if @show_all && @order == "teaching_asistant_score"%>
-
- <% end%>
-
-
- <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
- <% if @show_all && @order == "student_score"%>
-
- <% end%>
-
-
- <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
- <% if @show_all && @order == "final_score"%>
-
- <% end%>
-
+ <% if @is_evaluation.nil?%>
+ <%= render :partial => 'student_work_title'%>
+ <% else%>
+ <%= render :partial => 'evaluation_work_title'%>
+ <% end%>
<% @stundet_works.each do |student_work|%>
- <%= render :partial => 'student_work',:locals => {:student_work => student_work}%>
+ <%= render :partial => (@is_evaluation ? 'evaluation_work' :'student_work'),:locals => {:student_work => student_work}%>
<% end%>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 4dc925519..4f8708120 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -635,6 +635,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.t_c{ text-align:center;}
.hwork_tit{ width:240px; float:left; }
.hwork_tit a{ width:255px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
+.hwork_tit_e{ width:440px; float:left; }
+.hwork_tit_e a{ width:455px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_code{ width:60px; text-align:center; margin-right:15px;}
.hwork_code02{ width:60px; text-align:center; margin-right:10px;}
a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;overflow: hidden;}
From fc5be22a03aad4283cb6eefd35396cfcb72569a1 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 15:47:03 +0800
Subject: [PATCH 067/187] =?UTF-8?q?=E8=AF=84=E5=88=86=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=9C=8B=E4=B8=8D=E5=88=B0=E5=8C=BF=E8=AF=84?=
=?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_student_work_score.html.erb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb
index c1536df98..d4bec1968 100644
--- a/app/views/student_work/_student_work_score.html.erb
+++ b/app/views/student_work/_student_work_score.html.erb
@@ -1,7 +1,8 @@
- <%= link_to image_tag(url_to_avatar(score.user), :width => "34", :height => "34"), user_path(score.user),:class => "ping_pic fl" %>
+ <% show_real_name = @is_teacher || score.user == User.current %>
+ <%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %>
- <%= link_to score.user.show_name, user_path(score.user), :title => score.user.show_name, :class => "c_blue fl" %>
+ <%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "c_blue fl" %>
(<%= student_work_score_role score%>)
评分:
<%= score.score%>分
From eef59d9f5d6641fa1c73ddebf37e7d6f5daad417 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 15:50:26 +0800
Subject: [PATCH 068/187] =?UTF-8?q?=E8=AF=84=E5=88=86=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=9F=A5=E7=9C=8B=E5=8A=A9=E6=95=99=E5=92=8C?=
=?UTF-8?q?=E8=80=81=E5=B8=88=E7=9A=84=E7=9C=9F=E5=AE=9E=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_student_work_score.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb
index d4bec1968..c6ff0adae 100644
--- a/app/views/student_work/_student_work_score.html.erb
+++ b/app/views/student_work/_student_work_score.html.erb
@@ -1,5 +1,5 @@
- <% show_real_name = @is_teacher || score.user == User.current %>
+ <% show_real_name = @is_teacher || score.user == User.current || score.user.allowed_to?(:as_teacher,@course) %>
<%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %>
<%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "c_blue fl" %>
From 007aa001746a8edf43ea68d2a9ad7b18971eb486 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 May 2015 16:05:41 +0800
Subject: [PATCH 069/187] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8C=BF=E8=AF=84?=
=?UTF-8?q?=E6=89=93=E5=88=86=E4=B9=8B=E5=90=8E=EF=BC=8C=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/add_score.js.erb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index cb68155d8..5e6c4fe6d 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -8,7 +8,13 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
<% end%>
$("#score_list_<%= @work.id%>").removeAttr("style");
-$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
+<% if @is_teacher %>
+ $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
+<% else %>
+ $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>");
+<% end%>
+
+
$(function(){
$(".student_score_info").bind("mouseover",function(e){
//alert($(this).html());
From ee35de54474321e62308bf6738b8605865462cbf Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Fri, 29 May 2015 20:05:49 +0800
Subject: [PATCH 070/187] =?UTF-8?q?=E5=BF=BD=E7=95=A5redis=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 5810401cb..fdb7a3c6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
*.swp
/config/database.yml
/config/configuration.yml
+/config/additional_environment.rb
/files/*
/log/*
From 7bbd85f8c2046e1c5536b390f3a4e7a810e4c8ab Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Mon, 1 Jun 2015 13:50:06 +0800
Subject: [PATCH 071/187] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=A6=96=E9=A1=B5?=
=?UTF-8?q?=E8=B4=B4=E5=90=A7=E5=9B=9E=E5=A4=8D=E7=BC=93=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/welcome/course.html.erb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 476471897..256a976c4 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -195,7 +195,6 @@
<%= link_to "更多>>", forums_path %>
<% topics = find_new_forum_topics(10) %>
- <%# cache topics.maximum(:created_at) do%>
- <%# end %>
-<%= render partial: 'link_to_another' %>
\ No newline at end of file
+<%= render partial: 'link_to_another' %>
From e7868730615c0b20a1e80aea4e8190ad1f2db1bc Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Mon, 1 Jun 2015 13:58:37 +0800
Subject: [PATCH 072/187] =?UTF-8?q?=E8=BF=98=E6=98=AF=E7=BC=93=E5=AD=98?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/welcome/index.html.erb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 869df52a6..3acee0acf 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -123,7 +123,6 @@
<% topics = find_new_forum_topics(12) %>
- <% cache topics.maximum(:created_at) do%>
<% topics.includes(:forum, :last_reply, :author).each do |topic|%>
@@ -153,10 +152,9 @@
<% end %>
- <% end %>
-<%= render partial: 'link_to_another' %>
\ No newline at end of file
+<%= render partial: 'link_to_another' %>
From b6d22cfb314baf1c0605bc168370f91116acee63 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Mon, 1 Jun 2015 23:02:55 +0800
Subject: [PATCH 073/187] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E9=A2=84=E8=A7=88=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 9 ++++++---
app/controllers/test_controller.rb | 6 ++++++
config/routes.rb | 1 +
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index d880ebe35..b2364165b 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -69,9 +69,12 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
- send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
- :type => detect_content_type(@attachment),
- :disposition => 'attachment' #inline can open in browser
+ req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx', :txtDes => File.new(@attachment.diskfile, 'rb')
+ render :text => req.body
+
+ # send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
+ # :type => detect_content_type(@attachment),
+ # :disposition => 'attachment' #inline can open in browser
end
else
diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb
index 51ff293f1..12fead4f2 100644
--- a/app/controllers/test_controller.rb
+++ b/app/controllers/test_controller.rb
@@ -1,3 +1,5 @@
+require 'net/http'
+
class TestController < ApplicationController
helper :UserScore
@@ -5,6 +7,10 @@ class TestController < ApplicationController
def bootstrap; end
+ def view_office
+
+ end
+
def zip
homeworks_attach_path = []
homework_id = params[:homework_id]
diff --git a/config/routes.rb b/config/routes.rb
index 9a8e71156..109e71c32 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -110,6 +110,7 @@ RedmineApp::Application.routes.draw do
match 'courselist'
match 'zip'
match 'mailer'
+ match 'view_office'
end
##new added by linchun #以发布应用的形式参与竞赛
resources :softapplications do
From b3abf610d9390e66f3991c0bb33d039a8a8c4fa5 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Mon, 1 Jun 2015 23:10:25 +0800
Subject: [PATCH 074/187] add rest_client
---
Gemfile | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/Gemfile b/Gemfile
index c1f7bcbeb..660a7ff49 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,10 +6,7 @@ unless RUBY_PLATFORM =~ /w32/
gem 'iconv'
end
-source 'http://rubygems.oneapm.com' do
- gem 'oneapm_rpm'
-end
-
+gem 'rest-client'
gem "mysql2", "= 0.3.18"
gem 'redis-rails'
gem 'rubyzip'
From e4046851cf58680f34f95f71f57fd9412cd08995 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 09:33:34 +0800
Subject: [PATCH 075/187] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E5=93=81=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=20=20=20=E5=AD=A6=E5=8F=B7=E3=80=81=E5=A7=93=E5=90=8D?=
=?UTF-8?q?=E8=BF=87=E9=95=BF=E4=BC=9A=E6=8D=A2=E8=A1=8C=202=E3=80=81?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E4=BD=9C=E4=B8=9A=E7=9B=B8=E5=85=B3=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E8=BF=81=E7=A7=BB=203=E3=80=81student=5Fwork=E7=BC=BA?=
=?UTF-8?q?=E5=B0=91=E5=AD=97=E6=AE=B5project=5Fid?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/student_work.rb | 2 +-
db/migrate/20150601032112_about_homework.rb | 119 ++++++++++++++++++++
db/schema.rb | 14 +--
public/stylesheets/courses.css | 4 +-
4 files changed, 129 insertions(+), 10 deletions(-)
create mode 100644 db/migrate/20150601032112_about_homework.rb
diff --git a/app/models/student_work.rb b/app/models/student_work.rb
index c8e69a4a3..e2be18423 100644
--- a/app/models/student_work.rb
+++ b/app/models/student_work.rb
@@ -1,6 +1,6 @@
#学生提交作品表
class StudentWork < ActiveRecord::Base
- attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score
+ attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id
belongs_to :homework_common
belongs_to :user
diff --git a/db/migrate/20150601032112_about_homework.rb b/db/migrate/20150601032112_about_homework.rb
new file mode 100644
index 000000000..317748741
--- /dev/null
+++ b/db/migrate/20150601032112_about_homework.rb
@@ -0,0 +1,119 @@
+#encoding=UTF-8
+class AboutHomework < ActiveRecord::Migration
+ def up
+ Bid.where("reward_type = 3").each do |bid|
+ transaction do
+ if bid.courses.first
+ # 作品基础属性
+ homework = HomeworkCommon.new
+ homework.name = bid.name
+ homework.description = bid.description
+ homework.user_id = bid.author_id
+ homework.end_time = bid.deadline
+ homework.publish_time = bid.deadline
+ bid.open_anonymous_evaluation == 1 ? homework.homework_type = 1 : homework.homework_type = 0
+ homework.late_penalty = 0
+ homework.course_id = bid.courses.first.id
+ homework.created_at = bid.created_on
+ homework.updated_at = bid.updated_on
+ homework.save
+
+ #作业附件
+ bid.attachments.each do |attach|
+ attach.container = homework
+ attach.save
+ end
+
+ # 匿评作业相关属性
+ homework_detail_manual = HomeworkDetailManual.new
+ homework_detail_manual.ta_proportion = 0.6
+ homework_detail_manual.comment_status = bid.comment_status + 1
+ homework_detail_manual.evaluation_start = bid.created_on
+ homework_detail_manual.evaluation_end = bid.created_on
+ homework_detail_manual.evaluation_num = bid.evaluation_num
+ homework_detail_manual.absence_penalty = 0
+ homework_detail_manual.homework_common = homework
+ homework_detail_manual.save
+
+ #作品列表
+ bid.homeworks.each do |homework_attach|
+ student_work = StudentWork.new
+ student_work.name = homework_attach.name
+ student_work.description = homework_attach.description
+ student_work.user_id = homework_attach.user_id
+ student_work.project_id = homework_attach.project_id
+ student_work.homework_common = homework
+ student_work.save
+
+ #作品文件
+ homework_attach.attachments.each do |attach|
+ attach.container = student_work
+ attach.save
+ end
+
+ #作品匿评列表
+ homework_attach.homework_evaluations.each do |homework_evaluation|
+ student_work_evaluation = StudentWorksEvaluationDistribution.new
+ student_work_evaluation.user_id = homework_evaluation.user_id
+ student_work_evaluation.student_work = student_work
+ student_work_evaluation.save
+ end
+
+ #评分评论相关
+ stars_reates = homework_attach.rates(:quality)
+ if stars_reates
+ stars_reates.each do |reate|
+ student_work_score = StudentWorksScore.new
+ student_work_score.user_id = reate.rater_id
+ student_work_score.score = reate.stars * 20
+ student_work_score.student_work = student_work
+ rater = User.find reate.rater_id
+ if rater
+ member = rater.members.where("course_id = ?",bid.courses.first.id).first
+ if member
+ role = member.roles.first.name
+ case role
+ when "Teacher"
+ student_work_score.reviewer_role = 1
+ when "Manager"
+ student_work_score.reviewer_role = 1
+ when "TeachingAsistant"
+ student_work_score.reviewer_role = 2
+ when "Student"
+ student_work_score.reviewer_role = 3
+ end
+ else
+ student_work_score.reviewer_role = 3
+ end
+ else
+ student_work_score.reviewer_role = 3
+ end
+
+ jour = homework_attach.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{reate.rater_id}").order("created_on DESC").first
+ if jour
+ student_work_score.comment = jour.notes
+ student_work_score.save
+ #老师反馈附件
+ homework_attach.attachments.each do |attach|
+ attach.container = student_work_score
+ attach.save
+ end
+ else
+ student_work_score.save
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ def down
+ HomeworkCommon.destroy_all
+ HomeworkDetailManual.destroy_all
+ StudentWork.destroy_all
+ StudentWorksScore.destroy_all
+ StudentWorksEvaluationDistribution.destroy_all
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4c6be4b35..a55201b4b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20150519030544) do
+ActiveRecord::Schema.define(:version => 20150601032112) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -1203,13 +1203,13 @@ ActiveRecord::Schema.define(:version => 20150519030544) do
t.text "description"
t.integer "homework_common_id"
t.integer "user_id"
- t.float "final_score", :default => 0.0
- t.float "teacher_score", :default => 0.0
- t.float "student_score", :default => 0.0
- t.float "teaching_asistant_score", :default => 0.0
+ t.float "final_score"
+ t.float "teacher_score"
+ t.float "student_score"
+ t.float "teaching_asistant_score"
t.integer "project_id", :default => 0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "student_works_evaluation_distributions", :force => true do |t|
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 4f8708120..9d0df5d55 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -639,8 +639,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.hwork_tit_e a{ width:455px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_code{ width:60px; text-align:center; margin-right:15px;}
.hwork_code02{ width:60px; text-align:center; margin-right:10px;}
-a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;overflow: hidden;}
-a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;overflow: hidden;}
+a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;overflow: hidden; white-space: nowrap; text-overflow:ellipsis;}
+a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
.show_hwork ul li{ margin-bottom:5px;}
.show_hwork_arrow{ position:relative; top:2px; left:25px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;}
From c1d753f63477a3131d98189ca2db22167c6d909c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 10:09:05 +0800
Subject: [PATCH 076/187] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A2=9E=E5=8A=A0=E4=B8=AA=E4=BA=BA=E5=8A=A8?=
=?UTF-8?q?=E6=80=81=E4=B8=AD=E7=9A=84=E8=BF=81=E7=A7=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/migrate/20150601032112_about_homework.rb | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/db/migrate/20150601032112_about_homework.rb b/db/migrate/20150601032112_about_homework.rb
index 317748741..fe3ca1c12 100644
--- a/db/migrate/20150601032112_about_homework.rb
+++ b/db/migrate/20150601032112_about_homework.rb
@@ -18,6 +18,13 @@ class AboutHomework < ActiveRecord::Migration
homework.updated_at = bid.updated_on
homework.save
+ #个人动态
+ bid.acts.each do |act|
+ act.act_type = homework.class.to_s
+ act.act_id = homework.id
+ act.save
+ end
+
#作业附件
bid.attachments.each do |attach|
attach.container = homework
From 9c336a01c862bbcee99778e4013be527cc2a32f7 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 10:47:10 +0800
Subject: [PATCH 077/187] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E5=91=98=E8=AF=84=E5=88=86=E5=AE=9A=E4=B9=89=E4=B8=BA=E6=95=99?=
=?UTF-8?q?=E5=B8=88=E8=AF=84=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 9def1c630..7543bc770 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -138,7 +138,7 @@ class StudentWorkController < ApplicationController
@score.user_id = User.current.id
@score.student_work_id = @work.id
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
- @score.reviewer_role = get_role_by_name(role)
+ User.current.admin? ? @score.reviewer_role = 1 : @score.reviewer_role = get_role_by_name(role)
@is_new = true
end
From bdbcc5232024a11ccbf2749f44d8b3b6921d5508 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 11:01:49 +0800
Subject: [PATCH 078/187] =?UTF-8?q?=E8=AF=84=E5=88=86=E8=AE=A1=E7=AE=97?=
=?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../20150602021020_add_score_to_work.rb | 58 +++++++++++++++++++
db/schema.rb | 2 +-
2 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 db/migrate/20150602021020_add_score_to_work.rb
diff --git a/db/migrate/20150602021020_add_score_to_work.rb b/db/migrate/20150602021020_add_score_to_work.rb
new file mode 100644
index 000000000..93045793c
--- /dev/null
+++ b/db/migrate/20150602021020_add_score_to_work.rb
@@ -0,0 +1,58 @@
+class AddScoreToWork < ActiveRecord::Migration
+ require 'bigdecimal'
+
+ def up
+ transaction do
+ for i in 1 ... 1000 do i
+ StudentWork.page(i).per(10).each do |work|
+ teacher_score = work.student_works_scores.where(:reviewer_role => 1).order("created_at desc")
+ unless teacher_score.empty?
+ work.teacher_score = teacher_score.first.score
+ end
+
+ teaching_asistant_score = work.student_works_scores.where(:reviewer_role => 2)
+ unless teaching_asistant_score.empty?
+ work.teaching_asistant_score = teaching_asistant_score.average(:score).try(:round, 2).to_f
+ end
+
+ student_socre = work.student_works_scores.where(:reviewer_role => 3)
+ unless student_socre.empty?
+ work.student_score = student_socre.average(:score).try(:round, 2).to_f
+ end
+
+ if work.teacher_score.nil?
+ if work.teaching_asistant_score.nil? #教辅评分为空,最终评分为学生匿评
+ work.final_score = work.student_score
+ elsif work.student_score.nil? #学生匿评评分为空,最终评分为教辅评分
+ work.final_score = work.teaching_asistant_score
+ else #都不为空,按比例来
+ final_ta_score = BigDecimal.new("#{work.teaching_asistant_score}") * BigDecimal.new("0.6")
+ final_s_score = BigDecimal.new("#{work.student_score}") * BigDecimal.new('0.4')
+ final_score = final_ta_score + final_s_score
+ work.final_score = format("%.2f",final_score.to_f)
+ end
+ else #教师评分不为空,最终评分为教师评分
+ work.final_score = work.teacher_score
+ end
+ work.save
+ end
+ end
+ end
+
+
+ end
+
+ def down
+ transaction do
+ for i in 1 ... 1000 do i
+ StudentWork.page(i).per(10).each do |work|
+ work.teacher_score = nil
+ work.teaching_asistant_score = nil
+ work.student_score = nil
+ work.final_score = nil
+ work.save
+ end
+ end
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index a55201b4b..6f174868e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20150601032112) do
+ActiveRecord::Schema.define(:version => 20150602021020) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
From 6cddb59a4a92c2281c2c089d0f2ec27f5b30e58b Mon Sep 17 00:00:00 2001
From: huang
Date: Tue, 2 Jun 2015 11:02:12 +0800
Subject: [PATCH 079/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?=
=?UTF-8?q?=E6=8F=90=E9=86=92=EF=BC=9A=E9=A1=B9=E7=9B=AE=E7=BC=BA=E9=99=B7?=
=?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=8D=E8=83=BD=E6=94=B6=E5=88=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/mailer.rb | 42 +-
.../mailer/send_for_user_activities.html.erb | 566 +++++++++---------
2 files changed, 299 insertions(+), 309 deletions(-)
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index dbc5d3cff..44139fb03 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -45,7 +45,6 @@ class Mailer < ActionMailer::Base
MailerProxy.new(self)
end
- # author: alan
# 发送邀请未注册用户加入项目邮件
# 功能: 在加入项目的同时自动注册用户
def send_invite_in_project(email, project, invitor)
@@ -101,16 +100,16 @@ class Mailer < ActionMailer::Base
course_ids = courses.map {|course| course.id}.join(",")
# 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
- sql = "select DISTINCT i.* from issues i, watchers w
- where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
- or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
- and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
+ # sql = "select DISTINCT i.* from issues i, watchers w
+ # where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
+ # or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
+ # and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
+ sql = "select DISTINCT i.* from issues i where (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
@issues = Issue.find_by_sql(sql)
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
# @attachments查询课程课件更新
@attachments ||= []
-
@bids ||= [] # 老师发布的作业
unless courses.first.nil?
@@ -142,9 +141,9 @@ class Mailer < ActionMailer::Base
# 查询user在课程中发布的通知,项目中发的新闻
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
where n.course_id in (#{course_ids})
- and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
+ and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
@project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
- and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
+ and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
# 查询user在课程及个人中留言
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where
@@ -165,7 +164,7 @@ class Mailer < ActionMailer::Base
}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发
- mail :to => user.mail,:subject => subject if has_content
+ mail :to => user.mail, :subject => subject if has_content
end
# 公共讨论区发帖、回帖添加邮件发送信息
@@ -188,8 +187,8 @@ class Mailer < ActionMailer::Base
:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
:filter => true
end
- # Builds a Mail::Message object used to email recipients of the added journals for message.
+ # Builds a Mail::Message object used to email recipients of the added journals for message.
# 留言分为直接留言,和对留言人留言的回复
# 字段说明在JournalsForMessage.rb
# 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil
@@ -511,7 +510,7 @@ class Mailer < ActionMailer::Base
end
# Builds a Mail::Message object used to email recipients of a news' project when a news comment is added.
- #
+ # 新增新闻评论时邮件通知
# Example:
# news_comment_added(comment) => Mail::Message object
# Mailer.news_comment_added(comment) => sends an email to the news' project recipients
@@ -526,9 +525,9 @@ class Mailer < ActionMailer::Base
@comment = comment
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
mail :to => news.recipients,
- :cc => news.watcher_recipients,
- :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
- :filter => true
+ :cc => news.watcher_recipients,
+ :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
+ :filter => true
elsif news.course
redmine_headers 'Course' => news.course.id
@author = comment.author
@@ -563,9 +562,9 @@ class Mailer < ActionMailer::Base
@message = message
@message_url = url_for(message.event_url)
mail :to => recipients,
- :cc => cc,
- :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
- :filter => true
+ :cc => cc,
+ :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
+ :filter => true
elsif message.course
redmine_headers 'Course' => message.course.id,
'Topic-Id' => (message.parent_id || message.id)
@@ -909,10 +908,11 @@ class Mailer < ActionMailer::Base
if email.attachments && email.attachments.any?
email.attachments.each do |attachment|
obj.attachments << Attachment.create(:container => obj,
- :file => attachment.decoded,
- :filename => attachment.filename,
- :author => user,
- :content_type => attachment.mime_type)
+ :file => attachment.decoded,
+ :filename => attachment.filename,
+ :author => user,
+
+ :content_type => attachment.mime_type)
end
end
end
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index 73a561ca3..2cf070960 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -1,341 +1,331 @@
-
-
-
-
-
-
-
-<%= @subject %>
+ <%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first ||
- @homeworks.first || @course_journal_messages.first|| @course_messages.first %>
-
-
<%= l(:label_course_overview)%>
- <% unless @course_news.first.nil? %>
-
+ @homeworks.first || @course_journal_messages.first|| @course_messages.first %>
+
+
<%= l(:label_course_overview)%>
+ <% unless @course_news.first.nil? %>
+
+
+ <%= l(:label_course_news) %>
+ (<%= @course_news.count %>)
+
+ <% @course_news.each do |course_new|%>
+
+ ▪
+ [
-
- <%= l(:label_course_news) %>
- (<%= @course_news.count %>)
-
+ <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
- <% @course_news.each do |course_new|%>
-
- ▪
- [
-
- <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
+ <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_project_notice) %>
- <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_project_notice) %>
+ <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(course_new.created_on) %>
+
+ <% end %>
- <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(course_new.created_on) %>
-
+
+
+ <% end %>
+ <% if !@bids.first.nil? || !@homeworks.first.nil? %>
+
+
+ <%= l(:label_homework_overview) %>(<%= @bids.count %>)
+ <% unless @bids.first.nil?%>
+ <% @bids.each do |bid| %>
+
+ ▪
+ [
+
+ <%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
+
+ <%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_course_homework) %>
+
+ <%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(bid.created_on) %>
+
+ <% end %>
+ <% end %>
+ <% unless @homeworks.first.nil? %>
+ <% @homeworks.each do |homework| %>
+
+ ▪
+ [
+
+ <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
+
+ <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_course_submit_homework) %>
+
+ <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(homework.created_at) %>
+
+ <% end %>
+ <% end %>
+
+
+
<% end %>
-
-
- <% end %>
- <% if !@bids.first.nil? || !@homeworks.first.nil? %>
-
+ <% unless @course_journal_messages.first.nil? %>
+
- <%= l(:label_homework_overview) %>(<%= @bids.count %>)
- <% unless @bids.first.nil?%>
- <% @bids.each do |bid| %>
-
- ▪
- [
+
+ <%= l(:view_course_journals_for_messages) %>
+ (<%= @course_journal_messages.count %>)
+
- <%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
+ <% @course_journal_messages.each do |course_journal_message|%>
+
+ ▪
+ [
- <%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_course_homework) %>
+ <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
- <%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(bid.created_on) %>
-
- <% end %>
- <% end %>
- <% unless @homeworks.first.nil? %>
- <% @homeworks.each do |homework| %>
-
- ▪
- [
+ <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_send_course_journals_for_messages) %>
- <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
+ <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(course_journal_message.created_on) %>
+
+ <% end %>
- <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_course_submit_homework) %>
-
- <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(homework.created_at) %>
-
- <% end %>
+
+
<% end %>
-
-
- <% end %>
+ <% unless @course_messages.first.nil? %>
+
- <% unless @course_journal_messages.first.nil? %>
-
+
+ <%= l(:view_borad_course) %>
+ (<%= @course_journal_messages.count %>)
+
-
- <%= l(:view_course_journals_for_messages) %>
- (<%= @course_journal_messages.count %>)
-
+ <% @course_messages.each do |course_message|%>
+
+ ▪
+ [
- <% @course_journal_messages.each do |course_journal_message|%>
-
- ▪
- [
+ <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
- <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
+ <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_send_course_messages) %>
- <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_send_course_journals_for_messages) %>
+ <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(course_message.created_on) %>
+
+ <% end %>
- <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(course_journal_message.created_on) %>
-
- <% end %>
+
+
+ <% end %>
-
-
- <% end %>
+ <% unless @attachments.first.nil? %>
+
+
+ <%= l(:label_course_attendingcontestwork_download) %>
+ (<%= @attachments.count %>)
+
- <% unless @course_messages.first.nil? %>
-
+ <% @attachments.each do |attachment|%>
+
+ ▪
+ [
-
- <%= l(:view_borad_course) %>
- (<%= @course_journal_messages.count %>)
-
+ <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
- <% @course_messages.each do |course_message|%>
-
- ▪
- [
+ <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_course_file_upload) %>
- <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
+ <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(attachment.created_on) %>
+
+ <% end %>
+
+
+ <% end %>
+
+<% end %>
+<% if @issues.first || @project_messages.first %>
+
+
<%= l(:label_project_overview_new)%>
+ <% unless @issues.first.nil? %>
+
+
+ <%= l(:label_issue_tracking) %>
+ (<%= @issues.count %>)
+
+ <% @issues.each do |issue|%>
+
+ ▪
+ [
- <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_send_course_messages) %>
+ <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
- <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(course_message.created_on) %>
-
- <% end %>
+ <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_project_issue) %>
-
-
- <% end %>
+ <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+
<%= format_time(issue.created_on) %>
+
+ <% end %>
- <% unless @attachments.first.nil? %>
-
-
- <%= l(:label_course_attendingcontestwork_download) %>
- (<%= @attachments.count %>)
-
+
+
+ <% end %>
- <% @attachments.each do |attachment|%>
-
- ▪
- [
+ <% unless @project_messages.first.nil? %>
+
+
+ <%= l(:project_moule_boards_show) %>
+ (<%= @project_messages.count %>)
+
- <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
+ <% @project_messages.each do |project_message|%>
+
+ ▪
+ [
- <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_course_file_upload) %>
+ <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
- <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(attachment.created_on) %>
-
- <% end %>
-
-
- <% end %>
-
- <% end %>
- <% if @issues.first || @project_messages.first %>
-
-
<%= l(:label_project_overview_new)%>
- <% unless @issues.first.nil? %>
-
-
- <%= l(:label_issue_tracking) %>
- (<%= @issues.count %>)
-
+ <%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_send_course_messages) %>
- <% @issues.each do |issue|%>
-
- ▪
- [
+ <%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(project_message.created_on) %>
+
+ <% end %>
- <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
-
- <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_project_issue) %>
-
- <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(issue.created_on) %>
-
- <% end %>
-
-
-
- <% end %>
-
- <% unless @project_messages.first.nil? %>
-
-
- <%= l(:project_moule_boards_show) %>
- (<%= @project_messages.count %>)
-
-
- <% @project_messages.each do |project_message|%>
-
- ▪
- [
-
- <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
-
- <%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_send_course_messages) %>
-
- <%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(project_message.created_on) %>
-
- <% end %>
-
-
-
- <% end %>
+
+
+ <% end %>
-
- <% end %>
- <% unless @user_journal_messages.first.nil? %>
-
-
<%= l(:label_activities) %>
+
+<% end %>
+<% unless @user_journal_messages.first.nil? %>
+
+
<%= l(:label_activities) %>
-
-
- <%= l(:label_user_message) %>
- (<%= @user_journal_messages.count %>)
-
+
+
+ <%= l(:label_user_message) %>
+ (<%= @user_journal_messages.count %>)
+
- <% @user_journal_messages.each do |user_journal_message|%>
-
- ▪
+ <% @user_journal_messages.each do |user_journal_message|%>
+
+ ▪
- <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
- :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- <%= l(:label_show_your_message) %>
+ <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
+ :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ <%= l(:label_show_your_message) %>
- <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
+ <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
<%= format_time(user_journal_message.created_on) %>
<% end %>
-
-
+
+
-
- <% end %>
- <% if @forums.first || @memos.first %>
+
+<% end %>
+<% if @forums.first || @memos.first %>
<%= l(:lable_bar_active) %>
<% unless @forums.first.nil? %>
-
-
- <%= l(:label_user_forum) %>
- (<%= @forums.count %>)
-
+
+
+ <%= l(:label_user_forum) %>
+ (<%= @forums.count %>)
+
- <% @forums.each do |forum|%>
-
- ▪
+ <% @forums.each do |forum|%>
+
+ ▪
- <%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value),
- :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- <%= l(:label_forum_new) %>
+ <%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value),
+ :class => "wmail_name",
+ :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ <%= l(:label_forum_new) %>
- <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(forum.created_at) %>
+ <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(forum.created_at) %>
- <% end %>
+ <% end %>
-
-
+
+
<% end %>
<% unless @memos.first.nil? %>
@@ -366,14 +356,14 @@
<% end %>
<% end %>
-
+
From 64e56eca8e98d902505a5c8eb7c66eae5f9d4d53 Mon Sep 17 00:00:00 2001
From: huang
Date: Tue, 2 Jun 2015 11:14:13 +0800
Subject: [PATCH 080/187] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=8F=90=E9=86=92?=
=?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E8=AE=BA=E5=9D=9B?=
=?UTF-8?q?=E6=8F=90=E9=86=92=E4=B8=8D=E5=85=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/mailer.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 44139fb03..7be526f41 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -126,7 +126,7 @@ class Mailer < ActionMailer::Base
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子
- messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
+ messages = Message.find_by_sql("select DISTINCT * from messages where (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@course_messages ||= []
@project_messages ||= []
unless messages.first.nil?
From 8d23815169277a61420f94e59f9675dfb995bf2a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 11:42:12 +0800
Subject: [PATCH 081/187] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?=
=?UTF-8?q?=E4=B8=8D=E5=AE=8C=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/migrate/20150602021020_add_score_to_work.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/db/migrate/20150602021020_add_score_to_work.rb b/db/migrate/20150602021020_add_score_to_work.rb
index 93045793c..446a5a4f7 100644
--- a/db/migrate/20150602021020_add_score_to_work.rb
+++ b/db/migrate/20150602021020_add_score_to_work.rb
@@ -2,8 +2,9 @@ class AddScoreToWork < ActiveRecord::Migration
require 'bigdecimal'
def up
+ count = StudentWork.all.count / 10 + 1
transaction do
- for i in 1 ... 1000 do i
+ for i in 1 ... count do i
StudentWork.page(i).per(10).each do |work|
teacher_score = work.student_works_scores.where(:reviewer_role => 1).order("created_at desc")
unless teacher_score.empty?
@@ -43,8 +44,9 @@ class AddScoreToWork < ActiveRecord::Migration
end
def down
+ count = StudentWork.all.count / 10 + 1
transaction do
- for i in 1 ... 1000 do i
+ for i in 1 ... count do i
StudentWork.page(i).per(10).each do |work|
work.teacher_score = nil
work.teaching_asistant_score = nil
From 66c02f06679a02b83abec9aec0f88cd7dfee20a3 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 11:58:21 +0800
Subject: [PATCH 082/187] =?UTF-8?q?1=E3=80=81=E6=96=B0=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E5=99=A8=E5=A2=9E=E5=8A=A0HomeworkCommon=E7=9A=84Type=202?=
=?UTF-8?q?=E3=80=81=E8=80=81=E5=B8=88=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=80=81=E5=B8=88=E4=B8=AA=E4=BA=BA=E5=8A=A8?=
=?UTF-8?q?=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/owner_type_helper.rb | 1 +
app/models/homework_common.rb | 13 ++++++++++++-
.../homework_common/_homework_common_form.html.erb | 2 +-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/app/helpers/owner_type_helper.rb b/app/helpers/owner_type_helper.rb
index dd5dbbbac..c03f2d19e 100644
--- a/app/helpers/owner_type_helper.rb
+++ b/app/helpers/owner_type_helper.rb
@@ -6,4 +6,5 @@ module OwnerTypeHelper
COMMENT = 5
BID = 6
JOURNALSFORMESSAGE = 7
+ HOMEWORKCOMMON = 8
end
\ No newline at end of file
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index cb5c64778..b56406f19 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -11,6 +11,17 @@ class HomeworkCommon < ActiveRecord::Base
has_many :homework_tests, :dependent => :destroy
has_many :student_works, :dependent => :destroy
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
-
+ has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
acts_as_attachable
+
+ after_create :act_as_activity
+ after_destroy :delete_kindeditor_assets
+
+ def act_as_activity
+ self.acts << Activity.new(:user_id => self.user_id)
+ end
+ #删除对应的图片
+ def delete_kindeditor_assets
+ delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
+ end
end
diff --git a/app/views/homework_common/_homework_common_form.html.erb b/app/views/homework_common/_homework_common_form.html.erb
index 2418c5650..cbe054335 100644
--- a/app/views/homework_common/_homework_common_form.html.erb
+++ b/app/views/homework_common/_homework_common_form.html.erb
@@ -12,7 +12,7 @@
<%= l(:field_quote)%>:
<% if edit_mode %>
- <%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::BID %>
+ <%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
<% else %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor' %>
From 79f4e286cf7883fadfff7a630c3d79c2b733e63f Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 11:59:59 +0800
Subject: [PATCH 083/187] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=BF=9D=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/homework_common.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index b56406f19..925ebb106 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -3,6 +3,7 @@
class HomeworkCommon < ActiveRecord::Base
# attr_accessible :name, :user_id, :description, :publish_time, :end_time, :homework_type, :late_penalty, :course_id
include Redmine::SafeAttributes
+ include ApplicationHelper
belongs_to :course
belongs_to :user
From c8128cffea87e24be6a75d92c683a6892de680e9 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 13:59:33 +0800
Subject: [PATCH 084/187] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E6=95=88?=
=?UTF-8?q?=E5=8A=A8=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/migrate/20150602055730_remove_bid_activity.rb | 7 +++++++
db/schema.rb | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 db/migrate/20150602055730_remove_bid_activity.rb
diff --git a/db/migrate/20150602055730_remove_bid_activity.rb b/db/migrate/20150602055730_remove_bid_activity.rb
new file mode 100644
index 000000000..759091118
--- /dev/null
+++ b/db/migrate/20150602055730_remove_bid_activity.rb
@@ -0,0 +1,7 @@
+class RemoveBidActivity < ActiveRecord::Migration
+ def change
+ Activity.where(:act_type => "Bid").each do |act|
+ act.destroy
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6f174868e..42c743588 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20150602021020) do
+ActiveRecord::Schema.define(:version => 20150602055730) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
From bd6a0570087ffff4a57c7390a204181d33a43efd Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 14:35:17 +0800
Subject: [PATCH 085/187] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=B8=83=E7=BD=AE?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A0=E5=85=A5=E4=B8=AA=E4=BA=BA=E5=8A=A8?=
=?UTF-8?q?=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 8 ++--
app/models/homework_common.rb | 5 ++-
app/views/users/show.html.erb | 58 +++++++++--------------------
3 files changed, 25 insertions(+), 46 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index ace4ae903..0382e7be0 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -462,14 +462,14 @@ class UsersController < ApplicationController
ids = []
ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id}
- #Bid
- act_ids = activity.where(act_type: 'Bid').select('act_id').map{|x| x.act_id}
- course_ids = HomeworkForCourse.where(bid_id: act_ids).select('distinct course_id').map{|x| x.course_id}
+ #HomeworkCommon
+ act_ids = activity.where(act_type: 'HomeworkCommon').select('act_id').map{|x| x.act_id}
+ course_ids = HomeworkCommon.where(id: act_ids).select('distinct course_id').map{|x| x.course_id}
c_ids = []
Course.where(id: course_ids).each do |x|
c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x)
end
- ids << HomeworkForCourse.where(bid_id: act_ids, course_id: c_ids).map{|x| x.id}
+ ids << HomeworkCommon.where(id: act_ids, course_id: c_ids).map{|x| x.id}
#Journal
act_ids = activity.where(act_type: 'Journal').select('act_id').map{|x| x.act_id}
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index 925ebb106..ac10b2516 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -14,7 +14,10 @@ class HomeworkCommon < ActiveRecord::Base
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
acts_as_attachable
-
+ acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
+ :description => :description,
+ :author => :author,
+ :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
after_create :act_as_activity
after_destroy :delete_kindeditor_assets
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 6083b547c..40122fba7 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -45,7 +45,7 @@
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %>
<% act = e.act %>
<% unless act.nil? %>
- <% if e.act_type == 'JournalsForMessage' || e.act_type == 'Bid' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %>
+ <% if e.act_type == 'JournalsForMessage' || e.act_type == 'HomeworkCommon' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %>
@@ -119,52 +119,28 @@
- <% when 'Bid' %>
+ <% when 'HomeworkCommon' %>
- <% if act.reward_type == 3 && @show_course == 1 %>
- <% if e.user == User.current %>
-
-
- <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
-
+ <% if e.user == User.current %>
+
+
+ <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
+
<%= l(:label_i_new_activity) %>
- <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %>
-
- <% else %>
-
-
- <%= link_to(h(e.user), user_path(e.user_id)) %>
-
+ <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %>
+
+ <% else %>
+
+
+ <%= link_to(h(e.user), user_path(e.user_id)) %>
+
<%= l(:label_new_activity) %>
- <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %>
-
- <% end %>
- <% else %>
- <% if e.user == User.current %>
-
-
- <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
-
-
- <%= l(:label_i_new_activity) %>
-
- <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
-
- <% else %>
-
-
- <%= link_to(h(e.user), user_path(e.user_id)) %>
-
-
- <%= l(:label_new_activity) %>
-
- <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
-
- <% end %>
+ <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %>
+
<% end %>
@@ -177,7 +153,7 @@
- <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %>
+ <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_at)).to_s %>
From 3dce6ec763c88cf4a634d4a1a21f5c560800be53 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 14:59:58 +0800
Subject: [PATCH 086/187] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=EF=BC=9A=E6=9A=82=E6=97=B6=E4=B8=8D=E7=8E=B0=E5=AE=9E=E8=80=81?=
=?UTF-8?q?=E5=B8=88=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index be69b1777..d88815311 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -712,8 +712,8 @@ class CoursesController < ApplicationController
"show_course_news" => true,
"show_course_messages" => true,
#"show_course_journals_for_messages" => true,
- "show_bids" => true,
- "show_homeworks" => true,
+ # "show_bids" => true,
+ # "show_homeworks" => true,
"show_polls" => true
}
@date_to ||= Date.today + 1
From 9f552365c2a68e6dbb6131619bae896460b24fbb Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 15:07:22 +0800
Subject: [PATCH 087/187] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E6=95=B0=E8=AE=A1=E7=AE=97=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/courses_helper.rb | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index d0de1690a..13012a70c 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -570,11 +570,6 @@ module CoursesHelper
end
end
- #message_count
- #Board.where(course_id: @course_ids).each do |board|
- # activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
- #end
-
#message_count
Board.where(course_id: @course_ids).each do |board|
countmessage = 0
@@ -594,24 +589,15 @@ module CoursesHelper
end
end
- #feedback_count 留言目前有问题留待下一步处理
- #JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
- # activities[jourformess.jour_id]+=1
- #end
-
#homework_count
- HomeworkForCourse.where(course_id: @course_ids).each do |homework|
- countbid=0
- # @bid_ids<?",date_from).each do |bid|
- countbid+=1
- end
- activities[homework.course_id]+=countbid
- end
-
- #@bid_ids.each do |bid_id|
- # activities[] +=Bid.where(id: bid_id ).where("created_on>?",date_from).count
- #end
+ # HomeworkForCourse.where(course_id: @course_ids).each do |homework|
+ # countbid=0
+ # # @bid_ids<?",date_from).each do |bid|
+ # countbid+=1
+ # end
+ # activities[homework.course_id]+=countbid
+ # end
#poll_count
# 动态目前只统计发布的问卷,关闭的问卷不在动态内显示
From b935f50b36ac01595bdff84ee371822403ff4bc6 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 15:20:44 +0800
Subject: [PATCH 088/187] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=86=85=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8=E3=80=81=E6=96=B0=E5=BB=BA=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E7=AD=89=E8=B7=AF=E7=94=B1=E5=85=B3=E9=97=AD=EF=BC=8C?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2=E3=80=81=E6=96=B9=E6=B3=95?=
=?UTF-8?q?=E5=88=A0=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 26 --------
app/views/courses/homework.html.erb | 65 -------------------
app/views/courses/new_homework.html.erb | 4 --
config/routes.rb | 85 +------------------------
4 files changed, 1 insertion(+), 179 deletions(-)
delete mode 100644 app/views/courses/homework.html.erb
delete mode 100644 app/views/courses/new_homework.html.erb
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index d88815311..e2728f0c5 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -612,32 +612,6 @@ class CoursesController < ApplicationController
end
end
- def homework
- if @course.is_public != 0 || User.current.member_of_course?(@course) || User.current.admin?
- bids = @course.homeworks.order('created_on DESC')
- bids = bids.like(params[:name]) if params[:name].present?
- @bids = paginateHelper bids,10
- @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
- @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
- render :layout => 'base_courses'
- else
- render_403
- end
- end
-
- # 新建作业
- def new_homework
- @homework = Bid.new
- @homework.safe_attributes = params[:bid]
- @homework.open_anonymous_evaluation = 1
- @homework.deadline = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
- render :layout => 'base_courses'
- else
- render_403
- end
- end
-
def toggleCourse
@course_prefs = Course.find_by_extra(@course.extra)
unless (@course_prefs.teacher == User.current || User.current.admin?)
diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb
deleted file mode 100644
index 32728adf0..000000000
--- a/app/views/courses/homework.html.erb
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
- <%= l(:label_homework)%>
-
-
-
-
- <%= l(:label_totle)%><%= @obj_count%> <%= l(:label_homework_count)%>
-
- <%= link_to( l(:label_course_homework_new), new_homework_course_path(@course), :class => 'problem_new_btn fl c_dorange') if @is_teacher %>
-
-
-<% @bids.each do |bid|%>
-
- <%= link_to(image_tag(url_to_avatar(bid.author), :width => "42", :height => "42"), user_path(bid.author), :class => "problem_pic fl") %>
-
- <%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author),:class => 'problem_name fl') %>
-
<%= l(:label_user_create_project_homework) %>:
- <%= link_to(bid.name, course_for_bid_path(bid), :class => 'problem_tit fl fb c_dblue') %>
-
-
<%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )
- <% if @is_teacher%>
- <%= bid_anonymous_comment(bid)%>
- <% if bid.homeworks.empty? %>
- <%= link_to(l(:button_delete),bids_homework_path(:id => bid.id), :method => :delete, :confirm => l(:label_delete_confirm), :class => "fr mr10 work_edit") %>
- <% end %>
- <%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %>
- <% elsif @is_student%>
- <%= student_anonymous_comment bid %>
- <%= student_new_homework bid %>
- <% end %>
-
-
-
-
- <%= bid.description.html_safe %>
-
-
-
-
<%= l(:label_end_time)%>:<%= bid.deadline%>
- <% if betweentime(bid.deadline) < 0 %>
-
- <%= l(:label_commit_limit)%>
-
- <% else %>
-
-
-
- <% end %>
-
-
-
-<% end%>
-
-
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
-
-
diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb
deleted file mode 100644
index 9ec73d519..000000000
--- a/app/views/courses/new_homework.html.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
-<%= labelled_form_for @homework, :html => { :multipart => true }, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
- <%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid",:f => f,:edit_mode => false } %>
-<% end %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 8aab06ccc..bd4464458 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,9 +26,6 @@
# Example: :via => :get ====> :via => :get
RedmineApp::Application.routes.draw do
-
- #match '/discuss_demos/new',:to => 'discuss_demo#create',:via =>[:post]
- #match '/discuss_demo/show',:to => 'discuss_demo#show'
mount Mobile::API => '/api'
resources :homework_users
@@ -146,13 +143,6 @@ RedmineApp::Application.routes.draw do
end
end
- #resources :notificationcomments do
- #
- #end
-
- #resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy]
- # match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post
- # match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete
## new added by linchun #新竞赛相关
resources :contests, only: [:index] do
resources :contestnotifications do
@@ -195,13 +185,6 @@ RedmineApp::Application.routes.draw do
match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put]
match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put]
- #resource :previews, only: [] do
- # collection do
- # match 'news', :via => [:get, :post, :put]
- # match 'issue', :via => [:get, :post, :put]
- # end
- #end
-
resources :stores do
collection do
match 'search', :via => [:get, :post]
@@ -274,7 +257,7 @@ RedmineApp::Application.routes.draw do
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
# boards end
- delete 'bids/homework', :to => 'bids#homework_destroy'
+ # delete 'bids/homework', :to => 'bids#homework_destroy'
# Misc issue routes. TODO: move into resources
match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
@@ -306,7 +289,6 @@ RedmineApp::Application.routes.draw do
match 'user_projects', :to => 'users#user_projects', :via => :get
match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities"
match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback"
- # match 'watch_calls', :to => 'users#watch_bids', :via => [:get , :post]
match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info'
match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang
match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang
@@ -340,7 +322,6 @@ RedmineApp::Application.routes.draw do
end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
- #match 'user/:id/watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
#end
match 'my/account', :via => [:get, :post]
@@ -395,9 +376,6 @@ RedmineApp::Application.routes.draw do
get 'invite_members_by_mail', :action=> 'invite_members_by_mail'
get 'send_mail_to_member', :action => 'send_mail_to_member'
match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #add by huang
- get 'homework', :action => 'homework', :as => 'homework'
- get 'new_homework', :action => 'new_homework', :as => 'new_homework'
- #get 'news', :action => 'news', :as => 'news'
#end
post 'modules'
post 'archive'
@@ -415,19 +393,7 @@ RedmineApp::Application.routes.draw do
match '/member', :to => 'projects#member', :as => 'member', :via => :get
match '/file', :to => 'projects#file', :as => 'file', :via => :get
match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get
- # match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
- match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get
-
- # match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get
- # match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get
- # match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get
- # get 'projects/:project_id/show', :to => 'projects#show', :as => 'project_show'
- # get 'projects/:project_id/repository', :to => 'repositories#show', :as => 'project_repository'
-
- # match '/show', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get
match '/watcherlist', :to=>'projects#watcherlist', :as => 'watcherlist', :via => :get #add by huang
- # matche '/news', :controller => 'news', :action => 'index', :as => 'news', :via => :get
- #end
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
collection do
@@ -698,8 +664,6 @@ RedmineApp::Application.routes.draw do
member do
get 'settings(/:tab)', :action => 'settings', :as => 'settings'
get 'search_member', :action => 'search_member'
- get 'homework', :action => 'homework', :as => 'homework'
- get 'new_homework', :action => 'new_homework', :as => 'new_homework'
get 'file', :action => 'file', :as => 'file'
get 'feedback', :action => 'feedback', :as => 'course_feedback'
get 'member', :controller => 'courses', :action => 'member', :as => 'member'
@@ -771,7 +735,6 @@ RedmineApp::Application.routes.draw do
match 'delete_avatar', :to => 'avatar#delete_image',:via => :post
# Endof Tao's code
get 'robots.txt', :to => 'welcome#robots'
- #match 'welcome/course', :to => 'welcome#course'
##############测试留言功能 fq
post 'words/new', :to => 'words#new'
post 'words/create', :to => 'words#create'
@@ -782,66 +745,21 @@ RedmineApp::Application.routes.draw do
get 'words/more', :to => 'words#more'
get 'words/back', :to=> 'words#back'
get 'words/destroyJournal', :to => 'words#destroyJournal'
- ############## fq
- # post 'calls/create', :to => 'bids#create'
- # delete 'calls/destroy', :to => 'bids#destroy'
- # match 'calls/new', :to => 'bids#new', :via => [:get , :post]
- # get 'calls/more', :to => 'bids#more'
- # get 'calls/back', :to=> 'bids#back'
- # match 'calls/new_bid', :to => 'bids#new_bid'
- # match 'contest/new_contest', :to => 'bids#new_contest' #huang
- # match 'calls/:id/show_project', :to => 'bids#show_project', :as => 'project_for_bid'
- # match 'calls/:id/show_course', :to => 'bids#show_courseEx', :as => 'course_for_bid' # nwb added
- # match 'calls/:id/new_exercise_book', :to => 'homework_attach#new', :as => 'new_exercise_book'
- # match 'calls/:id/add', :to => 'bids#add'
- # match 'calls/:id/delete', :to => 'bids#delete'
- # match 'calls/:id/add_homework', :to => 'bids#add_homework', :via => :post
- # match 'calls/:id/new_submit_homework', :to => 'bids#new_submit_homework', :via => :get, :as => 'new_submit_homework'
match 'words/add_project_respond', :to => 'words#add_project_respond'
match 'words/:id/leave_project_message', :to => 'words#leave_project_message'
-
match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback'
- # match 'calls/create_bid', :to => 'bids#create_bid'
- # match 'contest/create_contest', :to => 'bids#create_contest' #huang
- # match 'calls/create_homework', :to => 'bids#create_homework'
- # match 'calls/:id/homework_respond', :to => 'bids#homework_respond'
- # match 'calls/:id/homework_statistics', :to => 'bids#homework_statistics'
- # match 'calls/:id/fork', :to => 'bids#fork', :as => 'fork'
- # match 'calls/:id/create_fork', :to => 'bids#create_fork'
- #
- # match 'calls/:id/show_course', :to => 'bids#show_course', :as => 'show_course'
- # match 'calls/:id/show_bid_project', :to => 'bids#show_bid_project', :as => 'show_bid_project'
- # match 'calls/:id/show_bid_user', :to => 'bids#show_bid_user', :as => 'show_bid_user'
-
match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share
post 'join_in/join', :to => 'courses#join', :as => 'join'
delete 'join_in/join', :to => 'courses#unjoin'
post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
delete 'join_in/join_group', :to => 'courses#unjoin_group'
- # post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest'
- # delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest'
- # match 'calls/:id/show_participator', :to => 'bids#show_participator' # bai
- # match 'calls/:id/update_contest', :to => 'bids#update_contest' # bai
- # match 'calls/:id/settings', :to => 'bids#settings' # bai
delete 'attachment/:id', :to => 'attachments#delete_homework'
match 'new_join', :to => 'courses#new_join', :as => 'try_join'
match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group'
# match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest'
match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
- # match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post]
-
-
- #added by william
- # match 'calls/:id/set_results',:controller => 'bids', :action => 'set_results',:via => [:get,:post],:as => 'set_results'
- # match 'calls/:id/set_prizes',:controller => 'bids',:action => 'set_prizes',:as => 'set_prizes'
- # match 'calls/:id/set_reward',:to => 'bids#set_reward',:as => 'set_reward'
-
- # added by young
- # match 'calls', :to => 'bids#index'
- #
- # match 'calls/:id', :to => 'bids#show', :as => 'respond'
########################
##added by wen##########
@@ -849,7 +767,6 @@ RedmineApp::Application.routes.draw do
get 'welcome/search', to: 'welcome#search'
get 'school/index', to: 'school#index'
get 'school/:school_id', to: 'welcome#course', :as => 'school_course_list'
- #get 'course/:school_id', to: 'welcome#course'
post 'school/get_options/:province', :to => 'school#get_options'
get 'school/get_options/:province', :to => 'school#get_options'
From be3680d4f33a1be96bac81bdf0e3a32f680f1cd9 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Tue, 2 Jun 2015 15:43:03 +0800
Subject: [PATCH 089/187] =?UTF-8?q?=E6=94=AF=E6=8C=81doc=20docx=20pdf?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index b2364165b..68d83f974 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -69,12 +69,14 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
- req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx', :txtDes => File.new(@attachment.diskfile, 'rb')
- render :text => req.body
-
- # send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
- # :type => detect_content_type(@attachment),
- # :disposition => 'attachment' #inline can open in browser
+ if %w[doc docx pdf].any?{|word| @attachment.diskfile.downcase.end_with? word}
+ req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx', :txtDes => File.new(@attachment.diskfile, 'rb')
+ render :text => req.body
+ else
+ send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
+ :type => detect_content_type(@attachment),
+ :disposition => 'attachment' #inline can open in browser
+ end
end
else
From e6af34e9f8be3a9269d889f05b7fccf6f72b6bab Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 16:22:15 +0800
Subject: [PATCH 090/187] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 63 ++++++++--------------
app/models/member.rb | 9 ++--
app/views/courses/show_member_score.js.erb | 2 +-
public/stylesheets/public.css | 1 +
4 files changed, 29 insertions(+), 46 deletions(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index e2728f0c5..333ad77b1 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -298,7 +298,6 @@ class CoursesController < ApplicationController
else
page_from = params[:page].nil? ? 0 : (params[:page].to_i - 1)
@results = student_homework_score(0,page_from, 10,"desc")
- @results = paginateHelper_for_members @results, 10
end
end
@@ -317,14 +316,11 @@ class CoursesController < ApplicationController
when '1'
@subPage_title = l :label_teacher_list
@all_members = searchTeacherAndAssistant(@course)
- #@members = paginateHelper @all_members, 10
@members = @all_members
when '2'
@subPage_title = l :label_student_list
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@all_members = student_homework_score(0,page, 10,"desc")
- # @all_members = @course.members
- # @members = paginateHelper_for_members @all_members, 10
@members = @all_members
end
respond_to do |format|
@@ -379,11 +375,9 @@ class CoursesController < ApplicationController
if group_id == '0'
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@results = student_homework_score(0,page, 10,@score_sort_by)
- @results = paginateHelper_for_members @results, 10
else
@group = CourseGroup.find(group_id)
@results = student_homework_score(group_id, 0, 0,@score_sort_by)
- @results = paginateHelper @results, 10
end
end
end
@@ -837,44 +831,32 @@ class CoursesController < ApplicationController
end
def student_homework_score(groupid,start_from, nums, score_sort_by)
- #teachers = find_course_teachers(@course)
start_from = start_from * nums
sql_select = ""
if groupid == 0
- if nums == 0
- sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
- WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
- AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
- UNION all
- SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
- students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
- members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
- )
- GROUP BY members.user_id ORDER BY score #{score_sort_by}"
- else
- sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
- WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
- AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
- UNION all
- SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
- students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
- members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
- )
- GROUP BY members.user_id ORDER BY score #{score_sort_by} " #limit #{start_from}, #{nums}"
-
- end
+ sql_select = "SELECT members.*,(
+ SELECT SUM(student_works.final_score)
+ FROM student_works,homework_commons
+ WHERE student_works.homework_common_id = homework_commons.id
+ AND homework_commons.course_id = #{@course.id}
+ AND student_works.user_id = members.user_id
+ ) AS score
+ FROM members
+ JOIN students_for_courses
+ ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
+ WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
else
- sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
- WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
- and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id})
- GROUP BY members.user_id
- UNION all
- SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id}
- and members.course_group_id = #{groupid} AND
- students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
- members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
- )
- GROUP BY members.user_id ORDER BY score #{score_sort_by}"
+ sql_select = "SELECT members.*,(
+ SELECT SUM(student_works.final_score)
+ FROM student_works,homework_commons
+ WHERE student_works.homework_common_id = homework_commons.id
+ AND homework_commons.course_id = #{@course.id}
+ AND student_works.user_id = members.user_id
+ ) AS score
+ FROM members
+ JOIN students_for_courses
+ ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
+ WHERE members.course_id = #{@course.id} AND members.course_group_id = #{groupid} ORDER BY score #{score_sort_by}"
end
sql = ActiveRecord::Base.connection()
homework_scores = Member.find_by_sql(sql_select)
@@ -896,7 +878,6 @@ class CoursesController < ApplicationController
@score_sort_by = "desc"
page_from = params[:page].nil? ? 0 : (params[:page].to_i - 1)
@results = student_homework_score(group.id,0,0, "desc")
- @results = paginateHelper @results, 10
end
diff --git a/app/models/member.rb b/app/models/member.rb
index f1a139f74..2936392ab 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -117,10 +117,11 @@ class Member < ActiveRecord::Base
# 查找每个学生每个作业的评分
def student_homework_score
score_count = 0
- homework_score = HomeworkAttach.find_by_sql("SELECT bids.name, homework_attaches.score as score
- FROM homework_attaches, bids where homework_attaches.user_id = #{self.user_id}
- and homework_attaches.bid_id IN (SELECT bid_id FROM homework_for_courses where course_id = #{self.course_id})
- AND homework_attaches.bid_id = bids.id ")
+ homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score 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}")
homework_score.each do |homework|
mem_score = 0
if homework[:score]
diff --git a/app/views/courses/show_member_score.js.erb b/app/views/courses/show_member_score.js.erb
index 87e728901..083f070c2 100644
--- a/app/views/courses/show_member_score.js.erb
+++ b/app/views/courses/show_member_score.js.erb
@@ -7,7 +7,7 @@ showModal('ajax-modal', '400px');
//$('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("" +
-" ");
+" ");
//$('#ajax-modal').parent().removeClass();
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed");
$('#ajax-modal').parent().addClass("new-watcher");
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 44ca87526..d6e6907fa 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -6,6 +6,7 @@ table,tr,td{border:0;cellspacing:0; cellpadding:0;}
ol,ul,li{ list-style-type:none}
a:link,a:visited{color:#7f7f7f;text-decoration:none;}
a:hover,a:active{color:#000;}
+a:hover {text-decoration: none; }
textarea {resize: none;}
/*常用*/
From 9f03e39e86e96f436cbef59ceb7fba46e21ba895 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 16:45:44 +0800
Subject: [PATCH 091/187] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=8F=E8=BF=B0?=
=?UTF-8?q?=E5=A4=A7=E4=BA=8E20=E8=A1=8C=E6=89=8D=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E6=9B=B4=E5=A4=9A=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/homework_common/index.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index 015df90c5..a74a4d752 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -34,7 +34,7 @@
<% end %>
From ad296e43b2bea989ba26a6b42ee4174cffa5b51d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 16:56:15 +0800
Subject: [PATCH 092/187] =?UTF-8?q?=E6=9C=AA=E5=90=AF=E7=94=A8=E5=8C=BF?=
=?UTF-8?q?=E8=AF=84=E7=9A=84=E4=BD=9C=E4=B8=9A=EF=BC=8C=E5=AD=A6=E7=94=9F?=
=?UTF-8?q?=E5=9C=A8=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=E4=B9=8B=E5=89=8D?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E7=9C=8B=E5=88=B0=E5=85=B6=E4=BB=96=E5=AD=A6?=
=?UTF-8?q?=E7=94=9F=E7=9A=84=E4=BD=9C=E5=93=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 7543bc770..0568ed077 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -13,7 +13,16 @@ class StudentWorkController < ApplicationController
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
if @show_all
- @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
+ if @homework.homework_type == 1 || @is_teacher || User.current.admin?
+ @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
+ else
+ my_work = @homework.student_works.where(:user_id => User.current.id)
+ if my_work.empty?
+ @stundet_works = []
+ else
+ @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
+ end
+ end
else #学生
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
@stundet_works = @homework.student_works.where(:user_id => User.current.id)
From faeee5bc0d79e5855c011eb26bd1a3b60819b508 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 17:17:34 +0800
Subject: [PATCH 093/187] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=90=9C=E7=B4=A2?=
=?UTF-8?q?=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/_course.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb
index 420a22f8a..f2972df44 100644
--- a/app/views/courses/_course.html.erb
+++ b/app/views/courses/_course.html.erb
@@ -46,8 +46,8 @@
-<% end %>
From 57f8c7d04f6d24c29c79dfd314e5a6062db7368c Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 10:54:40 +0800
Subject: [PATCH 107/187] added timeout
---
lib/tasks/office.rake | 28 +++++++++++--------------
lib/trustie/utils/office.rb | 42 +++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 16 deletions(-)
create mode 100644 lib/trustie/utils/office.rb
diff --git a/lib/tasks/office.rake b/lib/tasks/office.rake
index 770379b1a..3e4c0a286 100644
--- a/lib/tasks/office.rake
+++ b/lib/tasks/office.rake
@@ -1,23 +1,19 @@
namespace :office do
desc "conver any files to html"
task :conver => :environment do
+ all_count = Attachment.count
+ i = 0
Attachment.find_each do |a|
- convered_file = File.join(Rails.root, "files", "convered_office", a.disk_filename + ".html")
- unless File.exist?(convered_file)
- if File.exist? a.diskfile
- if %w(doc docx ppt pptx xls xlsx pdf).any?{|word| a.diskfile.downcase.end_with?(word)}
- begin
- req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx', :txtDes => File.new(a.diskfile, 'rb')
- File.new(convered_file, "ab+") do |f|
- f.write(req.body)
- end
- rescue =>e
- puts e.message
- end
- end
- else
- puts "can't find file #{a.diskfile}"
- end
+ i += 1
+ puts "process [#{i}/#{all_count}] => id #{a.id}"
+ saved_path = File.join(Rails.root, "files", "convered_office")
+ unless Dir.exist?(saved_path)
+ Dir.mkdir(saved_path)
+ end
+ convered_file = File.join(saved_path, a.disk_filename + ".html")
+ office = Trustie::Utils::Office.new(a.diskfile)
+ if office.conver(convered_file)
+ puts "process ok: #{convered_file} "
end
end
end
diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb
new file mode 100644
index 000000000..3d58bb047
--- /dev/null
+++ b/lib/trustie/utils/office.rb
@@ -0,0 +1,42 @@
+module Trustie
+ module Utils
+ class Office
+
+ def initialize(file)
+ @file = file
+ end
+
+ def office?
+ %w(doc docx ppt pptx xls xlsx pdf).any?{|word| @file.downcase.end_with?(word)}
+ end
+
+ def conver(saved_file, force=false)
+ if force || !File.exist?(saved_file)
+ if File.exist? @file
+ if office?
+ begin
+ resource = RestClient::Resource.new(
+ 'http://192.168.80.107/Any2HtmlHandler.ashx',
+ :timeout => -1,
+ :open_timeout => -1
+ )
+ req = resource.post :txtDes => File.new(@file, 'rb')
+ File.new(saved_file, "ab+") do |f|
+ f.write(req.body)
+ end
+ return true
+ rescue =>e
+ puts e.message
+ end
+ end
+ else
+ puts "can't find file #{@file}"
+ end
+ end
+ false
+ end
+
+ end
+ end
+end
+
From b2cdcf4bbeca362e1a7fe140774c4d95516f4e49 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 3 Jun 2015 10:57:51 +0800
Subject: [PATCH 108/187] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A6=96=E9=A1=B5?=
=?UTF-8?q?=E7=BC=93=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/welcome/course.html.erb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 16c191d5e..143c32dbe 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -173,9 +173,7 @@
<%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
<% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%>
<% end%>
- <% cache all_new_hot_course.max().created_at do %>
- <%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
- <% end %>
+ <%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% end %>
From 87e7db1a4b3f349e61d5fe42652bd870251976cb Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 11:14:33 +0800
Subject: [PATCH 109/187] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=99=84=E4=BB=B6?=
=?UTF-8?q?=E6=97=B6=E8=BD=AC=E6=8D=A2office=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/attachment.rb | 11 ++++++++++-
app/tasks/office_conver_task.rb | 12 ++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 app/tasks/office_conver_task.rb
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 7ac7d786d..1e477ed04 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -72,7 +72,7 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
- after_create :be_user_score ,:act_as_forge_activity# user_score
+ after_create :office_conver, :be_user_score ,:act_as_forge_activity# user_score
after_update :be_user_score
after_destroy :delete_from_disk,:down_user_score
@@ -258,6 +258,15 @@ class Attachment < ActiveRecord::Base
filename
end
+ def office_conver
+ saved_path = File.join(Rails.root, "files", "convered_office")
+ unless Dir.exist?(saved_path)
+ Dir.mkdir(saved_path)
+ end
+ convered_file = File.join(saved_path, self.disk_filename + ".html")
+ OfficeConverTask.new.conver(self.diskfile, convered_file)
+ end
+
# Copies the temporary file to its final location
# and computes its MD5 hash
def files_to_final_location
diff --git a/app/tasks/office_conver_task.rb b/app/tasks/office_conver_task.rb
new file mode 100644
index 000000000..da950bf2e
--- /dev/null
+++ b/app/tasks/office_conver_task.rb
@@ -0,0 +1,12 @@
+#coding=utf-8
+#
+class OfficeConverTask
+ def conver(source_file, saved_file)
+ office = Trustie::Utils::Office.new(source_file)
+ if office.conver(saved_file)
+ Rails.logger.info "process ok: #{saved_file} "
+ end
+ end
+ handle_asynchronously :conver,:queue => 'office_conver'
+end
+
From 00745f127009f9adfa8b4bdc4822395a09b00bcf Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 11:40:00 +0800
Subject: [PATCH 110/187] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E9=A2=84=E8=A7=88bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 2 +-
lib/trustie/utils/office.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 662a85fe1..c8b6a6fda 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -71,7 +71,7 @@ class AttachmentsController < ApplicationController
if stale?(:etag => @attachment.digest)
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".html")
if File.exist?(convered_file)
- render :text => File.open(convered_file).read
+ send_file convered_file, :type => 'text/html; charset=utf-8', :disposition => 'inline'
else
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb
index 3d58bb047..1bc18cb84 100644
--- a/lib/trustie/utils/office.rb
+++ b/lib/trustie/utils/office.rb
@@ -21,7 +21,7 @@ module Trustie
:open_timeout => -1
)
req = resource.post :txtDes => File.new(@file, 'rb')
- File.new(saved_file, "ab+") do |f|
+ File.open(saved_file, "wb+") do |f|
f.write(req.body)
end
return true
From 437287d93b4277e6b44646bf929dd04c88c2a788 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 12:14:39 +0800
Subject: [PATCH 111/187] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E8=A7=86=E9=A2=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/assets/kindeditor/kindeditor.js | 2 +-
.../assets/kindeditor/plugins/media/media.js | 23 +--
.../kindeditor/plugins/media/media.old.js | 170 ++++++++++++++++++
3 files changed, 176 insertions(+), 19 deletions(-)
create mode 100644 public/assets/kindeditor/plugins/media/media.old.js
diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js
index fbec91afb..d97f1cd2e 100644
--- a/public/assets/kindeditor/kindeditor.js
+++ b/public/assets/kindeditor/kindeditor.js
@@ -260,7 +260,7 @@ K.options = {
items : [ 'emoticons',
'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|',
'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
- 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'link',"more"
+ 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media',"more"
],
noDisableItems : ['source', 'fullscreen'],
colorTable : [
diff --git a/public/assets/kindeditor/plugins/media/media.js b/public/assets/kindeditor/plugins/media/media.js
index 58034662a..6d0d3a387 100644
--- a/public/assets/kindeditor/plugins/media/media.js
+++ b/public/assets/kindeditor/plugins/media/media.js
@@ -9,9 +9,9 @@
KindEditor.plugin('media', function(K) {
var self = this, name = 'media', lang = self.lang(name + '.'),
- allowMediaUpload = K.undef(self.allowMediaUpload, true),
+ allowMediaUpload = K.undef(self.allowMediaUpload, false),
allowFileManager = K.undef(self.allowFileManager, false),
- formatUploadUrl = K.undef(self.formatUploadUrl, true),
+ formatUploadUrl = K.undef(self.formatUploadUrl, false),
extraParams = K.undef(self.extraFileUploadParams, {}),
filePostName = K.undef(self.filePostName, 'imgFile'),
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
@@ -22,10 +22,8 @@ KindEditor.plugin('media', function(K) {
//url
'',
//width
@@ -38,11 +36,6 @@ KindEditor.plugin('media', function(K) {
'' + lang.height + ' ',
' ',
' ',
- //autostart
- '
',
- '' + lang.autostart + ' ',
- ' ',
- '
',
'
'
].join('');
var dialog = self.createDialog({
@@ -72,14 +65,8 @@ KindEditor.plugin('media', function(K) {
heightBox[0].focus();
return;
}
- var html = K.mediaImg(self.themesPath + 'common/blank.gif', {
- src : url,
- type : K.mediaType(url),
- width : width,
- height : height,
- autostart : autostartBox[0].checked ? 'true' : 'false',
- loop : 'true'
- });
+
+ var html = '
';
self.insertHtml(html).hideDialog().focus();
}
}
diff --git a/public/assets/kindeditor/plugins/media/media.old.js b/public/assets/kindeditor/plugins/media/media.old.js
new file mode 100644
index 000000000..58034662a
--- /dev/null
+++ b/public/assets/kindeditor/plugins/media/media.old.js
@@ -0,0 +1,170 @@
+/*******************************************************************************
+* KindEditor - WYSIWYG HTML Editor for Internet
+* Copyright (C) 2006-2011 kindsoft.net
+*
+* @author Roddy
+* @site http://www.kindsoft.net/
+* @licence http://www.kindsoft.net/license.php
+*******************************************************************************/
+
+KindEditor.plugin('media', function(K) {
+ var self = this, name = 'media', lang = self.lang(name + '.'),
+ allowMediaUpload = K.undef(self.allowMediaUpload, true),
+ allowFileManager = K.undef(self.allowFileManager, false),
+ formatUploadUrl = K.undef(self.formatUploadUrl, true),
+ extraParams = K.undef(self.extraFileUploadParams, {}),
+ filePostName = K.undef(self.filePostName, 'imgFile'),
+ uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
+ self.plugin.media = {
+ edit : function() {
+ var html = [
+ '',
+ //url
+ '
',
+ '' + lang.url + ' ',
+ ' ',
+ ' ',
+ '',
+ ' ',
+ ' ',
+ '
',
+ //width
+ '
',
+ '' + lang.width + ' ',
+ ' ',
+ '
',
+ //height
+ '
',
+ '' + lang.height + ' ',
+ ' ',
+ '
',
+ //autostart
+ '
',
+ '' + lang.autostart + ' ',
+ ' ',
+ '
',
+ '
'
+ ].join('');
+ var dialog = self.createDialog({
+ name : name,
+ width : 450,
+ height : 230,
+ title : self.lang(name),
+ body : html,
+ yesBtn : {
+ name : self.lang('yes'),
+ click : function(e) {
+ var url = K.trim(urlBox.val()),
+ width = widthBox.val(),
+ height = heightBox.val();
+ if (url == 'http://' || K.invalidUrl(url)) {
+ alert(self.lang('invalidUrl'));
+ urlBox[0].focus();
+ return;
+ }
+ if (!/^\d*$/.test(width)) {
+ alert(self.lang('invalidWidth'));
+ widthBox[0].focus();
+ return;
+ }
+ if (!/^\d*$/.test(height)) {
+ alert(self.lang('invalidHeight'));
+ heightBox[0].focus();
+ return;
+ }
+ var html = K.mediaImg(self.themesPath + 'common/blank.gif', {
+ src : url,
+ type : K.mediaType(url),
+ width : width,
+ height : height,
+ autostart : autostartBox[0].checked ? 'true' : 'false',
+ loop : 'true'
+ });
+ self.insertHtml(html).hideDialog().focus();
+ }
+ }
+ }),
+ div = dialog.div,
+ urlBox = K('[name="url"]', div),
+ viewServerBtn = K('[name="viewServer"]', div),
+ widthBox = K('[name="width"]', div),
+ heightBox = K('[name="height"]', div),
+ autostartBox = K('[name="autostart"]', div);
+ urlBox.val('http://');
+
+ if (allowMediaUpload) {
+ var uploadbutton = K.uploadbutton({
+ button : K('.ke-upload-button', div)[0],
+ fieldName : filePostName,
+ extraParams : extraParams,
+ url : K.addParam(uploadJson, 'dir=media'),
+ afterUpload : function(data) {
+ dialog.hideLoading();
+ if (data.error === 0) {
+ var url = data.url;
+ if (formatUploadUrl) {
+ url = K.formatUrl(url, 'absolute');
+ }
+ urlBox.val(url);
+ if (self.afterUpload) {
+ self.afterUpload.call(self, url, data, name);
+ }
+ alert(self.lang('uploadSuccess'));
+ } else {
+ alert(data.message);
+ }
+ },
+ afterError : function(html) {
+ dialog.hideLoading();
+ self.errorDialog(html);
+ }
+ });
+ uploadbutton.fileBox.change(function(e) {
+ dialog.showLoading(self.lang('uploadLoading'));
+ uploadbutton.submit();
+ });
+ } else {
+ K('.ke-upload-button', div).hide();
+ }
+
+ if (allowFileManager) {
+ viewServerBtn.click(function(e) {
+ self.loadPlugin('filemanager', function() {
+ self.plugin.filemanagerDialog({
+ viewType : 'LIST',
+ dirName : 'media',
+ clickFn : function(url, title) {
+ if (self.dialogs.length > 1) {
+ K('[name="url"]', div).val(url);
+ if (self.afterSelectFile) {
+ self.afterSelectFile.call(self, url);
+ }
+ self.hideDialog();
+ }
+ }
+ });
+ });
+ });
+ } else {
+ viewServerBtn.hide();
+ }
+
+ var img = self.plugin.getSelectedMedia();
+ if (img) {
+ var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
+ urlBox.val(attrs.src);
+ widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
+ heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
+ autostartBox[0].checked = (attrs.autostart === 'true');
+ }
+ urlBox[0].focus();
+ urlBox[0].select();
+ },
+ 'delete' : function() {
+ self.plugin.getSelectedMedia().remove();
+ // [IE] 删除图片后立即点击图片按钮出错
+ self.addBookmark();
+ }
+ };
+ self.clickToolbar(name, self.plugin.media.edit);
+});
From 3ef46fd8f5fa0708b0caac12a9986ff0d5c0e190 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 3 Jun 2015 13:54:49 +0800
Subject: [PATCH 112/187] 11
---
public/stylesheets/courses.css | 3 ---
1 file changed, 3 deletions(-)
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 1706098aa..457d6da75 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -502,9 +502,6 @@ blockquote {
}
a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: center;text-decoration: none;padding: 2px;}
.min_search_edit {width: 150px;height: 20px;border: 1px solid #d0d0d0 !important;color: #666;}
-
-a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; color:#64bdd9; }
-a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
.r_txt_tit{max-width:450px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
/*日历选择图*/
From 0354e65497a0f779f08a9cac70c154c594323a9e Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 3 Jun 2015 14:25:22 +0800
Subject: [PATCH 113/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9issues=E9=82=AE?=
=?UTF-8?q?=E4=BB=B6=E9=80=9A=E7=9F=A5=E6=9F=A5=E8=AF=A2=E8=AF=AD=E5=8F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/mailer.rb | 138 +++++++++++++++++++++----------------------
1 file changed, 68 insertions(+), 70 deletions(-)
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 7be526f41..e0726599b 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -45,6 +45,7 @@ class Mailer < ActionMailer::Base
MailerProxy.new(self)
end
+ # author: alan
# 发送邀请未注册用户加入项目邮件
# 功能: 在加入项目的同时自动注册用户
def send_invite_in_project(email, project, invitor)
@@ -88,7 +89,7 @@ class Mailer < ActionMailer::Base
date_from = "#{date_from} 17:59:59"
date_to = "#{date_to} 17:59:59"
-
+
# 生成token用于直接点击登录
@user = user
@token = Token.get_token_from_user(user, 'autologin')
@@ -100,16 +101,14 @@ class Mailer < ActionMailer::Base
course_ids = courses.map {|course| course.id}.join(",")
# 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
- # sql = "select DISTINCT i.* from issues i, watchers w
- # where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
- # or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
- # and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
- sql = "select DISTINCT i.* from issues i where (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
+ sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
+ and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
@issues = Issue.find_by_sql(sql)
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
# @attachments查询课程课件更新
@attachments ||= []
+
@bids ||= [] # 老师发布的作业
unless courses.first.nil?
@@ -118,15 +117,15 @@ class Mailer < ActionMailer::Base
for i in 0..count do
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
- @bids += bids if bids.count > 0
- @attachments += attachments if attachments.count > 0
+ @bids += bids if bids.count > 0
+ @attachments += attachments if attachments.count > 0
end
end
# user 提交的作业
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子
- messages = Message.find_by_sql("select DISTINCT * from messages where (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
+ messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@course_messages ||= []
@project_messages ||= []
unless messages.first.nil?
@@ -141,9 +140,9 @@ class Mailer < ActionMailer::Base
# 查询user在课程中发布的通知,项目中发的新闻
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
where n.course_id in (#{course_ids})
- and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
+ and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
@project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
- and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
+ and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
# 查询user在课程及个人中留言
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where
@@ -160,11 +159,11 @@ class Mailer < ActionMailer::Base
has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news,
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o|
- !o.empty?
- }
+ !o.empty?
+ }
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发
- mail :to => user.mail, :subject => subject if has_content
+ mail :to => user.mail,:subject => subject if has_content
end
# 公共讨论区发帖、回帖添加邮件发送信息
@@ -187,8 +186,8 @@ class Mailer < ActionMailer::Base
:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
:filter => true
end
-
# Builds a Mail::Message object used to email recipients of the added journals for message.
+
# 留言分为直接留言,和对留言人留言的回复
# 字段说明在JournalsForMessage.rb
# 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil
@@ -276,11 +275,11 @@ class Mailer < ActionMailer::Base
@token = Token.get_token_from_user(user, 'autologin')
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value)
- # edit
- @issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
- @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
+ # edit
+ @issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
+ @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
- @user_url = url_for(my_account_url(user,:token => @token.value))
+ @user_url = url_for(my_account_url(user,:token => @token.value))
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
@@ -288,13 +287,13 @@ class Mailer < ActionMailer::Base
:subject => subject,
:filter => true
end
- # issue.attachments.each do |attach|
- # attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
- # end
- # cc = issue.watcher_recipients - recipients
- #mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll")
+ # issue.attachments.each do |attach|
+ # attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
+ # end
+ # cc = issue.watcher_recipients - recipients
+ #mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll")
+
-
# Builds a Mail::Message object used to email recipients of the edited issue.
@@ -323,13 +322,13 @@ class Mailer < ActionMailer::Base
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
@user_url = url_for(my_account_url(user,:token => @token.value))
- @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
+ @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << issue.subject
@issue = issue
@journal = journal
- # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
+ # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
mail :to => recipients,
:subject => s,
:filter => true
@@ -359,10 +358,10 @@ class Mailer < ActionMailer::Base
@issues = issues
@days = days
@issues_url = url_for(:controller => 'issues', :action => 'index',
- :set_filter => 1, :assigned_to_id => user.id,
- :sort => 'due_date:asc')
+ :set_filter => 1, :assigned_to_id => user.id,
+ :sort => 'due_date:asc')
mail :to => user.mail,
- :subject => l(:mail_subject_reminder, :count => issues.size, :days => days)
+ :subject => l(:mail_subject_reminder, :count => issues.size, :days => days)
end
#缺陷到期邮件通知
@@ -493,8 +492,8 @@ class Mailer < ActionMailer::Base
@news = news
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
mail :to => news.recipients,
- :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
- :filter => true
+ :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
+ :filter => true
elsif news.course
redmine_headers 'Course' => news.course.id
@author = news.author
@@ -510,7 +509,7 @@ class Mailer < ActionMailer::Base
end
# Builds a Mail::Message object used to email recipients of a news' project when a news comment is added.
- # 新增新闻评论时邮件通知
+ #
# Example:
# news_comment_added(comment) => Mail::Message object
# Mailer.news_comment_added(comment) => sends an email to the news' project recipients
@@ -597,12 +596,12 @@ class Mailer < ActionMailer::Base
cc = wiki_content.page.wiki.watcher_recipients - recipients
@wiki_content = wiki_content
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
- :project_id => wiki_content.project,
- :id => wiki_content.page.title)
+ :project_id => wiki_content.project,
+ :id => wiki_content.page.title)
mail :to => recipients,
- :cc => cc,
- :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
- :filter => true
+ :cc => cc,
+ :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
+ :filter => true
end
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
@@ -619,15 +618,15 @@ class Mailer < ActionMailer::Base
cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
@wiki_content = wiki_content
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
- :project_id => wiki_content.project,
- :id => wiki_content.page.title)
+ :project_id => wiki_content.project,
+ :id => wiki_content.page.title)
@wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
- :project_id => wiki_content.project, :id => wiki_content.page.title,
- :version => wiki_content.version)
+ :project_id => wiki_content.project, :id => wiki_content.page.title,
+ :version => wiki_content.version)
mail :to => recipients,
- :cc => cc,
- :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
- :filter => true
+ :cc => cc,
+ :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
+ :filter => true
end
# Builds a Mail::Message object used to email the specified user their account information.
@@ -641,7 +640,7 @@ class Mailer < ActionMailer::Base
@password = password
@login_url = url_for(:controller => 'account', :action => 'login')
mail :to => user.mail,
- :subject => l(:mail_subject_register, Setting.app_title)
+ :subject => l(:mail_subject_register, Setting.app_title)
end
# Builds a Mail::Message object used to email all active administrators of an account activation request.
@@ -654,10 +653,10 @@ class Mailer < ActionMailer::Base
recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact
@user = user
@url = url_for(:controller => 'users', :action => 'index',
- :status => User::STATUS_REGISTERED,
- :sort_key => 'created_on', :sort_order => 'desc')
+ :status => User::STATUS_REGISTERED,
+ :sort_key => 'created_on', :sort_order => 'desc')
mail :to => recipients,
- :subject => l(:mail_subject_account_activation_request, Setting.app_title)
+ :subject => l(:mail_subject_account_activation_request, Setting.app_title)
end
# Builds a Mail::Message object used to email the specified user that their account was activated by an administrator.
@@ -670,7 +669,7 @@ class Mailer < ActionMailer::Base
@user = user
@login_url = url_for(:controller => 'account', :action => 'login')
mail :to => user.mail,
- :subject => l(:mail_subject_register, Setting.app_title)
+ :subject => l(:mail_subject_register, Setting.app_title)
end
def lost_password(token)
@@ -678,7 +677,7 @@ class Mailer < ActionMailer::Base
@token = token
@url = url_for(:controller => 'account', :action => 'lost_password', :token => token.value)
mail :to => token.user.mail,
- :subject => l(:mail_subject_lost_password, Setting.app_title)
+ :subject => l(:mail_subject_lost_password, Setting.app_title)
end
def register(token)
@@ -686,14 +685,14 @@ class Mailer < ActionMailer::Base
@token = token
@url = url_for(:controller => 'account', :action => 'activate', :token => token.value)
mail :to => token.user.mail,
- :subject => l(:mail_subject_register, Setting.app_title)
+ :subject => l(:mail_subject_register, Setting.app_title)
end
def test_email(user)
set_language_if_valid(user.language)
@url = url_for(:controller => 'welcome')
mail :to => user.mail,
- :subject => 'forge test'
+ :subject => 'forge test'
end
# Overrides default deliver! method to prevent from sending an email
@@ -701,8 +700,8 @@ class Mailer < ActionMailer::Base
def deliver!(mail = @mail)
set_language_if_valid @initial_language
return false if (recipients.nil? || recipients.empty?) &&
- (cc.nil? || cc.empty?) &&
- (bcc.nil? || bcc.empty?)
+ (cc.nil? || cc.empty?) &&
+ (bcc.nil? || bcc.empty?)
# Log errors when raise_delivery_errors is set to false, Rails does not
@@ -734,8 +733,8 @@ class Mailer < ActionMailer::Base
user_ids = options[:users]
scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" +
- " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
- " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
+ " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
+ " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
)
scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
scope = scope.where(:project_id => project.id) if project
@@ -799,12 +798,12 @@ class Mailer < ActionMailer::Base
def mail(headers={})
headers.merge! 'X-Mailer' => 'Redmine',
- 'X-Redmine-Host' => Setting.host_name,
- 'X-Redmine-Site' => Setting.app_title,
- 'X-Auto-Response-Suppress' => 'OOF',
- 'Auto-Submitted' => 'auto-generated',
- 'From' => Setting.mail_from,
- 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
+ 'X-Redmine-Host' => Setting.host_name,
+ 'X-Redmine-Site' => Setting.app_title,
+ 'X-Auto-Response-Suppress' => 'OOF',
+ 'Auto-Submitted' => 'auto-generated',
+ 'From' => Setting.mail_from,
+ 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
# Removes the author from the recipients and cc
# if he doesn't want to receive notifications about what he does
@@ -850,7 +849,7 @@ class Mailer < ActionMailer::Base
set_language_if_valid Setting.default_language
super
end
-
+
def self.deliver_mail(mail)
return false if mail.to.blank? && mail.cc.blank? && mail.bcc.blank?
Thread.new do
@@ -897,7 +896,7 @@ class Mailer < ActionMailer::Base
end
def mylogger
- if Setting.delayjob_enabled?
+ if Setting.delayjob_enabled?
Delayed::Worker.logger
else
Rails.logger
@@ -908,11 +907,10 @@ class Mailer < ActionMailer::Base
if email.attachments && email.attachments.any?
email.attachments.each do |attachment|
obj.attachments << Attachment.create(:container => obj,
- :file => attachment.decoded,
- :filename => attachment.filename,
- :author => user,
-
- :content_type => attachment.mime_type)
+ :file => attachment.decoded,
+ :filename => attachment.filename,
+ :author => user,
+ :content_type => attachment.mime_type)
end
end
end
From 1c4ca0c9131485f3378007cfa9c2b1a0410e0f57 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 3 Jun 2015 14:33:53 +0800
Subject: [PATCH 114/187] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=BF=9B?=
=?UTF-8?q?=E5=85=A5=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9=E7=9B=AE=E3=80=81?=
=?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E6=96=B0=E6=89=93=E5=BC=80?=
=?UTF-8?q?=E4=B8=80=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_new_header.html.erb | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/views/layouts/_new_header.html.erb b/app/views/layouts/_new_header.html.erb
index e4d2658b1..46a2eff63 100644
--- a/app/views/layouts/_new_header.html.erb
+++ b/app/views/layouts/_new_header.html.erb
@@ -18,15 +18,15 @@
<% if User.current.logged? -%>
- <%= link_to "#{User.current.login} ".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, :class => "uses_name"%>
+ <%= link_to "#{User.current.login} ".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, target:"_blank", :class => "uses_name"%>
<% end %>
+
<% if @issues.first || @project_messages.first %>
<%= l(:label_project_overview_new)%>
@@ -260,11 +261,9 @@
<% end %>
-
-
-
<% end %>
+
<% unless @user_journal_messages.first.nil? %>
<%= l(:label_activities) %>
@@ -293,7 +292,7 @@
<% end %>
-
+
<% end %>
From c331e5a9c8933064f8460de75e6cbec8a5805b42 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 17:42:41 +0800
Subject: [PATCH 120/187] =?UTF-8?q?=E8=BD=AChtml=E6=94=B9=E4=B8=BA?=
=?UTF-8?q?=E8=BD=ACpdf?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 13 ++++++++++---
lib/trustie/utils/office.rb | 9 ++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index c8b6a6fda..9c3b624af 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -62,6 +62,10 @@ class AttachmentsController < ApplicationController
render :action => 'file'
end
+ def pdf?(file)
+ file.downcase.end_with?(".pdf")
+ end
+
def download
# modify by nwb
# 下载添加权限设置
@@ -69,9 +73,12 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
- convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".html")
- if File.exist?(convered_file)
- send_file convered_file, :type => 'text/html; charset=utf-8', :disposition => 'inline'
+ convered_file = @attachment.disk_filename
+ unless pdf?(convered_file)
+ convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
+ end
+ if File.exist?(convered_file) && pdf?(convered_file)
+ send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
else
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb
index 1bc18cb84..adfa3fb5c 100644
--- a/lib/trustie/utils/office.rb
+++ b/lib/trustie/utils/office.rb
@@ -7,7 +7,7 @@ module Trustie
end
def office?
- %w(doc docx ppt pptx xls xlsx pdf).any?{|word| @file.downcase.end_with?(word)}
+ %w(doc docx ppt pptx xls xlsx).any?{|word| @file.downcase.end_with?(word)}
end
def conver(saved_file, force=false)
@@ -21,8 +21,11 @@ module Trustie
:open_timeout => -1
)
req = resource.post :txtDes => File.new(@file, 'rb')
- File.open(saved_file, "wb+") do |f|
- f.write(req.body)
+ File.delete(saved_file) if File.exist?(saved_file)
+ if req.body.length > 10 && !req.body.eql?('转换出错')
+ File.open(saved_file, "wb+") do |f|
+ f.write(req.body)
+ end
end
return true
rescue =>e
From 9ecb119aa46354f9e1de47166d6c79857c83499a Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 17:43:42 +0800
Subject: [PATCH 121/187] =?UTF-8?q?task=E4=B8=AD=E4=B9=9F=E6=94=B9?=
=?UTF-8?q?=E4=B8=BApdf?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/office.rake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tasks/office.rake b/lib/tasks/office.rake
index 3e4c0a286..ce2d3a221 100644
--- a/lib/tasks/office.rake
+++ b/lib/tasks/office.rake
@@ -10,7 +10,7 @@ namespace :office do
unless Dir.exist?(saved_path)
Dir.mkdir(saved_path)
end
- convered_file = File.join(saved_path, a.disk_filename + ".html")
+ convered_file = File.join(saved_path, a.disk_filename + ".pdf")
office = Trustie::Utils::Office.new(a.diskfile)
if office.conver(convered_file)
puts "process ok: #{convered_file} "
From e4d68e988ea2b95b06d5d842f9369b8aaa5200ce Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 17:52:59 +0800
Subject: [PATCH 122/187] =?UTF-8?q?=E5=8A=A0=E4=B8=8Autf8=E5=A4=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 2 +-
lib/tasks/office.rake | 2 ++
lib/trustie/utils/office.rb | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 9c3b624af..d3781d747 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -73,7 +73,7 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
- convered_file = @attachment.disk_filename
+ convered_file = @attachment.diskfile
unless pdf?(convered_file)
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
end
diff --git a/lib/tasks/office.rake b/lib/tasks/office.rake
index ce2d3a221..c6ee8b4dd 100644
--- a/lib/tasks/office.rake
+++ b/lib/tasks/office.rake
@@ -1,3 +1,5 @@
+#coding=utf-8
+
namespace :office do
desc "conver any files to html"
task :conver => :environment do
diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb
index adfa3fb5c..61d6b9d4c 100644
--- a/lib/trustie/utils/office.rb
+++ b/lib/trustie/utils/office.rb
@@ -1,3 +1,5 @@
+#coding=utf-8
+
module Trustie
module Utils
class Office
From e40f1a570e9993b0d3000a03572950b75a414ea7 Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 3 Jun 2015 18:11:52 +0800
Subject: [PATCH 123/187] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=82=AE=E4=BB=B6?=
=?UTF-8?q?=E9=82=80=E8=AF=B7=E6=88=90=E5=91=98=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/projects_controller.rb | 3 ++-
app/models/invite_list.rb | 12 ++++++++++--
app/models/mailer.rb | 1 +
app/models/project.rb | 2 +-
app/views/projects/invite_members_by_mail.html.erb | 7 ++++++-
5 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index fbafd16e9..3c34aa549 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -363,7 +363,8 @@ class ProjectsController < ApplicationController
#发送邮件邀请新用户
def invite_members_by_mail
- if User.current.member_of?(@project) || User.current.admin?
+ if User.current.member_of?(@project) || User.current.admin?
+ @inviter_lists = InviteList.where(project_id:@project.id).all
@is_zhuce = false
respond_to do |format|
format.html
diff --git a/app/models/invite_list.rb b/app/models/invite_list.rb
index f1ba8546f..4868fc3d7 100644
--- a/app/models/invite_list.rb
+++ b/app/models/invite_list.rb
@@ -1,5 +1,13 @@
class InviteList < ActiveRecord::Base
attr_accessible :project_id, :user_id
- # belongs_to :user
- # belongs_to :project
+ belongs_to :user
+ belongs_to :project
+
+ # 用户拒绝邀请后,删除记录
+ def self.delete_inviter(userid, projectid)
+ @inviters = AppliedProject.where("user_id = ? and project_id = ?", userid, projectid)
+ @inviters.each do |inviter|
+ inviter.destroy
+ end
+ end
end
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index c13334b08..001d1b1f6 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -58,6 +58,7 @@ class Mailer < ActionMailer::Base
us = UsersService.new
# 自动激活用户
user = us.register_auto(login, @email, @password)
+ InviteList.create(:user_id => user.id, :project_id => project.id)
User.current = user unless User.current.nil?
@user = user
diff --git a/app/models/project.rb b/app/models/project.rb
index bf94df248..249df8640 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -67,7 +67,7 @@ class Project < ActiveRecord::Base
has_many :student, :through => :students_for_courses, :source => :user
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
has_many :applied_projects
- # has_many :invite_lists
+ has_many :invite_lists
# end
#ADDED BY NIE
diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb
index 7f952cb3c..7cad9bff3 100644
--- a/app/views/projects/invite_members_by_mail.html.erb
+++ b/app/views/projects/invite_members_by_mail.html.erb
@@ -80,4 +80,9 @@
<% end %>
-
\ No newline at end of file
+
+
+<% @inviter_lists.each do |inviter_list| %>
+ <%= inviter_list.user.name %>
+ <% end
+ %>
\ No newline at end of file
From 3cc6fc1a64663df304b07a8059361dc994162069 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 18:15:08 +0800
Subject: [PATCH 124/187] =?UTF-8?q?=E5=88=A0=E6=8E=89additional=5Fenvirome?=
=?UTF-8?q?nt.rb?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/additional_environment.rb | 3 ---
1 file changed, 3 deletions(-)
delete mode 100644 config/additional_environment.rb
diff --git a/config/additional_environment.rb b/config/additional_environment.rb
deleted file mode 100644
index 5c73f6aab..000000000
--- a/config/additional_environment.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-if Rails.env.production?
- config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes }
-end
\ No newline at end of file
From f86acbb10f08b99175f722536476a54209dcde05 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 18:30:49 +0800
Subject: [PATCH 125/187] =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=BF=81=E7=A7=BB?=
=?UTF-8?q?=E7=9A=84=E9=A2=84=E8=A7=88=E6=96=87=E4=BB=B6=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/office.rake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/office.rake b/lib/tasks/office.rake
index c6ee8b4dd..8bfc0c0ea 100644
--- a/lib/tasks/office.rake
+++ b/lib/tasks/office.rake
@@ -3,9 +3,9 @@
namespace :office do
desc "conver any files to html"
task :conver => :environment do
- all_count = Attachment.count
+ all_count = Attachment.where(["container_type IN (?)", %w(Project Course)]).count
i = 0
- Attachment.find_each do |a|
+ Attachment.where(["container_type IN (?)", %w(Project Course)]).find_each do |a|
i += 1
puts "process [#{i}/#{all_count}] => id #{a.id}"
saved_path = File.join(Rails.root, "files", "convered_office")
From d2eb51bbb6f47644d64e156b54c3e8e26535326b Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 18:47:23 +0800
Subject: [PATCH 126/187] =?UTF-8?q?=E5=8F=AA=E5=A4=84=E7=90=86=E8=B5=84?=
=?UTF-8?q?=E6=BA=90=E5=BA=93=E7=9A=84=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/attachment.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 1e477ed04..4a6580a7a 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -259,11 +259,12 @@ class Attachment < ActiveRecord::Base
end
def office_conver
+ return unless %w(Project Course).included? (self.container_type)
saved_path = File.join(Rails.root, "files", "convered_office")
unless Dir.exist?(saved_path)
Dir.mkdir(saved_path)
end
- convered_file = File.join(saved_path, self.disk_filename + ".html")
+ convered_file = File.join(saved_path, self.disk_filename + ".pdf")
OfficeConverTask.new.conver(self.diskfile, convered_file)
end
From 3f9c5764e96f82e57c4438296c4e166df9959bfa Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 18:50:26 +0800
Subject: [PATCH 127/187] .
---
app/models/attachment.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 4a6580a7a..380e98e02 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -259,7 +259,7 @@ class Attachment < ActiveRecord::Base
end
def office_conver
- return unless %w(Project Course).included? (self.container_type)
+ return unless %w(Project Course).include? (self.container_type)
saved_path = File.join(Rails.root, "files", "convered_office")
unless Dir.exist?(saved_path)
Dir.mkdir(saved_path)
From d3baada893c2ceba398dfc399518d2cb6ee05d31 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 3 Jun 2015 18:57:05 +0800
Subject: [PATCH 128/187] =?UTF-8?q?=E5=9C=A8=E6=9B=B4=E6=96=B0Attachments?=
=?UTF-8?q?=E6=97=B6=E4=B9=9F=E8=A6=81=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/attachment.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 380e98e02..1f1d61581 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -72,8 +72,8 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
- after_create :office_conver, :be_user_score ,:act_as_forge_activity# user_score
- after_update :be_user_score
+ after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score
+ after_update :office_conver, :be_user_score
after_destroy :delete_from_disk,:down_user_score
# add by nwb
From d6fb35544ecbe9abe4dc8faae8bc3bb1a1946814 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 09:01:49 +0800
Subject: [PATCH 129/187] =?UTF-8?q?=E8=AF=84=E5=88=86=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E6=97=B6=E6=8F=90=E4=BA=A4=E6=8C=89=E9=92=AE=E5=9B=BA=E5=AE=9A?=
=?UTF-8?q?=E5=9C=A8=E6=8F=90=E4=BA=A4=E6=A0=8F=E7=9A=84=E5=8F=B3=E4=B8=8B?=
=?UTF-8?q?=E8=A7=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_add_score.html.erb | 2 +-
app/views/student_work/_show.html.erb | 2 +-
public/stylesheets/courses.css | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb
index e091e507d..bdfcff6e1 100644
--- a/app/views/student_work/_add_score.html.erb
+++ b/app/views/student_work/_add_score.html.erb
@@ -16,7 +16,7 @@
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
<%end%>
- 提交
+ 提交
<% end%>
\ No newline at end of file
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 3758ffedd..a04b5036b 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -54,7 +54,7 @@
<% if @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
-
+
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
<% end%>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 85db8361d..0663dc905 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -671,6 +671,8 @@ input#score{ width:40px;}
.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;}
.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px;}
+.evaluation{position: relative;}
+.evaluation_submit{position: absolute;right: 0px;bottom: 5px;}
From f168e43b0fb92e2d49f5cd6ad3950a586cffc02b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 09:57:30 +0800
Subject: [PATCH 130/187] =?UTF-8?q?1=E3=80=81=E8=BF=94=E8=BF=98=E6=89=B9?=
=?UTF-8?q?=E9=98=85=E7=9A=84=E9=99=84=E4=BB=B6=E5=8F=AF=E4=BB=A5=E5=88=A0?=
=?UTF-8?q?=E9=99=A4=E5=B9=B6=E4=B8=94js=E5=88=B7=E6=96=B0=202=E3=80=81?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8F=AF=E4=BB=A5=E5=9C=A8=E4=BD=9C=E5=93=81?=
=?UTF-8?q?show=E7=95=8C=E9=9D=A2=E5=88=A0=E9=99=A4=E8=87=AA=E5=B7=B1?=
=?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E7=9A=84=E9=99=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 10 +++-
app/controllers/homework_attach_controller.rb | 5 +-
app/controllers/homework_common_controller.rb | 3 ++
app/views/attachments/destroy.js.erb | 52 ++++++++++---------
.../student_work/_work_attachments.html.erb | 11 ++--
5 files changed, 48 insertions(+), 33 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index c8b6a6fda..46428d5e8 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -191,9 +191,15 @@ class AttachmentsController < ApplicationController
if !@attachment.container.nil? &&
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) &&
@attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) &&
- @attachment.container.board && @attachment.container.board.course ) )
+ @attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon))
if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) }
+ elsif @attachment.container.is_a?(StudentWorksScore)
+ @is_destroy = true #根据ID删除页面对应的数据,js刷新页面
+ format.js
+ elsif @attachment.container.is_a?(HomeworkCommon)
+ @is_destroy = true #根据ID删除页面对应的数据,js刷新页面
+ format.js
elsif @attachment.container.is_a?(Message)
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
elsif @course.nil?
@@ -431,7 +437,7 @@ private
@attachment.container.board.course)
@course = @attachment.container.board.course
else
- unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWorks'
+ unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
@project = @attachment.project
end
end
diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index f6b044c63..5dd5363b9 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -334,9 +334,8 @@ class HomeworkAttachController < ApplicationController
@homework.name = name
@homework.description = description
@homework.project_id = params[:project_id] || 0
- if params[:attachments]
- @homework.save_attachments(params[:attachments])
- end
+ @homework.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(@homework)
if @homework.save
respond_to do |format|
format.html { redirect_to course_for_bid_url @homework.bid }
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 58c959512..281ff7cf8 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -101,6 +101,9 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.absence_penalty = params[:absence_penalty]
+ @homework.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(@homework)
+
if @homework.save && @homework_detail_manual.save
respond_to do |format|
format.html {
diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb
index 0b6cee0df..d23422e24 100644
--- a/app/views/attachments/destroy.js.erb
+++ b/app/views/attachments/destroy.js.erb
@@ -1,26 +1,30 @@
-var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
-//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
-var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
-if(containerid==undefined){
- $('#attachments_<%= j params[:attachment_id] %>').remove();
- var count=$('#attachments_fields>span').length;
- if(count<=0){
- $("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
- $(".remove_all").remove();
+<% if @is_destroy%>
+ $("#attachment_<%= @attachment.id%>").remove();
+<%else%>
+ var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
+ //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
+ var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
+ if(containerid==undefined){
+ $('#attachments_<%= j params[:attachment_id] %>').remove();
+ var count=$('#attachments_fields>span').length;
+ if(count<=0){
+ $("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
+ $(".remove_all").remove();
+ }else{
+ $("#upload_file_count").html("
"+count+" "+"个文件"+"已上传");
+ }
}else{
- $("#upload_file_count").html("
"+count+" "+"个文件"+"已上传");
+ $('#attachments_<%= j params[:attachment_id] %>').remove();
+ var count=$('#attachments_fields'+containerid+'>span').length;
+ if(count<=0){
+ $('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
+ var remove_all_html_obj = $(".remove_all").filter(function(index){
+ return $(this).data('containerid')==containerid;
+ });
+ remove_all_html_obj.remove();
+ }else{
+ $('#upload_file_count'+containerid).html("
"+count+" "+"个文件"+"已上传");
+ }
}
-}else{
- $('#attachments_<%= j params[:attachment_id] %>').remove();
- var count=$('#attachments_fields'+containerid+'>span').length;
- if(count<=0){
- $('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
- var remove_all_html_obj = $(".remove_all").filter(function(index){
- return $(this).data('containerid')==containerid;
- });
- remove_all_html_obj.remove();
- }else{
- $('#upload_file_count'+containerid).html("
"+count+" "+"个文件"+"已上传");
- }
-}
-//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
\ No newline at end of file
+ //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
+<% end%>
\ No newline at end of file
diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb
index 638644fdf..2f7e1e1cd 100644
--- a/app/views/student_work/_work_attachments.html.erb
+++ b/app/views/student_work/_work_attachments.html.erb
@@ -1,5 +1,8 @@
-<% for attachment in attachments %>
- <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
-
(<%= number_to_human_size attachment.filesize %>)
-
+<% attachments.each_with_index do |attachment,i| %>
+
+ <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') if attachment.id && User.current == attachment.author %>
+
(<%= number_to_human_size attachment.filesize %>)
+
+
<% end -%>
From b822db9995be41fbac011022220ec380c7152a09 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 10:00:08 +0800
Subject: [PATCH 131/187] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A2=9E=E5=8A=A0tit?=
=?UTF-8?q?le?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_work_attachments.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb
index 2f7e1e1cd..373b84b74 100644
--- a/app/views/student_work/_work_attachments.html.erb
+++ b/app/views/student_work/_work_attachments.html.erb
@@ -1,7 +1,7 @@
<% attachments.each_with_index do |attachment,i| %>
<%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
- <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') if attachment.id && User.current == attachment.author %>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload') if attachment.id && User.current == attachment.author %>
(<%= number_to_human_size attachment.filesize %>)
From ae950cf3c0fa3ff3856ee0d3117242ea64cabd4b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 10:10:16 +0800
Subject: [PATCH 132/187] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=AF=84=E5=88=86?=
=?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=A1=86=E7=BC=BA=E5=B0=91=E5=85=B3=E9=97=AD?=
=?UTF-8?q?=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/show_member_score.js.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/courses/show_member_score.js.erb b/app/views/courses/show_member_score.js.erb
index 083f070c2..013b478fc 100644
--- a/app/views/courses/show_member_score.js.erb
+++ b/app/views/courses/show_member_score.js.erb
@@ -6,8 +6,8 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/show_me
showModal('ajax-modal', '400px');
//$('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("
" +
-" ");
+$('#ajax-modal').before("
" +
+" ");
//$('#ajax-modal').parent().removeClass();
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed");
$('#ajax-modal').parent().addClass("new-watcher");
From 444658d0b3a8ef46431396bd9ec7ffb3f6df8364 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 4 Jun 2015 10:24:05 +0800
Subject: [PATCH 133/187] =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=8F=98=E4=B8=BA?=
=?UTF-8?q?=E6=97=A2=E6=97=B6=E8=BD=AC=E6=8D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 33 ++++++++++++++-------
app/models/attachment.rb | 15 +++++-----
app/views/files/_project_file_list.html.erb | 5 ++--
lib/trustie/utils/office.rb | 13 ++++----
4 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index d3781d747..8ad48c9b2 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -66,6 +66,12 @@ class AttachmentsController < ApplicationController
file.downcase.end_with?(".pdf")
end
+ def direct_download
+ send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
+ :type => detect_content_type(@attachment),
+ :disposition => 'attachment' #inline can open in browser
+ end
+
def download
# modify by nwb
# 下载添加权限设置
@@ -73,23 +79,30 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
- convered_file = @attachment.diskfile
- unless pdf?(convered_file)
- convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
- end
- if File.exist?(convered_file) && pdf?(convered_file)
- send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
+ if params[:force] == 'true'
+ direct_download
else
- send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
- :type => detect_content_type(@attachment),
- :disposition => 'attachment' #inline can open in browser
+ convered_file = @attachment.diskfile
+ #如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化
+ unless pdf?(convered_file)
+ convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
+ unless File.exist?(convered_file)
+ office = Trustie::Utils::Office.new(@attachment.diskfile)
+ office.conver(convered_file)
+ end
+ end
+ if File.exist?(convered_file) && pdf?(convered_file)
+ send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
+ else
+ direct_download
+ end
end
end
else
render_403 :message => :notice_not_authorized
end
rescue => e
- redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html"
+ redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
end
#更新资源文件类型
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 1f1d61581..f999e27d6 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -259,13 +259,14 @@ class Attachment < ActiveRecord::Base
end
def office_conver
- return unless %w(Project Course).include? (self.container_type)
- saved_path = File.join(Rails.root, "files", "convered_office")
- unless Dir.exist?(saved_path)
- Dir.mkdir(saved_path)
- end
- convered_file = File.join(saved_path, self.disk_filename + ".pdf")
- OfficeConverTask.new.conver(self.diskfile, convered_file)
+ # 不在这里做后台转换,换为点击时做转换
+ # return unless %w(Project Course).include? (self.container_type)
+ # saved_path = File.join(Rails.root, "files", "convered_office")
+ # unless Dir.exist?(saved_path)
+ # Dir.mkdir(saved_path)
+ # end
+ # convered_file = File.join(saved_path, self.disk_filename + ".pdf")
+ # OfficeConverTask.new.conver(self.diskfile, convered_file)
end
# Copies the temporary file to its final location
diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb
index 35aa36195..a5152ecdc 100644
--- a/app/views/files/_project_file_list.html.erb
+++ b/app/views/files/_project_file_list.html.erb
@@ -30,6 +30,7 @@
<% else %>
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% end %>
+ <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %>
<% end %>
@@ -37,7 +38,7 @@
文件大小:<%= number_to_human_size(file.filesize) %>
<%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%>
- <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+ <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
@@ -51,4 +52,4 @@
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
\ No newline at end of file
+
diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb
index 61d6b9d4c..2b4a5f1ac 100644
--- a/lib/trustie/utils/office.rb
+++ b/lib/trustie/utils/office.rb
@@ -17,12 +17,13 @@ module Trustie
if File.exist? @file
if office?
begin
- resource = RestClient::Resource.new(
- 'http://192.168.80.107/Any2HtmlHandler.ashx',
- :timeout => -1,
- :open_timeout => -1
- )
- req = resource.post :txtDes => File.new(@file, 'rb')
+ # resource = RestClient::Resource.new(
+ # 'http://192.168.80.107/Any2HtmlHandler.ashx',
+ # :timeout => -1,
+ # :open_timeout => -1
+ # )
+ # req = resource.post :txtDes => File.new(@file, 'rb')
+ req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx',:txtDes => File.new(@file, 'rb')
File.delete(saved_file) if File.exist?(saved_file)
if req.body.length > 10 && !req.body.eql?('转换出错')
File.open(saved_file, "wb+") do |f|
From fb7c65a70d41f918503285039b9bebd37aec73f4 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 4 Jun 2015 10:26:35 +0800
Subject: [PATCH 134/187] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8B=E8=BD=BD?=
=?UTF-8?q?=E5=8E=9F=E5=A7=8B=E6=96=87=E4=BB=B6=E9=93=BE=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/files/_course_list.html.erb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb
index 6039b543b..6516135a8 100644
--- a/app/views/files/_course_list.html.erb
+++ b/app/views/files/_course_list.html.erb
@@ -40,6 +40,7 @@
<% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% end %>
+ <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %>
<% else %>
<% end %>
@@ -65,4 +66,4 @@
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
\ No newline at end of file
+
From b7dbaca15b12a18fbae840daf2b2b0da0f9b8d87 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 10:29:00 +0800
Subject: [PATCH 135/187] =?UTF-8?q?=E5=9C=A8=E5=AD=A6=E7=94=9F=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=EF=BC=8C=E7=82=B9=E5=87=BB=E5=AD=A6=E7=94=9F=E7=A7=AF?=
=?UTF-8?q?=E5=88=86=E4=B9=8B=E5=90=8E=EF=BC=8Ca=E6=A0=87=E7=AD=BE?=
=?UTF-8?q?=E6=9C=89=E4=B8=8B=E5=88=92=E7=BA=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/_show_member_score.html.erb | 33 +++++--------------
1 file changed, 8 insertions(+), 25 deletions(-)
diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb
index bb080b57b..0d250cf14 100644
--- a/app/views/courses/_show_member_score.html.erb
+++ b/app/views/courses/_show_member_score.html.erb
@@ -1,24 +1,5 @@
-<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
+<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
+<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>
@@ -123,21 +124,20 @@ function nh_init_board(params){
if(params.textarea.data('init') == undefined){
//初始化编辑器
var editor = params.kindutil.create(params.textarea, {
- resizeType : 1,
- allowPreviewEmoticons : false,
- allowImageUpload : false,
- minWidth:"1px",
- width:"565px",
- items : ['emoticons'],
+// allowPreviewEmoticons : false,
+// allowImageUpload : false,
+ resizeType : 1,minWidth:"1px",width:"565px",height:"150px",
+ allowFileManager:true,uploadJson:"/kindeditor/upload",
+ fileManagerJson:"/kindeditor/filemanager",
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
- var toolbar = $("div[class='ke-toolbar']",params.about_talk);
- $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
- params.toolbar_container.append(toolbar);
+// var toolbar = $("div[class='ke-toolbar']",params.about_talk);
+// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
+// params.toolbar_container.append(toolbar);
}
- });
+ }).loadPlugin('paste');
//主题输入框按键事件
params.inputsubject.keyup(function(){
From a967a86a1dbf8794287f13caccadfee9d63f950b Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 5 Jun 2015 14:24:50 +0800
Subject: [PATCH 171/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6500?=
=?UTF-8?q?=E7=BC=BA=E9=99=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/projects_controller.rb | 12 ++++++++++++
.../projects/invite_members_by_mail.html.erb | 18 +++++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 3c34aa549..1793eb39c 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -365,6 +365,18 @@ class ProjectsController < ApplicationController
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all
+ unless @inviter_lists.blank?
+ @inviter_lists.each do|inviter_list|
+ @inviters = []
+ @waiters = []
+ @inviters << inviter_list.user
+ @inviters_count = @inviters.size
+ unless inviter_list.user.member_of?(@project)
+ @waiters << inviter_list.user
+ @waiters_count = @waiters.size
+ end
+ end
+ end
@is_zhuce = false
respond_to do |format|
format.html
diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb
index ce7ea2aa1..bb98b3356 100644
--- a/app/views/projects/invite_members_by_mail.html.erb
+++ b/app/views/projects/invite_members_by_mail.html.erb
@@ -79,19 +79,23 @@
<% end %>
<%# 邀请用户的状态 %>
<% unless @inviter_lists.blank? %>
-
+
+ <% if @inviters_count > 0 %>
已邀请的用户
<% @inviter_lists.each do |inviter_list| %>
- <%= inviter_list.user.name %>
+ <%= inviter_list.user.name unless inviter_list.user.nil? %>
<% end %>
-
+ <% end %>
+
+ <% unless @waiters_count == 0 %>
等待加入项目的用户
<% @inviter_lists.each do |inviter_list| %>
- <% unless inviter_list.user.member_of?(@project) %>
- <%= inviter_list.user.name %>
- <% end %>
+ <% unless inviter_list.user.member_of?(@project) %>
+ <%= inviter_list.user.name unless inviter_list.user.nil? %>
+ <% end %>
<% end %>
-
+ <% end %>
+
<% end %>
From f7b3229065c264944ef42f32244bc48c5e9ee223 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 5 Jun 2015 14:33:22 +0800
Subject: [PATCH 172/187] =?UTF-8?q?=E5=BD=93=E4=BD=9C=E5=93=81=E4=B8=AD?=
=?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=99=84=E4=BB=B6=E6=97=B6=EF=BC=8C=E4=B8=8B?=
=?UTF-8?q?=E8=BD=BD=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/zipdown_controller.rb | 6 ++---
public/javascripts/application.js | 34 ++++++++++++++++-----------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb
index 043552872..d932d8b4d 100644
--- a/app/controllers/zipdown_controller.rb
+++ b/app/controllers/zipdown_controller.rb
@@ -30,8 +30,7 @@ class ZipdownController < ApplicationController
if file_count > 0
zipfile = zip_bid bid
else
- render file: 'public/no_file_found.html'
- return
+ zipfile = {:message => "no file"}
end
elsif params[:obj_class] == "HomeworkCommon"
homework = HomeworkCommon.find params[:obj_id]
@@ -41,8 +40,7 @@ class ZipdownController < ApplicationController
if file_count > 0
zipfile = zip_homework_common homework
else
- render file: 'public/no_file_found.html'
- return
+ zipfile = {:message => "no file"}
end
else
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index d9100b0bb..c514e8940 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -901,24 +901,30 @@ $(function(){
$('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) {
if(status == 'success'){
var res = JSON.parse(data.responseText);
- if(res.length<1){
+ if(res.length == null){
+ alert("该作业没有任何附件可下载");
+ }
+ else if(res.length<1){
return;
}
- if(res.length==1){
- location.href = '/zipdown/download?file='+res[0].file;return;
- }
- document.getElementById('light').style.display='block';
- $container = $('#light .upload_box_ul');
- $container.empty();
- for(var i = 0; i 1){
- des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载';
- } else {
- des = '第'+res[i].index+'个学生的作品下载';
+ else
+ {
+ if(res.length==1){
+ location.href = '/zipdown/download?file='+res[0].file;return;
}
- $(''+(i+1)+'. '+des+' (共'+res[i].size+'M) ').appendTo($container);
+ document.getElementById('light').style.display='block';
+ $container = $('#light .upload_box_ul');
+ $container.empty();
+ for(var i = 0; i 1){
+ des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载';
+ } else {
+ des = '第'+res[i].index+'个学生的作品下载';
+ }
+ $(''+(i+1)+'. '+des+' (共'+res[i].size+'M) ').appendTo($container);
+ }
}
}
});
From 412efb28fe1dac0a0352a85ac52fa26414ea244d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 5 Jun 2015 14:39:37 +0800
Subject: [PATCH 173/187] =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=EF=BC=8C=E6=96=B0=E6=89=93=E5=BC=80=E4=B8=80=E4=B8=AAtab?=
=?UTF-8?q?=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/homework_common/index.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index 87bf37f04..1e8189ddb 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -16,9 +16,9 @@
<%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %>
- <%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl') %>
+ <%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl',:target => "_blank") %>
<%= l(:label_user_create_project_homework) %>:
- <%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue') %>
+ <%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue',:target => "_blank") %>
<%= l(:lebel_homework_commit)%>
From 54abe5d85820c3d6c8f991804563c3f1ca6589e8 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 5 Jun 2015 14:51:36 +0800
Subject: [PATCH 174/187] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=AD=89=E5=BE=85?=
=?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=9A=84=E6=88=90=E5=91=98=E5=88=99=E4=B8=8D?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/projects/invite_members_by_mail.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb
index bb98b3356..7b3a4c552 100644
--- a/app/views/projects/invite_members_by_mail.html.erb
+++ b/app/views/projects/invite_members_by_mail.html.erb
@@ -87,7 +87,7 @@
<% end %>
<% end %>
- <% unless @waiters_count == 0 %>
+ <% unless @waiters_count.nil? %>
等待加入项目的用户
<% @inviter_lists.each do |inviter_list| %>
<% unless inviter_list.user.member_of?(@project) %>
From a148c49fa9ba5a44a948342d1578d854b2608bc0 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 5 Jun 2015 15:02:22 +0800
Subject: [PATCH 175/187] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=BB=99=E5=87=BA?=
=?UTF-8?q?=E6=BF=80=E6=B4=BB=E8=B4=A6=E5=8F=B7=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/mailer/send_invite_in_project.html.erb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb
index 6dbfcbda6..51b189f37 100644
--- a/app/views/mailer/send_invite_in_project.html.erb
+++ b/app/views/mailer/send_invite_in_project.html.erb
@@ -4,9 +4,9 @@
<%= l(:mail_issue_content)%>
- <%= @subject %>
- <%= link_to @project_url, @project_url%>
- 点击链接后,将自动为您注册账号
+ <%= @subject %>
+ 点击链接激活账号,系统会依据给出的密码和账号自动登录Trustie平台。
+ <%= link_to @project_url, @project_url%>
您的账号为:<%= @email %>
密码为: <%= @password %>
From 8adb00fccb70e5f865fd3f6f78c3ae1a38cd1b55 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 5 Jun 2015 15:26:14 +0800
Subject: [PATCH 176/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A8=E8=AE=BA?=
=?UTF-8?q?=E5=8C=BA=E9=82=AE=E4=BB=B6=E4=B8=AD=E6=A0=B7=E5=BC=8F=E5=92=8C?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/mailer/message_posted.html.erb | 2 +-
app/views/mailer/send_invite_in_project.html.erb | 2 +-
app/views/mailer/wiki_content_added.html.erb | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb
index dbe41976a..2be4e486e 100644
--- a/app/views/mailer/message_posted.html.erb
+++ b/app/views/mailer/message_posted.html.erb
@@ -23,7 +23,7 @@
<%= l(:mail_issue_content)%>
- <%= @message.content %>
+ <%= @message.content.html_safe? %>
diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb
index 51b189f37..ec559732f 100644
--- a/app/views/mailer/send_invite_in_project.html.erb
+++ b/app/views/mailer/send_invite_in_project.html.erb
@@ -5,7 +5,7 @@
<%= l(:mail_issue_content)%>
<%= @subject %>
- 点击链接激活账号,系统会依据给出的密码和账号自动登录Trustie平台。
+ 点击下面的链接即可激活账号,系统会根据给出的密码和账号自动登录Trustie平台。
<%= link_to @project_url, @project_url%>
您的账号为:<%= @email %>
密码为: <%= @password %>
diff --git a/app/views/mailer/wiki_content_added.html.erb b/app/views/mailer/wiki_content_added.html.erb
index 8c83f62c8..c4f6929a8 100644
--- a/app/views/mailer/wiki_content_added.html.erb
+++ b/app/views/mailer/wiki_content_added.html.erb
@@ -1,3 +1,3 @@
<%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
:author => h(@wiki_content.author)).html_safe %>
-<%=h @wiki_content.comments %>
+<%=h @wiki_content.comments.html_safe? %>
From f67521164261784815f58c6c587bcd4241b50435 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 5 Jun 2015 15:26:35 +0800
Subject: [PATCH 177/187] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E6=B2=A1=E6=9C=89=E7=9C=9F=E5=AE=9E?=
=?UTF-8?q?=E5=A7=93=E5=90=8D=E5=B0=B1=E6=98=BE=E7=A4=BAlogin=EF=BC=8C?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E9=99=84=E4=BB=B6=E5=AF=BC=E5=87=BA=E4=B9=9F?=
=?UTF-8?q?=E4=B8=80=E6=A0=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/zipdown_controller.rb | 6 +++---
app/models/user.rb | 9 ++++++---
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb
index d932d8b4d..7eb06d270 100644
--- a/app/controllers/zipdown_controller.rb
+++ b/app/controllers/zipdown_controller.rb
@@ -60,7 +60,7 @@ class ZipdownController < ApplicationController
unless homework.attachments.empty?
zipfile = zip_homework_by_user homework
send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) +
- "_" + (homework.user.lastname.nil? ? "" : homework.user.lastname) + (homework.user.firstname.nil? ? "" : homework.user.firstname) +
+ "_" + homework.user.show_name +
"_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile)
else
render file: 'public/no_file_found.html'
@@ -148,7 +148,7 @@ class ZipdownController < ApplicationController
end
end
out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){
- zipping("#{homework_attach.user.lastname}#{homework_attach.user.firstname}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
+ zipping("#{homework_attach.user.show_name}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
@@ -168,7 +168,7 @@ class ZipdownController < ApplicationController
end
end
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
- zipping("#{work.user.lastname}#{work.user.firstname}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
+ zipping("#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
diff --git a/app/models/user.rb b/app/models/user.rb
index a1f00a234..b4723cceb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -277,15 +277,18 @@ class User < Principal
end
def show_name
+ name = ""
unless self.user_extensions.nil?
if self.user_extensions.identity == 2
- firstname
+ name = firstname
else
- lastname+firstname
+ name = lastname+firstname
end
else
- lastname+firstname
+ name = lastname+firstname
end
+ name = name.empty? || name.nil? ? login : name
+ name
end
## end
From bef1917c4efff2eb6837a0adc6668b0ec7008e0c Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 5 Jun 2015 15:32:19 +0800
Subject: [PATCH 178/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/mailer/message_posted.html.erb | 2 +-
app/views/mailer/wiki_content_added.html.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb
index 2be4e486e..c55f4b000 100644
--- a/app/views/mailer/message_posted.html.erb
+++ b/app/views/mailer/message_posted.html.erb
@@ -23,7 +23,7 @@
<%= l(:mail_issue_content)%>
- <%= @message.content.html_safe? %>
+ <%= @message.content.html_safe %>
diff --git a/app/views/mailer/wiki_content_added.html.erb b/app/views/mailer/wiki_content_added.html.erb
index c4f6929a8..244597a1b 100644
--- a/app/views/mailer/wiki_content_added.html.erb
+++ b/app/views/mailer/wiki_content_added.html.erb
@@ -1,3 +1,3 @@
<%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
:author => h(@wiki_content.author)).html_safe %>
-<%=h @wiki_content.comments.html_safe? %>
+<%=h @wiki_content.comments.html_safe %>
From c62d468ed3d1c8970eaedc16014e1f9c798e3862 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 5 Jun 2015 15:54:56 +0800
Subject: [PATCH 179/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E6=96=B0=E9=97=BB=E5=92=8C=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?=
=?UTF-8?q?=E5=86=B2=E7=AA=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/mailer/send_for_user_activities.html.erb | 2 +-
config/locales/projects/zh.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index 81a65442f..da8b4c8c3 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -262,7 +262,7 @@
<% unless @project_news.first.nil? %>
- <%= l(:label_course_news) %>
+ <%= l(:label_project_news) %>
(<%= @project_news.count %>)
<% @project_news.each do |project_new|%>
diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml
index 78f608a80..e01e2992c 100644
--- a/config/locales/projects/zh.yml
+++ b/config/locales/projects/zh.yml
@@ -86,7 +86,7 @@ zh:
label_roadmap: 里程碑 #版本路线图
project_module_dts: DTS测试工具
label_project_tool_response: 用户反馈
- label_course_news: 项目新闻
+ label_project_news: 项目新闻
label_project_overview: "项目简介"
label_expend_information: 展开更多信息
From b4732814e6174d07742c2b429021907e7944a923 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Fri, 5 Jun 2015 16:20:26 +0800
Subject: [PATCH 180/187] ...
---
app/controllers/courses_controller.rb | 1 +
app/helpers/activity_notifys_helper.rb | 7 +++++++
app/views/courses/show.html.erb | 23 ++++++++++++++++++++---
public/stylesheets/courses.css | 2 +-
4 files changed, 29 insertions(+), 4 deletions(-)
create mode 100644 app/helpers/activity_notifys_helper.rb
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 333ad77b1..e89f621c8 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -6,6 +6,7 @@ class CoursesController < ApplicationController
helper :members
helper :words
helper :attachments
+ helper :activity_notifys
before_filter :auth_login1, :only => [:show, :feedback]
menu_item :overview
diff --git a/app/helpers/activity_notifys_helper.rb b/app/helpers/activity_notifys_helper.rb
new file mode 100644
index 000000000..15fc43b54
--- /dev/null
+++ b/app/helpers/activity_notifys_helper.rb
@@ -0,0 +1,7 @@
+module ActivityNotifysHelper
+ def get_new_notify_count(container,type)
+ logger.info('xxoo')
+ query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',container.id,type,User.current.id);
+ return query.count()
+ end
+end
\ No newline at end of file
diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb
index 9bbe4ea5a..4fbf3ad43 100644
--- a/app/views/courses/show.html.erb
+++ b/app/views/courses/show.html.erb
@@ -1,7 +1,9 @@
<% if @controller_name=='ActivityNotifys' %>
-
<%= l(:label_activity)%>
-
与我相关
+
<%= l(:label_activity)%>
+
与我相关
+ (<%=get_new_notify_count(@course,'Course')%> )
+
@@ -80,6 +84,14 @@
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index bbc6f5b55..edb70075b 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -677,7 +677,7 @@ input#score{ width:40px;}
/* 与我相关 */
.new_icon{background:url(../images/new_icon.png) 0px 0px no-repeat; width:35px; height:15px; display:block;}
-a.about_me{ width:80px;text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;}
+a.about_me{text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;}
a:hover.about_me{ color:#0781b4;}
From 79893c4917548bb0b1f3dc09a888fa00479e2033 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 5 Jun 2015 16:57:09 +0800
Subject: [PATCH 181/187] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?=
=?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=A0=B9=E6=8D=AE=E9=AA=8C=E8=AF=81=E7=BB=93?=
=?UTF-8?q?=E6=9E=9C=E7=9B=B8=E5=BA=94=E7=A9=BA=E9=97=B4focus?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/course.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index b629530f0..4c0cae670 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -470,7 +470,15 @@ $(function(){
//老师提交 新建/修改 作业
function submit_homework(id)
{
- if(regex_homework_name()&®ex_evaluation_num())
+ if(!regex_homework_name())
+ {
+ $("#homework_name").focus();
+ }
+ else if(!regex_evaluation_num())
+ {
+ $("#evaluation_num").focus();
+ }
+ else
{
homework_description_editor.sync();
$("#"+id).submit();
From c85fd9f7b8c2c81fc5282c33740dd3d7f600bdd2 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 5 Jun 2015 17:17:35 +0800
Subject: [PATCH 182/187] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B0=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E6=A8=A1=E5=9D=97=E7=9A=84=E5=86=B2=E7=AA=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/mailer.rb | 7 ++---
.../mailer/send_for_user_activities.html.erb | 27 ++-----------------
.../mailer/send_for_user_activities.text.erb | 24 ++---------------
3 files changed, 8 insertions(+), 50 deletions(-)
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 087fb6d73..1325ef613 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -115,14 +115,15 @@ class Mailer < ActionMailer::Base
count = courses.count
count = count - 1
for i in 0..count do
- bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
+ bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
@bids += bids if bids.count > 0
@attachments += attachments if attachments.count > 0
+
end
end
# user 提交的作业
- @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
+ # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where
@@ -157,7 +158,7 @@ class Mailer < ActionMailer::Base
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
- has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news,
+ has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index da8b4c8c3..e1712a15d 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -3,7 +3,7 @@
<%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first ||
- @homeworks.first || @course_journal_messages.first|| @course_messages.first %>
+ @course_journal_messages.first|| @course_messages.first %>
<%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %>
@@ -39,7 +39,7 @@
<% end %>
- <% if !@bids.first.nil? || !@homeworks.first.nil? %>
+ <% if !@bids.first.nil? %>
<%= l(:label_homework_overview) %>(<%= @bids.count %>)
<% unless @bids.first.nil?%>
@@ -65,29 +65,6 @@
<% end %>
<% end %>
- <% unless @homeworks.first.nil? %>
- <% @homeworks.each do |homework| %>
-
- ▪
- [
-
- <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
-
- <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_course_submit_homework) %>
-
- <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(homework.created_at) %>
-
- <% end %>
- <% end %>
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb
index 59735225d..2a2382301 100644
--- a/app/views/mailer/send_for_user_activities.text.erb
+++ b/app/views/mailer/send_for_user_activities.text.erb
@@ -1,6 +1,6 @@
<%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first ||
- @homeworks.first || @course_journal_messages.first|| @course_messages.first %>
+ @course_journal_messages.first|| @course_messages.first %>
<%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %>
<%= l(:label_course_news) %>
@@ -27,7 +27,7 @@
<% end %>
<% end %>
- <% if !@bids.first.nil? || !@homeworks.first.nil? %>
+ <% if !@bids.first.nil? %>
<%= l(:label_homework_overview) %><%= @bids.count %>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
@@ -51,26 +51,6 @@
<% end %>
<% end %>
- <% unless @homeworks.first.nil? %>
- <% @homeworks.each do |homework| %>
- ▪[
-
- <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value)
-
- %>
- ]
-
- <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value)
- %>
- <%= l(:label_course_submit_homework) %>
-
- <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value)
-
-
- %>
- <%= format_time(homework.created_at) %>
- <% end %>
- <% end %>
From b1ce342b3d71d1bcbd8267bd3970e54337dc2170 Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 6 Jun 2015 09:44:23 +0800
Subject: [PATCH 183/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=94=B9=E5=90=8E=E5=BC=95=E8=B5=B7=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/mailer/send_for_user_activities.html.erb | 10 +++++-----
app/views/mailer/send_for_user_activities.text.erb | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index e1712a15d..3d53acd5a 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -39,7 +39,7 @@
<% end %>
- <% if !@bids.first.nil? %>
+ <% unless @bids.empty? %>
<%= l(:label_homework_overview) %>(<%= @bids.count %>)
<% unless @bids.first.nil?%>
@@ -48,20 +48,20 @@
▪
[
- <%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value),
+ <%= link_to truncate(bid.course.name,length: 30,omission: '...'), course_url(bid.course, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
]
- <%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
+ <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= l(:label_course_homework) %>
- <%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value),
+ <%= link_to truncate(bid.name,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
- <%= format_time(bid.created_on) %>
+ <%= format_time(bid.created_at) %>
<% end %>
<% end %>
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb
index 2a2382301..669aca3d1 100644
--- a/app/views/mailer/send_for_user_activities.text.erb
+++ b/app/views/mailer/send_for_user_activities.text.erb
@@ -27,27 +27,27 @@
<% end %>
<% end %>
- <% if !@bids.first.nil? %>
+ <% unless @bids.empty? %>
<%= l(:label_homework_overview) %><%= @bids.count %>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
▪
[
- <%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'),course_url(bid.courses.first, :token => @token.value)
+ <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value)
%>
]
- <%= link_to bid.author, user_activities_url(bid.author,:token => @token.value)
+ <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value)
%>
<%= l(:label_course_homework) %>
- <%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(bid,:token => @token.value)
+ <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value)
%>
- <%= format_time(bid.created_on) %>
+ <%= format_time(bid.created_at) %>
<% end %>
<% end %>
From 1a3a23b0ed3928c77aa67292d7a84280a390b54f Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Sat, 6 Jun 2015 09:44:37 +0800
Subject: [PATCH 184/187] =?UTF-8?q?BId=E5=B7=B2=E5=8F=96=E6=B6=88=E7=95=99?=
=?UTF-8?q?=E8=A8=80=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/mailer.rb | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 1325ef613..ec46917d9 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -199,8 +199,8 @@ class Mailer < ActionMailer::Base
@title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
@issue_author_url = url_for(user_activities_url(@user))
@url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
- when :Bid
- course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
+ # when :Bid
+ # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
when :Project
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
@@ -236,12 +236,12 @@ class Mailer < ActionMailer::Base
mail :to => @recipients,
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
:filter => true
- elsif journals_for_message.jour.class.to_s.to_sym == :Bid
- if !journals_for_message.jour.author.notify_about? journals_for_message
- return -1
- end
-
- mail :to => recipients, :subject => @title,:filter => true
+ # elsif journals_for_message.jour.class.to_s.to_sym == :Bid
+ # if !journals_for_message.jour.author.notify_about? journals_for_message
+ # return -1
+ # end
+ #
+ # mail :to => recipients, :subject => @title,:filter => true
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
if !journals_for_message.jour.author.notify_about? journals_for_message
return -1
From 7e89cd27aacfd30390788a4f3faf589c16a97d9e Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 6 Jun 2015 10:22:56 +0800
Subject: [PATCH 185/187] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=82=80=E8=AF=B7bug?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/projects_controller.rb | 16 +++++++++-------
.../mailer/send_for_user_activities.html.erb | 1 -
.../projects/invite_members_by_mail.html.erb | 6 ++++--
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 1793eb39c..70efa47fa 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -367,13 +367,15 @@ class ProjectsController < ApplicationController
@inviter_lists = InviteList.where(project_id:@project.id).all
unless @inviter_lists.blank?
@inviter_lists.each do|inviter_list|
- @inviters = []
- @waiters = []
- @inviters << inviter_list.user
- @inviters_count = @inviters.size
- unless inviter_list.user.member_of?(@project)
- @waiters << inviter_list.user
- @waiters_count = @waiters.size
+ inviters = []
+ waiters = []
+ inviters << inviter_list.user
+ @inviters_count = inviters.size
+ unless inviter_list.user.nil?
+ unless inviter_list.user.member_of?(@project)
+ waiters << inviter_list.user
+ @waiters_count = waiters.size
+ end
end
end
end
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index 3d53acd5a..9723783fe 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -138,7 +138,6 @@
<%= l(:label_course_attendingcontestwork_download) %>
(<%= @attachments.count %>)
-
<% @attachments.each do |attachment|%>
▪
diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb
index 7b3a4c552..349bc2b56 100644
--- a/app/views/projects/invite_members_by_mail.html.erb
+++ b/app/views/projects/invite_members_by_mail.html.erb
@@ -90,8 +90,10 @@
<% unless @waiters_count.nil? %>
等待加入项目的用户
<% @inviter_lists.each do |inviter_list| %>
- <% unless inviter_list.user.member_of?(@project) %>
- <%= inviter_list.user.name unless inviter_list.user.nil? %>
+ <% unless inviter_list.user.nil? %>
+ <% unless inviter_list.user.member_of?(@project) %>
+ <%= inviter_list.user.name %>
+ <% end %>
<% end %>
<% end %>
<% end %>
From 543ae1bbd027e122e428812682d15075398605fe Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 6 Jun 2015 11:39:22 +0800
Subject: [PATCH 186/187] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=80=E8=AF=B7?=
=?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=A1=B9=E7=9B=AE=E9=80=BB=E8=BE=91=EF=BC=9A?=
=?UTF-8?q?=E6=94=B9=E6=88=90=E5=B7=B2=E5=8A=A0=E5=85=A5=E5=92=8C=E7=AD=89?=
=?UTF-8?q?=E5=BE=85=E5=8A=A0=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/projects_controller.rb | 15 ++++++++-------
.../projects/invite_members_by_mail.html.erb | 16 ++++++----------
2 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 70efa47fa..efe5a52ee 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -365,16 +365,17 @@ class ProjectsController < ApplicationController
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all
+ @inviters = []
+ @waiters = []
unless @inviter_lists.blank?
@inviter_lists.each do|inviter_list|
- inviters = []
- waiters = []
- inviters << inviter_list.user
- @inviters_count = inviters.size
unless inviter_list.user.nil?
- unless inviter_list.user.member_of?(@project)
- waiters << inviter_list.user
- @waiters_count = waiters.size
+ if inviter_list.user.member_of?(@project)
+ @inviters << inviter_list.user
+ @inviters_count = @inviters.size
+ else
+ @waiters << inviter_list.user
+ @waiters_count = @waiters.size
end
end
end
diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb
index 349bc2b56..4c6ee47d8 100644
--- a/app/views/projects/invite_members_by_mail.html.erb
+++ b/app/views/projects/invite_members_by_mail.html.erb
@@ -80,21 +80,17 @@
<%# 邀请用户的状态 %>
<% unless @inviter_lists.blank? %>
- <% if @inviters_count > 0 %>
- 已邀请的用户
- <% @inviter_lists.each do |inviter_list| %>
- <%= inviter_list.user.name unless inviter_list.user.nil? %>
+ <% unless @inviters_count.nil? %>
+ 已加入项目的用户
+ <% @inviters.each do |inv| %>
+ <%= inv.name unless inv.nil? %>
<% end %>
<% end %>
<% unless @waiters_count.nil? %>
等待加入项目的用户
- <% @inviter_lists.each do |inviter_list| %>
- <% unless inviter_list.user.nil? %>
- <% unless inviter_list.user.member_of?(@project) %>
- <%= inviter_list.user.name %>
- <% end %>
- <% end %>
+ <% @waiters.each do |wai| %>
+ <%= wai.name unless wai.nil?%>
<% end %>
<% end %>
From 6a997bace384f0fc72588e7f2c0b2f1998700c0c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Sat, 6 Jun 2015 12:11:19 +0800
Subject: [PATCH 187/187] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=A7=93=E5=90=8D?=
=?UTF-8?q?=E9=A2=9C=E8=89=B2=E8=B0=83=E6=95=B4=20=E5=8C=BF=E8=AF=84?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E5=AD=A6=E5=8F=B7=E6=98=BE=E7=A4=BA--?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_evaluation_work.html.erb | 6 ++++--
app/views/student_work/_student_work.html.erb | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb
index 5a339dc03..11ce7b080 100644
--- a/app/views/student_work/_evaluation_work.html.erb
+++ b/app/views/student_work/_evaluation_work.html.erb
@@ -6,13 +6,15 @@
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
+ <% else%>
+ --
<% end%>
<% if is_my_work%>
- <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name %>
+ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02" %>
<% else%>
- <%= link_to "匿名","javascript:void(0)"%>
+ <%= link_to "匿名","javascript:void(0)", :class => "c_blue02"%>
<% end%>
diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb
index e8fb2ce3a..e39cb130d 100644
--- a/app/views/student_work/_student_work.html.erb
+++ b/app/views/student_work/_student_work.html.erb
@@ -6,7 +6,7 @@
- <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name%>
+ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>