From 4b9bc7f0fccdd95f7c81acc52521088864d9fe7f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 21 Nov 2014 15:03:56 +0800 Subject: [PATCH 01/29] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A1=B5=E9=9D=A2?= =?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/views/memos/show.html.erb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 5222b466f..0330b65e4 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -8,8 +8,12 @@ <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
-
<%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %>
-

<%=link_to @memo.author.name, user_path(@memo.author) %>

+
+ <%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %> +
+

+ <%=link_to @memo.author.name, user_path(@memo.author) %> +

@@ -55,7 +59,8 @@
- <%= label_tag l(:field_subject) %>: <%=h @memo.subject %> + <%= label_tag l(:field_subject) %>: + <%=h @memo.subject %>
<%= textAreailizable(@memo,:content) %> @@ -67,7 +72,9 @@

-
<%= authoring @memo.created_at, @memo.author %>
+
+ <%= authoring @memo.created_at, @memo.author %> +

From a1b4b2ddae24548708c31dc53537c9954412ede6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 21 Nov 2014 15:48:08 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=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/views/homework_attach/_homework.html.erb | 2 +- public/stylesheets/css.css | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index c4be4777c..b821e2495 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -51,7 +51,7 @@ <% if is_my_homework %> <% if @bid.comment_status == 0 %> -
  • +
  • <%= link_to l(:button_edit), edit_homework_attach_path(homework) %> <% if homework.user == User.current || User.current.admin? %> diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 2eb401dfd..b10870201 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -1,5 +1,5 @@ /* CSS Document */ -body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} +body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; background:#fff; font-style:normal;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;} div,img,tr,td,textarea{ border:0;} table,tr,td{border:0; cellspacing:0; cellpadding:0;} @@ -38,9 +38,9 @@ a:hover.tb_all{ background:#eaeaea; text-decoration:none;} .pic_head a{ text-align:center; width:42px; overflow:hidden;text-overflow:ellipsis; white-space:nowrap;} .pic_head img{ border:1px solid #fff;} .pic_head img:hover{border:1px solid #15bccf;} -.dis ul li.wname a{ width:260px; font-size:14px; color:#595959; padding:20px 0 0 15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} -.dis ul li.wdown a{padding-top:22px; color:#3d7ec2; margin-right:35px;} -.wscore{ padding-top:22px; color:#888888; width:96px;} +.dis ul li.wname a{ width:260px; font-size:14px; color:#595959; padding:25px 0 0 15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} +.dis ul li.wdown a{padding-top:25px; color:#3d7ec2; margin-right:35px;} +.wscore{ padding-top:25px; color:#888888; width:96px;} .dis ul li.wping{margin-left:12px; } .dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:3px;} .dis ul li.wping a:hover{ background-color:#03a1b3;} From 2c28ed0fa13ae931e46322a72ce58c770b6bd472 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 21 Nov 2014 16:07:29 +0800 Subject: [PATCH 03/29] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E7=95=99=E8=A8=80=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework_list.html.erb | 2 +- public/stylesheets/css.css | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 036289b0a..23f7070b2 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -22,7 +22,7 @@ <%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> (<%= @jours_count %>)
  • -
  • +
  • <%= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %>
  • diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index b10870201..e756213ab 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -15,7 +15,7 @@ a:hover{ text-decoration:underline;} /* TAB 切换效果 */ .tb_{ background-color: #eaeaea; height:40px; } .tb_ ul{height:40px; } -.tb_ li{float:left;height:35px;width: 90px;cursor:pointer; font-size:14px; padding-top:5px; text-align:center; } +.tb_ li{float:left;height:30px;width: 90px;cursor:pointer; font-size:14px; padding-top:10px; text-align:center; } a.tb_all{ margin-left:235px; font-size:12px; display:block; height:23px; padding-top:4px; width:90px; color:#7a7a7a; border:1px solid #cbcbcb; background:#fff; text-align: center;} a:hover.tb_all{ background:#eaeaea; text-decoration:none;} @@ -44,7 +44,7 @@ a:hover.tb_all{ background:#eaeaea; text-decoration:none;} .dis ul li.wping{margin-left:12px; } .dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:3px;} .dis ul li.wping a:hover{ background-color:#03a1b3;} -ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } +ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px;line-height: 1.9; } .wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;} .wlist a{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;} .wlist a:hover{ background:#15bccf; color:#fff; text-decoration:none;} @@ -92,7 +92,7 @@ a:hover.ping_sub{ background:#14a8b9;} .recall_head img{ height:30px; width:30px;} .recall_head a:hover{border:1px solid #15bccf;} .recall_head img:hover{border:1px solid #15bccf;} -.recall_con{ float:left;color:#777777;max-width: 530px;width: 90%; margin-left:10px; } +.recall_con{ float:left;color:#777777;max-width: 530px;width: 80%; margin-left:10px; } .recall_con a{ color:#15bccf; } .ping_list{ margin-top:15px;} From 06f1ff026ab5d8318999333df1cd425064564660 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 21 Nov 2014 16:28:01 +0800 Subject: [PATCH 04/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE--?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=B7=A5=E5=85=B7=E9=9B=86logo=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/nyan.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 50a1de7c4..1ef7c8dd7 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -649,14 +649,14 @@ input[class='nyan-clean-gray']:active, .nyan-clean-gray:active { } .tools a:visited { - color: #fffbff; + color: #116699; text-decoration: none; padding: 3px 5px 0px 5px; width: 100px; } .tools a:hover { - color: #fffbff; + color: white; padding: 3px 3px 0px 20px; width: 88px; text-decoration: none; From db87f8f5db8259bc9c55757f0aa498656bf2eca8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 21 Nov 2014 16:38:14 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=B7=A5=E5=85=B7=E9=9B=86=E6=A0=8F=E6=97=B6?= =?UTF-8?q?=E9=A1=B9=E7=9B=AEtab=E6=A0=8F=E4=B8=8B=E7=9A=84=E6=A8=AA?= =?UTF-8?q?=E7=BA=BF=E6=B2=A1=E4=BA=86=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 1b1580d8c..8d60c06a2 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2202,7 +2202,7 @@ button.tab-right { padding-bottom: 2px; text-align: center; border: 1px solid #15BCCF; - border-bottom: 0px solid #15BCCF; + border-bottom: 1px solid #15BCCF; color:#606060; font-weight:bold; From c5a9defb3f4257c6e8c7002ffa96be107dffddd2 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 21 Nov 2014 17:06:58 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_file.html.erb | 18 ++++++++++++++++-- app/views/files/_course_list.html.erb | 2 +- app/views/tags/_tag_add.html.erb | 13 +++++++------ public/stylesheets/resource.css | 10 +++++----- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 49747ae11..04ce917c8 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -18,6 +18,20 @@ hideModal($("#popbox_upload")); } + function presscss(id) + { + if(id == "incourse") + { + $('#incourse').attr("class", "re_schbtn b_dblue"); + $('#insite').attr("class", "re_schbtn b_lblue"); + } + else + { + $('#incourse').attr("class", "re_schbtn b_lblue"); + $('#insite').attr("class", "re_schbtn b_dblue"); + } + } +
    @@ -25,8 +39,8 @@
    <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "课内搜索", :class => "re_schbtn b_dblue",:name => "incourse"%> - <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite" %> + <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onclick => "presscss('incourse')"%> + <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onclick => "presscss('insite')" %> <% end %> <% if is_course_teacher(User.current,@course) %> 上传资源 diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index fa22c404d..cb776aeb7 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -37,7 +37,7 @@
    -

    文件大小:<%= number_to_human_size(file.filesize) %>

    +

    文件大小:<%= number_to_human_size(file.filesize) %>

    <%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>

    <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用0

    diff --git a/app/views/tags/_tag_add.html.erb b/app/views/tags/_tag_add.html.erb index 14f2dc965..0b59015f2 100644 --- a/app/views/tags/_tag_add.html.erb +++ b/app/views/tags/_tag_add.html.erb @@ -1,13 +1,14 @@ <%= link_to '+ 添加标签', 'javascript:void(0);', :class => "yellowBtn f_l", :onclick=>"$('#add_tag_#{obj.id}').slideToggle();" if User.current.logged? %> - \ No newline at end of file diff --git a/public/stylesheets/resource.css b/public/stylesheets/resource.css index 1046429be..fc6b74b75 100644 --- a/public/stylesheets/resource.css +++ b/public/stylesheets/resource.css @@ -12,11 +12,12 @@ a:hover{ text-decoration:underline;} .b_lblue{ background:#64bdd9 !important;} .b_dblue{ background:#55a1b9 !important; cursor:pointer !important;} .f_b{ font-weight: bold !important;} -.c_blue{ color:#64bdd9;} +.c_blue{ color:#64bdd9 !important;} .c_grey{ color:#999999 !important;} .c_grey02{ color:#666666 !important;} +.font{ font-size: 12px;} .f_14{ font-size:14px ;} -.c_dblue{ color:#3e6d8e;} +.c_dblue{ color:#3e6d8e !important;} .w90{width:90px;} .ml10{margin-left:10px;} .ml5{margin-left:5px;} @@ -46,14 +47,14 @@ a:hover{ text-decoration:underline;} text-shadow: none !important; } a.re_fabu { display:block; width:90px; height:35px; font-size:14px; color:#fff; text-align:center; padding-top:5px; margin:5px; } -a:hover.re_fabu{background:#55a1b9;} +a:hover.re_fabu{background:#55a1b9 !important;} /****列表***/ .re_con{ margin:5px; width:683px;} .re_con_top{color:#494949; } .re_con_top span{ color:#999999; font-weight:bold;} a.re_select{ display:block; width:88px; height:22px; background:url(images/pic_select01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;} a:hover.re_select{background:url(images/pic_select02.png) 0 0 no-repeat;} -.re_open{display:block; width:46px; height:22px; background:url(images/pic_open01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;} +.re_open{display:block; width:46px; height:22px; background:url(images/pic_open01.png) 0 0 no-repeat; color:#fff !important; font-weight:bold; margin-left:10px;} a:hover.re_open{background:url(images/pic_open02.png) 0 0 no-repeat;} a.re_de{ color:#6883b6; margin-left:15px;} .re_con_box{ border-bottom:1px dashed #dadada; padding:10px 0;} @@ -76,7 +77,6 @@ a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} margin-top:2px !important; margin-left:3px !important; border:none !important; - margin-left:0px !important; box-shadow: none !important; padding: 0px !important; border-radius: 0 !important; From ea19c1aeefed788f49491cfd22a20a9f66570b98 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 09:33:37 +0800 Subject: [PATCH 07/29] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=95=99=E5=B8=88?= =?UTF-8?q?=E8=AF=84=E5=88=86=E6=89=80=E5=8D=A0=E6=AF=94=E4=BE=8B=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework_form.html.erb | 2 +- app/views/courses/_homework_form.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index cd682deb0..12393c558 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -40,7 +40,7 @@

    <%= f.select :is_evaluation, is_evaluation_option %>

    -

    +

    <%= f.select :proportion, proportion_option %>

    diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index 8ce6be3fe..2d20ecf07 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -45,7 +45,7 @@

    <%= f.select :is_evaluation, is_evaluation_option %>

    -

    +

    <%= f.select :proportion, proportion_option %>

    From 56150e44cee595b3daf13192f9e66116e4f0367f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 09:49:51 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=9C=A8=E6=96=B0=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E6=89=93=E5=BC=80=E7=BD=91=E9=A1=B5=E6=8A=A5500?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 22 +-- app/views/homework_attach/show.html.erb | 177 +----------------- 2 files changed, 3 insertions(+), 196 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 61760f462..0286fcad6 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -382,42 +382,22 @@ class HomeworkAttachController < ApplicationController if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) # 打分统计 stars_reates = @homework. rates(:quality) - #stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count - #stars_status = stars_reates.select("stars, count(*) as scount").group("stars") - #@stars_status_map = Hash.new(0.0) - #stars_status.each do |star_status| - # percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f - # percent_m = format("%.2f", percent) - # @stars_status_map["star#{star_status.stars.to_i}".to_sym] = - # percent_m.to_s + "%" - #end #是否已经进行过评价 temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first @m_score = temp.nil? ? 0:temp.stars @has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0 - #是否开启互评功能 - #@is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil - #@limit = 10 #@jours留言 is null条件用以兼容历史数据 @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") @cur_page = params[:cur_page] || 1 @cur_type = params[:cur_type] || 5 @jour = paginateHelper @jours,5 - #@feedback_count = @jours.count - #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - #@offset ||= @feedback_pages.offset - #@jour = @jours[@offset, @limit] - #@comprehensive_evaluation教师评论 - #@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC") + teachers = searchTeacherAndAssistant @course @comprehensive_evaluation = [] teachers.each do|teacher| temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first @comprehensive_evaluation << temp if temp end - #@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id in #{convert_array(teachers)}").order("created_on DESC") - #@anonymous_comments 匿评 - #@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC") annymous_users = @homework.homework_evaluations.map(&:user) unless annymous_users.nil? || annymous_users.count == 0 @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC") diff --git a/app/views/homework_attach/show.html.erb b/app/views/homework_attach/show.html.erb index 5f631c26a..d2f096bae 100644 --- a/app/views/homework_attach/show.html.erb +++ b/app/views/homework_attach/show.html.erb @@ -1,175 +1,2 @@ -<%= render :partial => 'layouts/base_homework_attach', :locals => {:homework_attach => @homework} %> - -<% is_student = is_cur_course_student @homework.bid.courses.first %> -<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %> -

    <%= notice %>

    -
    - - - - - - - - - - - - - - - - - - - - -
    作业基础信息<%=@count %>
    - 发布人员:<%= link_to @homework.user, user_path(@homework.user)%> - - 所属任务:<%= link_to(@homework.bid.name, course_for_bid_path(@homework.bid))%> -
    - 作业下载: - <% if @is_evaluation || is_teacher%> - <% options = {:author => true } %> - <%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %> - <% else %> - <%= l(:label_cant_download) %> - <% end %> - - 参与人员: - <% @homework.users.each do |homework_user| %> - <%= link_to homework_user, user_path(homework_user)%> - <% if @homework.users.count > 1 && homework_user != @homework.users.last %> -
                     - <% end %> - <% end %> -
    平均评分: - <%= render :partial => 'show_score', :locals => {:stars => @totle_score} %> - 发布时间:<%=format_time @homework.created_at %>
    - - -
    -
    - -
    - - - - - - - - - - - -
    作业描述:
    -
    - <% if @homework.description != nil && @homework.description != "" %> - <%= @homework.description %> - <% else %> -
    - 该作业无任何描述! -
    - <% end %> -
    -
    - - -
    -
    - -
    -
    - 作业得分: -
    -
    -
    -
    得分比例
    -
    - <% 100.step(20,-20) do |star| %> -
    -
    -
    -
    -
    -
    - <%= @stars_status_map["star#{(star/20).to_s}".to_sym] %> -
    - <% end %> -
    -
    -
    -
    最终得分
    -
    - <%= @totle_score %>分 -
    -
    - <%= render :partial => 'show_score', :locals => {:stars => @totle_score} %> -
    -
    -
    -
    打分总人数
    -
    - - <%= @homework.raters(:quality).count%> - -
    -
    -
    -
    -
    - - -
    - <%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score} %> -
    - -
    - - -<% if !users_for_homework(@homework).include?(User.current) %> -
    -
    作业评论:
    - <% if is_student %> - <% if @is_evaluation %> - <% if @has_evaluation %> -
    - <%= l(:lable_has_evaluation)%> -
    - <% else %> - <%= render :partial => 'evaluation', :locals => {:homework => @homework} %> - <% end %> - <% else %> -
    - <%= l(:lable_close_evaluation)%> -
    - <% end %> - <% end %> -
    -<% end %> - -<% if !is_teacher %> - -
    - <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => nil} %> -
    -<% end %> - - - -
    - <%= render :partial => 'showjour', :locals => {:jour => @jour,:homework => @homework} %> -
    - -
    -
    +<%= stylesheet_link_tag 'css', :media => 'all' %> +<%= render :partial => "show"%> \ No newline at end of file From 0049f921b94d7ddb2359e63664837b86dc28827e Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 22 Nov 2014 09:51:41 +0800 Subject: [PATCH 09/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E3=80=8A=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=89=88--=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE--?= =?UTF-8?q?=E9=85=8D=E7=BD=AE--=E6=88=90=E5=91=98=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=EF=BC=9A=E5=A6=82=E5=9B=BE=EF=BC=8C=E7=94=A8=E6=88=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E5=90=84=E7=94=A8=E6=88=B7=E7=9A=84=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E5=85=A8=E9=83=A8=E4=B8=BA=E7=A9=BA=E4=BA=86=E3=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: alan <547533434@qq.com> --- app/models/user.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index a9d73bd31..fe6222359 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -230,7 +230,12 @@ class User < Principal #选择项目成员时显示的用户信息文字 def userInfo - info=self.nickname + ' (' + self.realname + ')'; + if self.realname.gsub(' ','') == "" || self.realname.nil? + info = self.nickname; + else + info=self.nickname + ' (' + self.realname + ')'; + end + info end ###添加留言 fq From 36e7b222bb5d2da7d8654cbd7da0739a42522466 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 22 Nov 2014 10:06:56 +0800 Subject: [PATCH 10/29] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=85=AC=E5=BC=80=E7=9A=84=E4=B9=9F?= =?UTF-8?q?=E9=9C=80=E7=99=BB=E5=BD=95=E6=89=8D=E8=83=BD=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 ++ app/controllers/attachments_controller.rb | 2 +- app/helpers/files_helper.rb | 7 ++++++- app/models/role.rb | 2 +- app/views/files/_course_list.html.erb | 11 ++++++----- app/views/files/_show_quote_resource.html.erb | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 67948a8e1..cab5ada7c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -267,6 +267,8 @@ class ApplicationController < ActionController::Base end when "contest" return true + when "Course" + allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false) else return true end diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index a57b5f8a5..b28fda55b 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -76,7 +76,7 @@ class AttachmentsController < ApplicationController candown = User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1) elsif (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course course = @attachment.container.course - candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1) + candown = User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1) elsif @attachment.container.is_a?(Course) course = @attachment.container candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1) diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 4f3f401c9..f1f4f06f4 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -72,5 +72,10 @@ module FilesHelper result end - + def get_qute_number attachment + if attachment.copy_from.nil? + return 0 + end + count = Attachment.find_by_sql("select count(*) from attachments where copy_from = #{attachment.copy_from}") + end end \ No newline at end of file diff --git a/app/models/role.rb b/app/models/role.rb index 57fccd53c..f363b52bf 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -161,7 +161,7 @@ class Role < ActiveRecord::Base if action.is_a? Hash allowed_actions.include? "#{action[:controller]}/#{action[:action]}" else - allowed_permissions.include? action + allowed_permissions.include? action end end diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index cb776aeb7..51091caae 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,8 +1,8 @@ <% delete_allowed = User.current.allowed_to?(:manage_files, course) %>

    共有 <%= User.current.member_of_course?(course) ? all_attachments.count : 0 %> 个资源

    - + <#% end %>--> + 资源列表的多样化排序将在下周上线... +

    <% curse_attachments.each do |file| %> @@ -40,7 +41,7 @@

    文件大小:<%= number_to_human_size(file.filesize) %>

    <%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%> -

    <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用0

    +

    <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%=get_qute_number file %>

    diff --git a/app/views/files/_show_quote_resource.html.erb b/app/views/files/_show_quote_resource.html.erb index ef907f40f..58b0edda0 100644 --- a/app/views/files/_show_quote_resource.html.erb +++ b/app/views/files/_show_quote_resource.html.erb @@ -1,8 +1,8 @@
    -

    将此课件引入我的课程资源库

    +
    <%= form_tag course_attach_relations_path, method: :post, remote: true, From 74f9bc64044cf0a17c9467430175adb3b1944258 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 10:07:28 +0800 Subject: [PATCH 11/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=86=E6=95=B0=E9=A1=B5=E9=9D=A2=E6=8A=A5?= =?UTF-8?q?500=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 5 ++++- app/views/projects/show_projects_score.html.erb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 47c8107ce..b3efdcf97 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -842,7 +842,10 @@ class ProjectsController < ApplicationController end def show_projects_score - render :layout => false + respond_to do |format| + format.html { render :layout => "project_base"} + format.js + end end def issue_score_index diff --git a/app/views/projects/show_projects_score.html.erb b/app/views/projects/show_projects_score.html.erb index 7f3f05cce..836e0a05c 100644 --- a/app/views/projects/show_projects_score.html.erb +++ b/app/views/projects/show_projects_score.html.erb @@ -66,6 +66,6 @@
    - <%= render :partial => 'projects/project_score_index', :locals => {:index => 0 } %> + <%= render :partial => 'projects/project_score_index', :locals => {:index => 0,:project => @project } %>
    <% end %> \ No newline at end of file From 8d3a2ad7a20da18ac3b8526d528a9f52c6623086 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 10:36:14 +0800 Subject: [PATCH 12/29] =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=94=B9=E4=B8=BA=E6=98=AF=E5=90=A6=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=8C=BF=E8=AF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/zh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index f01a6e6d8..9e3a13fff 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2202,4 +2202,4 @@ zh: label_submit_comments: 提交评论 field_evaluation_num: 匿评分配数量 label_my_score: 我的评分 - field_open_anonymous_evaluation: 是否开启匿评 + field_open_anonymous_evaluation: 是否使用匿评 From a95a68caec7d2aeb337f022caadc7e451bed1291 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 10:46:15 +0800 Subject: [PATCH 13/29] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7js=E6=82=AC=E6=B5=AE=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_courses.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index bc665ea41..6cdc19471 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -24,7 +24,7 @@ - +<%= render :partial => 'courses/course_ad' %>
    From dacad260105fa9ac8e1ef1c8de9b5df35a893dc9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 11:19:58 +0800 Subject: [PATCH 14/29] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BD=9C=E5=93=81=E6=8F=8F=E8=BF=B0=20?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=E4=BD=9C=E5=93=81=E5=90=8D=E7=A7=B0=E5=92=8C?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=8F=8F=E8=BF=B0=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=8F=8F=E8=BF=B0=E4=B8=8D=E8=83=BD=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/new.html.erb | 32 ++++++++++++++++++++------ public/stylesheets/css.css | 2 +- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index a1e5028dc..5a512c800 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -2,11 +2,11 @@
    @@ -55,13 +72,14 @@

    -

    diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index e756213ab..19b68743a 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -128,7 +128,7 @@ a:hover.ping_sub{ background:#14a8b9;} .w430{ width:430px;} .w350{ width:350px;} -.w620{ width:580px; height:160px; border:1px solid #CCC;} +.w620{ width:580px; height:160px; border:1px solid #CCC !important; padding-left: 3px !important;} .bo{height:26px; border:1px solid #CCC !important; padding: 0 !important;} a.tijiao{ height:28px !important; display:block !important; width:80px !important; color:#fff !important; background:#15bccf !important; text-align:center !important; padding-top:4px !important; float:left !important; margin-right:10px !important;} a:hover.tijiao{ background:#0f99a9 !important;} From 9908a7f41f9d7e0da3c5641ec6ce99e94be59695 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 12:40:53 +0800 Subject: [PATCH 15/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E5=90=AF=E5=8A=A8=E5=8C=BF=E8=AF=84=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 4 ++-- app/views/layouts/base_homework.html.erb | 14 +++++++++++++- .../redpenny-master/stylesheets/application.css | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index aadc93fa4..8a6b276b3 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -27,8 +27,8 @@ background: #15bccf; color: #fff; text-align: center; - padding-top: 3px; - padding-left: 3px; + padding: 5px !important; + display: none; } .span_wping a:hover{ background-color:#03a1b3;} diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index b3336fb46..ec6214493 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -21,6 +21,18 @@ <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> + + <% course = @bid.courses.first %> @@ -107,7 +119,7 @@ <% if @bid.open_anonymous_evaluation == 1%> - + <% case @bid.comment_status %> <% when 0 %> <%= link_to '启动匿评', alert_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...' %> diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index f683607cf..e10c5a91b 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -498,7 +498,7 @@ color: #000000; #sidebar a,#sidebar a.selected { display:inline-block; - padding:4px 4px 4px 21px !important; + padding:4px 4px 4px 21px; transition:all .2s linear; -moz-transition:all .2s linear; -o-transition:all .2s linear; @@ -1641,7 +1641,7 @@ div.left_wf a { #sidebar a, #sidebar a.selected{ display: inline-block; - padding: 0px !important; + padding: 0px; transition: all 0.2s linear 0s; } From 287e9151a2ec56edef11c07fb99e7a6f7e35d249 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 12:43:42 +0800 Subject: [PATCH 16/29] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=99=84=E4=BB=B6=EF=BC=8C=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=99=84=E4=BB=B6=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_homework.html.erb | 41 ++++++++++++------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index ec6214493..811540323 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -161,31 +161,30 @@

    -
    - - - - - - +
    - - <%= l(:label_attachment) %> : - -
    - <% if @bid.attachments.any?%> + <% unless @bid.attachments.empty? %> +
    + + + + + + - - - - - -
    + + <%= l(:label_attachment) %> : + +
    <% options = {:author => true,:deletable => (@bid.author.id == User.current.id || User.current.admin? ? true : false),:wrap => true,:length => 7} %> <%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %> - <% end %> -
    -
    +
    +
    + <% end%>
    From 06a513b2ee41b687b0d9ae1726012fb29b335880 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 12:47:40 +0800 Subject: [PATCH 17/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8D=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=A1=B9=E7=9B=AE=E6=97=B6=E7=9A=84<>=E4=B8=BA?= =?UTF-8?q?=20NO=20PROJECT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/homework_attach_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index 750a71f6a..6965eca07 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -60,7 +60,7 @@ module HomeworkAttachHelper memberships = User.current.memberships.all(:conditions => cond) projects = memberships.map(&:project) not_have_project = [] - not_have_project << "<>" + not_have_project << "NO PROJECT" not_have_project << 0 type = [] type << not_have_project From 436cf1175f85291016b3039cd36dbe84d5967484 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 22 Nov 2014 13:45:17 +0800 Subject: [PATCH 18/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A8=A1=E5=9D=97=E7=9B=B8=E5=85=B3=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/controllers/attachments_controller.rb | 2 +- app/controllers/files_controller.rb | 10 ++++--- app/helpers/files_helper.rb | 10 +++++++ app/views/files/_course_list.html.erb | 20 +++++++------- app/views/tags/_tag_list.html.erb | 6 ++--- config/locales/en.yml | 3 ++- config/locales/zh.yml | 1 + public/stylesheets/resource.css | 33 +++++++++++++++++++---- 8 files changed, 62 insertions(+), 23 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index b28fda55b..5c3503718 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -366,7 +366,7 @@ class AttachmentsController < ApplicationController end rescue NoMethodError @save_flag = false - @save_message = [] << l(:error_attachment_empty) + @save_message = [] << l(:label_course_empty_select) respond_to do |format| format.js end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 6de800efc..251496e30 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -26,13 +26,15 @@ class FilesController < ApplicationController helper :sort include SortHelper + include FilesHelper helper :project_score def show_attachments obj - @all_attachments = [] + @attachments = [] obj.each do |container| - @all_attachments += container.attachments + @attachments += container.attachments end + @all_attachments = visable_attachemnts(@attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @@ -48,9 +50,11 @@ class FilesController < ApplicationController #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? if params[:insite] @result = find_public_attache q + @result = visable_attachemnts @result @searched_attach = paginateHelper @result,10 else @result = find_course_attache q,@course + @result = visable_attachemnts @result @searched_attach = paginateHelper @result,10 end @@ -69,7 +73,7 @@ class FilesController < ApplicationController # StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map # 此时内容不多速度还可,但文件增长,每条判断多则进行3-4次表连接。 # 现在还木有思路 药丸 - resultSet = Attachment.where("attachments.container_type IS NOT NULL AND (is_public = 1 OR author_id = #{User.current.id}) AND filename LIKE :like ", like: "%#{keywords}%"). + resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%"). reorder("created_on DESC") end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index f1f4f06f4..cd7603c65 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -72,6 +72,16 @@ module FilesHelper result end + def visable_attachemnts attachments + result = [] + attachments.each do |attachment| + if attachment.is_public? || attachment.author_id == User.current.id + result << attachment + end + end + result + end + def get_qute_number attachment if attachment.copy_from.nil? return 0 diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 51091caae..b8d0ad098 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,6 +1,6 @@ <% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
    -

    共有 <%= User.current.member_of_course?(course) ? all_attachments.count : 0 %> 个资源

    +

    共有 <%= all_attachments.count%> 个资源

    <% end %> - + <% else %> + <%= link_to "选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true %> + <% end %> <% else %> - <%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> <% end %>

    @@ -41,7 +41,7 @@

    文件大小:<%= number_to_human_size(file.filesize) %>

    <%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%> -

    <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%=get_qute_number file %>

    +

    <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  

    diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index c815d71f8..549ed1751 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -14,7 +14,7 @@ <% end %> <% else %> - -    <%= l(:label_tags_no) %> - + + <% end %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 94272b1fd..22b0df023 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1851,4 +1851,5 @@ en: label_teacher_comments: Teacher comments label_anonymous_comments: Anonymous comments label_anonymous: Anonymous - label_submit_comments: Submit_comments \ No newline at end of file + label_submit_comments: Submit_comments + label_course_empty_select: You have not selected course! \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3f4267b76..bad27274f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2204,3 +2204,4 @@ zh: field_evaluation_num: 匿评分配数量 label_my_score: 我的评分 field_open_anonymous_evaluation: 是否开启匿评 + label_course_empty_select: 尚未选择课程! diff --git a/public/stylesheets/resource.css b/public/stylesheets/resource.css index fc6b74b75..86ff85825 100644 --- a/public/stylesheets/resource.css +++ b/public/stylesheets/resource.css @@ -1,4 +1,4 @@ -body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;} +body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9 !important; background:#fff !important; font-style:normal !important;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,form,span,textarea{ margin:0; padding:0;} div,img,tr,td,textarea{ border:0;} table,tr,td{border:0; cellspacing:0; cellpadding:0;} @@ -52,10 +52,33 @@ a:hover.re_fabu{background:#55a1b9 !important;} .re_con{ margin:5px; width:683px;} .re_con_top{color:#494949; } .re_con_top span{ color:#999999; font-weight:bold;} -a.re_select{ display:block; width:88px; height:22px; background:url(images/pic_select01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;} -a:hover.re_select{background:url(images/pic_select02.png) 0 0 no-repeat;} -.re_open{display:block; width:46px; height:22px; background:url(images/pic_open01.png) 0 0 no-repeat; color:#fff !important; font-weight:bold; margin-left:10px;} -a:hover.re_open{background:url(images/pic_open02.png) 0 0 no-repeat;} +a.re_select{ + display: block; + height: 22px; + border: 1px solid #ff9900; + color: #ff9900; + margin-left: 10px; + padding-left: 10px; + padding-right: 10px; +} +a:hover.re_select{ + background: #ff9900; + color: #fff; + text-decoration: none;} +.re_open{ + display: block !important; + width: 46px !important; + height: 22px !important; + border: 1px solid #64bdd9 !important; + color: #64bdd9 !important; + margin-left: 10px !important; +} +a:hover.re_open +{ + background: #64bdd9; + color: #fff !important; + text-decoration: none !important; +} a.re_de{ color:#6883b6; margin-left:15px;} .re_con_box{ border-bottom:1px dashed #dadada; padding:10px 0;} /****翻页***/ From 62b6572d928774db8026612c389ee0cec01d7d24 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 13:53:40 +0800 Subject: [PATCH 19/29] 111 --- config/locales/zh.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 92db9cad0..7d6cc85b2 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2204,5 +2204,4 @@ zh: field_evaluation_num: 匿评分配数量 label_my_score: 我的评分 field_open_anonymous_evaluation: 是否使用匿评 - field_open_anonymous_evaluation: 是否开启匿评 label_course_empty_select: 尚未选择课程! From 8414e92bbe99e9717baddc55d678add1e5c574fc Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 22 Nov 2014 15:25:51 +0800 Subject: [PATCH 20/29] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E8=B7=B3=E8=BD=AC=E5=88=B0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=89=98=E7=AE=A1=E5=B9=B3=E5=8F=B0=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 2a5792e36..94717a4ce 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -163,7 +163,7 @@ class WelcomeController < ApplicationController return 0 elsif url.include?(Setting.host_user.gsub('/','')) - redirect_to(:controller => "users", :action => "index") + #redirect_to(:controller => "users", :action => "index") end From 0a6574b54284ae5fa44ede301410df4ce60a605e Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 22 Nov 2014 15:35:28 +0800 Subject: [PATCH 21/29] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B=E6=8C=89=E9=92=AE=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=89=80=E6=9C=89=E4=BA=BA=E9=83=BD?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_more_course.html.erb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/welcome/_more_course.html.erb b/app/views/welcome/_more_course.html.erb index 8d0f1564c..2c8d92719 100644 --- a/app/views/welcome/_more_course.html.erb +++ b/app/views/welcome/_more_course.html.erb @@ -1,8 +1,6 @@ <% if User.current.logged?%> - <% if User.current.user_extensions.identity == 0 %> <%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_course,nil, :global => true) %> - <% end %>      <%= link_to l(:label_course_join_student), join_private_courses_courses_path ,:remote => true, :class => 'icon icon-add' %>      From 13bf91f954244578275c9f7d02bee56ad314ebb1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 15:50:14 +0800 Subject: [PATCH 22/29] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E4=B8=AD=E3=80=81=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E3=80=81=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E3=80=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=AD=89=E6=8C=89=E9=92=AE=E4=B8=8D=E8=A7=81=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=E4=BF=AE=E6=94=B9=E5=8C=BF=E8=AF=84=E3=80=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=84=E8=AE=BA=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 1 - db/schema.rb | 3 ++- public/stylesheets/css.css | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 8a6b276b3..c29b784b0 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -28,7 +28,6 @@ color: #fff; text-align: center; padding: 5px !important; - display: none; } .span_wping a:hover{ background-color:#03a1b3;} diff --git a/db/schema.rb b/db/schema.rb index 2e664eaa7..973e2afbe 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 => 20141119011439) do +ActiveRecord::Schema.define(:version => 20141120091234) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,6 +52,7 @@ ActiveRecord::Schema.define(:version => 20141119011439) do t.string "disk_directory" t.integer "attachtype", :default => 1 t.integer "is_public", :default => 1 + t.integer "copy_from" end add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 19b68743a..b85b6ae73 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -42,7 +42,7 @@ a:hover.tb_all{ background:#eaeaea; text-decoration:none;} .dis ul li.wdown a{padding-top:25px; color:#3d7ec2; margin-right:35px;} .wscore{ padding-top:25px; color:#888888; width:96px;} .dis ul li.wping{margin-left:12px; } -.dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:3px;} +.dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:8px;} .dis ul li.wping a:hover{ background-color:#03a1b3;} ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px;line-height: 1.9; } .wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;} @@ -84,7 +84,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} .ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;} .ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;} a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;} -a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;} +a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;line-height: 1.9;} a:hover.ping_sub{ background:#14a8b9;} .recall{ border-top:1px solid #CCC; padding:5px 0;} .recall_head{ float:left;} From ca7b56cbf005e12a8a9042fe5ce30c8bb5e129d8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 15:56:42 +0800 Subject: [PATCH 23/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=93=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=8F=90=E4=BA=A4=E5=A4=A7=E4=BA=8E=E7=AD=89=E4=BA=8E?= =?UTF-8?q?2=E4=BB=BD=E6=97=B6=E6=89=8D=E6=98=BE=E7=A4=BA=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=8C=BF=E8=AF=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 2 +- app/views/layouts/base_homework.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index c29b784b0..107ee5bba 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -75,7 +75,7 @@ <% end %> <% end %> <% if (User.current.admin?||User.current.id==bid.author_id) %> - <% if bid.open_anonymous_evaluation == 1%> + <% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%> <% case bid.comment_status %> <% when 0 %> diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 811540323..c3028c8f1 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -118,7 +118,7 @@ <% if (User.current.admin?||User.current.id==@bid.author_id) %> - <% if @bid.open_anonymous_evaluation == 1%> + <% if @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2%> <% case @bid.comment_status %> <% when 0 %> From 88ab53730b831fb9a06f43ad19bd1b96ad47d9aa Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 22 Nov 2014 17:45:09 +0800 Subject: [PATCH 24/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E3=80=8A=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=AF=86=E7=A0=81=E9=94=99=E8=AF=AF=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E3=80=8B=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index fe6222359..48254ef90 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -364,7 +364,9 @@ class User < Principal end end end - last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + unless user.nil? + last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + end user.update_column(:last_login_on, Time.now) if user && !user.new_record? [user, last_login_on] rescue => text From 3417b2bce198677f3e303b358d275ba9ffe95571 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 22 Nov 2014 22:50:48 +0800 Subject: [PATCH 25/29] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E3=80=8A=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=B7=B3=E8=BD=AC=E3=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: alan <547533434@qq.com> --- app/controllers/account_controller.rb | 30 ++++++++++++--------------- app/models/user.rb | 8 +++---- app/views/account/login.html.erb | 5 ++++- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index b5975e452..aedfc7407 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -234,7 +234,7 @@ class AccountController < ApplicationController end def password_authentication - user, last_login_on = User.try_to_login(params[:username], params[:password]) + user = User.try_to_login(params[:username], params[:password]) if user.nil? invalid_credentials @@ -244,7 +244,7 @@ class AccountController < ApplicationController onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) else # Valid user - successful_authentication(user, last_login_on) + successful_authentication(user) end end @@ -291,7 +291,7 @@ class AccountController < ApplicationController end end - def successful_authentication(user, last_login_on) + def successful_authentication(user) logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}" # Valid user self.logged_user = user @@ -302,20 +302,16 @@ class AccountController < ApplicationController call_hook(:controller_account_success_authentication_after, {:user => user }) code = /\d*/ - #根据home_url生产正则表达式 - eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") - if code=~params[:back_url] && last_login_on != '' - redirect_to user_activities_path(user) - else - if last_login_on == '' - redirect_to my_account_url - else - #by young - #redirect_back_or_default my_page_path - #sredirect_back_or_default User.current - redirect_to my_account_url - #redirect_to User.current - end + #根据home_url生产正则表达式 + eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") + if code=~params[:back_url] + redirect_to user_activities_path(user) + else + + #by young + #redirect_back_or_default my_page_path + redirect_back_or_default User.current + end end diff --git a/app/models/user.rb b/app/models/user.rb index 48254ef90..8e6f121b0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -364,11 +364,11 @@ class User < Principal end end end - unless user.nil? - last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + if user && !user.new_record? + #last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + user.update_column(:last_login_on, Time.now) end - user.update_column(:last_login_on, Time.now) if user && !user.new_record? - [user, last_login_on] + user rescue => text raise text end diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 1115ca80e..4175282b3 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -20,7 +20,10 @@ } } - + + + +
    <%= form_tag(signin_path) do %> <%= back_url_hidden_field_tag %> From 949867c50bf9cec009a65b17fb4f8e8167ca71bd Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sun, 23 Nov 2014 09:36:47 +0800 Subject: [PATCH 26/29] Signed-off-by: alan <547533434@qq.com> --- app/controllers/account_controller.rb | 30 +++++++++++++++------------ app/models/user.rb | 4 ++-- public/javascripts/application.js | 8 +++++++ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index aedfc7407..279e89f13 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -234,7 +234,7 @@ class AccountController < ApplicationController end def password_authentication - user = User.try_to_login(params[:username], params[:password]) + user, last_login_on = User.try_to_login(params[:username], params[:password]) if user.nil? invalid_credentials @@ -244,7 +244,7 @@ class AccountController < ApplicationController onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) else # Valid user - successful_authentication(user) + successful_authentication(user, last_login_on) end end @@ -291,7 +291,7 @@ class AccountController < ApplicationController end end - def successful_authentication(user) + def successful_authentication(user, last_login_on) logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}" # Valid user self.logged_user = user @@ -302,16 +302,20 @@ class AccountController < ApplicationController call_hook(:controller_account_success_authentication_after, {:user => user }) code = /\d*/ - #根据home_url生产正则表达式 - eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") - if code=~params[:back_url] - redirect_to user_activities_path(user) - else - - #by young - #redirect_back_or_default my_page_path - redirect_back_or_default User.current - + #根据home_url生产正则表达式 + eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") + if code=~params[:back_url] && last_login_on != '' + redirect_to user_activities_path(user) + else + if last_login_on == '' + redirect_to my_account_url + else + #by young + #redirect_back_or_default my_page_path + redirect_back_or_default User.current + #redirect_to my_account_url + #redirect_to User.current + end end end diff --git a/app/models/user.rb b/app/models/user.rb index 8e6f121b0..29709519d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -365,10 +365,10 @@ class User < Principal end end if user && !user.new_record? - #last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s + last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s user.update_column(:last_login_on, Time.now) end - user + [user, last_login_on] rescue => text raise text end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 57e3e32b8..42f345d15 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -2,6 +2,14 @@ /* Redmine - project management software Copyright (C) 2006-2013 Jean-Philippe Lang */ +$(function() { + $.ajaxSetup({ + beforeSend: function ( xhr ) { + xhr.setRequestHeader("Accept", "text/javascript") + } + }) +} + function cleanArray (actual){ var newArray = new Array(); for (var i = 0; i< actual.length; i++){ From 6963d494ae73e426c40df93d5665eee3015f5aff Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sun, 23 Nov 2014 10:44:51 +0800 Subject: [PATCH 27/29] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E3=80=8A=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E3=80=8B=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 48 +- app/models/user.rb | 27 +- app/views/account/login.html.erb | 40 +- app/views/account/register.html.erb | 615 +++++++++--- app/views/my/account.html.erb | 1301 +++++++++++-------------- 5 files changed, 1102 insertions(+), 929 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 279e89f13..2e9ac74c5 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -66,7 +66,7 @@ class AccountController < ApplicationController if @user.save @token.destroy flash[:notice] = l(:notice_account_password_updated) - redirect_to signin_url + redirect_to signin_path return end end @@ -92,7 +92,7 @@ class AccountController < ApplicationController Mailer.lost_password(token).deliver end flash[:notice] = l(:notice_account_lost_email_sent) - redirect_to signin_url + redirect_to signin_path return end end @@ -103,7 +103,7 @@ class AccountController < ApplicationController def register # @root_path="/home/pdl/redmine-2.3.2-0/apache2/" # - #@cache_identityy = params[:identity]||"" #身份 + @cache_identityy = params[:identity]||"" #身份 @cache_no = params[:no]||"" #学号 @cache_technical_title = params[:technical_title]||"" #教师职称 @cache_province = params[:province]||"" #省份 @@ -144,7 +144,22 @@ class AccountController < ApplicationController @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation] end - + if(@cache_identityy == "") + if params[:identity] == "2" + @user.firstname = firstname_code + @user.lastname = lastname_code + end + flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty') + return + end + if(@cache_city == "") + if params[:identity] == "2" + @user.firstname = firstname_code + @user.lastname = lastname_code + end + flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty') + return + end case Setting.self_registration when '1' @@ -189,7 +204,7 @@ class AccountController < ApplicationController token.destroy flash[:notice] = l(:notice_account_activated) end - redirect_to signin_url + redirect_to signin_path end def valid_ajax @@ -219,10 +234,6 @@ class AccountController < ApplicationController render :json => req end - def email_valid - - end - private def authenticate_user @@ -234,7 +245,7 @@ class AccountController < ApplicationController end def password_authentication - user, last_login_on = User.try_to_login(params[:username], params[:password]) + user = User.try_to_login(params[:username], params[:password]) if user.nil? invalid_credentials @@ -244,7 +255,7 @@ class AccountController < ApplicationController onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) else # Valid user - successful_authentication(user, last_login_on) + successful_authentication(user) end end @@ -291,7 +302,7 @@ class AccountController < ApplicationController end end - def successful_authentication(user, last_login_on) + def successful_authentication(user) logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}" # Valid user self.logged_user = user @@ -304,18 +315,13 @@ class AccountController < ApplicationController code = /\d*/ #根据home_url生产正则表达式 eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") - if code=~params[:back_url] && last_login_on != '' + if code=~params[:back_url] redirect_to user_activities_path(user) else - if last_login_on == '' - redirect_to my_account_url - else #by young #redirect_back_or_default my_page_path redirect_back_or_default User.current - #redirect_to my_account_url #redirect_to User.current - end end end @@ -357,7 +363,7 @@ class AccountController < ApplicationController UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) Mailer.register(token).deliver flash[:notice] = l(:notice_account_register_done) - render action: 'email_valid', locals: {:mail => user.mail} + redirect_to signin_path else yield if block_given? end @@ -374,7 +380,7 @@ class AccountController < ApplicationController UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) self.logged_user = user flash[:notice] = l(:notice_account_activated) - redirect_to my_account_url + redirect_to my_account_path else yield if block_given? end @@ -396,6 +402,6 @@ class AccountController < ApplicationController def account_pending flash[:notice] = l(:notice_account_pending) - redirect_to signin_url + redirect_to signin_path end end diff --git a/app/models/user.rb b/app/models/user.rb index 29709519d..78bfc75f0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -75,7 +75,6 @@ class User < Principal has_many :homework_users has_many :homework_attaches, :through => :homework_users - has_many :homework_evaluations has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, :after_remove => Proc.new {|user, group| group.user_removed(user)} @@ -168,7 +167,7 @@ class User < Principal LOGIN_LENGTH_LIMIT = 25 MAIL_LENGTH_LIMIT = 60 - validates_presence_of :login, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } + validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false # Login must contain letters, numbers, underscores only @@ -199,19 +198,13 @@ class User < Principal } scope :sorted, lambda { order(*User.fields_for_order_statement)} - scope :like, lambda {|arg, type| + scope :like, lambda {|arg| if arg.blank? where(nil) else pattern = "%#{arg.to_s.strip.downcase}%" #where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) - if type == "0" - where(" LOWER(login) LIKE :p ", :p => pattern) - elsif type == "1" - where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) - else - where(" LOWER(mail) LIKE :p ", :p => pattern) - end + where(" LOWER(login) LIKE :p ", :p => pattern) end } @@ -230,12 +223,7 @@ class User < Principal #选择项目成员时显示的用户信息文字 def userInfo - if self.realname.gsub(' ','') == "" || self.realname.nil? - info = self.nickname; - else - info=self.nickname + ' (' + self.realname + ')'; - end - info + info=self.nickname + ' (' + self.realname + ')'; end ###添加留言 fq @@ -364,11 +352,8 @@ class User < Principal end end end - if user && !user.new_record? - last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s - user.update_column(:last_login_on, Time.now) - end - [user, last_login_on] + user.update_column(:last_login_on, Time.now) if user && !user.new_record? + user rescue => text raise text end diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 4175282b3..20b0c5c04 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -20,20 +20,13 @@ } } - - - - +
    <%= form_tag(signin_path) do %> <%= back_url_hidden_field_tag %> - + - - + + <% if Setting.openid? %> - - + + <% end %>
    - - <%= text_field_tag 'username', params[:username], :tabindex => '1' , :value => "#{l(:label_login_prompt)}", :onfocus => "clearInfo('username','#{l(:label_login_prompt)}')", @@ -42,48 +35,33 @@
    - - - <%= password_field_tag 'password', nil, :tabindex => '2' %> - <%= password_field_tag 'password', nil, :tabindex => '2' %>
    - - - <%= text_field_tag "openid_url", nil, :tabindex => '3' %> - <%= text_field_tag "openid_url", nil, :tabindex => '3' %>
    <% if Setting.autologin? %> - + <% end %>
    - - <% if Setting.lost_password? %> + <% if Setting.lost_password? %> <%= link_to l(:label_password_lost), lost_password_path %> <% end %> +
    diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 0bebfdf5f..21c8c11b9 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -1,127 +1,490 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> - - - - - - -

    <%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

    - -<%= labelled_form_for @user, :url => register_path do |f| %> - <%= error_messages_for 'user' %> -
    - - <% if @user.auth_source_id.nil? %> -

    <%= f.text_field :login, :size => 25, :required => true %> - <%= l(:label_max_number) %> -

    -

    <%= f.password_field :password, :size => 25, :required => true %> - <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %> -

    -

    <%= f.password_field :password_confirmation, :size => 25, :required => true %>

    - <% end %> - -

    - <%= f.text_field :mail,:size => 25, :required => true %> - -

    -

    - -

    <%= "#{l(:label_mail_attention)} " %>

    -

    <%= "#{l(:label_mail_attention1)} " %>

    -
    -

    - - - - -
    - -

    - - - - -
    <%= submit_tag l(:button_submit) %>
    -

    -<% end %> -<% if Setting.openid? %> -

    <%= f.text_field :identity_url %>

    -<% end %> -<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %> -

    <%= custom_field_tag_with_label :user, value %>

    -<% end %> -
    -<% password_min_length = Setting.password_min_length %> - + + + + + +

    <%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

    + +<%= labelled_form_for @user, :url => register_path do |f| %> + <%= error_messages_for 'user' %> + +
    +

    + + + + + + +
    + <%= l(:label_identity) %> * + + + + +<% else %> +<%= text_field_tag :no, nil, :placeholder => "请输入学号" %> +<% end %> +
    +

    + + <% if @user.auth_source_id.nil? %> +

    <%= f.text_field :login, :size => 25, :required => true %> + <%= l(:label_max_number) %>

    + +

    <%= f.password_field :password, :size => 25, :required => true %> + <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>

    + +

    <%= f.password_field :password_confirmation, :size => 25, :required => true %>

    + <% end %> + + + +

    <%= f.text_field :mail, :required => true %>

    + +

    + <%= "#{l(:label_mail_attention)} " %>

    + +

    <%= f.select :language, lang_options_for_select, :required => true %>

    + + + + + + +

    + + + + + + +
    + <%= l(:label_location) %> * + + + + +
    +

    + +
    + +

    + + + + +
    <%= submit_tag l(:button_submit) %>
    +

    +<% end %> + +<% if Setting.openid? %> +

    <%= f.text_field :identity_url %>

    +<% end %> + + +<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %> +

    <%= custom_field_tag_with_label :user, value %>

    +<% end %> +
    + + + + \ No newline at end of file diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 277a6eaca..a57e35e65 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,731 +1,572 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> - - - - -
    - <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> - <%= call_hook(:view_my_account_contextual, :user => @user) %> -
    - -

    - <%= l(:label_my_account) %> -

    -<%= error_messages_for 'user' %> -
    -<%= labelled_form_for :user, @user, - :url => {:action => "account"}, - :html => {:id => 'my_account_form', - - :method => :post} do |f| %> - - - - - - - - - <%= submit_tag l(:button_save) %> -
    -<% end %> -<% html_title(l(:label_my_account)) -%> - - + + + + + + +
    + <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> + <%= call_hook(:view_my_account_contextual, :user => @user) %> +
    + +

    <%= l(:label_my_account) %>

    +<%= error_messages_for 'user' %> + +
    + +<%= labelled_form_for :user, @user, + :url => {:action => "account"}, + :html => {:id => 'my_account_form', + :method => :post} do |f| %> + + + + + + + + + <%= submit_tag l(:button_save) %> +
    +<% end %> +<% html_title(l(:label_my_account)) -%> + + \ No newline at end of file From 4221f5edb310287f07f005945f70b4a48ad9a1c2 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sun, 23 Nov 2014 11:48:59 +0800 Subject: [PATCH 28/29] =?UTF-8?q?<=E8=BF=98=E5=8E=9F>=20Signed-off-by:=20a?= =?UTF-8?q?lan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32cfefa9d..cab5ada7c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -124,7 +124,7 @@ class ApplicationController < ActionController::Base else # HTTP Basic, either username/password or API key/random authenticate_with_http_basic do |username, password| - user = User.try_to_login(username, password)[0] || User.find_by_api_key(username) + user = User.try_to_login(username, password) || User.find_by_api_key(username) end end # Switch user if requested by an admin user From 90e4387395a918ce3e9ef7954872e5b719377885 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 24 Nov 2014 09:08:49 +0800 Subject: [PATCH 29/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95=20Si?= =?UTF-8?q?gned-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 1 + public/javascripts/application.js | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4ba8ecf6c..6916219a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -125,6 +125,7 @@ GEM mocha (1.1.0) metaclass (~> 0.0.1) multi_json (1.10.1) + mysql2 (0.3.11) mysql2 (0.3.11-x86-mingw32) net-ldap (0.3.1) nokogiri (1.6.3) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 42f345d15..7e8080a4a 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -2,13 +2,7 @@ /* Redmine - project management software Copyright (C) 2006-2013 Jean-Philippe Lang */ -$(function() { - $.ajaxSetup({ - beforeSend: function ( xhr ) { - xhr.setRequestHeader("Accept", "text/javascript") - } - }) -} + function cleanArray (actual){ var newArray = new Array(); @@ -397,6 +391,7 @@ function submitPreview(url, form, target) { $.ajax({ url: url, type: 'post', + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, data: $('#'+form).serialize(), success: function(data){ $('#'+target).html(data); @@ -441,6 +436,7 @@ function scmEntryClick(id, url) { el.addClass('loading'); $.ajax({ url: url, + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, success: function(data){ el.after(data); el.addClass('open').addClass('loaded').removeClass('loading'); @@ -462,6 +458,7 @@ function randomKey(size) { function updateIssueFrom(url) { $.ajax({ url: url, + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, type: 'post', data: $('#issue-form').serialize() }); @@ -470,6 +467,7 @@ function updateIssueFrom(url) { function updateBulkEditFrom(url) { $.ajax({ url: url, + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, type: 'post', data: $('#bulk_edit_form').serialize() }); @@ -508,6 +506,7 @@ function observeSearchfield(fieldId, targetId, url) { $.ajax({ url: url, type: 'get', + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, data: {q: $this.val()}, success: function(data){ if(targetId) $('#'+targetId).html(data); }, beforeSend: function(){ $this.addClass('ajax-loading'); }, @@ -548,6 +547,7 @@ function initMyPageSortable(list, url) { $.ajax({ url: url, type: 'post', + beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})} }); } @@ -629,6 +629,14 @@ function transpotUrl (scope) { $(document).ready(setupAjaxIndicator); $(document).ready(hideOnLoad); $(document).ready(addFormObserversForDoubleSubmit); +$(document).ready(function(){ + $.ajaxSetup({ + headers: { + 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') + } + }); + } +) function img_thumbnails() { $('.thumbnails a').colorbox({rel:'nofollow'});