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/159] =?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 | 172 ++++++++++-----------
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, 228 insertions(+), 153 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
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/159] =?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/159] =?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/159] =?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 | 105 +++++++++---------
.../student_work/_work_attachments.html.erb | 5 +
app/views/student_work/index.html.erb | 3 -
public/stylesheets/public.css | 7 ++
5 files changed, 67 insertions(+), 58 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/159] =?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 9e4f303742fd6b7ba252c99bd55e84d9dfd12f8d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Sat, 23 May 2015 17:18:13 +0800
Subject: [PATCH 023/159] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E9=83=A8=E5=88=86?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/avatar_controller.rb | 62 ++++++++++++++++------------
1 file changed, 35 insertions(+), 27 deletions(-)
diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb
index b6efaef0c..afd206c92 100644
--- a/app/controllers/avatar_controller.rb
+++ b/app/controllers/avatar_controller.rb
@@ -29,43 +29,51 @@ class AvatarController < ApplicationController
end
if @temp_file && (@temp_file.size > 0)
- diskfile=disk_filename(@source_type,@source_id)
- @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
+ if @temp_file.size > Setting.upload_avatar_max_size.to_i
+ @status = 1
+ @msg = l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i))
+ elsif Trustie::Utils::Image.new(@temp_file.tempfile.path).image?
+ diskfile=disk_filename(@source_type,@source_id)
+ @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
- # 用户头像上传时进行特别处理
- if @source_type == 'User'
- diskfile += "temp"
- @urlfile += "temp"
- end
+ # 用户头像上传时进行特别处理
+ if @source_type == 'User'
+ diskfile += "temp"
+ @urlfile += "temp"
+ end
- logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)")
- path = File.dirname(diskfile)
- unless File.directory?(path)
- FileUtils.mkdir_p(path)
- end
- md5 = Digest::MD5.new
- File.open(diskfile, "wb") do |f|
- if @temp_file.respond_to?(:read)
- buffer = ""
- while (buffer = @temp_file.read(8192))
- f.write(buffer)
- md5.update(buffer)
+ logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)")
+ path = File.dirname(diskfile)
+ unless File.directory?(path)
+ FileUtils.mkdir_p(path)
+ end
+ md5 = Digest::MD5.new
+ File.open(diskfile, "wb") do |f|
+ if @temp_file.respond_to?(:read)
+ buffer = ""
+ while (buffer = @temp_file.read(8192))
+ f.write(buffer)
+ md5.update(buffer)
+ end
+ else
+ f.write(@temp_file)
+ md5.update(@temp_file)
end
- else
- f.write(@temp_file)
- md5.update(@temp_file)
end
+
+ Trustie::Utils::Image.new(diskfile,true).compress(300)
+ @status = 0
+ @msg = ''
+ else
+ @status = 2
+ @msg = l(:not_valid_image_file)
end
-# self.digest = md5.hexdigest
end
@temp_file = nil
- image = Trustie::Utils::Image.new(diskfile,true)
- image.compress(300)
-
respond_to do |format|
format.json{
- render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html'
+ render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html'
return
}
format.js
From 69affa8a2ecdc914e32a215f362e67f3f8bb0541 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Mon, 25 May 2015 15:19:42 +0800
Subject: [PATCH 024/159] ...
---
app/views/boards/_form_project.html.erb | 6 +-
app/views/boards/_project_new_topic.html.erb | 2 +-
app/views/boards/_project_show.html.erb | 165 +++++++++++--------
3 files changed, 98 insertions(+), 75 deletions(-)
diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb
index 5cf20a993..58bb5501c 100644
--- a/app/views/boards/_form_project.html.erb
+++ b/app/views/boards/_form_project.html.erb
@@ -81,7 +81,11 @@
<% end %>
-
+ <% if replying%>
+
+ <% else %>
+
+ <%end %>
diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb
index 05304e978..d7c8972fc 100644
--- a/app/views/boards/_project_new_topic.html.erb
+++ b/app/views/boards/_project_new_topic.html.erb
@@ -1,4 +1,4 @@
-<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:nhname=>'form', :html => {:multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
+<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb
index ae8dd5ed2..dc1cff634 100644
--- a/app/views/boards/_project_show.html.erb
+++ b/app/views/boards/_project_show.html.erb
@@ -31,72 +31,73 @@
讨论区共有<%= @topic_count %> 个帖子
<% if @topics.any? %>
<% @topics.each do |topic| %>
-
-
- <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
-
- <% author = topic.author.to_s + ":" %>
- <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
-
<%= h(topic.subject) %>
- <% if topic.editable_by?(User.current) %>
-
<%= l(:button_edit) %>
- <% end %>
- <%= link_to(
- l(:button_delete),
- {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
- :method => :post,
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'talk_edit fr',
- :style => ' margin-right: 10px;'
- ) if topic.destroyable_by?(User.current) %>
- <% if topic.sticky? %>
-
<%= l(:label_board_sticky)%>
- <% end %>
-
-
-
- <%= topic.content.html_safe %>
-
-
-
- [展开]
-
-
-
-
- <%= link_to_attachments_course topic, :author => false %>
- <%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
-
- <% if User.current.logged? %>
- <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %>
- <% end %>
-
-
-
-
- <%= render :partial => 'edit',locals: {:topic => topic} %>
-
-
-
-
-
-
- <% reply = Message.new(:subject => "RE: #{@message.subject}")%>
- <% if !topic.locked? && authorize_for('messages', 'reply') %>
-
-
-
- <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
- :html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
- <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
-
<%= l(:button_cancel)%>
-
<%= l(:label_memo_create)%>
- <% end %>
-
-
- <% end %>
-
-
+
+ <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
+
+ <% author = topic.author.to_s + ":" %>
+ <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
+
<%= h(topic.subject) %>
+
+ <% if topic.editable_by?(User.current) %>
+
<%= l(:button_edit) %>
+ <% end %>
+ <%= link_to(
+ l(:button_delete),
+ {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'talk_edit fr',
+ :style => ' margin-right: 10px;'
+ ) if topic.destroyable_by?(User.current) %>
+ <% if topic.sticky? %>
+
<%= l(:label_board_sticky)%>
+ <% end %>
+
+
+
+
+ <%= topic.content.html_safe %>
+
+
+
+ [展开]
+
+
+
+
+ <%= link_to_attachments_course topic, :author => false %>
+ <%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
+
+ <% if User.current.logged? %>
+
<%= l(:button_reply) %>
+ <% end %>
+
+
+
+ <%= render :partial => 'edit',locals: {:topic => topic} %>
+
+
+
+
+ <% reply = Message.new(:subject => "RE: #{@message.subject}")%>
+ <% if !topic.locked? && authorize_for('messages', 'reply') %>
+
+
+
+ <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
+ :html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
+ <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<% end %>
<% end %>
@@ -130,7 +131,8 @@
function nh_init_board(params){
params.showbtn.click(function(){//发帖/编辑/回复按钮的click
if(params.textarea.data('init') == undefined){
- var editor = params.kindutil.create(params.textarea, {//初始化编辑器
+ //初始化编辑器
+ var editor = params.kindutil.create(params.textarea, {
resizeType : 1,
allowPreviewEmoticons : false,
allowImageUpload : false,
@@ -138,7 +140,8 @@
width:"565px",
items : []
});
- params.submitbtn.click(function(){//提交按钮click
+ //表单提交
+ params.form.submit(function(){
var is_checked = nh_check_field({
subject:params.inputsubject,
subjectmsg:params.subjectmsg,
@@ -148,14 +151,29 @@
if(is_checked){
alert('submit');
params.textarea.html(editor.html());
-// params.form.submit();
+ return false;
+// return true;
}
+ return false;
});
- params.cancelbtn.click(function(){//取消按钮click
+ //提交按钮click
+ params.submitbtn.click(function(){
+ params.form.submit();
+ });
+ //取消按钮click
+ params.cancelbtn.click(function(){
params.about_talk.toggle();//显示/隐藏编辑区
- params.inputsubject.focus();
+ if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
+ params.form[0].reset();
+ editor.html(params.textarea.html());
+ params.subjectmsg.hide();
+ params.contentmsg.hide();
+ }else{
+ if(params.type=='reply'){editor.focus();}//有bug 页面不跟着跳
+ else params.inputsubject.focus();
+ }
});
- params.textarea.data('init','1')
+ params.textarea.data('init','1');//标记为已经初始化
}
params.cancelbtn.click();//显示/隐藏编辑区
});
@@ -178,10 +196,11 @@
form:$("form[nhname='form']",about_talk)
});
});
- $("div[ecname='container_board_reply']").each(function(){
+ $("div[mhname='container_board_reply']").each(function(){
var container = $(this);
var about_talk = $("div[nhname='about_talk_reply']",container);
nh_init_board({
+ type:'reply',
kindutil:K,
showbtn:$("a[nhname='showbtn_reply']",container),
about_talk:about_talk,
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 025/159] =?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 026/159] =?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 027/159] =?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 028/159] =?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 4244c69b4670775aaafec09dbdebeb6679f11336 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Tue, 26 May 2015 14:18:42 +0800
Subject: [PATCH 029/159] ...
---
app/views/boards/_form_project.html.erb | 6 +-
app/views/boards/_project_show.html.erb | 178 ++++++++++++++++++++----
2 files changed, 153 insertions(+), 31 deletions(-)
diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb
index 58bb5501c..ca23193b4 100644
--- a/app/views/boards/_form_project.html.erb
+++ b/app/views/boards/_form_project.html.erb
@@ -15,7 +15,7 @@
<% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
<% if replying %>
-
+
* <%= l(:field_subject) %> :
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
@@ -47,11 +47,11 @@
-
+
<% unless replying %>
* <%= l(:field_description) %> :
<% end %>
- <%= text_area :quote,:quote,:style => 'display:none' %>
+ <%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
<% if replying%>
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb
index dc1cff634..b0fd4049f 100644
--- a/app/views/boards/_project_show.html.erb
+++ b/app/views/boards/_project_show.html.erb
@@ -79,7 +79,7 @@
- <% reply = Message.new(:subject => "RE: #{@message.subject}")%>
+ <% reply = Message.new(:subject => "RE: #{topic.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
@@ -97,39 +97,107 @@
<% end %>
+ <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
+ reorder("#{Message.table_name}.id asc").all %>
+ <% unless replies_all.empty? %>
+
+
+ <% replies_all_i = 0 %>
+ <% replies_all.each do |message| %>
+ <% replies_all_i=replies_all_i+1 %>
+
+ <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
+
+ <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
+
+
<%= textAreailizable message,:content,:attachments => message.attachments %>
+
+
<%= format_time(message.created_on) %>
+ <%= link_to(
+
+ l(:button_delete),
+ {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:button_delete),
+ :class => ' c_dblue fr'
+ ) if message.course_destroyable_by?(User.current) %>
+ <%= link_to(
+ l(:button_reply),
+ 'javascript:;',
+ :nhname =>'showbtn_child_reply',
+ :class => ' c_dblue fr',
+ :style => 'margin-right: 10px;',
+ :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
+
+
+
+ <% end %>
+
+
+ <%if topic.replies_count>2 %>
+
+ <% end %>
+ <% end %>
<% end %>
+ <% else %>
+ <%= l(:label_no_data) %>
+ <% end %>
+
+ <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
+
+
+
+<%# other_formats_links do |f| %>
+ <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
+<%# end %>
+ <% html_title @board.name %>
+ <% content_for :header_tags do %>
+ <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
<% end %>
+
@@ -59,7 +62,7 @@
<%= topic.content.html_safe %>
-
+
[展开]
@@ -87,6 +90,7 @@
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
+
+
\ 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 033/159] =?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 034/159] =?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 035/159] =?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 dc557f7826eb05b5c94d06e1691ccb6e438b06e9 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Wed, 27 May 2015 09:04:39 +0800
Subject: [PATCH 036/159] ...
---
app/views/boards/_project_show.html.erb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb
index fd685f168..738d9ac63 100644
--- a/app/views/boards/_project_show.html.erb
+++ b/app/views/boards/_project_show.html.erb
@@ -104,7 +104,7 @@
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.id asc").all %>
<% unless replies_all.empty? %>
-
+
<% replies_all_i = 0 %>
<% replies_all.each do |message| %>
@@ -294,6 +294,7 @@
$(".talkmain_box").each(function(){
var target = $("li[nhname='reply_rec']",$(this));
var btn = $("a[nhname='reply_ex_btn']",$(this));
+ var jumpobj = $("div[nhname='nh_reply_div']",$(this));
btn.click(function(){
if($(this).data('init')=='0'){
$(this).data('init',1);
@@ -305,6 +306,8 @@
target.hide();
target.eq(0).show();
target.eq(1).show();
+ $("#nhjump").attr('href','#'+jumpobj.attr('id'));
+ $("#nhjump")[0].click();
}
});
});
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 037/159] =?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;
- }
- return xsun;
- }
- function setScrollTop(value) {
- if (Sys.chrome) {
- document.body.scrollTop = value;
+ 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;
}
- else {
- document.documentElement.scrollTop = value;
+ 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);
+ 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 038/159] =?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 94c7c68b7f639c1545ebc775419628207ba7bf67 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Wed, 27 May 2015 14:42:36 +0800
Subject: [PATCH 039/159] ...
---
app/views/boards/_course_new.html.erb | 7 +-
app/views/boards/_course_show.html.erb | 362 +++++++++++++-----------
app/views/boards/_form_course.html.erb | 19 +-
app/views/boards/_project_show.html.erb | 129 +--------
app/views/boards/show.html.erb | 203 ++++++++++---
5 files changed, 380 insertions(+), 340 deletions(-)
diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb
index 10f23d4f2..61c774a95 100644
--- a/app/views/boards/_course_new.html.erb
+++ b/app/views/boards/_course_new.html.erb
@@ -1,9 +1,10 @@
-<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
+<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
- <%= l(:button_cancel) %>
-
+
+ <%= l(:button_cancel) %>
+
<%= l(:button_submit)%>
diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb
index d7eb7c215..fc3c38aad 100644
--- a/app/views/boards/_course_show.html.erb
+++ b/app/views/boards/_course_show.html.erb
@@ -1,26 +1,27 @@
-
-
-
-
-
- <% if User.current.language == "zh"%>
- <%= h @board.name %>
- <% else %>
- <%= l(:project_module_boards) %>
- <% end %>
-
-
-
<%= l(:label_message_new) %>
+
+
+
+ <% if User.current.language == "zh"%>
+ <%= h @board.name %>
+ <% else %>
+ <%= l(:project_module_boards) %>
+ <% end %>
+
+
+
<%= l(:label_message_new) %>
+
+
+
+
+
+ <%= render :partial => 'course_new' %>
+
+
+
-
-
-
- <%= render :partial => 'course_new' %>
-
-
<% if !User.current.logged?%>
@@ -32,7 +33,7 @@
讨论区共有<%= @topic_count %> 个帖子
<% if @topics.any? %>
<% @topics.each do |topic| %>
-
+
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<% author = topic.author.to_s + ":" %>
@@ -40,7 +41,7 @@
<%= h(topic.subject) %>
<% if topic.course_editable_by?(User.current) %>
-
<%= l(:button_edit) %>
<% end %>
@@ -81,105 +82,118 @@
<%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
- <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
+
<%= l(:button_reply) %>
-
-
-
-
- <%= render :partial => 'edit',locals: {:topic => topic} %>
-
-
-
- <% reply = Message.new(:subject => "RE: #{@message.subject}")%>
- <% if !topic.locked? && authorize_for('messages', 'reply') %>
-
-
-
- <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
-
- <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
- <%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %>
-
<%= l(:label_memo_create)%>
- <% end %>
+
+
+ <%= render :partial => 'edit',locals: {:topic => topic} %>
+
+
+
+
+ <% reply = Message.new(:subject => "RE: #{@message.subject}")%>
+ <% if !topic.locked? && authorize_for('messages', 'reply') %>
+
-
- <% end %>
- <% replies_all = topic.children.
- includes(:author, :attachments, {:board => :project}).
- reorder("#{Message.table_name}.created_on DESC").offset(2).
- all %>
- <% replies_show = topic.children.
- includes(:author, :attachments, {:board => :project}).
- reorder("#{Message.table_name}.created_on DESC").limit(2).
- all %>
- <% unless replies_show.empty? %>
- <% reply_count = 0 %>
-
-
- <% replies_show.each do |message| %>
-
-
- <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
-
- <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
-
-
<%= textAreailizable message,:content,:attachments => message.attachments %>
-
-
-
<%= format_time(message.created_on) %>
- <%= link_to(
-
- l(:button_delete),
- {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
- :method => :post,
- :data => {:confirm => l(:text_are_you_sure)},
- :title => l(:button_delete),
- :class => ' c_dblue fr'
- ) if message.course_destroyable_by?(User.current) %>
-
-
-
-
+
+ <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
+ :html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
+
+ <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
+
+
<% end %>
-
-
-
-
- <% replies_all.each do |message| %>
-
-
- <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
-
- <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
-
-
<%= textAreailizable message,:content,:attachments => message.attachments %>
-
-
-
<%= format_time(message.created_on) %>
- <%= link_to(
-
- l(:button_delete),
- {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
- :method => :post,
- :data => {:confirm => l(:text_are_you_sure)},
- :title => l(:button_delete),
- :class => ' c_dblue fr'
- ) if message.course_destroyable_by?(User.current) %>
-
-
-
-
- <% end %>
-
-
- <%if replies_all.first %>
-
- <% end %>
- <% end %>
-
+
+
+ <% end %>
+ <% replies_all = topic.children.
+ includes(:author, :attachments, {:board => :project}).
+ reorder("#{Message.table_name}.created_on DESC").offset(2).
+ all %>
+ <% replies_show = topic.children.
+ includes(:author, :attachments, {:board => :project}).
+ reorder("#{Message.table_name}.created_on DESC").limit(2).
+ all %>
+ <% unless replies_show.empty? %>
+ <% reply_count = 0 %>
+
+
+ <% replies_show.each do |message| %>
+
+
+ <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
+
+ <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
+
+
<%= textAreailizable message,:content,:attachments => message.attachments %>
+
+
+
<%= format_time(message.created_on) %>
+ <%= link_to(
+
+ l(:button_delete),
+ {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:button_delete),
+ :class => ' c_dblue fr'
+ ) if message.course_destroyable_by?(User.current) %>
+ <%= link_to(
+ l(:button_reply),
+ 'javascript:;',
+ :nhname =>'showbtn_child_reply',
+ :class => ' c_dblue fr',
+ :style => 'margin-right: 10px;',
+ :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
+
+
+
+
+ <% end %>
+
+
+
+
+ <% replies_all.each do |message| %>
+
+
+ <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
+
+ <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
+
+
<%= textAreailizable message,:content,:attachments => message.attachments %>
+
+
+
<%= format_time(message.created_on) %>
+ <%= link_to(
+
+ l(:button_delete),
+ {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:button_delete),
+ :class => ' c_dblue fr'
+ ) if message.course_destroyable_by?(User.current) %>
+
+
+
+
+ <% end %>
+
+
+ <%if replies_all.first %>
+
+ <% end %>
+ <% end %>
+
+
+
+
<% end %>
<% else %>
<%= l(:label_no_data) %>
@@ -197,58 +211,80 @@
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %>
<% end %>
+
\ No newline at end of file
diff --git a/app/views/boards/_form_course.html.erb b/app/views/boards/_form_course.html.erb
index cfef18f93..65e750b57 100644
--- a/app/views/boards/_form_course.html.erb
+++ b/app/views/boards/_form_course.html.erb
@@ -5,19 +5,19 @@
* <%= l(:field_subject) %> :
- <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585", :aa=>"subject" }.merge(extra_option) %>
+ <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
-
+
<% else %>
* <%= l(:field_subject) %> :
- <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :aa=>"subject" }.merge(extra_option) %>
+ <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
-
+
<% end %>
@@ -34,11 +34,11 @@
-
+
<% unless replying %>
* <%= l(:field_description) %> :
<% end %>
- <%= text_area :quote,:quote,:style => 'display:none' %>
+ <%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
<% if replying%>
@@ -46,13 +46,14 @@
:width => '89%',
:height => 300,
:id => "message_content#{f.object.id}",
- :aa => 'content',
+ :nhname => 'textarea',
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %>
<% else %>
+
<%= f.text_area :content,
:width => '90%',
:height => 300,
@@ -61,14 +62,14 @@
:id => "message_content#{f.object.id}",
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
- :aa => 'content',
+ :nhname => 'textarea',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %>
<% end %>
-
+
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb
index 738d9ac63..d6332a029 100644
--- a/app/views/boards/_project_show.html.erb
+++ b/app/views/boards/_project_show.html.erb
@@ -90,7 +90,7 @@
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
-
+
<%= l(:button_cancel)%>
<%= l(:button_submit)%>
@@ -115,6 +115,7 @@
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<%= textAreailizable message,:content,:attachments => message.attachments %>
+
<%= format_time(message.created_on) %>
<%= link_to(
@@ -165,131 +166,7 @@
-
+<% if @project %>
+ <%= render :partial => 'project_show', locals: {project: @project} %>
+<% elsif @course %>
+ <%= render :partial => 'course_show', locals: {course: @course} %>
+<% end %>
+
+
-
-<% if @project %>
- <%= render :partial => 'project_show', locals: {project: @project} %>
-<% elsif @course %>
- <%= render :partial => 'course_show', locals: {course: @course} %>
-<% end %>
+
\ No newline at end of file
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 040/159] =?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 041/159] =?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 042/159] =?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 cd38e9aa7009f13a415ead66120039d82c7ac803 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Wed, 27 May 2015 15:50:31 +0800
Subject: [PATCH 043/159] ...
---
app/views/boards/_course_show.html.erb | 63 ++++++-------------------
app/views/boards/_project_show.html.erb | 2 +-
app/views/boards/show.html.erb | 10 ++--
3 files changed, 23 insertions(+), 52 deletions(-)
diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb
index fc3c38aad..ddf6a532d 100644
--- a/app/views/boards/_course_show.html.erb
+++ b/app/views/boards/_course_show.html.erb
@@ -8,12 +8,14 @@
<% end %>
-
<%= l(:label_message_new) %>
+ <% if User.current.logged? %>
+
<%= l(:label_message_new) %>
+ <% end %>
-
+
<%= render :partial => 'course_new' %>
@@ -39,7 +41,7 @@
<% author = topic.author.to_s + ":" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
-
<%= h(topic.subject) %>
+
<%= h(topic.subject) %>
<% if topic.course_editable_by?(User.current) %>
<%= l(:button_edit) %>
@@ -111,21 +113,15 @@
<% end %>
- <% replies_all = topic.children.
- includes(:author, :attachments, {:board => :project}).
- reorder("#{Message.table_name}.created_on DESC").offset(2).
- all %>
- <% replies_show = topic.children.
- includes(:author, :attachments, {:board => :project}).
- reorder("#{Message.table_name}.created_on DESC").limit(2).
- all %>
- <% unless replies_show.empty? %>
- <% reply_count = 0 %>
-
+ <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
+ reorder("#{Message.table_name}.created_on DESC").all %>
+ <% unless replies_all.empty? %>
+ <% replies_all_i = 0 %>
+
- <% replies_show.each do |message| %>
-
-
+ <% replies_all.each do |message| %>
+ <% replies_all_i=replies_all_i+1 %>
+
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
@@ -157,37 +153,8 @@
<% end %>
-
-
- <% replies_all.each do |message| %>
-
-
- <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
-
- <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
-
-
<%= textAreailizable message,:content,:attachments => message.attachments %>
-
-
-
<%= format_time(message.created_on) %>
- <%= link_to(
-
- l(:button_delete),
- {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
- :method => :post,
- :data => {:confirm => l(:text_are_you_sure)},
- :title => l(:button_delete),
- :class => ' c_dblue fr'
- ) if message.course_destroyable_by?(User.current) %>
-
-
-
-
- <% end %>
-
-
- <%if replies_all.first %>
-
+ <%if topic.replies_count>2 %>
+
<% end %>
<% end %>
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb
index d6332a029..d20119a6c 100644
--- a/app/views/boards/_project_show.html.erb
+++ b/app/views/boards/_project_show.html.erb
@@ -102,7 +102,7 @@
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
- reorder("#{Message.table_name}.id asc").all %>
+ reorder("#{Message.table_name}.id desc").all %>
<% unless replies_all.empty? %>
diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb
index 3d20fd411..bb3faf28f 100644
--- a/app/views/boards/show.html.erb
+++ b/app/views/boards/show.html.erb
@@ -1,5 +1,8 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>
@@ -147,9 +148,9 @@ function nh_init_board(params){
textarea:params.textarea
});
if(is_checked){
-// alert('submit');
-// return false;
- return true;
+ //return true 居然不提交 fuck your sister
+ $(this)[0].submit();
+// return true;
}
return false;
});
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 055/159] =?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 056/159] =?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 057/159] =?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 058/159] =?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 059/159] =?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 6f1573881712d5b7e6e399b2e1bfa620657ec7a4 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 28 May 2015 12:23:56 +0800
Subject: [PATCH 060/159] =?UTF-8?q?=E6=8D=A2=E4=B8=80=E4=B8=AAautologin,?=
=?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=80=81=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/account_controller.rb | 4 +++-
app/controllers/application_controller.rb | 6 +++++-
config/configuration.yml | 5 ++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index dc1cceb87..181f76b22 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -336,9 +336,11 @@ class AccountController < ApplicationController
:expires => 1.month.from_now,
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
- :domain => Redmine::Configuration['cookie_domain'],
:httponly => true
}
+ if Redmine::Configuration['cookie_domain'].present?
+ cookie_options = cookie_options.merge(domain: Redmine::Configuration['cookie_domain'])
+ end
cookies[autologin_cookie_name] = cookie_options
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 88cd51d67..10e5e6f06 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -199,7 +199,11 @@ class ApplicationController < ActionController::Base
# Logs out current user
def logout_user
if User.current.logged?
- cookies.delete(autologin_cookie_name, domain: :all)
+ if Redmine::Configuration['cookie_domain'].present?
+ cookies.delete(autologin_cookie_name, domain: Redmine::Configuration['cookie_domain'])
+ else
+ cookies.delete autologin_cookie_name
+ end
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil
end
diff --git a/config/configuration.yml b/config/configuration.yml
index 45e307157..390754a87 100644
--- a/config/configuration.yml
+++ b/config/configuration.yml
@@ -90,7 +90,6 @@ default:
user_name: "huang.jingquan@163.com"
password: 'xinhu1ji2qu366'
- cookie_domain: ".trustie.net"
# Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance.
# Your Redmine instance needs to have write permission on this
@@ -104,7 +103,7 @@ default:
# autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /)
# autologin_cookie_secure: true sets the cookie secure flag (default: false)
- autologin_cookie_name:
+ autologin_cookie_name: "autologin_trustie"
autologin_cookie_path:
autologin_cookie_secure:
@@ -201,7 +200,7 @@ default:
# specific configuration options for production environment
# that overrides the default ones
production:
- # CJK support
+ cookie_domain: ".trustie.net"
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
email_delivery:
delivery_method: :smtp
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 061/159] =?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 709c026910a8274026b3b0ac007a8d20fd05cd5b Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Thu, 28 May 2015 15:48:52 +0800
Subject: [PATCH 062/159] ...
---
app/views/boards/_course_show.html.erb | 4 ++--
app/views/boards/_project_show.html.erb | 2 +-
app/views/boards/show.html.erb | 13 ++++++++-----
public/images/public_icon.png | Bin 4987 -> 11734 bytes
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb
index 889e82350..0b0e95b21 100644
--- a/app/views/boards/_course_show.html.erb
+++ b/app/views/boards/_course_show.html.erb
@@ -132,8 +132,8 @@
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
-
<%= textAreailizable message,:content,:attachments => message.attachments %>
-
+
<%= textAreailizable message,:content,:attachments => message.attachments %>
+
<%= format_time(message.created_on) %>
<%= link_to(
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb
index 48b3d6ccf..a8dc4ad1a 100644
--- a/app/views/boards/_project_show.html.erb
+++ b/app/views/boards/_project_show.html.erb
@@ -120,7 +120,7 @@
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
-
<%= textAreailizable message,:content,:attachments => message.attachments %>
+
<%= textAreailizable message,:content,:attachments => message.attachments %>
<%= format_time(message.created_on) %>
diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb
index 8bc4cc7af..69300ec4b 100644
--- a/app/views/boards/show.html.erb
+++ b/app/views/boards/show.html.erb
@@ -1,7 +1,10 @@
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 5333b91a7..d27895b03 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -19,7 +19,7 @@ a:hover.project_name{ color:#016f33;}
a.project_txt02{ color:#0781b4; width:618px; display:block; float:left; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a:hover.project_txt{ color:#066e9a;}
.noline{ border-bottom:none;}
-.news_description{max-height: 38px;overflow:hidden; }
+.news_description{max-height: 360px;overflow:hidden; }
.news_description_none{max-height: none;}
a.news_foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:600px; height:20px; padding-top:3px; cursor:pointer;}
a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;}
From 0eace6e598f57a3b10aae17bf7889b9f088347e4 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Fri, 29 May 2015 18:42:22 +0800
Subject: [PATCH 091/159] =?UTF-8?q?cached=E5=AF=BC=E8=87=B4=E7=9A=84?=
=?UTF-8?q?=E4=B8=AA=E4=BA=BA=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_user_project_list.html.erb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb
index f7cf841f8..e38f9c4bd 100644
--- a/app/views/layouts/_user_project_list.html.erb
+++ b/app/views/layouts/_user_project_list.html.erb
@@ -2,13 +2,11 @@
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
-<% end %>
\ No newline at end of file
+<% end %>
From f4c1cc839c65fe8f7b3943e887e69bf2e166b28b Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Fri, 29 May 2015 19:33:33 +0800
Subject: [PATCH 092/159] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=A0=87?=
=?UTF-8?q?=E7=AD=BE=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/stores/index.html.erb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb
index 89405b8ab..6fab364b5 100644
--- a/app/views/stores/index.html.erb
+++ b/app/views/stores/index.html.erb
@@ -3,10 +3,10 @@
<% end %>
-<% @attach_array.each do |k|%>
+<% @attach_array.each_with_index do |k, index|%>
- <%= @str_arr.shift %>
+ <%= @str_arr[index] %>
@@ -24,7 +24,7 @@
- <% if @str_arr.shift == @str_arr[2]%>
+ <% if index == 2%>
<% k.each do |c1|%>
@@ -94,4 +94,4 @@
}
});
-<% html_title(l(:label_stores_index)) -%>
\ No newline at end of file
+<% html_title(l(:label_stores_index)) -%>
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 093/159] =?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 3967b632b55d4f82fa273934388073fea92c8b18 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Mon, 1 Jun 2015 10:41:23 +0800
Subject: [PATCH 094/159] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=AF=BC=E8=88=AA?=
=?UTF-8?q?=E7=9A=84=E7=BC=93=E5=AD=98=20Signed-off-by:=20alan=20<54753343?=
=?UTF-8?q?4@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_user_courses_list.html.erb | 4 ++--
app/views/layouts/_user_project_list.html.erb | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/views/layouts/_user_courses_list.html.erb b/app/views/layouts/_user_courses_list.html.erb
index 38ccf72bf..ce9282ee7 100644
--- a/app/views/layouts/_user_courses_list.html.erb
+++ b/app/views/layouts/_user_courses_list.html.erb
@@ -3,14 +3,14 @@
<%=link_to l(:label_my_course), user_courses_user_path(User.current.id) %>
<% end %>
\ No newline at end of file
diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb
index f7cf841f8..c70086499 100644
--- a/app/views/layouts/_user_project_list.html.erb
+++ b/app/views/layouts/_user_project_list.html.erb
@@ -2,13 +2,13 @@
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
<% end %>
\ No newline at end of file
From 5347d83f8fe2294ede387aea4d69a04fedfe7768 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 1 Jun 2015 12:39:58 +0800
Subject: [PATCH 095/159] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=90=9C=E7=B4=A2bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/services/users_service.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/services/users_service.rb b/app/services/users_service.rb
index 40275a29b..aff0a975c 100644
--- a/app/services/users_service.rb
+++ b/app/services/users_service.rb
@@ -245,10 +245,10 @@ class UsersService
"show_changesets" => true
}
scope = User.logged.status(status)
+ search_by = params[:search_by] ? params[:search_by] : "0"
if params[:is_search_assitant].nil?
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件(bug:#2270) start
#say by yutao: params[:user_id]这个是指谁发起的搜索么? 如果是 这个值貌似应该从session获取 怪怪的赶脚-_-!
- search_by = params[:search_by] ? params[:search_by] : "0"
if params[:name].present?
if !params[:user_id].nil?
watcher = User.watched_by(params[:user_id])
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 096/159] =?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 097/159] =?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 098/159] =?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 099/159] 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 100/159] =?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 101/159] =?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 102/159] =?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 103/159] =?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 8d23815169277a61420f94e59f9675dfb995bf2a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 2 Jun 2015 11:42:12 +0800
Subject: [PATCH 104/159] =?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 105/159] =?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 106/159] =?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 107/159] =?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 108/159] =?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)) %>
-
-
- <%= 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 %>
+ <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %>
+
<% 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)) %>
-
+
+
+ <%= link_to(h(e.user), user_path(e.user_id)) %>
+
- <%= l(:label_new_activity) %>
+ <%= 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 109/159] =?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 110/159] =?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 111/159] =?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 112/159] =?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 113/159] =?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 114/159] =?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 115/159] =?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 116/159] =?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 130/159] 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 131/159] =?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 132/159] =?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 133/159] =?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 134/159] =?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 135/159] 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 1c4ca0c9131485f3378007cfa9c2b1a0410e0f57 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 3 Jun 2015 14:33:53 +0800
Subject: [PATCH 136/159] =?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%>
- 提交
+ 提交
<% 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 142/159] =?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 143/159] =?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 144/159] =?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 b7dbaca15b12a18fbae840daf2b2b0da0f9b8d87 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 4 Jun 2015 10:29:00 +0800
Subject: [PATCH 145/159] =?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 @@