From 228857f20c8b72506acda073c1bc4d37af91c2c8 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 20 Feb 2016 17:23:24 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/org.css | 6 ++++-- public/stylesheets/public.css | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 4d09449b4..02b2e71bb 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -69,7 +69,7 @@ a.linkGrey8:hover {color:#585858;} .orgMenuArrow2 {background:url(../images/nav_icon.png) -10px -132px no-repeat; position:relative; display:inline-block; width:20px; height:30px;} .org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;} -#orgUserName {display:inline-block;} +#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;} .org_login_list a {color:#269ac9;} .orgListStatus {width:55px; float:left;} @@ -113,4 +113,6 @@ div.flash {margin-top :0px !important} .blueBtn:hover {background-color:#298fbd;} /*文本描述展开高度*/ .maxh360 {max-height: 810px;} -.lh18 { line-height: 18px;} \ No newline at end of file +.lh18 { line-height: 18px;} + +a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;} \ No newline at end of file diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 285cac3bc..80c219350 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -255,6 +255,7 @@ a.bBlue {background-color:#3498db;} a.bBlue:hover {background-color:#297fb8;} a.submit_btn {border:1px solid #3498db; padding:3px 10px; border-radius:3px; color:#3498db;} a.submit_btn:hover {background-color:#3498db; color:#ffffff;} +a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;} /* commonBtn */ .grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center;padding:2px 10px;} From 808f9a6b7a138fcb9cb93c9b50bc997fddf8c24a Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 20 Feb 2016 17:40:00 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8F=B3=E4=B8=8A=E8=A7=92=E6=A0=B7=E5=BC=8F=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/org.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 02b2e71bb..06c8022c6 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -69,7 +69,7 @@ a.linkGrey8:hover {color:#585858;} .orgMenuArrow2 {background:url(../images/nav_icon.png) -10px -132px no-repeat; position:relative; display:inline-block; width:20px; height:30px;} .org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;} -#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;} +#orgUserName {display:inline-block;} .org_login_list a {color:#269ac9;} .orgListStatus {width:55px; float:left;} From d84da7908d535f3661f162a0e2e1f35018e735b2 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 20 Feb 2016 17:43:15 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E9=97=AE=E5=8D=B7=E8=B0=83=E6=9F=A5=E7=BB=93=E6=9E=9C=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 75b07557e..b04f96db5 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -62,7 +62,7 @@ <% if has_commit%>
  • <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%>
  • <%else%> -
  • 统计结果
  • +
  • 统计结果
  • <%end%> <% end %> <% end%> \ No newline at end of file From 935ddc053a62d006524a29e4ffc52b783c036ef1 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 20 Feb 2016 17:48:45 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=A1=B9=E7=9B=AE500?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/_new_repositories.html.erb | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index 6f01bf65c..43535153d 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -60,31 +60,6 @@ <% end %> -<<<<<<< HEAD -<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post"} do |f| %> -
    -
      -
    • - - <%= label_tag('repository_scm', - options_for_select(["Git"],@repository.class.name.demodulize), - :data => {:remote => true, :method => 'get'})%> - <% if @repository && ! @repository.class.scm_available %> - <%= l(:text_scm_command_not_available) %> - <% end %> -
    • - <% unless judge_main_repository(@project) %> -
    • - - <%= f.check_box :is_default, :label => "", :no_label => true %>

      -
    • - <% end %> -
    • - - <%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %> - <% unless @repository.identifier_frozen? %> - <%=l(:text_length_between,:min=>1,:max=>254)< -======= <% if @project.repositories.any? %> <%= render :partial => 'projects/settings/rep_gitlab', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %> <%#= render :partial => 'projects/settings/rep_forge', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %> @@ -109,7 +84,6 @@ <%=h truncate(repository.url,:length=>10) %> <% end %> ->>>>>>> develop <% end %> From 3369183fb75d92d653c8ef2c9a349593595bf69d Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 20 Feb 2016 18:16:07 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=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 --- .../20160220100507_update_course_term.rb | 19 +++++++++++++++++++ db/schema.rb | 5 ++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20160220100507_update_course_term.rb diff --git a/db/migrate/20160220100507_update_course_term.rb b/db/migrate/20160220100507_update_course_term.rb new file mode 100644 index 000000000..afd849779 --- /dev/null +++ b/db/migrate/20160220100507_update_course_term.rb @@ -0,0 +1,19 @@ +class UpdateCourseTerm < ActiveRecord::Migration + def up + count = Course.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + Course.page(i).per(30).each do |course| + if course.end_time.nil? && course.end_term.nil? + course.end_time = course.time + course.end_term = course.term + course.save + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 1c9866602..c22b79790 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 => 20160202034530) do +ActiveRecord::Schema.define(:version => 20160220100507) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1219,7 +1219,6 @@ ActiveRecord::Schema.define(:version => 20160202034530) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" - t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end @@ -1374,7 +1373,7 @@ ActiveRecord::Schema.define(:version => 20160202034530) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 - t.integer "act_num", :default => 0 + t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" end From ba66425befaf5b624dff25e24f597e0983c0ed50 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 20 Feb 2016 18:26:52 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E6=8A=A5?= =?UTF-8?q?500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 36 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e0afc38ae..e6ff904f3 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -98,14 +98,22 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + @stundet_works = [] + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.where(:id => pro.student_work_id) + end else my_work = @homework.student_works.where(:user_id => User.current.id) end @@ -113,7 +121,11 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end @@ -134,14 +146,22 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + @stundet_works = [] + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.where(:id => pro.student_work_id) + end else my_work = @homework.student_works.where(:user_id => User.current.id) end @@ -149,7 +169,11 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end From c1a84e2ce5141fa6ab810b22aea3d67725bf0926 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 22 Feb 2016 11:14:26 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8F=B3=E4=B8=8A=E8=A7=92=E7=9A=84=E7=94=A8=E6=88=B7=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=94=B9=E6=88=90https://www.trustie.net=E7=9A=84?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 9f026d69d..81c6e82a5 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -44,8 +44,8 @@
    • <% if User.current.logged? %> From 278139104b8c2e2922d2c42212bf918ce236ed11 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 22 Feb 2016 15:09:07 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E5=85=81=E8=AE=B8=E8=80=81=E5=B8=88?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=80=E5=A7=8B=E5=AD=A6=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/settings.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 617cefc93..b0c4a067f 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -139,6 +139,6 @@ $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("anonymos"); } - $("#time").click(select); - $("#term").click(select); + //$("#time").click(select); + //$("#term").click(select); From 1234bc0aefba2d5ea138dfe74051f8fcb8779979 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 22 Feb 2016 15:34:50 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AF=BC=E8=AF=AD?= =?UTF-8?q?=E4=BB=8E=E5=B8=96=E5=AD=90=E4=B8=AD=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course_activity.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index c9c6cec4b..9c1431d5d 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -67,8 +67,9 @@ class CourseActivity < ActiveRecord::Base # 导语 def add_course_lead if self.course_act_type == "Course" - name = Redmine::Configuration['course_message_lead_subject'] - content = Redmine::Configuration['course_message_lead_content'] + lead_message = Message.find(12440) + name = lead_message.subject + content = lead_message.content # message的status状态为0为正常,为1表示创建课程时发送的message message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直 From 78c70dce81ff65935ee4262334eba09ba5cec5de Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 22 Feb 2016 15:52:16 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E9=95=BF=E5=BA=A6=E5=BC=95=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E9=94=99=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 4 ++-- public/stylesheets/project.css | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index afe4740eb..76d5745df 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -36,12 +36,12 @@ <% if @changesets && !@changesets.empty? %> <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %> <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> -
      <%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %>
      +
      提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
      <%= @changesets_latest_coimmit.message %>
      <% else %> -
      <%=@changesets_latest_coimmit.author_email %>
      +
      提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
      <%= @changesets_latest_coimmit.message %>
      diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 29c099d3d..11c01aa09 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1168,3 +1168,4 @@ div.disable_link {background-color: #c1c1c1 !important;} /*问题跟踪局部修改属性*/ .proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} .proInfoBox2 ul li{ height:24px; position:relative;} +.maxwidth150{max-width: 150px;} From 2156b6db76fd977fcf48540fe015867158bbbe49 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 22 Feb 2016 16:56:37 +0800 Subject: [PATCH 11/15] =?UTF-8?q?issue=E5=9B=9E=E5=A4=8D=20Forge=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=B4=E6=96=B0=E6=8E=92=E5=BA=8F=E9=9D=A0=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journal.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/journal.rb b/app/models/journal.rb index 2da815a44..b184c82e6 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -52,6 +52,7 @@ class Journal < ActiveRecord::Base # fq after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message + after_create :update_issue_time # end #after_destroy :down_user_score #before_save :be_user_score @@ -230,4 +231,12 @@ class Journal < ActiveRecord::Base project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1) end end + + # 回复issue的时候,更新issue的时候 + def update_issue_time + if self.journalized_type == "Issue" + forge_activity = ForgeActivity.where("forge_act_id =? and forge_act_type =?", self.issue, "Issue").first + forge_activity.update_attribute(:created_at, self.created_on) unless forge_activity.nil? + end + end end From 98946b98552be3e4c8ebc6cced2ef16c6c877423 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 22 Feb 2016 18:10:20 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BC=B9=E6=A1=86=E7=9A=84=E5=BB=B6=E8=BF=9F?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 17 ++++++ app/controllers/users_controller.rb | 14 ++--- app/helpers/courses_helper.rb | 2 +- app/helpers/files_helper.rb | 3 +- app/views/files/_course_list.html.erb | 3 ++ app/views/files/_upload_course_files.erb | 53 ++++++++++++++++--- ...160222064143_add_publish_to_attachments.rb | 21 ++++++++ 7 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 db/migrate/20160222064143_add_publish_to_attachments.rb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c4932b1b2..e83a13ad9 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -488,6 +488,23 @@ class FilesController < ApplicationController if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') Mailer.run.attachments_added(attachments[:files]) end + if !attachments.empty? && attachments[:files] + attachments[:files].each do |attachment| + if params[:publish_time] + if params[:publish_time] == "" + attachment.publish_time = Date.today + else + attachment.publish_time = params[:publish_time] + end + else + attachment.publish_time = Date.today + end + if attachment.publish_time > Date.today + attachment.is_publish = 0 + end + attachment.save + end + end if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) params[:course_attachment_type].each do |type| tag_name = get_tag_name_by_type_number type diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 625a1de74..fb35d8495 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2144,22 +2144,22 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ - "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and is_publish = 1 " + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + - "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc") end elsif params[:type] == "2" #课程资源 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 - @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+ - "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and is_publish = 1)"+ + "or (container_type = 'Course' and is_public = 1 and is_publish = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "3" #项目资源 if User.current.id.to_i == params[:id].to_i diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 40ed4a21a..6d0066fbc 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -746,7 +746,7 @@ module CoursesHelper return[] unless course result = [] course.attachments.each do |attachment| - if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin? + if attachment.is_public? ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin? result << attachment end end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index bd023f6d0..6b748649b 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -123,7 +123,8 @@ module FilesHelper attachments.each do |attachment| if attachment.is_public? || (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) || - (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| + (attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))|| + (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)|| attachment.author_id == User.current.id || attachment.container_type == "OrgSubfield" result << attachment diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 47c08d2fb..d7aade6c2 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -18,6 +18,9 @@ 私有 <%end %>
      + <% if file.is_publish == 0 %> + <%=file.publish_time %>  0点发布 + <% end %>
    上传时间:<%= format_time(file.created_on)%> diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb index 6cce4bf2e..2e53f05d2 100644 --- a/app/views/files/_upload_course_files.erb +++ b/app/views/files/_upload_course_files.erb @@ -21,10 +21,20 @@ <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
    - - <%= l(:button_cancel)%> - - <%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %> + <% if User.current.allowed_to?(:as_teacher,course) %> +
    + +
    + + <%#= calendar_for('attachment_publish_time')%> +
    + +
    +
    + <% end %> + <%= l(:button_cancel)%> + <%= l(:button_confirm)%> + <%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %> <% end %> @@ -35,8 +45,39 @@ \ No newline at end of file diff --git a/db/migrate/20160222064143_add_publish_to_attachments.rb b/db/migrate/20160222064143_add_publish_to_attachments.rb new file mode 100644 index 000000000..5ca354396 --- /dev/null +++ b/db/migrate/20160222064143_add_publish_to_attachments.rb @@ -0,0 +1,21 @@ +class AddPublishToAttachments < ActiveRecord::Migration + def change + add_column :attachments, :is_publish, :integer, :default => 1 + add_column :attachments, :publish_time, :date +=begin + count = Attachment.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + Attachment.page(i).per(30).each do |atta| + begin + atta.publish_time = atta.created_on.strftime('%d-%b-%Y') + atta.save + ensure + logger.error("===================>>container_id is null") + end + end + end + end +=end + end +end From 6b4be999ee12dd494241794042cd97c27da2c586 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 22 Feb 2016 18:35:04 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/resource_publish.rake | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/tasks/resource_publish.rake diff --git a/lib/tasks/resource_publish.rake b/lib/tasks/resource_publish.rake new file mode 100644 index 000000000..2df0c6145 --- /dev/null +++ b/lib/tasks/resource_publish.rake @@ -0,0 +1,11 @@ +#coding=utf-8 + +namespace :resource_publish do + desc "start publish resource" + task :publish => :environment do + attachments = Attachment.where("publish_time = '#{Date.today}'") + attachments.each do |attachment| + attachment.update_column('is_publish', 1) + end + end +end \ No newline at end of file From e62386ad656c4708644e2cc1e8ccba372f516538 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 23 Feb 2016 09:12:50 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=B1=80=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/trustie/gitlab/helper.rb | 24 ++++++++++++++++++++++++ lib/trustie/gitlab/sync.rb | 8 +++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/trustie/gitlab/helper.rb b/lib/trustie/gitlab/helper.rb index 61c1fbd17..a306bb855 100644 --- a/lib/trustie/gitlab/helper.rb +++ b/lib/trustie/gitlab/helper.rb @@ -3,6 +3,15 @@ module Trustie module Gitlab module Helper + GUEST = 10 + REPORTER = 20 + DEVELOPER = 30 + MASTER = 40 + OWNER = 50 + # 项目公开和私有 + PUBLIC = 20 + PRIVATE = 0 + def change_password(uid, en_pwd, salt) return unless uid options = {:encrypted_password=>en_pwd, :password_salt=>salt} @@ -44,6 +53,21 @@ module Trustie self.g.delete_user(user.gid) end + def get_gitlab_role m + case m.roles.first.position + when 1,2 + GUEST + when 5 + REPORTER + when 4 + DEVELOPER + when 3 + MASTER + else + GUEST + end + end + end end end \ No newline at end of file diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index d41b813e7..2f4f77c53 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -61,7 +61,7 @@ module Trustie unless gid gid = sync_user(m.user).id end - self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER) + self.g.add_team_member(gproject.id, gid, get_gitlab_role(m)) rescue => e puts e end @@ -111,7 +111,7 @@ module Trustie unless gid gid = sync_user(m.user).id end - self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER) + self.g.add_team_member(gproject.id, gid, get_gitlab_role(m)) rescue => e puts e end @@ -125,7 +125,7 @@ module Trustie unless gid gid = sync_user(m.user).id end - self.g.add_team_member(project.gpid, gid, UserLevel::DEVELOPER) + self.g.add_team_member(project.gpid, gid, get_gitlab_role(m)) rescue => e puts e end @@ -134,6 +134,8 @@ module Trustie def remove_project end + + end end From ed7183b1a966ee41124d16fc60ca449aa6b9240c Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 23 Feb 2016 11:31:34 +0800 Subject: [PATCH 15/15] 0 --- lib/trustie/gitlab/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trustie/gitlab/helper.rb b/lib/trustie/gitlab/helper.rb index a306bb855..9fb1f5735 100644 --- a/lib/trustie/gitlab/helper.rb +++ b/lib/trustie/gitlab/helper.rb @@ -11,7 +11,7 @@ module Trustie # 项目公开和私有 PUBLIC = 20 PRIVATE = 0 - + def change_password(uid, en_pwd, salt) return unless uid options = {:encrypted_password=>en_pwd, :password_salt=>salt}