From 3476731b83a418fa31153866e64245a6ecb16554 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 9 Dec 2015 09:59:13 +0800 Subject: [PATCH 001/105] =?UTF-8?q?=E5=B0=86at=20js=20data=E6=95=B4?= =?UTF-8?q?=E5=90=88=E5=88=B0=E6=96=87=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/at_controller.rb | 25 +++++++++++++++++++++++ app/controllers/issues_controller.rb | 29 ++++++++++----------------- app/helpers/application_helper.rb | 10 +-------- app/views/at/show.js.erb | 8 ++++++++ app/views/issues/show.html.erb | 2 +- config/routes.rb | 3 ++- public/assets/kindeditor/at/config.js | 5 ++--- 7 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 app/controllers/at_controller.rb create mode 100644 app/views/at/show.js.erb diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb new file mode 100644 index 000000000..92506d4e8 --- /dev/null +++ b/app/controllers/at_controller.rb @@ -0,0 +1,25 @@ +#coding=utf-8 + +class AtController < ApplicationController + respond_to :js + + def show + type = params[:type] + case type + when "Issue" + @users = find_issue(params) + else + end + end + + private + def find_issue(params) + #1. issues list persons + #2. project persons + issue = Issue.find(params[:id]) + journals = issue.journals + at_persons = journals.map(&:user) + issue.project.users + at_persons.uniq{|u| u.id}.delete_if{|u| u.id == User.current.id} + end + +end \ No newline at end of file diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 7cdc838e2..6f441c29a 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -142,24 +142,17 @@ class IssuesController < ApplicationController @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq - #id name email - #1. issues list persons - #2. project persons - @at_persons = @journals.map(&:user) + @issue.project.users - @at_persons = @at_persons.uniq{|u| u.id}.delete_if{|u| u.id == User.current.id} - @at_persons = nil - - respond_to do |format|`` - format.html { - retrieve_previous_and_next_issue_ids - render :template => 'issues/show', :layout => @project_base_tag#by young - } - format.api - format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } - format.pdf { - pdf = issue_to_pdf(@issue, :journals => @journals) - send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") ) - } + respond_to do |format| + format.html { + retrieve_previous_and_next_issue_ids + render :template => 'issues/show', :layout => @project_base_tag#by young + } + format.api + format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } + format.pdf { + pdf = issue_to_pdf(@issue, :journals => @journals) + send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") ) + } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ba8fe4f53..227de930f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2624,15 +2624,7 @@ int main(int argc, char** argv){ opt = {enable_at: true, prettify: false, init_activity: false}.merge default_opt ss = '' if opt[:enable_at] - ss = '" + ss += %Q|| end ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg') diff --git a/app/views/at/show.js.erb b/app/views/at/show.js.erb new file mode 100644 index 000000000..df253f237 --- /dev/null +++ b/app/views/at/show.js.erb @@ -0,0 +1,8 @@ +(function(){ + window.atPersonLists = []; + <% @users && @users.each_with_index do |person,index| %> + var o = {id: <%=index%>, name: '<%=person.show_name%>', login: '<%=person.login%>', searchKey: '<%=person.get_at_show_name%>'}; + atPersonLists.push(o); + <% end %> + +})(); diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 80d3aaac1..67d1186c4 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> -<%= import_ke(enable_at: true) %> +<%= import_ke(enable_at: {id: @issue.id, type: 'Issue'}) %> <% end %>
diff --git a/config/routes.rb b/config/routes.rb index 59eb29d70..656f55720 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1035,13 +1035,14 @@ RedmineApp::Application.routes.draw do match 'system_log/clear' ##ended by lizanle - resources :git_callback do collection do post 'post_update' end end + resources :at + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| file = File.join(plugin_dir, "config/routes.rb") if File.exists?(file) diff --git a/public/assets/kindeditor/at/config.js b/public/assets/kindeditor/at/config.js index b9769c42e..0a1bbf11a 100644 --- a/public/assets/kindeditor/at/config.js +++ b/public/assets/kindeditor/at/config.js @@ -1,4 +1,4 @@ -function enableAt(_editor) { +var enableAt = function(_editor) { var editor = _editor; if(editor.edit == undefined || editor.edit.iframe == undefined){ return; @@ -11,7 +11,7 @@ function enableAt(_editor) { console.log("enable at"); $.fn.atwho.debug = true; - if(!atPersonLists){ + if("undefined" === (typeof atPersonLists) || !atPersonLists){ return; } var names = atPersonLists; @@ -32,7 +32,6 @@ function enableAt(_editor) { } $inputor = $(ifrBody).atwho(at_config); - window.aaa= $inputor; $inputor.caret('pos', 47); $inputor.focus().atwho('run'); }; From e9cfe007bbe4bcc1f160a6c0377a11bf8f94ddb9 Mon Sep 17 00:00:00 2001 From: houxiang Date: Thu, 10 Dec 2015 15:59:31 +0800 Subject: [PATCH 002/105] modify by hx --- Gemfile | 2 +- app/controllers/repositories_controller.rb | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 0125e9d60..deecb67e3 100644 --- a/Gemfile +++ b/Gemfile @@ -44,7 +44,7 @@ group :development do gem 'grape-swagger' gem 'better_errors', '~> 1.1.0' gem 'rack-mini-profiler', '~> 0.9.3' - gem 'win32console' + #gem 'win32console' end group :development, :test do diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index dd3f4ede9..db303af53 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -346,10 +346,6 @@ update # end # end - - - - @changesets = g.commits(@project.gpid) # @changesets = @repository.latest_changesets(@path, @rev) # @changesets_count = @repository.latest_changesets(@path, @rev).count @@ -406,7 +402,7 @@ update count = count_commits(@project.gpid , 25 , 50)+ 25 * 20 elsif g.commits(@project.gpid , :page=>75).count ==0 count = count_commits(@project.gpid , 50 , 75)+ 50 * 20 - elsif g.commits(@project.gpid , :page=>100).count== 0 + elsif g.commits(@project.gpid , :page=>100).count==0 count = count_commits(@project.gpid , 75 , 100) + 75 * 20 elsif g.commits(@project.gpid , :page=>125).count==0 count = count_commits(@project.gpid , 100 , 125) + 100 * 20 From 91b245ad2cb694726996c31811276b5129a0be7e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 12 Dec 2015 18:06:59 +0800 Subject: [PATCH 003/105] =?UTF-8?q?lastname=E4=B8=BA=E7=A9=BA=E6=97=B6?= =?UTF-8?q?=E4=B9=9F=E5=8F=AF=E4=BB=A5=E5=8A=A0,=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=9C=81=E6=8E=89=E6=9F=A5=E8=AF=A2extensions=E7=9A=84?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 65c0bf858..0d3d465e2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -399,16 +399,7 @@ class User < Principal end def show_name - name = "" - unless self.user_extensions.nil? - if self.user_extensions.identity == 2 - name = firstname - else - name = lastname+firstname - end - else - name = lastname+firstname - end + name = lastname + firstname name.empty? || name.nil? ? login : name end ## end From 9b86ec30445a0ad2682ee91361ecbbf2a0019543 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 10:07:55 +0800 Subject: [PATCH 004/105] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_search_all_results.html.erb | 4 ++-- app/views/welcome/_search_memo_results.html.erb | 2 +- app/views/welcome/_search_project_results.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/welcome/_search_all_results.html.erb b/app/views/welcome/_search_all_results.html.erb index 34ef9a8eb..7256534e5 100644 --- a/app/views/welcome/_search_all_results.html.erb +++ b/app/views/welcome/_search_all_results.html.erb @@ -67,7 +67,7 @@
  • <%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description%>
  • -
  • 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>创建时间:<%= date_format_local( Project.find(item.id).created_on) %>
  • +
  • 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(item.id).updated_on) %>
  • @@ -83,7 +83,7 @@
  • <%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%>
  • -
  • 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>创建时间:<%= format_date( item.created_at) %>
  • +
  • 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>更新时间:<%= format_date( item.updated_at) %>
  • diff --git a/app/views/welcome/_search_memo_results.html.erb b/app/views/welcome/_search_memo_results.html.erb index c5fe9cc72..98f9ae7f0 100644 --- a/app/views/welcome/_search_memo_results.html.erb +++ b/app/views/welcome/_search_memo_results.html.erb @@ -12,7 +12,7 @@
  • <%= memo.try(:highlight).try(:content) ? memo.highlight.content[0].html_safe : memo.content.html_safe%>
  • -
  • 发帖人:<%= memo.author_id ? User.find(memo.author_id).login : '无' %>创建时间:<%= format_date( memo.created_at) %>
  • +
  • 发帖人:<%= memo.author_id ? User.find(memo.author_id).login : '无' %>更新时间:<%= format_date( memo.updated_at) %>
  • diff --git a/app/views/welcome/_search_project_results.html.erb b/app/views/welcome/_search_project_results.html.erb index b3ed44654..5775a939d 100644 --- a/app/views/welcome/_search_project_results.html.erb +++ b/app/views/welcome/_search_project_results.html.erb @@ -12,7 +12,7 @@
  • <%= project.try(:highlight).try(:description) ? project.highlight.description[0].html_safe : project.description%>
  • -
  • 管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %>创建时间:<%= date_format_local( Project.find(project.id).created_on) %>
  • +
  • 管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(project.id).updated_on) %>
  • From 0602a03e12000d2b4081b33215c0e7d97969f6e1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 14 Dec 2015 10:26:34 +0800 Subject: [PATCH 005/105] =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E6=A0=8F=E7=9B=AE=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 93 +++++++++++++++++++ app/helpers/files_helper.rb | 6 ++ app/views/files/_subfield_files.html.erb | 2 +- .../files/search_files_in_subfield.js.erb | 2 + .../_org_left_subfield_list.html.erb | 4 +- config/routes.rb | 2 +- db/schema.rb | 4 + 7 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 app/views/files/search_files_in_subfield.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 328446fbb..6ed42bd6e 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -131,6 +131,45 @@ class FilesController < ApplicationController end end + def search_files_in_subfield + sort = "" + @sort = "" + @order = "" + @is_remote = true + @q = params[:name].strip + if params[:sort] + order_by = params[:sort].split(":") + @sort = order_by[0] + if order_by.count > 1 + @order = order_by[1] + end + sort = "#{@sort} #{@order}" + end + # show_attachments [@course] + begin + q = "%#{params[:name].strip}%" + #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? + if params[:insite] + if q == "%%" + @result = [] + @searched_attach = paginateHelper @result,10 + else + @result = find_public_attache q,sort + @result = visable_attachemnts_insite @result,@org_subfield + @searched_attach = paginateHelper @result,10 + end + else + @result = find_org_subfield_attache q,@org_subfield,sort + @result = visable_attachemnts @result + @searched_attach = paginateHelper @result,10 + #@tag_list = get_course_tag_list @course + end + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url + end + end + def find_course_attache keywords,course,sort = "" if sort == "" sort = "created_on DESC" @@ -144,6 +183,19 @@ class FilesController < ApplicationController #resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC") end + def find_org_subfield_attache keywords,org_subfield,sort = "" + if sort == "" + sort = "created_on DESC" + end + if keywords != "%%" + resultSet = Attachment.where("attachments.container_type = 'OrgSubfield' And attachments.container_id = '#{org_subfield.id}' AND filename LIKE :like ", like: "%#{keywords}%"). + reorder(sort) + else + resultSet = Attachment.where("attachments.container_type = 'OrgSubfield' And attachments.container_id = '#{org_subfield.id}' "). reorder(sort) + end + #resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC") + end + def find_project_attache keywords,project,sort = "" if sort == "" sort = "created_on DESC" @@ -298,6 +350,47 @@ class FilesController < ApplicationController render :layout => 'base_courses' elsif params[:org_subfield_id] + if params[:sort] + params[:sort].split(",").each do |sort_type| + order_by = sort_type.split(":") + + case order_by[0] + when "filename" + attribute = "filename" + when "size" + attribute = "filesize" + when "attach_type" + attribute = "attachtype" + when "content_type" + attribute = "created_on" + when "field_file_dense" + attribute = "is_public" + when "downloads" + attribute = "downloads" + when "created_on" + attribute = "created_on" + when "quotes" + attribute = "quotes" + else + attribute = "created_on" + end + @sort = order_by[0] + @order = order_by[1] + if order_by.count == 1 && attribute + sort += "#{Attachment.table_name}.#{attribute} asc " + if sort_type != params[:sort].split(",").last + sort += "," + end + elsif order_by.count == 2 && order_by[1] + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + if sort_type != params[:sort].split(",").last + sort += "," + end + end + end + else + sort = "#{Attachment.table_name}.created_on desc" + end @container_type = 2 @organization = Organization.find(params[:organization_id]) @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index cf9cbcc32..276786fb7 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -141,6 +141,12 @@ module FilesHelper result << attachment end end + elsif obj.is_a?(OrgSubfield) + attachments.each do |attachment| + if attachment.is_public? || (attachment.container_type == "OrgSubfield" && attachment.container_id == obj.id )|| attachment.author_id == User.current.id + result << attachment + end + end end end result diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index ea408c7a6..b0bc9ea09 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -68,7 +68,7 @@
    - <%= form_tag( search_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> + <%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> diff --git a/app/views/files/search_files_in_subfield.js.erb b/app/views/files/search_files_in_subfield.js.erb new file mode 100644 index 000000000..deed2d5d3 --- /dev/null +++ b/app/views/files/search_files_in_subfield.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', + :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 367c23843..152310bba 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -29,8 +29,8 @@ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% else %> - <%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> - <%= field.name %> + <%= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <% end %>
    - @@ -40,11 +39,10 @@

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

    - - - - - +
    + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> +
    <% end %> diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index b0bc9ea09..2a552dc43 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -70,7 +70,7 @@
    <%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> + <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> <% end %> <%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> @@ -88,7 +88,7 @@
    -
    +
    <%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
    From 14912078ee3067a922e7a61886f763a3ed14c195 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 11:03:04 +0800 Subject: [PATCH 010/105] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cbc646eac..ad4da60a7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1934,6 +1934,8 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="StudentWork" candown = true + elsif attachment.container.class.to_s=="BlogComment" #博客资源允许下载 + candown = true elsif attachment.container.class.to_s == "User" candown = (attachment.is_public == 1 || attachment.is_public == true || attachment.author_id == User.current.id) elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses From 9aebafee09990cdd25fb4bafa0d9977e3b6c381b Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 11:11:09 +0800 Subject: [PATCH 011/105] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_search_all_results.html.erb | 6 +++++- app/views/welcome/_search_course_results.html.erb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/views/welcome/_search_all_results.html.erb b/app/views/welcome/_search_all_results.html.erb index 537da336a..4ed9fba33 100644 --- a/app/views/welcome/_search_all_results.html.erb +++ b/app/views/welcome/_search_all_results.html.erb @@ -37,7 +37,11 @@
  • <%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %>
  • -
  • 教师:<%= User.find(item.tea_id).realname %>授课时间:<%= item.time.to_s + item.term%><%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
  • +
  • + 教师:<%= User.find(item.tea_id).realname %> + 授课时间:<%= item.time.to_s + item.term%> + 更新时间:<%= format_date(item.updated_at)%> + <%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
  • diff --git a/app/views/welcome/_search_course_results.html.erb b/app/views/welcome/_search_course_results.html.erb index 89567063d..e51452ada 100644 --- a/app/views/welcome/_search_course_results.html.erb +++ b/app/views/welcome/_search_course_results.html.erb @@ -12,7 +12,11 @@
  • <%= course.try(:highlight).try(:description) ? course.highlight.description[0].html_safe : (course.description.present? ? course.description : '暂时没有该课程描述') %>
  • -
  • 教师:<%= User.find(course.tea_id).realname %>授课时间:<%= course.time.to_s + course.term%><%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%>
  • +
  • + 教师:<%= User.find(course.tea_id).realname %> + 授课时间:<%= course.time.to_s + course.term%> + 更新时间:<%= format_date(course.updated_at)%> + <%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%>
  • From f3013ca3e71dc61effbedb4a733ad41c2fbe7919 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 11:22:36 +0800 Subject: [PATCH 012/105] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=9A=84=E6=8F=90=E7=A4=BA=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 2 +- app/views/layouts/_unlogin_header.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index d100e79a5..a0cbe4eed 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -54,7 +54,7 @@ <% name = name%> <%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %> - " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户以及资源"/> + " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户、资源以及帖子"/> diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index 162f59ed4..7a2196d01 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -52,7 +52,7 @@ <% name = name%> <%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %> - " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户以及资源" onkeypress="search_in_header_I(event,$(this));"/> + " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户、资源以及帖子" onkeypress="search_in_header_I(event,$(this));"/> From a5fa68c9289c7220a25e7901accc11e029999052 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 14 Dec 2015 16:41:18 +0800 Subject: [PATCH 013/105] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 6 +++++- app/views/files/_upload_subfield_file.html.erb | 6 ++---- app/views/files/subfield_upload_file.js.erb | 6 ++++++ app/views/layouts/base_org.html.erb | 4 ++-- app/views/organizations/_org_left_subfield_list.html.erb | 6 +++++- config/routes.rb | 1 + public/stylesheets/org.css | 4 +++- 7 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 app/views/files/subfield_upload_file.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 6ed42bd6e..7b375377c 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -392,8 +392,8 @@ class FilesController < ApplicationController sort = "#{Attachment.table_name}.created_on desc" end @container_type = 2 - @organization = Organization.find(params[:organization_id]) @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] + @organization = Organization.find(@containers.first.organization_id) show_attachments @containers render :layout => 'base_org' # @subfield = params[:org_subfield_id] @@ -733,4 +733,8 @@ class FilesController < ApplicationController # format.html end end + + def subfield_upload_file + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + end end diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb index c3ca72ecd..5d8723d03 100644 --- a/app/views/files/_upload_subfield_file.html.erb +++ b/app/views/files/_upload_subfield_file.html.erb @@ -10,7 +10,7 @@ - <%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %> + <%= render :partial => 'files/attachement_list'%>
    <%= l(:button_cancel)%> <%= l(:button_confirm)%> @@ -18,9 +18,7 @@
    - <% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> - <% end %> + | - end ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg') if opt[:enable_at] diff --git a/app/views/at/show.js.erb b/app/views/at/show.js.erb deleted file mode 100644 index df253f237..000000000 --- a/app/views/at/show.js.erb +++ /dev/null @@ -1,8 +0,0 @@ -(function(){ - window.atPersonLists = []; - <% @users && @users.each_with_index do |person,index| %> - var o = {id: <%=index%>, name: '<%=person.show_name%>', login: '<%=person.login%>', searchKey: '<%=person.get_at_show_name%>'}; - atPersonLists.push(o); - <% end %> - -})(); diff --git a/app/views/at/show.json.erb b/app/views/at/show.json.erb new file mode 100644 index 000000000..7af729ff7 --- /dev/null +++ b/app/views/at/show.json.erb @@ -0,0 +1,6 @@ +[ + <% @users && @users.each_with_index do |person,index| %> + {"id": <%=index%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} + <%= index != @users.size-1 ? ',' : '' %> + <% end %> +] diff --git a/app/views/bids/_new_homework_form.html.erb b/app/views/bids/_new_homework_form.html.erb index 5958fccff..815ff27e4 100644 --- a/app/views/bids/_new_homework_form.html.erb +++ b/app/views/bids/_new_homework_form.html.erb @@ -15,10 +15,10 @@ <% if edit_mode %> - <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0 %> + <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0,act_id: @course.id, act_type: @course.class.to_s %> <% else %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0 %> + <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0, act_id: @course.id, act_type: @course.class.to_s %> <% end %>
    diff --git a/app/views/blog_comments/_edit.html.erb b/app/views/blog_comments/_edit.html.erb index c7065ece4..048402635 100644 --- a/app/views/blog_comments/_edit.html.erb +++ b/app/views/blog_comments/_edit.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false) %> + <%= import_ke(enable_at: true, prettify: false) %> <%= javascript_include_tag 'blog' %> <% end %> @@ -34,7 +34,9 @@ :class => 'talk_text fl', :input_html => { :id => 'message_content', :class => 'talk_text fl', - :maxlength => 5000 }%> + :maxlength => 5000 }, + act_id: article.id, act_type: article.class.to_s + %>

    diff --git a/app/views/blog_comments/_reply_form.html.erb b/app/views/blog_comments/_reply_form.html.erb index 32f4333c2..67642069c 100644 --- a/app/views/blog_comments/_reply_form.html.erb +++ b/app/views/blog_comments/_reply_form.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false) %> + <%= import_ke(enable_at: true, prettify: false) %> <% end %>
  • @@ -27,7 +27,9 @@ :minHeight=>100, :input_html => { :id => 'message_content', :class => 'talk_text fl', - :maxlength => 5000 }%> + :maxlength => 5000 }, + at_id: article.id, at_type: article.class.to_s + %>

  • diff --git a/app/views/blog_comments/quote.js.erb b/app/views/blog_comments/quote.js.erb index 088b2cf67..cd53707d5 100644 --- a/app/views/blog_comments/quote.js.erb +++ b/app/views/blog_comments/quote.js.erb @@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%"); + init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>"); }); }else if($("#reply_to_message_<%= @blogComment.id%>").length >0) { $("#reply_to_message_<%= @blogComment.id%>").replaceWith("

    "); diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb index 1cb64b2b5..06adca74d 100644 --- a/app/views/blog_comments/reply.js.erb +++ b/app/views/blog_comments/reply.js.erb @@ -1,7 +1,7 @@ <% if @in_user_center%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); <% else%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); <% end %> \ No newline at end of file diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index e46a7249f..aa984c621 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -27,7 +27,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @article.id%>,null,"85%"); + init_activity_KindEditor_data(<%= @article.id%>,null,"85%", '<%=@article.class.to_s%>'); showNormalImage('message_description_<%= @article.id %>'); }); diff --git a/app/views/blogs/_article_list.html.erb b/app/views/blogs/_article_list.html.erb index a91dd8151..f6383c95b 100644 --- a/app/views/blogs/_article_list.html.erb +++ b/app/views/blogs/_article_list.html.erb @@ -74,7 +74,7 @@ } $(function () { - init_activity_KindEditor_data(<%= topic.id%>, null, "87%"); + init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>"); showNormalImage('activity_description_<%= topic.id %>'); /*var description_images=$("div#activity_description_<%#= topic.id %>").find("img"); if (description_images.length>0) { diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index e4cf57ae3..31cdf41eb 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false) %> + <%= import_ke(enable_at: true, prettify: false) %> <% end %> <%= error_messages_for 'message' %> @@ -34,7 +34,9 @@ :class => 'talk_text fl', :input_html => { :id => 'message_content', :class => 'talk_text fl', - :maxlength => 5000 }%> + :maxlength => 5000 }, + at_id: topic.id, at_type: topic.class.to_s + %>

    diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 306a0c7ce..074da9af1 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -74,7 +74,7 @@ } $(function () { - init_activity_KindEditor_data(<%= topic.id%>, null, "87%"); + init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>"); showNormalImage('activity_description_<%= topic.id %>'); /*var description_images=$("div#activity_description_<%#= topic.id %>").find("img"); if (description_images.length>0) { diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index ea904a63f..c3942ee38 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -1,3 +1,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%"); +init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%", "UserActivity"); diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index b4c560fa4..d31b28bc0 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <% end %> <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <% end %> - diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index f4b8ce8a4..9d20b5adb 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -1,6 +1,6 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <%= javascript_include_tag 'blog' %> <% end %> @@ -40,7 +40,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @article.id%>,null,"87%"); + init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>"); showNormalImage('message_description_<%= @article.id %>'); }); diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index ea63ea12c..ffeda2cb5 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -2,10 +2,10 @@ alert('启动成功'); <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); <% end %> /*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/ <% elsif @statue == 2 %> diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index 214a157dc..308e8a39f 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -1,10 +1,10 @@ alert('关闭成功'); <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); +init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); <% end %> /* $("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/ diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index b8f362429..05793ea7c 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -1,8 +1,7 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> <% end %> - <%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %> <%= error_messages_for 'issue', 'time_entry' %> <%= render :partial => 'conflict' if @conflict %> @@ -24,7 +23,7 @@
    回复 - <%= f.kindeditor :notes, :style => "width:99%;",:height=>'100px', :cssData =>"blockquote { padding:0px}", :rows => "5", :no_label => true, :editor_id=>'issue_journal_kind_reply' %> + <%= f.kindeditor :notes, :style => "width:99%;",:height=>'100px', :cssData =>"blockquote { padding:0px}", :rows => "5", :no_label => true, :editor_id=>'issue_journal_kind_reply', at_id: @issue.id, at_type: @issue.class.to_s %>
    diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 0d5c876f1..c1d2a841b 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -49,7 +49,7 @@ <%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %> <%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %> <%#= content_tag 'span', :id => "issue_description_and_toolbar" do %> - <%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true %> + <%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true,at_id: @project.id, at_type: @project.class.to_s %> <%# end %> <%#= wikitoolbar_for 'issue_description' %> <% end %> diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 0b1c02b88..8ff5a71f1 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,3 +1,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file diff --git a/app/views/issues/add_journal_in_org.js.erb b/app/views/issues/add_journal_in_org.js.erb index ad7a85540..34e874f13 100644 --- a/app/views/issues/add_journal_in_org.js.erb +++ b/app/views/issues/add_journal_in_org.js.erb @@ -1,3 +1,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index 9c6ad647c..c4daedaa4 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> <% end %> diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 67d1186c4..80d3aaac1 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> -<%= import_ke(enable_at: {id: @issue.id, type: 'Issue'}) %> +<%= import_ke(enable_at: true) %> <% end %>
    diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 44f3e5a64..b7cc1a0c2 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -34,7 +34,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @memo.id%>,null,"87%"); + init_activity_KindEditor_data(<%= @memo.id%>,null,"87%", "<%=@memo.class.to_s%>"); }); function del_confirm(){ diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 0f39b73d2..e06c04775 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -27,7 +27,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%"); + init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index eee820c61..b0e8ecb85 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -11,7 +11,7 @@ if($("#reply_message_<%= @message.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @message.id%>,null,"85%"); + init_activity_KindEditor_data(<%= @message.id%>,null,"85%", "<%=@message.class.to_s%>"); }); }else if($("#reply_to_message_<%= @message.id%>").length >0) { $("#reply_to_message_<%= @message.id%>").replaceWith("

    "); diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index ac80de3b4..518479344 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -3,4 +3,4 @@ <%elsif @course%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); <%end%> -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file diff --git a/app/views/org_document_comments/_reply_form.html.erb b/app/views/org_document_comments/_reply_form.html.erb index 7871b910d..8808ff8b7 100644 --- a/app/views/org_document_comments/_reply_form.html.erb +++ b/app/views/org_document_comments/_reply_form.html.erb @@ -1,2 +1,2 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb index 40ed2eeb2..84f8c1f83 100644 --- a/app/views/org_document_comments/add_reply.js.erb +++ b/app/views/org_document_comments/add_reply.js.erb @@ -1,3 +1,3 @@ $("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document, :act => @act}) %>"); -init_activity_KindEditor_data(<%= @act.id %>,"","87%"); \ No newline at end of file +init_activity_KindEditor_data(<%= @act.id %>,"","87%", "<%=@act.class.to_s%>"); \ No newline at end of file diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index 331e61bfd..ddbb6bf9c 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -19,7 +19,7 @@ <% @documents.each do |document| %> <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first} %> diff --git a/app/views/org_document_comments/quote.js.erb b/app/views/org_document_comments/quote.js.erb index a71b23f0e..7ea5daf7b 100644 --- a/app/views/org_document_comments/quote.js.erb +++ b/app/views/org_document_comments/quote.js.erb @@ -3,7 +3,7 @@ if($("#reply_message_<%= @org_comment.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%"); + init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%", "<%=@org_comment.class.to_s%>"); }); }else if($("#reply_to_message_<%= @org_comment.id %>").length >0) { $("#reply_to_message_<%= @org_comment.id%>").replaceWith("

    "); diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 1b1eca418..3a50e5faa 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -5,7 +5,7 @@ diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 33ac13e76..8f9acbc7b 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -2,7 +2,7 @@ <% org_activities.each do |act| %> <% if act.container_type == 'Organization' %> diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 7200761a3..9d62dd1f9 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -59,7 +59,7 @@ <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> diff --git a/app/views/student_work/forbidden_anonymous_comment.js.erb b/app/views/student_work/forbidden_anonymous_comment.js.erb index a72c29509..47dfb4b51 100644 --- a/app/views/student_work/forbidden_anonymous_comment.js.erb +++ b/app/views/student_work/forbidden_anonymous_comment.js.erb @@ -1,7 +1,7 @@ <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); +init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); <% end %> \ No newline at end of file diff --git a/app/views/student_work/set_score_rule.js.erb b/app/views/student_work/set_score_rule.js.erb index ff3a0e7ed..180f04faa 100644 --- a/app/views/student_work/set_score_rule.js.erb +++ b/app/views/student_work/set_score_rule.js.erb @@ -1,8 +1,8 @@ clickCanel(); <% if @user_activity_id %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); <% else %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); <% end %> \ No newline at end of file diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 4f1d3a5d8..557b9e9ee 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -1,12 +1,12 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <% end %> -
    -

    <%= l(:label_issue_tracking) %>

    -
    -
    - <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> - <%= hidden_field_tag 'set_filter', '1' %> - - <%= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %> -

    <%= l(:label_issues_sum) %>:<%= @project.issues.visible.all.count %> - <%= l(:lable_issues_undo) %>:<%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> -

    +
    +
    +
    <%= l(:label_issue_tracking) %>
    +
    +
    + <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> + <%= hidden_field_tag 'set_filter', '1' %> + + <%#= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %> +

    <%= l(:label_issues_sum) %>:<%= @project.issues.visible.all.count %> + <%= l(:lable_issues_undo) %>:<%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> +

    -
    -
    +
    +
    + + <%= select( :issue, :user_id, principals_options_for_isuue_list(@project), + { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 + }, + {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"w90 mr18"} + ) + %> + <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), + { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 + }, + {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w90 mr18"} + ) + %> + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + { :include_blank => false,:selected=>@status_id ? @status_id : 0 + }, + {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"w90 mr18"} + ) + %> + <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), + { :include_blank => false,:selected=>@author_id ? @author_id : 0 + }, + {:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:class=>"w90 mr18"} + ) + %> +
    +
    +
     
    +
    + + <%= text_field_tag 'issue_create_date_start_show', '创建日期起始',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%> + <%= calendar_for('issue_create_date_start_show') %> +
    +
     - 
    +
    + + <%= text_field_tag 'issue_create_date_end_show', '创建日期结束',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%> + <%= calendar_for('issue_create_date_end_show') %> +
    +
    +
    + <% end %> - <%= select( :issue, :user_id, principals_options_for_isuue_list(@project), - { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 - }, - {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"w90"} - ) - %> - <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), - { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 - }, - {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w90"} - ) - %> - <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), - { :include_blank => false,:selected=>@status_id ? @status_id : 0 - }, - {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"w90"} - ) - %> - <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), - { :include_blank => false,:selected=>@author_id ? @author_id : 0 - }, - {:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:class=>"w90"} - ) - %> -
    -
    -
     
    -
    - - <%= text_field_tag 'issue_create_date_start_show', '创建日期起始',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%> - <%= calendar_for('issue_create_date_start_show') %> -
    -
     - 
    -
    - - <%= text_field_tag 'issue_create_date_end_show', '创建日期结束',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%> - <%= calendar_for('issue_create_date_end_show') %> -
    -
    <% end %> +
    -
    - <% end %> -
    -
    - <% if !@query.new_record? && @query.editable_by?(User.current) %> - <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> - <%= delete_link query_path(@query) %> - <% end %> -
    +
    + <% if !@query.new_record? && @query.editable_by?(User.current) %> + <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> + <%= delete_link query_path(@query) %> + <% end %> +
    -<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> -
    -
    + <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> +
    +
    -<%= error_messages_for 'query' %> + <%= error_messages_for 'query' %> -<% if @query.valid? %> - <% if @issues.empty? %> -

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

    - <% else %> -
    - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %> + <% if @query.valid? %> + <% if @issues.empty? %> +

    + <%= l(:label_no_data) %> +

    + <% else %> +
    + <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %> +
    + + + <% end %> + +
    + <% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> + <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> + <%= f.link_to 'PDF', :url => params %> + <% end %>
    + + <% end %> + <%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> + <% content_for :sidebar do %> + <%= render :partial => 'issues/sidebar' %> <% end %> -
    - <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> - <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> - <%= f.link_to 'PDF', :url => params %> - <% end %> -
    + <% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, + {:query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_issue_plural)) %> + <%= auto_discovery_link_tag(:atom, + {:controller => 'journals', :action => 'index', + :query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_changes_details)) %> + <% end %> - -<% end %> -<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> -<% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> -<% end %> - -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, - {:query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_issue_plural)) %> - <%= auto_discovery_link_tag(:atom, - {:controller => 'journals', :action => 'index', - :query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_changes_details)) %> -<% end %> - -<%= context_menu issues_context_menu_path %> + <%= context_menu issues_context_menu_path %> +
    \ No newline at end of file diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index aa3297128..c0afe45d5 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -161,9 +161,9 @@ a:hover.invi_search_btn{ background:#0da1b2; border:1px solid #0da1b2;} /*问题跟踪*/ .problem_top{ margin:10px 0 ;} -.problem_search_input{ border:1px solid #64bdd9; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:5px;} -a.problem_search_btn{ background:#64bdd9; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #64bdd9; padding-top:2px; cursor:pointer;} -a:hover.problem_search_btn{ background:#3da1c1; border:1px solid #3da1c1;} +.problem_search_input{ border:1px solid #dddddd; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:5px;} +a.problem_search_btn{ background:#269ac9; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #64bdd9; padding-top:2px; cursor:pointer;} +a:hover.problem_search_btn{ background:#269ac9; border:1px solid #3da1c1;} a.problem_new_btn{ margin-left:10px; border:1px solid #ff7143; color:#ff7143; width:60px; height:21px; font-size:12px; text-align:center; padding-top:3px;} a:hover.problem_new_btn{ background:#ff7143; color:#fff;} .problem_p{ color:#535252; margin-top:5px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 003cf90df..13362dd19 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -87,6 +87,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mr55{ margin-right:55px;} .mr10{ margin-right:10px;} .mr15 {margin-right:15px;} +.mr18 {margin-right:15px;} .mr20{ margin-right:20px;} .mr25 {margin-right:25px;} .mr30{ margin-right:30px;} From 032428264107c4a17c33228d0237a34b1cc7be9f Mon Sep 17 00:00:00 2001 From: houxiang Date: Wed, 16 Dec 2015 14:30:46 +0800 Subject: [PATCH 033/105] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=AF=8F=E4=B8=AA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E5=90=84=E4=B8=AA=E6=88=90=E5=91=98?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=8F=90=E4=BA=A4=E8=B4=A1=E7=8C=AE=E6=AC=A1?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/gitlab/client/repositories.rb | 7 +++++ lib/tasks/project_commits_query.rake | 30 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 lib/tasks/project_commits_query.rake diff --git a/lib/gitlab-cli/lib/gitlab/client/repositories.rb b/lib/gitlab-cli/lib/gitlab/client/repositories.rb index f489e5009..e56a740db 100644 --- a/lib/gitlab-cli/lib/gitlab/client/repositories.rb +++ b/lib/gitlab-cli/lib/gitlab/client/repositories.rb @@ -85,5 +85,12 @@ class Gitlab::Client get("/projects/#{project}/repository/commits/#{sha}/diff") end alias_method :repo_commit_diff, :commit_diff + + #Get the commits count of each contributor in a project + #@param [Integer] project the ID fo a project. + # @return [Gitlab::ObjectifiedHash] + def contributors(project) + get("/projects/#{project}/repository/contributors") + end end end diff --git a/lib/tasks/project_commits_query.rake b/lib/tasks/project_commits_query.rake new file mode 100644 index 000000000..df33419f3 --- /dev/null +++ b/lib/tasks/project_commits_query.rake @@ -0,0 +1,30 @@ +#coding=utf-8 + +namespace :gitlab do + desc "sync gitlab's users which lost in last sync" + task :query => :environment do + g = Gitlab.client + projects = Project.all + users_email = User.find_by_sql("select mail from users where mail != '' ") + projects.each do|project| + gpid = project.gpid + begin + contributors_list = g.contributors(gpid) + rescue + next + end + puts "project_id #{project.id}" + contributors_list.each do|contributor| + if users_email.include?(contributor.email) + contributors_list.delete(contributor) + end + end + + contributors_list.each do|contributor| + puts "name #{contributor.name}" + puts "email #{contributor.email}" + puts "commits_count #{contributor.commits}" + end + end + end +end \ No newline at end of file From 0fef18312dc0f19246fcc38936219826283c9fc8 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 16 Dec 2015 15:36:01 +0800 Subject: [PATCH 034/105] =?UTF-8?q?=E9=BC=A0=E6=A0=87=E7=BB=8F=E8=BF=87?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A0=8F=E7=9B=AETAG=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=8F=98=E6=88=90=E6=89=8B=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/tags/_tag_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index 14b6a0597..de8c0a4d2 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -2,7 +2,7 @@ <% if @tags.size > 0 %> <% @tags.each do |tag| %> - <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> + <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <%= tag %> <% case object_flag %> From b13ae8f599378215f66a71273fa2f7f4cb23a6d9 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 16 Dec 2015 15:55:40 +0800 Subject: [PATCH 035/105] issue --- app/controllers/issues_controller.rb | 2 +- app/views/issues/_list.html.erb | 15 ++++++++++++--- app/views/issues/index.html.erb | 16 ++++++++-------- app/views/issues/index.js.erb | 5 ++--- public/javascripts/application.js | 4 ++++ 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 1eb39fb32..48bf3b568 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -81,7 +81,7 @@ class IssuesController < ApplicationController @status_id = params[:status_id] @subject = params[:subject] @issue_count = @query.issue_count - @issue_pages = Paginator.new @issue_count, @limit, params['page'] + @issue_pages = Paginator.new @issue_count, @limit, params['page'].to_i + 1 @offset ||= @issue_pages.offset @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => sort_clause, diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 327cc2c75..c071d57d8 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -39,6 +39,15 @@ <%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> <% end %> -
      - <%= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => true, :flag => true %> -
    \ No newline at end of file + <% if issues.count == 10%> +
    展开更多<%=link_to "", project_issues_path(:project_id => project.id,:page => issue_pages.page),:id => "more_issues_link",:remote => "true",:class => "none" %>
    + <%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> + <% end%> + + + + \ No newline at end of file diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index df7f9dddc..7c358aaed 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -144,19 +144,19 @@

    <% else %>
    - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %> + <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project} %>
    <% end %> -
    - <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> - <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> - <%= f.link_to 'PDF', :url => params %> - <% end %> -
    + + + + + + + diff --git a/db/schema.rb b/db/schema.rb index 17e613acb..bcc6b2c80 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -544,26 +544,23 @@ ActiveRecord::Schema.define(:version => 20151209085942) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "editor_of_documents", :force => true do |t| @@ -912,6 +909,16 @@ ActiveRecord::Schema.define(:version => 20151209085942) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" From 0a3c5f6acc8a17ff2a9be18d617876f252abac2b Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 17 Dec 2015 09:22:01 +0800 Subject: [PATCH 042/105] =?UTF-8?q?issues=E5=A6=82=E6=9E=9C=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E4=B8=BA=E7=A9=BA=E9=9C=80=E8=A6=81=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 6 ++++-- app/views/issues/update.js.erb | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 3263ebc07..140d49f37 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -219,7 +219,7 @@ class IssuesController < ApplicationController @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) saved = false begin - saved = @issue.save_issue_with_child_records(params, @time_entry) + @saved = @issue.save_issue_with_child_records(params, @time_entry) rescue ActiveRecord::StaleObjectError @conflict = true if params[:last_journal_id] @@ -228,7 +228,7 @@ class IssuesController < ApplicationController end end - if saved + if @saved #修改界面增加跟踪者 watcherlist = @issue.watcher_users select_users = [] @@ -265,6 +265,8 @@ class IssuesController < ApplicationController end else respond_to do |format| + + format.js format.html { render :action => 'edit' } format.api { render_validation_errors(@issue) } end diff --git a/app/views/issues/update.js.erb b/app/views/issues/update.js.erb index 8ff6e5245..cb281de72 100644 --- a/app/views/issues/update.js.erb +++ b/app/views/issues/update.js.erb @@ -1,3 +1,4 @@ +<% if @saved %> $("#issue_detail").replaceWith('<%= escape_javascript(render :partial => 'issues/detail') %>') $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') $("#issue_detail").show(); @@ -17,4 +18,6 @@ issue_desc_editor = KindEditor.create('#issue_description', "allowFileManager":true, "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"}); - +<%else%> + alert('<%= @issue.errors.full_messages[0].to_s%>') +<%end %> From 8d58b045f19a399538df3f3560ef36ec903dfe9f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 17 Dec 2015 09:55:02 +0800 Subject: [PATCH 043/105] =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=8D=B4=E5=BC=B9=E5=87=BA=E5=9B=BE=E7=89=87=E6=A1=86=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index dcf153a80..901e302d3 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -969,6 +969,7 @@ function showNormalImage(id) { var element=$("").attr("href",image.attr('src')); image.wrap(element); } + $('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框 } - $('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); + } From acb604883db69def25aa662c9938f2cf2d36dbca Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 17 Dec 2015 10:01:28 +0800 Subject: [PATCH 044/105] =?UTF-8?q?=E9=A1=B9=E7=9B=AE/=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=85=B3=E8=81=94=E7=BB=84=E7=BB=87=EF=BC=8C?= =?UTF-8?q?=E5=B7=A6=E8=BE=B9=E7=9A=84=E7=BB=84=E7=BB=87=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=94=B1=E6=AF=8F=E9=A1=B510=E4=B8=AA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=A2=9E=E8=87=B315=E4=B8=AA=E7=BB=84=E7=BB=87=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 7 ++++--- app/controllers/projects_controller.rb | 7 ++++--- app/views/courses/search_public_orgs_not_in_course.js.erb | 2 +- .../projects/search_public_orgs_not_in_project.js.erb | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1b0ead141..aa0e1596f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -36,17 +36,18 @@ class CoursesController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end + limit = 15 course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id) if course_org_ids.empty? - @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count else course_org_ids = "(" + course_org_ids.join(',') + ")" - @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count end # @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count - @orgs_page = Paginator.new @org_count, 10,params[:page] + @orgs_page = Paginator.new @org_count, limit,params[:page] @hint_flag = params[:hint_flag] #render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json respond_to do |format| diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 88aae0f8b..7384e2c98 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -75,17 +75,18 @@ class ProjectsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end + limit = 15 project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id) if project_org_ids.empty? - @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count else project_org_ids = "(" + project_org_ids.join(',') + ")" - @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count end # @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count - @orgs_page = Paginator.new @org_count, 10,params[:page] + @orgs_page = Paginator.new @org_count, limit,params[:page] @no_roll_hint = params[:hint_flag] #render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json respond_to do |format| diff --git a/app/views/courses/search_public_orgs_not_in_course.js.erb b/app/views/courses/search_public_orgs_not_in_course.js.erb index 2669f8a0f..ebd0c58a7 100644 --- a/app/views/courses/search_public_orgs_not_in_course.js.erb +++ b/app/views/courses/search_public_orgs_not_in_course.js.erb @@ -11,7 +11,7 @@ $("#search_orgs_result_list").append('
      '); $("#search_orgs_result_list").append(link ); <%end %> $("#search_orgs_result_list").append('
    ') -<% if @org_count > 10 %> +<% if @org_count > 15 %> $("#paginator").html(' <%= pagination_links_full @orgs_page, @org_count ,:per_page_links => true,:remote =>true,:flag=>true%>'); $("#paginator").css("display", "block"); <% else %> diff --git a/app/views/projects/search_public_orgs_not_in_project.js.erb b/app/views/projects/search_public_orgs_not_in_project.js.erb index c8ac999a1..cb8fb3ea2 100644 --- a/app/views/projects/search_public_orgs_not_in_project.js.erb +++ b/app/views/projects/search_public_orgs_not_in_project.js.erb @@ -12,7 +12,7 @@ $("#search_orgs_result_list").append('
      '); $("#search_orgs_result_list").append(link ); <%end %> $("#search_orgs_result_list").append('
    ') -<% if @org_count > 10 %> +<% if @org_count > 15 %> $("#paginator").html(' <%= pagination_links_full @orgs_page, @org_count ,:per_page_links => true,:remote =>true,:flag=>true%>'); $("#paginator").css("display", "block"); <% else %> From c183574a5efd8b802cd4f26c3c7b0b4406aee15f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 17 Dec 2015 10:19:43 +0800 Subject: [PATCH 045/105] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index b92223edc..7c09e2cdf 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -118,6 +118,7 @@ class BlogCommentsController < ApplicationController @blogComment.content = @quote + @blogComment.content @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] @article.children << @blogComment + @article.save @user_activity_id = params[:user_activity_id] user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first if user_activity From 074d8f62c2a22dd828f3afa5ef3cbbdb7b328318 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Dec 2015 11:16:46 +0800 Subject: [PATCH 046/105] delete the two config files on gitlab --- config/configuration.yml | 235 --------------------------- config/initializers/gitlab_config.rb | 9 - 2 files changed, 244 deletions(-) delete mode 100644 config/configuration.yml delete mode 100644 config/initializers/gitlab_config.rb diff --git a/config/configuration.yml b/config/configuration.yml deleted file mode 100644 index 3790045aa..000000000 --- a/config/configuration.yml +++ /dev/null @@ -1,235 +0,0 @@ -# = Redmine configuration file -# -# Each environment has it's own configuration options. If you are only -# running in production, only the production block needs to be configured. -# Environment specific configuration options override the default ones. -# -# Note that this file needs to be a valid YAML file. -# DO NOT USE TABS! Use 2 spaces instead of tabs for identation. -# -# == Outgoing email settings (email_delivery setting) -# -# === Common configurations -# -# ==== Sendmail command -# -# production: -# email_delivery: -# delivery_method: :sendmail -# -# ==== Simple SMTP server at localhost -# -# production: -# email_delivery: -# delivery_method: :smtp -# smtp_settings: -# address: smtp.163.com -# port: 25 -# -# ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com -# -# production: -# email_delivery: -# delivery_method: :smtp -# smtp_settings: -# address: smtp.gmail.com -# port: 587 -# authentication: :login -# domain: 'foo.com' -# user_name: senluowanxiangt@gmail.com -# password: 1913TXBja -# -# ==== SMTP server at example.com using PLAIN authentication -# -# production: -# email_delivery: -# delivery_method: :smtp -# smtp_settings: -# address: smtp.gmail.com -# port: 587 -# authentication: :plain -# domain: 'example.com' -# user_name: senluowanxiangt@gmail.com -# password: 1913TXBja -# -# ==== SMTP server at using TLS (GMail) -# -# This might require some additional configuration. See the guides at: -# http://www.redmine.org/projects/redmine/wiki/EmailConfiguration -# -# production: -# email_delivery: -# delivery_method: :smtp -# smtp_settings: -# enable_starttls_auto: true -# address: smtp.gmail.com -# port: 587 -# domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps -# authentication: :plain -# user_name: senluowanxiangt@gmail.com -# password: 1913TXBja -# -# -# === More configuration options -# -# See the "Configuration options" at the following website for a list of the -# full options allowed: -# -# http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer - - - -default: - email_delivery: - delivery_method: :smtp - smtp_settings: - address: mail.trustie.net - port: 25 - domain: mail.trustie.net - authentication: :login - user_name: "mail@trustie.net" - password: "loong2010" - - # Absolute path to the directory where attachments are stored. - # The default is the 'files' directory in your Redmine instance. - # Your Redmine instance needs to have write permission on this - # directory. - # Examples: - # attachments_storage_path: /var/redmine/files - # attachments_storage_path: D:/redmine/files - attachments_storage_path: - - # Configuration of the autologin cookie. - # autologin_cookie_name: the name of the cookie (default: autologin) - # autologin_cookie_path: the cookie path (default: /) - # autologin_cookie_secure: true sets the cookie secure flag (default: false) - autologin_cookie_name: "autologin_trustie" - autologin_cookie_path: - autologin_cookie_secure: - - # Configuration of SCM executable command. - # - # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe) - # On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work. - # - # On Windows + JRuby 1.6.2, path which contains spaces does not work. - # For example, "C:\Program Files\TortoiseHg\hg.exe". - # If you want to this feature, you need to install to the path which does not contains spaces. - # For example, "C:\TortoiseHg\hg.exe". - # - # Examples: - # scm_subversion_command: svn # (default: svn) - # scm_mercurial_command: C:\Program Files\TortoiseHg\hg.exe # (default: hg) - # scm_git_command: /usr/local/bin/git # (default: git) - # scm_cvs_command: cvs # (default: cvs) - # scm_bazaar_command: bzr.exe # (default: bzr) - # scm_darcs_command: darcs-1.0.9-i386-linux # (default: darcs) - # - scm_subversion_command: - scm_mercurial_command: - scm_git_command: - scm_cvs_command: - scm_bazaar_command: - scm_darcs_command: - - # Absolute path to the SCM commands errors (stderr) log file. - # The default is to log in the 'log' directory of your Redmine instance. - # Example: - # scm_stderr_log_file: /var/log/redmine_scm_stderr.log - scm_stderr_log_file: - - # Key used to encrypt sensitive data in the database (SCM and LDAP passwords). - # If you don't want to enable data encryption, just leave it blank. - # WARNING: losing/changing this key will make encrypted data unreadable. - # - # If you want to encrypt existing passwords in your database: - # * set the cipher key here in your configuration file - # * encrypt data using 'rake db:encrypt RAILS_ENV=production' - # - # If you have encrypted data and want to change this key, you have to: - # * decrypt data using 'rake db:decrypt RAILS_ENV=production' first - # * change the cipher key here in your configuration file - # * encrypt data using 'rake db:encrypt RAILS_ENV=production' - database_cipher_key: - - # Set this to false to disable plugins' assets mirroring on startup. - # You can use `rake redmine:plugins:assets` to manually mirror assets - # to public/plugin_assets when you install/upgrade a Redmine plugin. - # - #mirror_plugins_assets_on_startup: false - - # Your secret key for verifying cookie session data integrity. If you - # change this key, all old sessions will become invalid! Make sure the - # secret is at least 30 characters and all random, no regular words or - # you'll be exposed to dictionary attacks. - # - # If you have a load-balancing Redmine cluster, you have to use the - # same secret token on each machine. - #secret_token: 'change it to a long random string' - - # Absolute path (e.g. /usr/bin/convert, c:/im/convert.exe) to - # the ImageMagick's `convert` binary. Used to generate attachment thumbnails. - imagemagick_convert_command: '/home/pdl/redmine-2.3.2-0/common/bin/convert' - - # Configuration of RMagcik font. - # - # Redmine uses RMagcik in order to export gantt png. - # You don't need this setting if you don't install RMagcik. - # - # In CJK (Chinese, Japanese and Korean), - # in order to show CJK characters correctly, - # you need to set this configuration. - # - # Because there is no standard font across platforms in CJK, - # you need to set a font installed in your server. - # - # This setting is not necessary in non CJK. - # - # Examples for Japanese: - # Windows: - # rmagick_font_path: C:\windows\fonts\msgothic.ttc - # Linux: - # rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf - # - rmagick_font_path: - - # Maximum number of simultaneous AJAX uploads - #max_concurrent_ajax_uploads: 2 - #pic_types: "bmp,jpeg,jpg,png,gif" - - repository_root_path: '/tmp/htdocs' - judge_server: 'http://judge.trustie.net/' - - # Git's url - gitlab_address: 'http://gitfast.trustie.net' - -# specific configuration options for production environment -# that overrides the default ones -production: - # CJK support - rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf - judge_server: 'http://192.168.80.21:8080/' - repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs' - cookie_domain: ".trustie.net" - email_delivery: - delivery_method: :smtp - smtp_settings: - address: mail.trustie.net - port: 25 - domain: mail.trustie.net - authentication: :login - user_name: "mail@trustie.net" - password: "loong2010" - -# specific configuration options for development environment -# that overrides the default ones -development: - email_delivery: - delivery_method: :smtp - smtp_settings: - address: mail.trustie.net - port: 25 - domain: mail.trustie.net - authentication: :login - user_name: "mail@trustie.net" - password: "loong2010" diff --git a/config/initializers/gitlab_config.rb b/config/initializers/gitlab_config.rb deleted file mode 100644 index c82b2edff..000000000 --- a/config/initializers/gitlab_config.rb +++ /dev/null @@ -1,9 +0,0 @@ -Gitlab.configure do |config| - # config.endpoint = 'http://192.168.41.130:3000/trustie/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] - # config.private_token = 'cK15gUDwvt8EEkzwQ_63' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN'] - config.endpoint = 'http://gitfast.trustie.net/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] - config.private_token = 'fPc_gBmEiSANve8TCfxW' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN'] - # Optional - # config.user_agent = 'Custom User Agent' # user agent, default: 'Gitlab Ruby Gem [version]' - # config.sudo = 'user' # username for sudo mode, default: nil -end From 31c57b78bf7ab670efe52348108d032c585e56ee Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 17 Dec 2015 11:28:28 +0800 Subject: [PATCH 047/105] =?UTF-8?q?issue=E7=9A=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9B=B4=E6=94=B9issue=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E9=82=A3=E4=B9=88=E5=B0=B1=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82=E9=9C=80=E8=A6=81=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=96=B0=E5=BB=BAeditor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/show.html.erb | 56 ++++++++++--------- .../app/views/issues/update_form.js.erb | 12 ++++ 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 4c56a0f05..a1450fc03 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -8,11 +8,11 @@ });
    -
    -
    问题跟踪
    -
    +
    +
    问题跟踪
    +
    -
    +
    <%= render :partial => 'issues/detail'%> @@ -22,30 +22,32 @@
    -
    -
    -
    回复(<%= @issue.journals.count %>)
    -
    -
    +
    +
    +
    回复(<%= @issue.journals.count %>)
    +
    +
    -
    - <%= render :partial => 'issue_replies',:locals => {:issue=>@issue,:replies_all_i=>0} %> -
    +
    + <%= render :partial => 'issue_replies',:locals => {:issue=>@issue,:replies_all_i=>0} %> +
    -
    - <%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f|%> -
    - <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %> -
    - -
    - <%= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%> -
    +
    + <%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f|%> +
    + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
    - 发送 -
    - <% end %> -
    -
    - \ No newline at end of file + +
    + <%= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%> +
    +
    + 发送 +
    + <% end %> +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb b/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb index e7d3e2ad2..23bd5108b 100644 --- a/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb +++ b/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb @@ -9,3 +9,15 @@ $('#all_attributes').html('<%= escape_javascript(render :partial => 'form') %>') <% else %> $('#log_time').hide(); <% end %> +issue_desc_editor = KindEditor.create('#issue_description', + {"width":"85%", + "resizeType":0, + "no_label":true, + "autoHeightMode":true, + "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\"),$(this.toolbar.div).hide();})", + "afterFocus":"eval(function(){$(this.toolbar.div).show();})", + "afterBlur":"eval(function(){$(this.toolbar.div).hide();})", + "emotionsBasePath":"http://localhost:3000", + "height":300,"allowFileManager":true, + "uploadJson":"/kindeditor/upload", + "fileManagerJson":"/kindeditor/filemanager"}); \ No newline at end of file From b02cb6fdd4c3056e820eff35881ed3008d2373c4 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 17 Dec 2015 11:30:52 +0800 Subject: [PATCH 048/105] =?UTF-8?q?issue=E7=9A=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9B=B4=E6=94=B9issue=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E9=82=A3=E4=B9=88=E5=B0=B1=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82=E9=9C=80=E8=A6=81=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=96=B0=E5=BB=BAeditor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/_edit.html.erb | 3 +-- app/views/issues/_form.html.erb | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index b1127a3d3..2879c9592 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -10,8 +10,7 @@
    <%= render :partial => 'issues/form', :locals => {:f => f} %> - 确定 - 取消 +
    <%# if @journals.present? %> diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index b96b700d5..7cda806a1 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -102,3 +102,5 @@ <%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %> <% end %> + 确定 + 取消 \ No newline at end of file From 721a007779102df75494aaddec312e99649dfae7 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Dec 2015 13:22:41 +0800 Subject: [PATCH 049/105] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E7=94=B1=E4=BA=8E?= =?UTF-8?q?course=E3=80=81project=E4=B8=80=E5=BC=A0=E8=A1=A8=E8=80=8C?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20151217051447_delete_valid_project.rb | 15 +++++++++++++++ db/schema.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20151217051447_delete_valid_project.rb diff --git a/db/migrate/20151217051447_delete_valid_project.rb b/db/migrate/20151217051447_delete_valid_project.rb new file mode 100644 index 000000000..fd99ac08e --- /dev/null +++ b/db/migrate/20151217051447_delete_valid_project.rb @@ -0,0 +1,15 @@ +class DeleteValidProject < ActiveRecord::Migration + def up + projects = Project.where("project_type =?", 1) + begin + projects.each do |p| + p.delete + end + rescue => e + logger.error "Delete project failed ====>#{e}" + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 5f53dd5cf..27de276b1 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 => 20151215070238) do +ActiveRecord::Schema.define(:version => 20151217051447) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 2d2329a1e098d4be0c7e1db1dcfbcee74456c65f Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Dec 2015 14:31:55 +0800 Subject: [PATCH 050/105] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_link_to_functions.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/repositories/_link_to_functions.html.erb b/app/views/repositories/_link_to_functions.html.erb index fc3784d46..0e2a402ae 100644 --- a/app/views/repositories/_link_to_functions.html.erb +++ b/app/views/repositories/_link_to_functions.html.erb @@ -5,9 +5,9 @@ <% if @repository.supports_cat? %> <%= link_to_if action_name != 'entry', l(:button_view), {:action => 'entry', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> | <% end %> -<% if @repository.supports_annotate? %> - <%= link_to_if action_name != 'annotate', l(:button_annotate), {:action => 'annotate', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> | -<% end %> +<%# if @repository.supports_annotate? %> + <%#= link_to_if action_name != 'annotate', l(:button_annotate), {:action => 'annotate', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> +<%# end %> <%= link_to(l(:button_download), {:action => 'raw', :id => @project, :repository_id => @repository.identifier_param, From de229c0f1c494a7fb9804ac8e159f36f4e634ab3 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 17 Dec 2015 14:51:02 +0800 Subject: [PATCH 051/105] =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E7=9A=84=E6=96=87=E4=BB=B6=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=A2=AB=E5=BC=95=E7=94=A8=E8=87=B3=E5=BD=93=E5=89=8D=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E4=B8=8B=E7=9A=84=E8=B5=84=E6=BA=90=E6=A0=8F=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 40 +++++++++++++++++++ app/controllers/files_controller.rb | 6 +++ app/helpers/application_helper.rb | 2 + app/helpers/files_helper.rb | 11 +++++ .../add_exist_file_to_org_subfield.js.erb | 8 ++++ app/views/files/_org_subfield_list.html.erb | 5 +++ ..._show_quote_resource_org_subfield.html.erb | 31 ++++++++++++++ .../quote_resource_show_org_subfield.js.erb | 11 +++++ config/locales/zh.yml | 2 + config/routes.rb | 3 +- 10 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 app/views/attachments/add_exist_file_to_org_subfield.js.erb create mode 100644 app/views/files/_show_quote_resource_org_subfield.html.erb create mode 100644 app/views/files/quote_resource_show_org_subfield.js.erb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d371ed4cb..664dc4cf5 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -438,6 +438,46 @@ class AttachmentsController < ApplicationController end end + def add_exist_file_to_org_subfield + file = Attachment.find(params[:file_id]) + org_subfields = params[:org_subfields][:org_subfield] + @message = "" + org_subfields.each do |org_subfield| + s = OrgSubfield.find(org_subfield) + if s.attachments.include?file + if @message && @message == "" + @message += l(:label_resource_subfield_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed) + next + else + @message += "
    " + l(:label_resource_subfield_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed) + next + end + end + attach_copied_obj = file.copy + attach_copied_obj.tag_list.add(file.tag_list) # tag关联 + attach_copied_obj.container = s + attach_copied_obj.created_on = Time.now + attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = file.copy_from.nil? ? file.id : file.copy_from + if attach_copied_obj.attachtype == nil + attach_copied_obj.attachtype = 4 + end + @obj = s + @save_flag = attach_copied_obj.save + @save_message = attach_copied_obj.errors.full_messages + update_quotes attach_copied_obj + end + respond_to do |format| + format.js + end + rescue NoMethodError + @save_flag = false + @save_message = [] << l(:label_resource_subfield_empty_select) + respond_to do |format| + format.js + end + end + def update_quotes attachment if attachment.copy_from attachments = Attachment.find_by_sql("select * from attachments where copy_from = #{attachment.copy_from} or id = #{attachment.copy_from}") diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 0cd7d77c2..68f7cc9cb 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -412,6 +412,12 @@ class FilesController < ApplicationController @can_quote = attachment_candown @file end + def quote_resource_show_org_subfield + @file = Attachment.find(params[:id]) + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @can_quote = attachment_candown @file + end + def new @versions = @project.versions.sort @course_tag = @project.project_type diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9a622316a..ccbf7099a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1924,6 +1924,8 @@ module ApplicationHelper elsif attachment.container.is_a?(Course) course = attachment.container candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) + elsif attachment.container.is_a?(OrgSubfield) + candown = true elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board && attachment.container.board.course course = attachment.container.board.course diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 276786fb7..bd023f6d0 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -67,6 +67,17 @@ module FilesHelper s.html_safe end + #带勾选框的组织资源栏目列表 + def org_subfields_check_box_tags(name,org_subfields,attachment) + s = '' + org_subfields.each do |org_subfield| + if !org_subfield.attachments.include?attachment + s << "
    " + end + end + s.html_safe + end + #判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期 def has_course? user,file result = false diff --git a/app/views/attachments/add_exist_file_to_org_subfield.js.erb b/app/views/attachments/add_exist_file_to_org_subfield.js.erb new file mode 100644 index 000000000..4c4208f76 --- /dev/null +++ b/app/views/attachments/add_exist_file_to_org_subfield.js.erb @@ -0,0 +1,8 @@ +<% if !@save_flag && @save_message %> + $("#error_show").html("<%= @save_message.join(', ') %>"); +<% elsif @message && @message != "" %> + $("#error_show").html("<%= @message.html_safe %>"); +<% else %> + closeModal(); + location.reload(); +<% end %> \ No newline at end of file diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index 750aed9ae..029570047 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -28,6 +28,11 @@ download_named_attachment_path(file.id, file.filename), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <% if User.current.logged? %> + <% if !@org_subfield.attachments.all.include?file %> + <%= link_to("选入栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %> + <% else %> + <%= link_to("选入组织其他栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %> + <% end %> <%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %> <% end %>
    diff --git a/app/views/files/_show_quote_resource_org_subfield.html.erb b/app/views/files/_show_quote_resource_org_subfield.html.erb new file mode 100644 index 000000000..ab2eb318d --- /dev/null +++ b/app/views/files/_show_quote_resource_org_subfield.html.erb @@ -0,0 +1,31 @@ +
    +
    +

    将此资源引入组织资源栏目

    + <% if error == '403' %> +
    +
    您没有权限引用此资源
    +
    + <% else %> +
    +
    + <%= form_tag attachments_add_exist_file_to_org_subfield_path, + method: :post, + remote: true, + id: "relation_file_form" do %> + <%= hidden_field_tag(:file_id, file.id) %> + <%= content_tag('div', org_subfields_check_box_tags('org_subfields[org_subfield][]',org_subfield.organization.org_subfields.where("field_type='Resource'"),file), :id => 'org_subfields')%> + 引  用取  消 + <% end -%> +
    + <% end %> + + +
    +
    + + \ No newline at end of file diff --git a/app/views/files/quote_resource_show_org_subfield.js.erb b/app/views/files/quote_resource_show_org_subfield.js.erb new file mode 100644 index 000000000..fe34e9624 --- /dev/null +++ b/app/views/files/quote_resource_show_org_subfield.js.erb @@ -0,0 +1,11 @@ +<% if @can_quote %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>'); +<% else %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>'); +<% end %> + +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 81b20a67e..03424bd5a 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1969,9 +1969,11 @@ zh: label_my_score: 我的评分 field_open_anonymous_evaluation: 是否使用匿评 label_course_empty_select: 尚未选择课程! + label_resource_subfield_empty_select: 尚未选择资源栏目! label_project_empty_select: 尚未选择项目! label_course_prompt: 课程: label_project_prompt: 项目: + label_resource_subfield_prompt: 资源栏目: label_contain_resource: 已包含资源: label_quote_resource_failed: ",此资源引用失败! " label_file_lost: 以下无法成功下载,请联系相关人员重新上传: diff --git a/config/routes.rb b/config/routes.rb index 6dce046de..e68169824 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -81,7 +81,7 @@ RedmineApp::Application.routes.draw do match "subfield_upload_file", :via => :post end member do - match "quote_resource_show", :via => [:get] + match "quote_resource_show_org_subfield", :via => [:get] end end end @@ -807,6 +807,7 @@ RedmineApp::Application.routes.draw do post 'attachments/relationfiles', to: 'attachments#add_exist_file_to_projects', as: 'attach_relations' post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation' post 'attachments/courserelationfiles', to: 'attachments#add_exist_file_to_courses', as: 'course_attach_relations' + match 'attachments/add_exist_file_to_org_subfield' get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/ resources :attachments, :only => [:show, :destroy] do collection do From fc63dfcb7bde22f6d8d01c976aa2e695c6939800 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Thu, 17 Dec 2015 15:14:52 +0800 Subject: [PATCH 052/105] =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/at_controller.rb | 8 +- app/controllers/boards_controller.rb | 5 + app/controllers/homework_common_controller.rb | 8 ++ app/controllers/issues_controller.rb | 8 ++ app/helpers/users_helper.rb | 3 +- app/models/at_message.rb | 100 ++++++++++++++++++ app/models/journal.rb | 13 ++- app/models/journals_for_message.rb | 10 +- app/models/message.rb | 15 ++- app/models/user.rb | 1 + app/views/boards/_course_show.html.erb | 2 +- app/views/boards/_project_show.html.erb | 6 +- app/views/boards/show.html.erb | 6 +- app/views/users/_user_at_message.html.erb | 16 +-- .../20151216025539_create_at_messages.rb | 15 +++ ...20151216030610_add_sender_to_at_message.rb | 5 + spec/factories/at_messages.rb | 12 +++ spec/models/at_message_spec.rb | 5 + 18 files changed, 218 insertions(+), 20 deletions(-) create mode 100644 app/models/at_message.rb create mode 100644 db/migrate/20151216025539_create_at_messages.rb create mode 100644 db/migrate/20151216030610_add_sender_to_at_message.rb create mode 100644 spec/factories/at_messages.rb create mode 100644 spec/models/at_message_spec.rb diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 5664201f3..8c551d0df 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -28,11 +28,17 @@ class AtController < ApplicationController find_message(id) when 'HomeworkCommon' find_homework(id) + when 'Topic' + find_topic(id) else nil end end + def find_topic(id) + + end + def find_issue(id) #1. issues list persons #2. project persons @@ -98,7 +104,7 @@ class AtController < ApplicationController def find_message(id) message = Message.find(id) at_persons = message.board.messages.map(&:author) - + (at_persons || []) + (find_project(message.board.project_id)||[]) end #News diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 2ec3cac0d..22c0d5317 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -79,6 +79,11 @@ class BoardsController < ApplicationController end end end + + @project.boards.messages.each do |m| + User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!} + end + elsif @course query_course_messages = @board.messages query_course_messages.each do |query_course_message| diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index a8d6dfe8f..b42868ce1 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -19,6 +19,14 @@ class HomeworkCommonController < ApplicationController @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_new = params[:is_new] + + #设置at已读 + @homeworks.each do |homework| + homework.journals_for_messages.each do |j| + User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!} + end + end + respond_to do |format| format.js format.html diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6f441c29a..44fc7dcba 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -115,6 +115,14 @@ class IssuesController < ApplicationController # 当前用户查看指派给他的缺陷消息,则设置消息为已读 query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first query.update_attribute(:viewed, true) unless query.nil? + + # issue 新建的at消息 + User.current.at_messages.unviewed('Issue', @issue.id).each {|x| x.viewed!} + # 回复的at消息 + @issue.journals.each do |j| + User.current.at_messages.unviewed('Journal', j.id).each {|x| x.viewed!} + end + # 缺陷状态更新 query_journals = @issue.journals query_journals.each do |query_journal| diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 2935d018a..963284f7f 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -89,7 +89,8 @@ module UsersHelper forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count = user.at_messages.where(viewed: false).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count end def user_mail_notification_options(user) diff --git a/app/models/at_message.rb b/app/models/at_message.rb new file mode 100644 index 000000000..1a75c4aae --- /dev/null +++ b/app/models/at_message.rb @@ -0,0 +1,100 @@ +class AtMessage < ActiveRecord::Base + belongs_to :user + belongs_to :sender, class_name: "User", foreign_key: "sender_id" + attr_accessible :at_message, :container, :viewed, :user_id, :sender_id + belongs_to :at_message, polymorphic: true + belongs_to :container, polymorphic: true + + has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy + validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true + + after_create :add_user_message + + scope :unviewed, ->(type, id){ + where(at_message_type: type, at_message_id:id, viewed: false) + } + + def viewed! + update_attribute :viewed, true + end + + def at_valid? + return true if at_message_type == 'Issue' + return true if 'Journal' == at_message_type + return true if 'JournalsForMessage' == at_message_type + return true if 'Message' == at_message_type + false + end + + def add_user_message + if MessageAll.where(message_type: self.class.name,message_id: self.id).empty? + self.message_alls << MessageAll.new(:user_id => self.user_id) + end + end + + def subject + case at_message_type + when "Issue" + "新建问题: " + at_message.subject + when "Journal" + "问题留言: " + at_message.journalized.subject + when 'Message' + if(at_message.topic?) + "发布新帖: " + else + "回复帖子: " + end + at_message.subject + when 'JournalsForMessage' + "作业留言: " + at_message.jour.description + else + logger.error "error type: #{at_message_type}" + end + end + + def description + case at_message_type + when "Issue" + at_message.description + when "Journal" + at_message.notes + when 'Message' + at_message.content + when "JournalsForMessage" + at_message.notes + else + logger.error "error type: #{at_message_type}" + end + end + + def author + case at_message_type + when "Issue" + at_message.author + when "Journal" + at_message.user + when 'Message' + at_message.author + when 'JournalsForMessage' + at_message.user + else + logger.error "error type: #{at_message_type}" + end + end + + def url + case at_message_type + when "Issue" + {controller: :issues, action: :show, id: at_message} + when "Journal" + {controller: :issues, action: :show, id: at_message.journalized} + when 'Message' + {controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board} + when 'JournalsForMessage' + {controller: :homework_common, action: :index, course: at_message.jour.course_id} + else + logger.error "error type: #{at_message_type}" + end + + end + +end diff --git a/app/models/journal.rb b/app/models/journal.rb index 9ffc5d405..8aec82911 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -31,7 +31,9 @@ class Journal < ActiveRecord::Base has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy # 被ForgeMessage虚拟关联 has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy - # end + + has_many :at_messages, as: :at_message, dependent: :destroy + attr_accessor :indice acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" }, @@ -50,7 +52,7 @@ class Journal < ActiveRecord::Base before_create :split_private_notes # fq - after_save :act_as_activity,:be_user_score,:act_as_forge_activity, :act_as_forge_message + after_save :act_as_activity,:be_user_score,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message # end #after_destroy :down_user_score #before_save :be_user_score @@ -184,6 +186,13 @@ class Journal < ActiveRecord::Base end end + def act_as_at_message + users = self.notes.scan //m + users && users.flatten.uniq.each do |uid| + self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id) + end + end + # 更新用户分数 -by zjc def be_user_score #新建了缺陷留言且留言不为空,不为空白 diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index ec6390408..d1431d31f 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -64,8 +64,10 @@ class JournalsForMessage < ActiveRecord::Base has_many :course_messages, :class_name => 'CourseMessage',:as =>:course_message ,:dependent => :destroy has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:journals_for_message, :dependent => :destroy + has_many :at_messages, as: :at_message, dependent: :destroy + validates :notes, presence: true, if: :is_homework_jour? - after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score + 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_destroy :reset_counters! after_save :be_user_score @@ -240,6 +242,12 @@ class JournalsForMessage < ActiveRecord::Base end end + def act_as_at_message + users = self.notes.scan //m + users && users.flatten.uniq.each do |uid| + self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id) + end + end # 用户留言消息通知 def act_as_user_feedback_message # 主留言 diff --git a/app/models/message.rb b/app/models/message.rb index d8f62171a..4cdae1f6e 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -38,7 +38,7 @@ class Message < ActiveRecord::Base # 课程/项目 消息 has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy - #end + has_many :at_messages, as: :at_message, dependent: :destroy has_many :ActivityNotifies,:as => :activity, :dependent => :destroy @@ -74,7 +74,7 @@ class Message < ActiveRecord::Base after_update :update_messages_board after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets - after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score + after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message #before_save :be_user_score scope :visible, lambda {|*args| @@ -96,6 +96,10 @@ class Message < ActiveRecord::Base end } + def topic? + parent_id.nil? + end + def visible?(user=User.current) if project !user.nil? && user.allowed_to?(:view_messages, project) @@ -237,6 +241,13 @@ class Message < ActiveRecord::Base end end end + + def act_as_at_message + users = self.content.scan //m + users && users.flatten.uniq.each do |uid| + self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id) + end + end #更新用户分数 -by zjc def be_user_score diff --git a/app/models/user.rb b/app/models/user.rb index 7043bd039..2714117e9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -161,6 +161,7 @@ class User < Principal has_many :user_feedback_messages has_one :onclick_time has_many :system_messages + has_many :at_messages # 虚拟转换 has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1" diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 074da9af1..00dfc03e3 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false) %> + <%= import_ke(enable_at: true, prettify: false) %> <%= javascript_include_tag "init_activity_KindEditor" %> <% end %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 5f6275e9d..839d587b2 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -20,7 +20,7 @@ <% end %>
    -