From 2e561de52500f7e1ddddea2d757d2e15a604c42f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 31 Jul 2015 16:32:55 +0800 Subject: [PATCH 01/27] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=86=85=E9=83=A8?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E5=8F=B7#2264=E4=B9=9F=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=EF=BC=9A=E5=85=B6=E5=AE=9E=E9=99=85=E7=9A=84?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 8c12d62e0..b72558de4 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -2,11 +2,11 @@

<%= l(:label_issue_edit) %>

-<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %> +<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.id}" %>
<%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %> - <%= "#" + @issue.project_index %> + <%= "#" + @issue.id.to_s %>
From 035e47510f2c8e0ebb00371162b789d20568535b Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 25 Jan 2016 10:37:32 +0800 Subject: [PATCH 02/27] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/images/close.png | Bin 1637 -> 1417 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public/stylesheets/images/close.png b/public/stylesheets/images/close.png index 301ba5e85e4af660ec48808a6b3c37aac00e2f78..1246850354ebc0fbdd531a56241f67e5f5e94b49 100644 GIT binary patch delta 782 zcmaFL)5$%-lTm4+SD&h}ZnA-)p@Ny2o}r1UnVF%Ef{}rtk-h;CndusuSecqx8JTbV ztHj7{rl1j?nU|7ZUaUD;gGnaF!qLdg&C%S|$<4&X(9qS?!q~*z(b>Y$#M0H!$ime^ zNueUQz}MHxB|o_|H#M)s)5TT^D595=nPLUi>xN73w#f$^`Wi(^Q|tv6H8dxr#y9Di^5eQ(;b^ohDTsogxy0!r$Nx3^x+t#5vC z$hTWz#hc?^LcSMNGALO%HN3d_J%?m-K$yB4CxZzYcpp*z+*Ur2A6u)K`I@ZdUI3TO9t>FX6pXMN;rfHGlcQYbp*Z zi|&MG?)v2XPUgg}SIfk=rro;w!>r}R1WCpl8z-L(E1Z*d<GdVq8uiU*3P}vcno-a}V^wt^cik+cu zZx*-39R0cazS%S;Q~%r9W|vuSlrk=pbg0|KWzUwfW5q`c7Y(QL2JYbn?`_}3=&>fP zcb+kS-h#3d3}wDfJ)L3a*UW6>2u?cLx_id*;wPnB?#M*`YS7uYgR53I%Y=2e94mJ@ zi|5Au;VLGA&op>+j#PZt7ufp$lwSLu?!`Pl1|aZs^>bP0l+XkK DE;dRD delta 1026 zcmeC=e#$e!lTl%!SD&hZZnA-yfr6Q#o}sacxw*NHf{}rtfxdx}zM+w>p}Cc@k(GhL z#=lC8oTdulnRzMs<;9b=m}Fwy98C-?Oz*Q}aqZU2K(rB6=yADOOOurnvM@Uc_Vov%m9(`EO1SPn6vJd`)|f z?75E_KMy=V^jYrQ_2;$w&i~%C#6v}i#fejg;d6t;4Awe^`v&#-jr>0(^CvL3TsWT3 zP~1{5hw=A;Y&%Ci#V_mMMr2(1!D++XcavLK#MQ7qp6wlj)}#ALOc$7A9~jTSAW|Sc zLGZu)ig~&Zmi%v+c`i4hO(OozAvY`aEeFZj!8XaD0>8VCDQ|$!z z#?==V7hj%x{`vRjgAcgpUFWG?m>sja*KP6Z607nMt*bF+vr9K!2l7oOdaRl1wbXh3 z`R&#UnNvDu9C}&kwm0tmjht=nT&+&WM4Xjw-@d)N)#>4Z*IzF&?e3Neb>*zLTzfNT zo~2BmtjaX6rEkPj4h`w7HVC z)l09Lr$bC=6=&yzL-J0+@2+KS?Yo;-Uw_7|!(mQP#k3FKJaxp1-@knuIGN;h(8G#p~&sh8xvsy{q0_EwFgwq9oV<-15G7 zK=5L_;MG?@Wte0=tysz~G9&qs_J$VzL;Gh}RaFUfx}0*FeLrt|wTW+d_1-x4Z97gz zxhc8Vyy0BUJnguJ+CB#VU#W?F``GF%?AZiU8hGU1&RP6NcwSG`wE!8@$vnI5Z#uEa z?U(=fVnUxn!#mE(hO{)JGo{@JoKH6xtFY$?@4CHLvgFhR=NN^+7>0EZCd=g>)L+ni g_m;#n=KZV^47PC}EAA{WlVkt_Pgg&ebxsLQ05_GaYXATM From f099611d7ae1d9fecbbb55072c5cef3be834d69f Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 25 Jan 2016 11:25:43 +0800 Subject: [PATCH 03/27] =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/_project_issue_detail.html.erb | 228 +++++++++--------- 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index b682a74ea..774d92cb9 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -1,115 +1,115 @@ - -
-
-
    - <%#= labelled_fields_for :issue, @issue do |f| %> - <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), - {:include_blank => false, :selected => @status_id ? @status_id : 0 }, - {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> - <%# end %> - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> -
  • -

     状态  : 

    -

    <%= activity.status.name %>

    - <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), - {:include_blank => false, :selected => @status_id ? @status_id : 0 }, - {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} - ) - %> -
  • - <% end %> -
    - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> -
  • -

     指派  : 

    - - <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> - - <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), - { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, - {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %> -
  • - <% end %> -
    -
-
    - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> -
  • -

     优先级  : 

    - <%= activity.priority.name %> - <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), - {:include_blank => false,:selected=>@priority_id ? @priority_id : 0}, - {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %> -
  • - <% end %> -
    - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> -
  • -

     完成度  : 

    - <%= activity.done_ratio %>% - <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, - {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %> - <% end %> -
  • - -
    -
-
    -
  • -

     开始  : 

    -

    <%= format_date(activity.start_date) %>

    -
  • -
    -
  • -

     周期  : 

    - <%= l_hours(activity.estimated_hours) %>
  • -
    -
-
    -
  • -

     计划完成  : 

    - <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
  • -
    -
  • -

     目标版本  : 

    - <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
  • -
    -
- + +
+
+
    + <%#= labelled_fields_for :issue, @issue do |f| %> + <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> + <%# end %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> +
  • +

     状态  : 

    +

    <%= activity.status.name %>

    + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit",:style=>"white-space:nowrap; overflow:hidden;"} + ) + %> +
  • + <% end %> +
    + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> +
  • +

     指派  : 

    + + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> + + <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), + { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, + {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %> +
  • + <% end %> +
    +
+
    + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> +
  • +

     优先级  : 

    + <%= activity.priority.name %> + <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), + {:include_blank => false,:selected=>@priority_id ? @priority_id : 0}, + {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %> +
  • + <% end %> +
    + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> +
  • +

     完成度  : 

    + <%= activity.done_ratio %>% + <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, + {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %> + <% end %> +
  • + +
    +
+
    +
  • +

     开始  : 

    +

    <%= format_date(activity.start_date) %>

    +
  • +
    +
  • +

     周期  : 

    + <%= l_hours(activity.estimated_hours) %>
  • +
    +
+
    +
  • +

     计划完成  : 

    + <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
  • +
    +
  • +

     目标版本  : 

    + <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
  • +
    +
+
\ No newline at end of file From 1607508887a35bd7f69db590bf4f9826f34981c2 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 25 Jan 2016 14:19:39 +0800 Subject: [PATCH 04/27] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B0=86=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E5=8F=91=E9=80=81=E8=87=B3=E8=AF=BE=E7=A8=8B=E3=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/controllers/users_controller.rb | 59 +++++++++++++++---- app/views/files/index.html.erb | 14 ----- app/views/messages/_course_show.html.erb | 2 +- .../messages/_org_subfield_show.html.erb | 1 + app/views/messages/_project_show.html.erb | 2 +- app/views/org_subfields/show.html.erb | 14 ----- .../_org_subfield_message.html.erb | 1 - app/views/users/_course_message.html.erb | 4 +- app/views/users/_project_message.html.erb | 4 +- .../users/_share_message_to_course.html.erb | 56 ++++++++++++++++++ .../users/_share_message_to_org.html.erb | 59 +++++++++++++++++++ .../users/_share_message_to_project.html.erb | 53 +++++++++++++++++ app/views/users/search_user_course.js.erb | 4 +- app/views/users/search_user_org.js.erb | 4 +- app/views/users/search_user_project.js.erb | 4 +- .../users/share_message_to_course.js.erb | 2 + app/views/users/share_message_to_org.js.erb | 2 + .../users/share_message_to_project.js.erb | 2 + config/routes.rb | 3 + 20 files changed, 240 insertions(+), 52 deletions(-) create mode 100644 app/views/users/_share_message_to_course.html.erb create mode 100644 app/views/users/_share_message_to_org.html.erb create mode 100644 app/views/users/_share_message_to_project.html.erb create mode 100644 app/views/users/share_message_to_course.js.erb create mode 100644 app/views/users/share_message_to_org.js.erb create mode 100644 app/views/users/share_message_to_project.js.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4e3286700..514903e93 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -302,7 +302,7 @@ class OrganizationsController < ApplicationController def org_resources_subfield @org = Organization.find(params[:id]) - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @subfield = @org.org_subfields.where("field_type = 'Post'") else @subfield = @org.org_subfields.where('field_type = "Resource" ') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 38d148907..84f7d44c4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1791,16 +1791,6 @@ class UsersController < ApplicationController def share_news_to_project news = News.find(params[:send_id]) project_ids = params[:project_ids] - # project_ids.each do |project_id| - # if Project.find(project_id).news.map(&:id).exclude?(news.id) - # project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now) - # news.attachments.each do |attach| - # project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, - # :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, - # :is_public => attach.is_public, :quotes => 0) - # end - # end - # end project_ids.each do |project_id| project = Project.find(project_id) if project.news.map(&:id).exclude?(news.id) @@ -1826,6 +1816,53 @@ class UsersController < ApplicationController OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id) end + def share_message_to_course + @message = Message.find(params[:send_id]) + course_ids = params[:course_ids] + course_ids.each do |course_id| + course = Course.find(course_id) + if course.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_project + @message = Message.find(params[:send_id]) + project_ids = params[:project_ids] + project_ids.each do |project_id| + project = Project.find(project_id) + if project.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_org + field_id = params[:subfield] + @message = Message.find(params[:send_id]) + @message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1) + @message.save + board = OrgSubfield.find(field_id).boards.first + mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id) + end + def change_org_subfield end @@ -2175,7 +2212,7 @@ class UsersController < ApplicationController @user = User.current if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} else @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 8cb547b13..d4d12232e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -185,20 +185,6 @@ } - - function org_id_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - $(".orgDirection").text(orgDirection + sendText); - } - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - - function course_attachmenttypes_change(id, type) { <% if @course%> $.ajax({ diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index c3278a209..ce2f6e085 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -60,7 +60,7 @@ ) if @message.course_destroyable_by?(User.current) %> <% end %> -
  • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 304694b39..2578b2101 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -89,6 +89,7 @@ :class => 'postOptionLink' ) if @message.org_subfield_editable_by?(User.current) %> +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');",:class => 'postOptionLink'%>
  • diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index e5aba7c02..25fbc841b 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -115,7 +115,7 @@ ) if @message.destroyable_by?(User.current) %> <% end %> -
  • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
  • diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb index 82203b4de..7d3a2b969 100644 --- a/app/views/org_subfields/show.html.erb +++ b/app/views/org_subfields/show.html.erb @@ -178,20 +178,6 @@ } - - function org_id_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - $(".orgDirection").text(orgDirection + sendText); - } - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - - function course_attachmenttypes_change(id, type) { <% if @course%> $.ajax({ diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 349f7c86e..16a2a55d6 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -13,7 +13,6 @@ <% end %> TO <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%> -
    <% if activity.parent_id.nil? %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 5abd08224..8a7c6d4cd 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -71,9 +71,7 @@ ) if activity.course_destroyable_by?(User.current) %> <% end %> -
  • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index d4a7a9e60..ec36854cb 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -71,9 +71,7 @@ ) if activity.destroyable_by?(User.current) %> <% end %> -
  • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • diff --git a/app/views/users/_share_message_to_course.html.erb b/app/views/users/_share_message_to_course.html.erb new file mode 100644 index 000000000..eda4a9b97 --- /dev/null +++ b/app/views/users/_share_message_to_course.html.erb @@ -0,0 +1,56 @@ + + +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_course_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_message_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !courses.empty? %> + <% courses.each do |course| %> +
      +
    • + +
    • +
    • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb new file mode 100644 index 000000000..da3c7a072 --- /dev/null +++ b/app/views/users/_share_message_to_org.html.erb @@ -0,0 +1,59 @@ +
    +
    发送到
    +
    + +
    + <%= form_tag search_user_org_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_org_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + <% end %> +
    +
    +<%= form_tag share_message_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + +
      + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
    • + +
    • + <%end%> + <%end%> +
    +
    +
    +
      + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
    +
    +
    +
    目标地址:
    +
    + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
    +
    + 取消 +
    +
    +<%end %> \ No newline at end of file diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb new file mode 100644 index 000000000..4b79a779c --- /dev/null +++ b/app/views/users/_share_message_to_project.html.erb @@ -0,0 +1,53 @@ +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_project_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> +
    + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !projects.empty? %> + <% projects.each do |project| %> +
      +
    • + +
    • +
    • <%= project.name%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index 138eab6f9..eed7499d5 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -11,8 +11,10 @@ //$("#upload_box").css('display','block'); <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index fb6efec9a..877629e34 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,7 +1,9 @@ <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index 926b7aa58..f80be34f8 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,7 +1,9 @@ <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/users/share_message_to_course.js.erb b/app/views/users/share_message_to_course.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_course.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_message_to_org.js.erb b/app/views/users/share_message_to_org.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_org.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_message_to_project.js.erb b/app/views/users/share_message_to_project.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_project.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3a4d2fb92..4f191a9bf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -541,6 +541,9 @@ RedmineApp::Application.routes.draw do post 'share_news_to_course' post 'share_news_to_project' post 'share_news_to_org' + post 'share_message_to_course' + post 'share_message_to_project' + post 'share_message_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' From b6e13340e56a09dfd4060760df1b744379466645 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 15:33:50 +0800 Subject: [PATCH 05/27] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80?= =?UTF-8?q?=E7=9A=84=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 4 ++- .../users/_user_journalsformessage.html.erb | 27 +++++++++++++++++-- app/views/words/create_reply.js.erb | 6 +---- app/views/words/destroy.js.erb | 12 ++++++--- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index d24427a9d..699a5e8ca 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -73,7 +73,6 @@ class WordsController < ApplicationController # render 'test/index' # } format.js { - @reply_type = params[:reply_type] @user_activity_id = params[:user_activity_id] @activity = JournalsForMessage.find(parent_id) @is_activity = params[:is_activity] @@ -95,6 +94,9 @@ class WordsController < ApplicationController @user = User.find(@journal_destroyed.jour_id) @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count @is_user = true + @user_activity_id = params[:user_activity_id] if params[:user_activity_id] + @is_activity = params[:is_activity].to_i if params[:is_activity] + @activity = @journal_destroyed.parent if @journal_destroyed.parent elsif @journal_destroyed.jour_type == 'HomeworkCommon' @homework = HomeworkCommon.find @journal_destroyed.jour_id if params[:user_activity_id] diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index e30fd1824..d7247621a 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -39,6 +39,22 @@ 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
    + <% if activity.user == User.current || User.current.admin?%> +
    +
      +
    • +
        +
      • + <%= link_to(l(:label_bid_respond_delete), + {:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', + :class => "postOptionLink", :title => l(:button_delete)) %> +
      • +
      +
    • +
    +
    + <% end%>
    @@ -71,7 +87,7 @@
    <%= comment.notes.html_safe %> @@ -112,7 +136,6 @@ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> - <%= hidden_field_tag 'reply_type',params[:reply_type],:value =>'user' %> <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
    diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index d4d9a2cd7..d9e00a112 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,10 +1,6 @@ <% if @save_succ %> <% if @user_activity_id %> - <% if @reply_type == 'user' %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); - <% else %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); - <% end %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); <% else %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 6a56249a3..6d0055718 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -2,13 +2,19 @@ alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%> <% if @is_user%> - var destroyedItem = $('#<%=@journal_destroyed.id%>'); + <% if @activity %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); + init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + <% else %> + $("#user_activity_<%= @user_activity_id%>").hide(); + <% end %> + /*var destroyedItem = $('#<%#=@journal_destroyed.id%>'); destroyedItem.fadeOut(600,function(){ destroyedItem.remove(); }); - <% if @jours_count && @jours_count == 0 %> + <%# if @jours_count && @jours_count == 0 %> $("#user_jour_list").css("padding","0px"); - <% end %> + <%# end %>*/ <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); From 184e0ee6898bd1a034f93cf711acc926eb6d8e93 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 16:50:34 +0800 Subject: [PATCH 06/27] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E3=80=81=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E3=80=81=E8=AF=BE=E7=A8=8B=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E3=80=81=E4=BD=9C=E4=B8=9A=E4=B8=AA=E6=95=B0=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 1 + lib/redmine/menu_manager.rb | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 68386de44..c7b4dc615 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -29,6 +29,7 @@ class AdminController < ApplicationController def index @no_configuration_data = Redmine::DefaultData::Loader::no_data? + @lastest_login_user_count = User.all.count end def projects diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index a2d2214b6..f9ce21987 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -1,3 +1,4 @@ +#coding=utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -180,8 +181,20 @@ module Redmine end def render_single_menu_node(item, caption, url, selected) - - link_to(h(caption), url, item.html_options(:selected => selected)) + title = h(caption) + case title + when '作业' + title = h(caption) + "(#{HomeworkCommon.all.count})" + when '组织列表' + title = h(caption) + "(#{Organization.all.count})" + when '项目列表' + title = h(caption) + "(#{Project.all.count})" + when '课程列表' + title = h(caption) + "(#{Course.all.count})" + when '用户列表' + title = h(caption) + "(#{User.all.count})" + end + link_to(title, url, item.html_options(:selected => selected)) end From 945d0a933f527337764393a6f0959071dffa1dfa Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 17:34:04 +0800 Subject: [PATCH 07/27] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=B8=BA=E8=B4=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 1 - app/controllers/users_controller.rb | 6 ++++++ db/schema.rb | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index c7b4dc615..68386de44 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -29,7 +29,6 @@ class AdminController < ApplicationController def index @no_configuration_data = Redmine::DefaultData::Loader::no_data? - @lastest_login_user_count = User.all.count end def projects diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b155e9f90..8794808a3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1633,6 +1633,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end elsif params[:send_ids].present? @@ -1668,6 +1671,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end end diff --git a/db/schema.rb b/db/schema.rb index b2c74a96c..8af34d878 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1371,6 +1371,7 @@ ActiveRecord::Schema.define(:version => 20160122143138) 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 "attach_num", :default => 0 t.datetime "commit_time" end From dda64245b3056c3b2e823f7b9295bb89b068ad30 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 26 Jan 2016 10:35:54 +0800 Subject: [PATCH 08/27] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A1.=E7=BC=96=E8=BE=91=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E9=A6=96=E9=A1=B5=E5=90=8E=EF=BC=8C=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E8=87=B3=E4=B8=AA=E4=BA=BA=E5=8A=A8=E6=80=81=EF=BC=9B2.?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=90=8D=E7=89=87=E4=B8=AD=EF=BC=8C=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E6=98=BE=E7=A4=BA=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=9B3.=E5=90=8C=E6=84=8F=E7=94=B3=E8=AF=B7=E5=AD=90?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E5=90=8E=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=B7=B2?= =?UTF-8?q?=E5=90=8C=E6=84=8F=E7=94=B3=E8=AF=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 4 ++-- app/views/users/_show_detail_info.html.erb | 9 +++++++-- app/views/users/_user_message_org.html.erb | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index df6ba10d2..055236302 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -55,8 +55,8 @@ class BlogCommentsController < ApplicationController if params[:in_act] redirect_to user_path(params[:user_id]) else - if params[:is_homepage] - redirect_to user_blogs_path(params[:user_id]) + if @article.id.eql?(User.find(params[:user_id]).blog.homepage_id) + redirect_to user_path(params[:user_id]) else redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) end diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index dc6599884..9de431336 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -6,11 +6,16 @@
    - + <% if (user.user_extensions && (user.user_extensions.identity != 2) ) %> + + <% end %> +

    - <%= user.user_extensions.technical_title %> + <% if user.user_extensions && user.user_extensions.identity %> + <%= get_user_roll(user) %> + <% end %>

    diff --git a/app/views/users/_user_message_org.html.erb b/app/views/users/_user_message_org.html.erb index 5bf1c8950..e3b656a46 100644 --- a/app/views/users/_user_message_org.html.erb +++ b/app/views/users/_user_message_org.html.erb @@ -12,7 +12,7 @@ <%= ma.content %>
  • - <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"已同意申请", + <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"申请已批准", agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ), :id => "agree_apply_subdomain_#{ma.id}", :method => 'post', From 63d1d3a8e7c1ff91f59cb9a592a07e18b82f187f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 26 Jan 2016 10:59:28 +0800 Subject: [PATCH 09/27] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E5=8F=AA=E8=A6=81=E6=98=AF=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=B0=B1=E6=98=BE=E7=A4=BA=E7=BC=96=E8=BE=91?= =?UTF-8?q?issue=E5=A4=9A=E5=B1=9E=E6=80=A7=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 1e9f1bb68..c5d93e0a5 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -52,7 +52,7 @@ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> - <% if is_project_manager?(User.current, activity.project) %> + <% if User.current.member_of?(activity.project) %> <% unless params[:action] == "index" %>
    <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> From 821ade7985401ba8dc43cb40d2b74b5612e02654 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 26 Jan 2016 11:00:24 +0800 Subject: [PATCH 10/27] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E8=AF=BE=E7=A8=8B=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_project_info.html.erb | 4 +- .../_programing_work_show.html.erb | 279 +++++++++--------- app/views/student_work/_show.html.erb | 277 ++++++++--------- .../_work_attachments_status.html.erb | 2 +- 4 files changed, 282 insertions(+), 280 deletions(-) diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index 60fc6f96d..98670dba0 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -9,13 +9,13 @@ <%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
    -
    <%= @course.is_public == 0 ? "私有课程" : "公开课程" %> +
    ID:<%= @course.id%><%= @course.is_public == 0 ? "(私有)" : "(公开)" %> <% if @course.id == 370 %> 精品课程 <% end %>
    -ID:<%= @course.id%> +加入课程
    -
  • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> -
  • -
  • - <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> -
  • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> - -
  • - <%= render :partial => 'student_work_praise' %> -
  • - <% end%> -
    - -
  • - 编程代码: -
    -
    -
    -
    -
  • - -
  • - - 测试结果: - -
    - <% work.student_work_tests.each_with_index do |test, index| %> -
    -

    - 第<%= work.student_work_tests.count - index%>次测试 -

    - - <%= test.created_at.to_s(:db) %> - -
    -
    - <% if test.status.to_i == -2 %> -
    - <%= test.results.first %> -
    - <% else %> -
    -
      - <% test.results.each_with_index do |x, i| %> -
    • - 测试<%=i+1%> - <% if x["status"].to_i != 0 %> - 测试错误! - 您的输出: - <%=x["result"]%> - 正确输出: - <%=x["output"]%> -
      - <% else %> - 测试正确! -
      - <% end %> -
    • - <% end %> -
    -
    - <% end %> - <% end %> -
    -
  • - -
  • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> - -
    - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
    - <% end%> -
    -
  • - - -
    - <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
    -
    - -
    - <%student_work_scores.each do |student_score|%> -
    - <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
    - <% end%> -
    - - 收起 -
    - - +
    +
    + + +
    + <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
    +
    + +
    + <%student_work_scores.each do |student_score|%> +
    + <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> +
    + <% end%> +
    +
    + + 收起 +
    +
    + diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 662ddece4..d66a30718 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,139 +1,140 @@ -
    -
    - <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> - <% if @homework.homework_type != 3 %> - <% is_my_work = work.user == User.current%> - <% else %> - <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> - <% is_my_work = pro && pro.student_work_id == work.id%> - <% end %> - - -
    - <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
    -
    - -
    - <%student_work_scores.each do |student_score|%> -
    - <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
    - <% end%> -
    - - 收起 -
    -
    - \ No newline at end of file diff --git a/app/views/student_work/_work_attachments_status.html.erb b/app/views/student_work/_work_attachments_status.html.erb index c4b2a795e..6a8591197 100644 --- a/app/views/student_work/_work_attachments_status.html.erb +++ b/app/views/student_work/_work_attachments_status.html.erb @@ -1,7 +1,7 @@ <% attachments.each_with_index do |attachment,i| %>
    - + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%> From 520811fdc79fbae2b94644ee016322774bb694a2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 11:17:55 +0800 Subject: [PATCH 11/27] =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8C=89=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 18 ++++++----------- app/controllers/words_controller.rb | 1 + app/models/journals_for_message.rb | 2 +- ...160126024429_update_journal_for_message.rb | 20 +++++++++++++++++++ db/schema.rb | 2 +- 5 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20160126024429_update_journal_for_message.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8794808a3..cb8afd3a1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -755,23 +755,17 @@ class UsersController < ApplicationController if params[:type].present? case params[:type] when "public" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC') when "private" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC') else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 699a5e8ca..351be4e64 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -62,6 +62,7 @@ class WordsController < ApplicationController update_forge_activity('JournalsForMessage',parent_id) update_org_activity('JournalsForMessage',parent_id) update_principal_activity('JournalsForMessage',parent_id) + (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) end respond_to do |format| # format.html { diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 9e0ce2dd2..cdcf9d19e 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :reset_counters! - after_update :update_ativity + #after_update :update_activity after_destroy :reset_counters! after_save :be_user_score after_destroy :down_user_score diff --git a/db/migrate/20160126024429_update_journal_for_message.rb b/db/migrate/20160126024429_update_journal_for_message.rb new file mode 100644 index 000000000..f6b848c79 --- /dev/null +++ b/db/migrate/20160126024429_update_journal_for_message.rb @@ -0,0 +1,20 @@ +class UpdateJournalForMessage < ActiveRecord::Migration + def up + journals = JournalsForMessage.where("m_parent_id is null and jour_type ='Principal' ") + count = journals.count / 30 + 2 + transaction do + for i in 1 ... count do i + journals.page(i).per(30).each do |jour| + act = UserActivity.where("act_type='JournalsForMessage' and act_id = #{jour.id}").first + unless act.nil? + jour.updated_on = act.updated_at + jour.save + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 8af34d878..736ce0f4e 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 => 20160122143138) do +ActiveRecord::Schema.define(:version => 20160126024429) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 19003f27fca2dcbd89d4c79ad829bbbbc9205882 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 15:05:45 +0800 Subject: [PATCH 12/27] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0is=5F?= =?UTF-8?q?copy=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 5 ++++- db/migrate/20160126031857_add_is_copy_to_course.rb | 5 +++++ db/schema.rb | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20160126031857_add_is_copy_to_course.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 43a49c7d9..0697f0d0a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -441,7 +441,10 @@ class CoursesController < ApplicationController @course = cs.create_course(params,User.current)[:course] if params[:copy_course] copy_course = Course.find params[:copy_course].to_i - @course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource) + @course.is_copy = 1 + @course.open_student = copy_course.open_student + @course.publish_resource = copy_course.publish_resource + @course.save if params[:checkAll] attachments = copy_course.attachments attachments.each do |attachment| diff --git a/db/migrate/20160126031857_add_is_copy_to_course.rb b/db/migrate/20160126031857_add_is_copy_to_course.rb new file mode 100644 index 000000000..f60914bbd --- /dev/null +++ b/db/migrate/20160126031857_add_is_copy_to_course.rb @@ -0,0 +1,5 @@ +class AddIsCopyToCourse < ActiveRecord::Migration + def change + add_column :courses, :is_copy, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 736ce0f4e..42a5ea702 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 => 20160126024429) do +ActiveRecord::Schema.define(:version => 20160126031857) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -501,6 +501,7 @@ ActiveRecord::Schema.define(:version => 20160126024429) do t.string "end_term" t.integer "is_excellent", :default => 0 t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 end create_table "custom_fields", :force => true do |t| From 89a919163c58a751f13d07cdb47ae14574fd1d02 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 26 Jan 2016 15:25:25 +0800 Subject: [PATCH 13/27] =?UTF-8?q?=E4=B8=80=E6=97=A6=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=A7=81=E6=9C=89=EF=BC=8C=E5=B0=B1disabled=E6=8E=89=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E6=B8=B8=E5=AE=A2=E4=B8=8B=E8=BD=BD=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/new.html.erb | 5 +++-- app/views/organizations/setting.html.erb | 14 ++++++++++++-- public/javascripts/application.js | 13 +++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index ea7fbbb30..e12bf3849 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -30,14 +30,15 @@
  • - + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
  • - + (打钩为允许游客下载文件) +
  • diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 9ec118bec..b9b2f9b4c 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -63,11 +63,12 @@
  • 公开 : - class="ml3" /> + class="ml3" />
    下载支持 : - class="ml3" /> + name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />  允许游客下载 + <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %>
    保存 <% end %> @@ -187,4 +188,13 @@ $("#apply_hint").text("子域名命名不规范,只能包含字母、数字和下划线,请重新输入"); } } + +// $(document).ready(function(){ +// if ( $("#is_public").attr("checked") != true){ +// alert($(this).attr("checked")); +// $("#allow_download").attr("checked", false); +// $("#allow_download").attr("disabled", true); +// $("#allow_down_hint").html(""); +// } +// }); \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index f982d92f6..8fba6770a 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1135,3 +1135,16 @@ function chooseSendType(res_id,res_ids, user_id, send_type){ } lastSendType = sendType; } + +function disable_down(source, des, hint){ + if (source.attr("checked")){ + des.attr("disabled", false); + hint.html(""); + } + else{ + des.attr("checked", false); + des.attr("disabled", true); + hint.html("(私有组织不允许游客下载资源)"); + + } +} From af7ca36c92ad8f8bcbf0931e8d4293d292b05243 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 15:59:39 +0800 Subject: [PATCH 14/27] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=96=E9=80=80=E5=87=BA=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 9 ++++----- app/views/layouts/_project_info.html.erb | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4e90fc106..f326f2099 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -697,17 +697,16 @@ module CoursesHelper def join_in_course_header(course, user, options=[]) if user.logged? joined = course.members.map{|member| member.user_id}.include? user.id - text = joined ? ("".html_safe + l(:label_course_exit_student)) : ("".html_safe + l(:label_course_join_student)) + text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link = "#{l(:label_course_join_student)}" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) + link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) else - link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "#{l(:label_course_exit_student)}".html_safe + link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") end else - link = "#{l(:label_course_join_student)}" + - "#{l(:label_course_exit_student)}" + link = "#{l(:label_course_join_student)}" end link.html_safe end diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index d4b5b20fe..db9e24a36 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -15,7 +15,10 @@ <% end %>
    -加入课程 + <% unless is_teacher %> + +
    <%= join_in_course_header(@course, User.current) %>
    + <% end %>
    <% case object_flag %> <% when '10' %> From 4b95ee95c073876faa641a07dfa6dfc87b70e981 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 27 Jan 2016 16:12:34 +0800 Subject: [PATCH 19/27] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=B8=96=E5=AD=90=EF=BC=8C=E5=9C=A8=E7=99=BB=E9=99=86=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E5=B0=B1=E8=83=BD=E5=8F=91=E9=80=81=EF=BC=9B?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E7=BB=87=E6=A0=8F=E7=9B=AE=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E5=B8=96=E5=AD=90=E6=A0=8F=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=BE=91=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E3=80=81=E5=8F=91=E9=80=81=E9=80=89=E9=A1=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../messages/_org_subfield_show.html.erb | 2 +- .../_org_subfield_message.html.erb | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 7fdf5d02c..1e31881d5 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -68,7 +68,7 @@ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
    - <% if @message.org_subfield_editable_by?(User.current) %> + <% if User.current.logged? %>
    From ec41cd4318c79ae5637c44c7299310d59d2d685e Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 27 Jan 2016 17:26:57 +0800 Subject: [PATCH 20/27] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E9=A2=98=E5=BA=93=E4=B8=AD=E7=9A=84=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 57 ++++++++++++++- .../_homework_detail_information.html.erb | 27 +++++++ .../users/_homework_search_input.html.erb | 29 ++++++++ .../users/_show_user_homework_form.html.erb | 33 ++++++--- app/views/users/_show_user_homeworks.html.erb | 71 ++++++++++++------- app/views/users/_user_homework_form.html.erb | 2 +- app/views/users/show_homework_detail.js.erb | 1 + app/views/users/user_homework_type.js.erb | 4 ++ app/views/users/user_import_homeworks.js.erb | 7 +- app/views/users/user_search_homeworks.js.erb | 4 +- config/routes.rb | 6 +- public/stylesheets/new_user.css | 23 +++++- public/stylesheets/public.css | 21 ++++++ 13 files changed, 238 insertions(+), 47 deletions(-) create mode 100644 app/views/users/_homework_detail_information.html.erb create mode 100644 app/views/users/_homework_search_input.html.erb create mode 100644 app/views/users/show_homework_detail.js.erb create mode 100644 app/views/users/user_homework_type.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index cb8afd3a1..51feecb23 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -403,8 +403,47 @@ class UsersController < ApplicationController #导入作业 def user_import_homeworks + @user = User.current @select_course = params[:select_course] ? 1 : 0 - @user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + @type = params[:type] + @limit = 10 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,10 + respond_to do |format| + format.js + end + end + + def user_homework_type + @user = User.current + if(params[:type].blank? || params[:type] == "1") #公共题库 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + elsif params[:type] == "2" #我的题库 + @homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + end + @type = params[:type] + @limit = 10 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,10 + respond_to do |format| + format.js + end + end + + def show_homework_detail + @homework = HomeworkCommon.find params[:homework].to_i respond_to do |format| format.js end @@ -412,7 +451,21 @@ class UsersController < ApplicationController #用户主页过滤作业 def user_search_homeworks - @user_homeworks = HomeworkCommon.where("user_id = '#{@user.id}' and lower(name) like '%#{params[:name].to_s.downcase}%'").order("created_at desc") + search = params[:name].to_s.strip.downcase + if(params[:type].blank? || params[:type] == "1") #全部 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and (name like '%#{search}%')").order("created_at desc") + elsif params[:type] == "2" #课程资源 + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and (name like '%#{search}%')").order("created_at desc") + end + @type = params[:type] + @limit = 10 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,10 respond_to do |format| format.js end diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb new file mode 100644 index 000000000..6887444ab --- /dev/null +++ b/app/views/users/_homework_detail_information.html.erb @@ -0,0 +1,27 @@ +
    题目信息
    +
    + <% if homework.nil? %> + 请先在左侧选择作业 + <% else %> +
    标题:<%=homework.name %>
    + 来源:<%=homework.course.name %>
    + <% if homework.homework_type == 2 && homework.homework_detail_programing %> + 编程语言:<%=homework.language_name %>
    + <% end %> + 贡献者:<%=homework.user.show_name %>
    + 描述如下: +
    +
    + <%=homework.description.html_safe %> +
    + <% if homework.homework_type == 2 %> +
    + 测试集:<%=homework.homework_tests.count %>组 +
    + <% elsif homework.homework_type ==3 && homework.homework_detail_group %> +
    + 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人 +
    + <% end %> + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb new file mode 100644 index 000000000..ba85f0d09 --- /dev/null +++ b/app/views/users/_homework_search_input.html.erb @@ -0,0 +1,29 @@ + + \ No newline at end of file diff --git a/app/views/users/_show_user_homework_form.html.erb b/app/views/users/_show_user_homework_form.html.erb index ef0265683..bd70e27fb 100644 --- a/app/views/users/_show_user_homework_form.html.erb +++ b/app/views/users/_show_user_homework_form.html.erb @@ -1,13 +1,24 @@ -<% user_homeworks.each do |homework|%> -
      -
    • - -
    • - +
    • + <% case homework.homework_type %> + <% when 1 %> + 普通 + <% when 2 %> + 编程 + <% when 3 %> + 分组 + <% end %> +
    • <%= homework.user.show_name %>
    • <%=format_date homework.publish_time %>
    diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index ad1fcdf7a..f013705c5 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -10,13 +10,14 @@
      +
    • 作业类型
    • 贡献者
    • 发布时间
    <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %> -
    +
    <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
    <% end %> diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 409b914b4..3f5c21567 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1442,14 +1442,15 @@ a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:360px; padding-left:10px;} +.subjectName {width:260px; padding-left:10px;} +.subjectType {width:100px; text-align:center;} .subjectPublisher {width:100px; text-align:center;} .subjectDate {width:115px; text-align:center;} -.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;} -.subjectRow li {height:40px; line-height:40px; vertical-align:middle;} +.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} .subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} -.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;} +.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} .subjectIntro {color:#585858; line-height:18px; font-size:12px;} .subjectContent {color:#888888; line-height:18px; font-size:12px;} .popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 611e96a2c..2d6bad0a1 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -1027,13 +1027,14 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} .subjectName {width:360px; padding-left:10px;} +.subjectType {width:100px; text-align:center;} .subjectPublisher {width:100px; text-align:center;} .subjectDate {width:115px; text-align:center;} -.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;} -.subjectRow li {height:40px; line-height:40px; vertical-align:middle;} +.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} .subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} -.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;} +.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} .subjectIntro {color:#585858; line-height:18px; font-size:12px;} .subjectContent {color:#888888; line-height:18px; font-size:12px;} .popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} From c857fb734b5306248d87c8c10d92a09dad5307b1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 28 Jan 2016 10:16:45 +0800 Subject: [PATCH 22/27] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E8=AE=BE=E7=BD=AE=E5=9B=9E=E5=A4=8D=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E9=AB=98=E5=BA=A6=E5=92=8C=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_org_subfield_show.html.erb | 2 +- public/javascripts/application.js | 3 +++ public/javascripts/create_kindeditor.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 1e31881d5..fab0f752e 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -58,7 +58,7 @@ } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 8fba6770a..7f60b11b4 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1032,6 +1032,7 @@ function subfield_click(){ $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); } +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { $('#'+fieldId).each(function() { var $this = $(this); @@ -1107,6 +1108,7 @@ function show_send(id, user_id, send_type){ //id 发送的id //发送的id数组 +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 function chooseSendType(res_id,res_ids, user_id, send_type){ sendType = $(".resourcesSendType").val(); @@ -1136,6 +1138,7 @@ function chooseSendType(res_id,res_ids, user_id, send_type){ lastSendType = sendType; } +//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项 function disable_down(source, des, hint){ if (source.attr("checked")){ des.attr("disabled", false); diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index 0eac4b01e..ea6262931 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -10,16 +10,16 @@ function sd_create_editor(params){ resizeType : 1,minWidth:"1px",width:"94%", height:"33px",// == undefined ? "30px":paramsHeight+"px", minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", + width:params.width, items:['emoticons','fontname', 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', 'formatblock', 'fontsize', '|','indent', 'outdent', '|','imagedirectupload'], afterChange:function(){//按键事件 - var edit = this.edit; var body = edit.doc.body; edit.iframe.height(paramsHeight); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); + //this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); }, afterBlur:function(){ //params.toolbar_container.hide(); From a613b58b46fd321779113d183e37bc6109c71c39 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 28 Jan 2016 11:08:16 +0800 Subject: [PATCH 23/27] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E7=9A=84=E9=AB=98=E5=BA=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_programing_attr.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb index 3f2e53fe8..71816689b 100644 --- a/app/views/users/_user_programing_attr.html.erb +++ b/app/views/users/_user_programing_attr.html.erb @@ -7,7 +7,7 @@ <%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3, "Java"=>4}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
    -
    +
    <% if edit_mode && homework.is_program_homework? %> <% homework.homework_tests.each_with_index do |test, index| %>
    From c942c843b94fec9d660b60e64e87728bb7958b9d Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 28 Jan 2016 16:27:46 +0800 Subject: [PATCH 24/27] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=95=E7=94=A8=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 21 ++++++++++++------- .../_homework_detail_information.html.erb | 6 +++++- .../users/_show_user_homework_form.html.erb | 1 + app/views/users/_show_user_homeworks.html.erb | 3 ++- app/views/users/_user_homework_form.html.erb | 3 +++ app/views/users/user_select_homework.js.erb | 1 + .../20160128024452_add_quotes_to_homework.rb | 5 +++++ db/schema.rb | 3 ++- public/stylesheets/new_user.css | 9 ++++---- public/stylesheets/public.css | 9 ++++---- 10 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 db/migrate/20160128024452_add_quotes_to_homework.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9cf69504b..190784f26 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -408,7 +408,7 @@ class UsersController < ApplicationController #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") @type = params[:type] @limit = 15 @is_remote = true @@ -426,9 +426,9 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") #公共题库 visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") elsif params[:type] == "2" #我的题库 - @homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") end @type = params[:type] @limit = 15 @@ -451,13 +451,14 @@ class UsersController < ApplicationController #用户主页过滤作业 def user_search_homeworks + @user = User.current search = params[:name].to_s.strip.downcase if(params[:type].blank? || params[:type] == "1") #全部 visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and (name like '%#{search}%')").order("created_at desc") + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'} and (name like '%#{search}%')").order("created_at desc") elsif params[:type] == "2" #课程资源 - @homeworks = HomeworkCommon.where("user_id = #{@user.id} and (name like '%#{search}%')").order("created_at desc") + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") end @type = params[:type] @limit = 15 @@ -479,6 +480,7 @@ class UsersController < ApplicationController @homework = HomeworkCommon.new @select_course = params[:select_course] || 0 if homework + @ref_homework = homework @homework.name = homework.name @homework.description = homework.description @homework.end_time = homework.end_time @@ -636,13 +638,15 @@ class UsersController < ApplicationController homework_detail_manual.save if homework_detail_manual homework_detail_programing.save if homework_detail_programing homework_detail_group.save if homework_detail_group - + if params[:quotes] && !params[:quotes].blank? + homework = HomeworkCommon.find params[:quotes].to_i + homework.update_attribute(:quotes, homework.quotes+1) + end if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => homework.course_id) else redirect_to user_homeworks_user_path(User.current.id) end - end end else @@ -1681,7 +1685,8 @@ class UsersController < ApplicationController end attach_copied_obj.save unless Project.find(project_id).project_score.nil? - Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + Project.find(project_id).project_score.update_attribute(:attach_num, + Project.find(project_id).project_score.attach_num + 1) end end end diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb index 6887444ab..d650cd084 100644 --- a/app/views/users/_homework_detail_information.html.erb +++ b/app/views/users/_homework_detail_information.html.erb @@ -8,7 +8,11 @@ <% if homework.homework_type == 2 && homework.homework_detail_programing %> 编程语言:<%=homework.language_name %>
    <% end %> - 贡献者:<%=homework.user.show_name %>
    + 贡献者:<%=homework.user.show_name %> + <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %> + ,<%=homework.user.user_extensions.occupation%> + <% end %> +
    描述如下:
    diff --git a/app/views/users/_show_user_homework_form.html.erb b/app/views/users/_show_user_homework_form.html.erb index b316093c3..43d204508 100644 --- a/app/views/users/_show_user_homework_form.html.erb +++ b/app/views/users/_show_user_homework_form.html.erb @@ -16,6 +16,7 @@ 分组 <% end %> +
  • <%= homework.quotes %>
  • <%= homework.user.show_name %>
  • <%=format_date homework.publish_time %>
  • diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index f013705c5..9f90a633f 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -10,7 +10,8 @@
      -
    • 作业类型
    • +
    • 类型
    • +
    • 引用数
    • 贡献者
    • 发布时间
    diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 5781a3416..4082854da 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -34,6 +34,9 @@
    <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%> + <% unless edit_mode %> + + <% end %> <% if edit_mode %> <% end %> diff --git a/app/views/users/user_select_homework.js.erb b/app/views/users/user_select_homework.js.erb index 9b4b43b33..306374b84 100644 --- a/app/views/users/user_select_homework.js.erb +++ b/app/views/users/user_select_homework.js.erb @@ -5,6 +5,7 @@ $("#homework_end_time").val("<%= @homework.end_time%>"); <% if @select_course == "0"%> $("#course_id").val("<%= @homework.course_id%>"); <% end%> +$("#ref_homework_id").val("<%= @ref_homework.id%>"); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true,:show_member=>true})%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); <% if @homework_detail_group %> diff --git a/db/migrate/20160128024452_add_quotes_to_homework.rb b/db/migrate/20160128024452_add_quotes_to_homework.rb new file mode 100644 index 000000000..7f02062fb --- /dev/null +++ b/db/migrate/20160128024452_add_quotes_to_homework.rb @@ -0,0 +1,5 @@ +class AddQuotesToHomework < ActiveRecord::Migration + def change + add_column :homework_commons, :quotes, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 42a5ea702..4539131c1 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 => 20160126031857) do +ActiveRecord::Schema.define(:version => 20160128024452) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -783,6 +783,7 @@ ActiveRecord::Schema.define(:version => 20160126031857) do t.datetime "updated_at", :null => false t.integer "teacher_priority", :default => 1 t.integer "anonymous_comment", :default => 0 + t.integer "quotes", :default => 0 end add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 3f5c21567..d31c1ee0c 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1442,10 +1442,11 @@ a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:260px; padding-left:10px;} -.subjectType {width:100px; text-align:center;} -.subjectPublisher {width:100px; text-align:center;} -.subjectDate {width:115px; text-align:center;} +.subjectName {width:270px; padding-left:10px; padding-right:10px;} +.subjectPublisher {width:80px; text-align:center;} +.subjectDate {width:80px; text-align:center;} +.subjectType {width:70px; text-align:center;} +.subjectCount {width:65px; text-align:center;} .subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} .subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 2d6bad0a1..be9d51799 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -1026,10 +1026,11 @@ a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:360px; padding-left:10px;} -.subjectType {width:100px; text-align:center;} -.subjectPublisher {width:100px; text-align:center;} -.subjectDate {width:115px; text-align:center;} +.subjectName {width:270px; padding-left:10px; padding-right:10px;} +.subjectPublisher {width:80px; text-align:center;} +.subjectDate {width:80px; text-align:center;} +.subjectType {width:70px; text-align:center;} +.subjectCount {width:65px; text-align:center;} .subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} .subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} From 280f679b0c24c1125dd3fc091e5c76f1f84c9617 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 28 Jan 2016 16:49:25 +0800 Subject: [PATCH 25/27] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E9=97=AE=E9=A2=98=E5=BF=AB=E6=8D=B7=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E5=AE=BD=E5=BA=A6=EF=BC=9B2.https://www.trus?= =?UTF-8?q?tie.net/manual/feedback=E9=93=BE=E6=8E=A5=E5=88=B0=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9=E4=B8=AD=E5=BF=83=EF=BC=9B3.=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A1=86=E6=98=BE=E7=A4=BA=E6=9B=B4=E5=A4=9A=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue_detail.html.erb | 14 +++++++------- config/routes.rb | 1 + public/javascripts/create_kindeditor.js | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index 774d92cb9..1235b4e53 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -57,12 +57,12 @@ <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
  •  指派  : 

    - - <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> + + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:100px; display:inline-block;" %> <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, - {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %> + {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"undis issueEdit", :style => "width:130px;"}) %>
  • <% end %>
    @@ -93,22 +93,22 @@
    •  开始  : 

      -

      <%= format_date(activity.start_date) %>

      +

      <%= format_date(activity.start_date) %>

    •  周期  : 

      - <%= l_hours(activity.estimated_hours) %>
    • + <%= l_hours(activity.estimated_hours) %>
    •  计划完成  : 

      - <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
    • + <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
    •  目标版本  : 

      - <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
    • + <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
    diff --git a/config/routes.rb b/config/routes.rb index 07c161265..da876d664 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1128,6 +1128,7 @@ RedmineApp::Application.routes.draw do match "/system_log" ,:to => 'system_log#index' match 'system_log/clear' get 'upload_files_menu', :to => 'files#upload_files_menu' + get '/manual/feedback', to:redirect("http://forge.trustie.net/forums/1/memos/1168") ##ended by lizanle resources :git_callback do diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index ea6262931..bc28aa2bd 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -14,7 +14,7 @@ function sd_create_editor(params){ items:['emoticons','fontname', 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', 'formatblock', 'fontsize', '|','indent', 'outdent', - '|','imagedirectupload'], + '|','imagedirectupload','more'], afterChange:function(){//按键事件 var edit = this.edit; var body = edit.doc.body; From e9a7f6f82667136f49114bddcf8c2f0ef222ac95 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 11:02:57 +0800 Subject: [PATCH 26/27] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=90=E7=BB=A9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 56 +++++++++++++++++++++++---- app/helpers/courses_helper.rb | 2 +- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0697f0d0a..0961f2480 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -321,11 +321,12 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") + @homeworks = @course.homework_commons.order("created_at desc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; respond_to do |format| format.xls { - send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", + send_data(member_to_xls(@homeworks,@course,@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition("#{filename}.xls")) } end @@ -963,7 +964,7 @@ class CoursesController < ApplicationController sql_select = "" if groupid == 0 sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -975,7 +976,7 @@ class CoursesController < ApplicationController WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" else sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -1009,16 +1010,54 @@ class CoursesController < ApplicationController end - def member_to_xls members,groups + def member_to_xls homeworks, course, members,groups xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "student" - blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 - sheet1.row(0).default_format = blue + #sheet1.row(0).default_format = blue + #sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)]) + sheet1[0,0] = "课程编号" + sheet1[0,1] = course.id + sheet1[1,0] = "课程学期" + sheet1[1,1] = course.time.to_s+"年"+course.term + sheet1[2,0] = "课程名称" + sheet1[2,1] = course.name + sheet1[3,0] = "教师团队" + sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') + sheet1[4,0] = "主讲教师" + sheet1[4,1] = course.teacher.show_name + sheet1[5,0] = "排名" + sheet1[5,1] = "学生姓名" + sheet1[5,2] = "昵称" + sheet1[5,3] = "学号" + for i in 0 ... homeworks.count + sheet1[5,i+4] = "第"+(i+1).to_s+"次" + end + sheet1[5,homeworks.count+4] = "总成绩" + sheet1[5,0] = "排名" + sheet1[5,0] = "排名" + count_row = 6 + members.each_with_index do |member, i| + sheet1[count_row,0]= i+1 + sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s + sheet1[count_row,2] = member.user.login + sheet1[count_row,3] = member.user.user_extensions.student_id + homeworks.each_with_index do |homework, j| + student_works = homework.student_works.where("user_id = #{member.user.id}") + if student_works.empty? + sheet1[count_row,j+4] = format("%0.2f",0) + else + final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score + score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty + sheet1[count_row,j+4] = format("%0.2f",score <0 ? 0:score) + end + end + sheet1[count_row,homeworks.count+4] = format("%0.2f",member.score.nil? ? 0:member.score.to_s) + count_row += 1 + end - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_score)]) - count_row = 1 +=begin group0 = CourseGroup.new(); group0.id = 0; group0.name = l(:excel_member_with_out_class) @@ -1040,6 +1079,7 @@ class CoursesController < ApplicationController end end end +=end book.write xls_report xls_report.string end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index f326f2099..1e4cedf14 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -795,7 +795,7 @@ module CoursesHelper # 学生按作业总分排序,取前8个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{course.id} From d3ba23bc64d1a64f033017056dbd7fd0dc164674 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 15:37:03 +0800 Subject: [PATCH 27/27] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 11 +++++ app/controllers/homework_common_controller.rb | 6 ++- .../_user_homework_search_list.html.erb | 46 +++++++++++++++++++ app/views/courses/homework_search.js.erb | 5 ++ .../_homework_search_form.html.erb | 6 +++ app/views/homework_common/index.html.erb | 5 +- app/views/users/_user_homework_list.html.erb | 4 +- config/routes.rb | 1 + 8 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 app/views/courses/_user_homework_search_list.html.erb create mode 100644 app/views/courses/homework_search.js.erb create mode 100644 app/views/homework_common/_homework_search_form.html.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0961f2480..97dacb178 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -907,6 +907,17 @@ class CoursesController < ApplicationController return 404 end end + #搜索作业 + def homework_search + @search = "%#{params[:search].strip.downcase}%" + @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + @page = params[:page] ? params[:page].to_i + 1 : 0 + if @is_teacher + @homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end + end private def update_quotes attachment diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d345fba5f..398b385a4 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -15,8 +15,12 @@ class HomeworkCommonController < ApplicationController @new_homework.homework_detail_manual = HomeworkDetailManual.new @new_homework.course = @course @page = params[:page] ? params[:page].to_i + 1 : 0 - @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + if @is_teacher + @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_new = params[:is_new] diff --git a/app/views/courses/_user_homework_search_list.html.erb b/app/views/courses/_user_homework_search_list.html.erb new file mode 100644 index 000000000..585d8761a --- /dev/null +++ b/app/views/courses/_user_homework_search_list.html.erb @@ -0,0 +1,46 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> +<% end %> + + +
    + <% homework_commons.each do |homework_common|%> + + <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %> + <% end%> + <% if homework_commons.count == 10%> + <%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> + <% end%> +
    \ No newline at end of file diff --git a/app/views/courses/homework_search.js.erb b/app/views/courses/homework_search.js.erb new file mode 100644 index 000000000..3c644ad9e --- /dev/null +++ b/app/views/courses/homework_search.js.erb @@ -0,0 +1,5 @@ +<% if @page == 0 %> + $("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% else %> + $("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% end %> \ No newline at end of file diff --git a/app/views/homework_common/_homework_search_form.html.erb b/app/views/homework_common/_homework_search_form.html.erb new file mode 100644 index 000000000..aa3eef59e --- /dev/null +++ b/app/views/homework_common/_homework_search_form.html.erb @@ -0,0 +1,6 @@ +<%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id), + :remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> + + <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> + +<% end %> \ No newline at end of file diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index bc960154e..5c91a37fc 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -36,6 +36,9 @@
    作业
    +
    + <%= render :partial => 'homework_search_form',:locals => {:course=>@course} %> +
    @@ -50,8 +53,8 @@ <% end%>
    <% end%> - <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %> +
    diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 36f823a9a..28544fbf3 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -14,6 +14,7 @@ .homepagePostReplyInputContainer .ke-inline-block {display: none;} .homepagePostReplyInputContainer .ke-container {float: left;} +
    <% homework_commons.each do |homework_common|%>