From a467338161a1426e1837fc275ef87e99986eaec7 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 29 Aug 2016 11:32:11 +0800 Subject: [PATCH 01/71] =?UTF-8?q?iphone=E5=AE=9A=E4=BD=8Djs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 2 +- public/assets/wechat/course_discussion.html | 2 +- public/assets/wechat/course_notice.html | 2 +- public/assets/wechat/homework_detail.html | 2 +- public/assets/wechat/issue_detail.html | 2 +- public/assets/wechat/jour_message_detail.html | 2 +- public/assets/wechat/project_discussion.html | 2 +- .../wechat/directives/iphone_recognize.js | 29 +++++++++++-------- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index daeec493d..2d11b5964 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -25,7 +25,7 @@
{{blog.praise_count}}
{{blog.praise_count}}
-
+ diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 78a3fa0b7..2395129c3 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -24,7 +24,7 @@
{{discussion.praise_count}}
{{discussion.praise_count}}
-
+ diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index af9f22da1..85b3a901a 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -23,7 +23,7 @@
{{news.praise_count}}
{{news.praise_count}}
-
+ diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 6ead09e69..7fa8459c4 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -28,7 +28,7 @@
{{homework.praise_count}}
{{homework.praise_count}}
-
+ diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index c10d15ddb..efc7ed64d 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -29,7 +29,7 @@
{{issue.praise_count}}
{{issue.praise_count}}
-
+ diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 41f7290e5..e2e65ca58 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -23,7 +23,7 @@
{{message.praise_count}}
{{message.praise_count}}
-
+ diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 4557ba55f..30d464802 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -24,7 +24,7 @@
{{discussion.praise_count}}
{{discussion.praise_count}}
-
+ diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js index 66014e71a..46d4a4292 100644 --- a/public/javascripts/wechat/directives/iphone_recognize.js +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -7,21 +7,26 @@ app.directive('iphoneRecognize',["$timeout",function(timer){ scope: {}, link: function(scope, element){ timer(function(){ - var userAgent = navigator.userAgent; var contentHeight = $(".post-container").height(); - if (/ipad|iphone|mac/i.test(navigator.userAgent)){ - $("#postInput1").bind('focus',function(){ + var toBottom = function(){ element.css({"position":"relative","padding":"1px 0"}); - $(".post-wrapper").css("margin-bottom","0"); - $("#all_homework_reply").css("margin-bottom","0"); + $(".post-wrapper").css("marginBottom","0"); + $("#all_homework_reply").css("marginBottom","0"); window.scrollTo(0,contentHeight); - }); - $("#postInput1").bind('blur',function(){ - element.css("position","fixed"); - $(".post-wrapper").css("margin-bottom","10px"); - $("#all_homework_reply").css("margin-bottom","50px"); - }); - } + } + if (/ipad|iphone|mac/i.test(navigator.userAgent)){ + $("#postInput1").bind('focus',function(){ + toBottom(); + }); + $("#postInput1,#replyBlock").bind("click",function(){ + toBottom(); + }); + $("#postInput1").bind('blur',function(){ + element.css("position","fixed"); + $(".post-wrapper").css("marginBottom","10px"); + $("#all_homework_reply").css("marginBottom","50px"); + }); + } }) } } From e30416f6b36a902be0da06707ddb8c1aa018de3e Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 30 Aug 2016 10:49:44 +0800 Subject: [PATCH 02/71] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E8=A1=A8=E6=83=85?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/others/factory.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 6d887282b..498096c25 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -111,6 +111,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc } var temp = data.comment.replace(/\n/g,'
'); + temp = temp.replaceAll("[^\\u0000-\\uFFFF]", "[表情]"); var userInfo = { type: type, From 8a6ad8997302d4e081c39485fcd16ffd7b0d23e1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 30 Aug 2016 14:08:10 +0800 Subject: [PATCH 03/71] =?UTF-8?q?issue=E6=8C=87=E5=90=91=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E6=89=8D=E5=8F=91=E5=BE=AE=E4=BF=A1=E6=B6=88=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81=E9=87=8C?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E9=93=BE=E6=8E=A5=EF=BC=8C@=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BE=AE=E4=BF=A1=E6=B6=88=E6=81=AF=EF=BC=8C=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=8E=BB=E6=8E=89=E5=8A=A0=E5=85=A5=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=92=8C=E9=A1=B9=E7=9B=AE=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/activity.rb | 7 ++ app/controllers/issues_controller.rb | 6 +- app/helpers/application_helper.rb | 10 +++ app/models/at_message.rb | 85 ++++++++++++++++++- app/services/wechat_service.rb | 13 +++ config/menu.yml.production | 8 -- config/menu.yml.test | 8 -- config/wechat.yml.template | 1 + config/wechat.yml.test | 1 + public/assets/wechat/activities.html | 58 ++++++++++--- .../wechat/controllers/activity.js | 42 ++++++++- 11 files changed, 205 insertions(+), 34 deletions(-) diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 95940c0c5..6f5a3db74 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -73,6 +73,12 @@ module Mobile elsif ac.container_type == "Blog" "发表博客" end + when :course_project_id + if ac.container_type == "Course" + ac.container_id + elsif ac.container_type == "Project" + ac.container_id + end when :activity_type_name if ac.container_type == "Course" case ac.act_type @@ -137,6 +143,7 @@ module Mobile act_expose :subject #标题 act_expose :description #描述 act_expose :latest_update #最新更新时间 + act_expose :course_project_id #课程/项目ID act_expose :course_project_name #课程/项目名字 act_expose :activity_type_name #课程问答区/项目缺陷等 expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b0c83e869..8880a4f3e 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -589,19 +589,19 @@ class IssuesController < ApplicationController return false end end - @issue.safe_attributes = issue_attributes senduser = User.find(params[:issue][:assigned_to_id]) - if senduser.id != User.current.id + if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id] issue_id = @issue.id issue_title = params[:issue][:subject] priority_id = params[:issue][:priority_id] - ps = ProjectsService.new ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id end + @issue.safe_attributes = issue_attributes + @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current) true diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0c0e0919e..aabacb6e0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3236,6 +3236,16 @@ def get_all_children result, jour result end +#获取该节点所在的帖子 +def get_root_parent comment + while comment.parent + comment = comment.parent + end + comment +end + + + #将有置顶属性的提到数组前面 def sort_by_sticky topics tmpTopics = [] diff --git a/app/models/at_message.rb b/app/models/at_message.rb index bca2c7ba4..702b16335 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -1,6 +1,7 @@ #coding=utf-8 class AtMessage < ActiveRecord::Base + include ApplicationHelper belongs_to :user belongs_to :sender, class_name: "User", foreign_key: "sender_id" attr_accessible :at_message, :container, :viewed, :user_id, :sender_id @@ -10,7 +11,7 @@ class AtMessage < ActiveRecord::Base 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 + after_create :add_user_message, :send_wechat_message scope :unviewed, ->(type, id){ where(at_message_type: type, at_message_id:id, viewed: false) @@ -34,6 +35,88 @@ class AtMessage < ActiveRecord::Base end end + def send_wechat_message + shield_type = "" + container_id = 0 + status = 0 + type = "" + detail_id = 0 + detail_title = "" + + if defined? at_message.notes + detail_content = strip_html at_message.notes,30 + elsif defined? at_message.content + detail_content = strip_html at_message.content,30 + end + + user = self.user + + topic = get_root_parent at_message + + case at_message_type + when "Issue" + shield_type = "Project" + container_id = at_message.project.id + type = "issue" + detail_id = topic.id + detail_title = at_message.subject + when "Journal" + + topic = get_root_parent at_message.journalized + + shield_type = "Project" + container_id = at_message.journalized.project.id + type = "issue" + detail_id = topic.id + detail_title = at_message.journalized.subject + when 'Message' + if at_message.course + shield_type = "Course" + container_id = at_message.course.id + type = "course_discussion" + detail_id = topic.id + detail_title = at_message.subject + elsif at_message.project + shield_type = "Project" + container_id = at_message.project.id + type = "project_discussion" + detail_id = topic.id + detail_title = at_message.subject + else + status = -1 + end + when 'JournalsForMessage' + if at_message.jour && at_message.jour.course + shield_type = "Course" + container_id = at_message.jour.course.id + type = "homework" + + detail_id = at_message.jour.id + detail_title = at_message.jour.name + else + type = "journal_for_message" + detail_id = topic.id + detail_title = at_message.subject + end + else + status = -1 + end + + count = 0 + + detail_title = detail_title.gsub(/RE: /, '') + + if container_id != 0 + count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='#{shield_type}' and shield_id=#{container_id}").count + end + if count == 0 && status == 0 + message_title = self.sender.show_name+"@了您" + ws = WechatService.new + ws.at_notice user.id, type, detail_id, message_title, detail_title, format_time(Time.now), detail_content, "点击查看详情。",0 + end + + end + def subject case at_message_type when "Issue" diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 423676983..8adc1392f 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -432,4 +432,17 @@ class WechatService end end + def at_notice(user_id, type, id, first, key1, key2,key3,remark="",uid=0) + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = three_keys_template uw.openid,Wechat.config.at_notice, type, id, first, key1, key2, key3, remark,uid + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[at_notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end + end + end \ No newline at end of file diff --git a/config/menu.yml.production b/config/menu.yml.production index 55318e811..8929d002e 100644 --- a/config/menu.yml.production +++ b/config/menu.yml.production @@ -22,14 +22,6 @@ button: - name: "更多" sub_button: - - - type: "view" - name: "加入班级" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_class#wechat_redirect" - - - type: "view" - name: "加入项目" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_project#wechat_redirect" - type: "view" name: "历史推文" diff --git a/config/menu.yml.test b/config/menu.yml.test index 45e23aaf3..303b30c26 100644 --- a/config/menu.yml.test +++ b/config/menu.yml.test @@ -22,14 +22,6 @@ button: - name: "更多" sub_button: - - - type: "view" - name: "加入班级" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_class#wechat_redirect" - - - type: "view" - name: "加入项目" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_project#wechat_redirect" - type: "view" name: "历史推文" diff --git a/config/wechat.yml.template b/config/wechat.yml.template index adda8e7e8..8ca6ac237 100644 --- a/config/wechat.yml.template +++ b/config/wechat.yml.template @@ -25,6 +25,7 @@ default: &default project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E" join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg" project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI" + at_notice: "U3kqzgriCaqkPI9qX0NDQOInJ5hiwHCz6wgTsPysSx4" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/config/wechat.yml.test b/config/wechat.yml.test index 8c0dafc2f..12cee4751 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -25,6 +25,7 @@ default: &default project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" + at_notice: "p4HfyZQuF8O5bP_44RbbJS30SGojLJAuZEqp34iB4JU" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 506dcc724..2d45f4d17 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -40,7 +40,7 @@
- +
{{act.praise_count}}
@@ -75,7 +75,7 @@
- +
{{act.praise_count}}
@@ -111,7 +111,7 @@
- +
{{act.praise_count}}
@@ -147,7 +147,7 @@
- + @@ -236,7 +236,7 @@
- +
{{act.praise_count}}
@@ -272,7 +272,7 @@
- +
{{act.praise_count}}
@@ -405,7 +405,7 @@
- +
{{act.praise_count}}
@@ -440,7 +440,7 @@
- +
{{act.praise_count}}
@@ -476,7 +476,7 @@
- +
{{act.praise_count}}
@@ -492,6 +492,42 @@
+
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+
+ +
+
+ + + + + + + + + + +
+
+
+
+
+
@@ -536,7 +572,7 @@
- +
{{act.praise_count}}
@@ -572,7 +608,7 @@
- +
{{act.praise_count}}
diff --git a/public/javascripts/wechat/controllers/activity.js b/public/javascripts/wechat/controllers/activity.js index 25ced0a17..c5a18e2f6 100644 --- a/public/javascripts/wechat/controllers/activity.js +++ b/public/javascripts/wechat/controllers/activity.js @@ -126,14 +126,14 @@ app.controller('ActivityController', } break; } - rms.save("tab_num",$scope.currentTab); + rms.save("activity_tab_num",$scope.currentTab); } - $scope.currentTab = rms.get('tab_num') || 1; + $scope.currentTab = rms.get('activity_tab_num') || 1; if($scope.activities.length<=0){ - $scope.loadActData('tab_num',0); + $scope.loadActData($scope.currentTab,0); } else { $timeout(function(){ window.scrollTo(0, rms.get("yoffset")); @@ -200,4 +200,40 @@ app.controller('ActivityController', common.decreaseCommonPraise(act); }; + + + $scope.goClass = function(id){ + rms.save("activities",[]); + rms.save("course_activities",[]); + rms.save("project_activities",[]); + + rms.save('course_activities_page',0); + rms.save("course_has_more",false); + rms.save("course",null); + rms.save("tab_num",null); + + rms.save("has_more",false); + rms.save("project_has_more",false); + + $location.path("/class").search({id: id}); + }; + + $scope.goProject = function(id){ + rms.save("activities",[]); + rms.save("course_activities",[]); + rms.save("project_activities",[]); + rms.save('project_activities_page',0); + rms.save("project_has_more",false); + rms.save("project",null); + rms.save("project_master_members",[]); + rms.save("project_develop_members",[]); + rms.save("project_report_members",[]); + rms.save("review_master_members",[]); + rms.save("review_develop_members",[]); + rms.save('tab_num',null); + rms.save("has_more",false); + rms.save("course_has_more",false); + + $location.path("/project").search({id: id}); + }; }]); \ No newline at end of file From bc1caf3d54f358ccb8749f18ba1c8c8d7d9f2f58 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 30 Aug 2016 14:12:05 +0800 Subject: [PATCH 04/71] =?UTF-8?q?=E8=A1=A8=E6=83=85=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/others/factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 498096c25..f08ef5813 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -111,7 +111,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc } var temp = data.comment.replace(/\n/g,'
'); - temp = temp.replaceAll("[^\\u0000-\\uFFFF]", "[表情]"); + temp = temp.replace(/^\:[a-z0-9_]+\:$/g, "[表情]"); var userInfo = { type: type, From b4a5179a1bd7d05193db7f420c734b9768eb70be Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 30 Aug 2016 14:25:36 +0800 Subject: [PATCH 05/71] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E6=88=90=E5=91=98=E7=AE=A1=E9=87=8C=E7=9A=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=90=8E=E6=98=BE=E7=A4=BA=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E5=8F=8A@issue=E9=93=BE=E6=8E=A5=E6=97=A0=E6=95=88=E7=9A=84?= =?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/models/at_message.rb | 4 ++-- public/javascripts/wechat/controllers/class.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/at_message.rb b/app/models/at_message.rb index 702b16335..302211911 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -57,7 +57,7 @@ class AtMessage < ActiveRecord::Base when "Issue" shield_type = "Project" container_id = at_message.project.id - type = "issue" + type = "issues" detail_id = topic.id detail_title = at_message.subject when "Journal" @@ -66,7 +66,7 @@ class AtMessage < ActiveRecord::Base shield_type = "Project" container_id = at_message.journalized.project.id - type = "issue" + type = "issues" detail_id = topic.id detail_title = at_message.journalized.subject when 'Message' diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index a6fb0feed..6721d4d12 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -244,6 +244,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.onSetting = function(user){ rms.save('current_edit_member', user); + rms.save("course",vm.course); rms.save("tab_num",vm.currentTab); $location.path("/edit_class_member").search({id: courseid,user_id: user.id}); }; @@ -251,6 +252,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.review = function(user){ rms.save('current_review_member', user); rms.save('current_course', vm.course); + rms.save("course",vm.course); rms.save("tab_num",vm.currentTab); $location.path("/review_class_member").search({id: courseid,user_id: user.id}); }; From b9e989225734bd2c85adfe440baaabca7e9b11fe Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 30 Aug 2016 15:01:26 +0800 Subject: [PATCH 06/71] =?UTF-8?q?=E5=BE=AE=E4=BF=A1issue=E6=8C=87=E5=90=91?= =?UTF-8?q?BUG=E4=BF=AE=E6=94=B9=EF=BC=8Cissue@=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 2 +- app/models/at_message.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 8880a4f3e..f108c685a 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -592,7 +592,7 @@ class IssuesController < ApplicationController senduser = User.find(params[:issue][:assigned_to_id]) - if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id] + if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i issue_id = @issue.id issue_title = params[:issue][:subject] priority_id = params[:issue][:priority_id] diff --git a/app/models/at_message.rb b/app/models/at_message.rb index 302211911..1c0c88d89 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -47,6 +47,8 @@ class AtMessage < ActiveRecord::Base detail_content = strip_html at_message.notes,30 elsif defined? at_message.content detail_content = strip_html at_message.content,30 + elsif defined? at_message.description + detail_content = strip_html at_message.description,30 end user = self.user From e2c0237fcd8b75358242b1247806cb05a406bf62 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 30 Aug 2016 15:30:01 +0800 Subject: [PATCH 07/71] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=A9=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20160511055221_merge_two_homeworks.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/db/migrate/20160511055221_merge_two_homeworks.rb b/db/migrate/20160511055221_merge_two_homeworks.rb index a30bc983b..42aabbbd9 100644 --- a/db/migrate/20160511055221_merge_two_homeworks.rb +++ b/db/migrate/20160511055221_merge_two_homeworks.rb @@ -6,13 +6,17 @@ class MergeTwoHomeworks < ActiveRecord::Migration work.update_column('homework_common_id', 3463) end end - homework = HomeworkCommon.find 3387 - homework.destroy if homework - stu_works = StudentWork.where("homework_common_id = 3387") - stu_work_ids = stu_works.empty? ? "(-1)" : "(" + stu_works.map{|work| work.id}.join(',') + ")" - stu_work_tests = StudentWorkTest.where("student_work_id in #{stu_work_ids}") - stu_work_tests.destroy_all if stu_work_tests - stu_works.destroy_all if stu_works + begin + homework = HomeworkCommon.find 3387 + homework.destroy if homework + stu_works = StudentWork.where("homework_common_id = 3387") + stu_work_ids = stu_works.empty? ? "(-1)" : "(" + stu_works.map{|work| work.id}.join(',') + ")" + stu_work_tests = StudentWorkTest.where("student_work_id in #{stu_work_ids}") + stu_work_tests.destroy_all if stu_work_tests + stu_works.destroy_all if stu_works + rescue Exception => e + puts e + end end def down From 6d0f22fd60589771950e2413ff5fe9338ba87464 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 30 Aug 2016 16:03:28 +0800 Subject: [PATCH 08/71] =?UTF-8?q?=E7=A9=BA=E6=95=B0=E6=8D=AE=E5=BA=93--?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0=E5=88=A0=E9=99=A4issue?= =?UTF-8?q?=E6=A0=87=E7=AD=BE500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/tracker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tracker.rb b/app/models/tracker.rb index af56d23bf..4ef18b7b0 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -34,7 +34,7 @@ class Tracker < ActiveRecord::Base end has_and_belongs_to_many :projects - has_and_belongs_to_many :courses + # has_and_belongs_to_many :courses has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id' acts_as_list From 0c221abd6175ebbb6efb603e840c0ef58ad4ef90 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 09:18:05 +0800 Subject: [PATCH 09/71] =?UTF-8?q?PULL=20REQUEST=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 6 +----- app/views/projects/_development_group.html.erb | 14 ++++++++------ app/views/pull_requests/index.html.erb | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1ff7fc2d9..6588d15f3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -830,11 +830,7 @@ module ApplicationHelper return false if project.gpid.nil? g = Gitlab.client count = g.user_static(project.gpid, :rev => "master").count - if User.current.member_of?(project) && count > 0 - true - else - false - end + count end # 判断版本库是否初始为gitlab diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 82bcb5501..52f4e002a 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -40,12 +40,14 @@
<% end %> - +<% if allow_pull_request(@project) %> + +<% end %> <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> <% if visible_repository?(@project) %> diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index f4fe0725e..2af67293f 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -3,7 +3,7 @@
  • <%= link_to "待处理#{@requests_opened_count}".html_safe, project_pull_requests_path(:type => "1"), :remote => true %>
  • <%= link_to "已处理#{@requests_merged_count}".html_safe, project_pull_requests_path(:type => "2"), :remote => true %>
  • <%= link_to "已关闭#{@requests_closed_count}".html_safe, project_pull_requests_path(:type => "3"), :remote => true %>
  • - <% if allow_pull_request(@project) %> + <% if allow_pull_request(@project) && User.current.member_of?(@project) %> <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %> <% end %>
    From 936198a8bda1eb3b0e7274a7966d720f654fe2fc Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 10:30:23 +0800 Subject: [PATCH 10/71] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=9D=9E=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 7 +++++++ app/views/layouts/_footer.html.erb | 4 +++- app/views/layouts/_logined_header.html.erb | 12 +++++++----- app/views/layouts/base_projects.html.erb | 5 +++-- app/views/layouts/base_users_new.html.erb | 1 + app/views/layouts/new_base.html.erb | 4 +++- app/views/layouts/new_base_user.html.erb | 8 ++++---- app/views/users/_selector_for_messages.html.erb | 3 ++- app/views/users/_user_resource_type_filter.html.erb | 10 ++++++---- app/views/users/show.html.erb | 4 +--- app/views/users/user_messages.html.erb | 4 +++- 11 files changed, 40 insertions(+), 22 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2d6e84762..72963c15c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,6 +37,13 @@ module ApplicationHelper # super # end + # 隐藏项目以外的信息 + # return: true 显示,false 不显示 + def hidden_unproject_infos + hidden_info = Setting.find_by_name("hidden_non_project") + (hidden_info && hidden_info.value == "1") ? true : false + end + # 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换 def get_user_by_mail mail user = User.find_by_mail(mail) diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index a639e1203..e549473e7 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -4,7 +4,9 @@
  • <%= l(:label_about_us)%>|
  • 服务协议|
  • -
  • <%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|
  • + <% if hidden_unproject_infos %> +
  • <%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|
  • + <% end %>
  • <%= l(:label_forums)%>
  • diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 753022d75..1f35c4728 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -10,12 +10,14 @@ - - + + + <% end %> +<% if hidden_unproject_infos %> + <%= render :partial => 'layouts/new_feedback' %> +<% end %> -
    123
    -<%= render :partial => 'layouts/new_feedback' %> diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index c1f6a5644..976de8235 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -298,6 +298,7 @@
    + <%= render :partial => 'layouts/new_feedback' %> diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb index e9703a943..d28171f5f 100644 --- a/app/views/layouts/new_base.html.erb +++ b/app/views/layouts/new_base.html.erb @@ -59,7 +59,9 @@
    <%= render :partial => 'layouts/footer' %>
    -<%= render :partial => 'layouts/new_feedback' %> +<% if hidden_unproject_infos %> + <%= render :partial => 'layouts/new_feedback' %> +<% end %> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index d1084c794..20754b0ff 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -157,9 +157,7 @@
    - <% hidden_courses = Setting.find_by_name("hidden_courses") %> - <% unvisiable = hidden_courses && hidden_courses.value == "1"%> - <% if !unvisiable %> + <% if hidden_unproject_infos %>
    • <%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %> @@ -220,7 +218,9 @@ <%= yield %>
    - <%= render :partial => 'layouts/new_feedback' %> + <% if hidden_unproject_infos %> + <%= render :partial => 'layouts/new_feedback' %> + <% end %>
    <%= render :partial => 'layouts/footer' %> diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb index 3727e4a1d..14609f4fc 100644 --- a/app/views/users/_selector_for_messages.html.erb +++ b/app/views/users/_selector_for_messages.html.erb @@ -3,6 +3,7 @@ + <% if hidden_unproject_infos %>
    • @@ -35,7 +36,18 @@
    • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
  • - + <% else %> +
  • +
      +
    • 更多
    • +
    • <%= link_to "所有消息",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
    • +
    • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %>
    • +
    • <%= link_to "系统消息", user_system_messages_path(User.current, :type => 'system_messages'), :class => "homepageTypeSystem postTypeGrey" %>
    • +
    • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %>
    • +
    • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
    • +
    +
  • + <% end %> From 1f6bd68e61f35cdb5e4497901ac81bf0102bdce7 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:37:28 +0800 Subject: [PATCH 20/71] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE=20?= =?UTF-8?q?=20=E7=BB=84=E7=BB=87=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/show.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index ab3120a5d..690750fd2 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -20,6 +20,7 @@ From 79e30862e97e70ea54991966d0c6ca879cea60e4 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 15:58:53 +0800 Subject: [PATCH 44/71] change sonar method into restart and cancel push events --- .../quality_analysis_controller.rb | 158 +++++++++--------- app/views/quality_analysis/_show.html.erb | 6 +- app/views/repositories/show.html.erb | 8 +- 3 files changed, 87 insertions(+), 85 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 3a9eff0ce..365889640 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -16,8 +16,8 @@ class QualityAnalysisController < ApplicationController end # params 说明:{identifier:版本库名} + # type: 1 新的分析 2 重新分析 def create - logger.info("11111111111111111111111111111") begin user_name = User.find(params[:user_id]).try(:login) identifier = params[:identifier] @@ -30,98 +30,98 @@ class QualityAnalysisController < ApplicationController # 考虑到历史数据:有些用户创建类job但是build失败,即sonar没有结果,这个时候需要把job删除,并且删掉quality_analyses表数据 # 如果不要这句则需要迁移数据 @sonar_address = Redmine::Configuration['sonar_address'] - projects_date = open(@sonar_address + "/api/projects/index").read - arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] - quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first - if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank? - aa = @client_jenkins.job.delete("#{job_name}") - quality_an.delete unless quality_an.blank? - end + # projects_date = open(@sonar_address + "/api/projects/index").read + # arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] + quality_an = QualityAnalysis.where(:sonar_name => sonar_name) + # if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank? + # aa = @client_jenkins.job.delete("#{job_name}") + # quality_an.delete unless quality_an.blank? + # end + + # type 1的时候之所以判断job是否存在,为了防止特殊情况,正常情况是不会出现的 + # 重新分析的时候需要删除以前的分析结果 + @client_jenkins.job.delete("#{job_name}") if @client_jenkins.job.exists?(job_name) + quality_an.delete_all unless quality_an.blank? # Checks if the given job exists in Jenkins. - unless @client_jenkins.job.exists?(job_name) - @g = Gitlab.client - branch = params[:branch] - language = swith_language_type(params[:language]) - path = params[:path].blank? ? "./" : params[:path] - # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first - version = quality_an.nil? ? 1 : quality_an.sonar_version + 1 - properties = "sonar.projectKey=#{sonar_name} + @g = Gitlab.client + branch = params[:branch] + language = swith_language_type(params[:language]) + path = params[:path].blank? ? "./" : params[:path] + # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first + version = 1 + properties = "sonar.projectKey=#{sonar_name} sonar.projectName=#{sonar_name} sonar.projectVersion=#{version} sonar.sources=#{path} sonar.language=#{language.downcase} sonar.sourceEncoding=utf-8" - git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" + git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" - # 替换配置文件 - @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) - @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url - @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" - @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties + # 替换配置文件 + @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) + @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url + @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" + @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties - # jenkins job创建 - jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml) - logger.info("Jenkins status of create ==> #{jenkins_job}") + # jenkins job创建 + jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml) - # 将地址作为hook值添加到gitlab - @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}") - # job创建完成后自动运行job,如果运行成功则返回‘200’ - code = @client_jenkins.job.build("#{job_name}") - logger.error("build result ==> #{code}") + # 将地址作为hook值添加到gitlab + # @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}") + # job创建完成后自动运行job,如果运行成功则返回‘200’ + code = @client_jenkins.job.build("#{job_name}") - # 判断调用sonar分析是否成功 - # 等待启动时间处理, 最长时间为30分钟 - for i in 0..360 do - sleep(5) - @current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}") - if (@current_build_status == "success" || @current_build_status == "failure") + # 判断调用sonar分析是否成功 + # 等待启动时间处理, 最长时间为30分钟 + for i in 0..360 do + sleep(5) + @current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}") + if (@current_build_status == "success" || @current_build_status == "failure") + break + if i == 360 + @build_console_result = false break - if i == 360 - @build_console_result = false - break - end - end - end - - # sonar 缓冲,sonar生成数据 - sleep(10) - - # 获取sonar output结果 - console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"] - logger.info("@current_build_status is ==> #{@current_build_status}") - - # 两种情况需要删除job: - # 1/创建成功但是build失败则删除job - # 2/creat和build成功,调用sonar启动失败则删除job - # 错误信息存储需存到Trustie数据库,否则一旦job删除则无法获取这些信息 - if jenkins_job == '200' && code != '201' - @client_jenkins.job.delete("#{job_name}") - else - if @current_build_status == "failure" - reg_console = /Exception:.*?\r/.match(console_build) - output = reg_console[0].gsub("\r", "") unless reg_console.nil? - se = SonarError.where(:jenkins_job_name => job_name).first - se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output) - @client_jenkins.job.delete("#{job_name}") - elsif @current_build_status == "success" - if quality_an.blank? - QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, - :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}") - else - qa.update_attribute(:sonar_version, version) - end - end - end - - respond_to do |format| - if @current_build_status == "success" - format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)} - elsif @current_build_status == "failure" - format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)} end end end + + # sonar 缓冲,sonar生成数据 + sleep(10) + + # 获取sonar output结果 + console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"] + logger.info("@current_build_status is ==> #{@current_build_status}") + + # 两种情况需要删除job: + # 1/创建成功但是build失败则删除job + # 2/creat和build成功,调用sonar启动失败则删除job + # 错误信息存储需存到Trustie数据库,否则一旦job删除则无法获取这些信息 + if jenkins_job == '200' && code != '201' + @client_jenkins.job.delete("#{job_name}") + else + if @current_build_status == "failure" + reg_console = /Exception:.*?\r/.match(console_build) + output = reg_console[0].gsub("\r", "") unless reg_console.nil? + se = SonarError.where(:jenkins_job_name => job_name).first + se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output) + @client_jenkins.job.delete("#{job_name}") + elsif @current_build_status == "success" + if quality_an.blank? + QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, + :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}") + end + end + end + + respond_to do |format| + if @current_build_status == "success" + format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)} + elsif @current_build_status == "failure" + format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)} + end + end + rescue => e @message = e.message logger.error("######################====>#{e.message}") @@ -302,10 +302,8 @@ class QualityAnalysisController < ApplicationController @jenkins_address = Redmine::Configuration['jenkins_address'] jenkins_username = Redmine::Configuration['jenkins_username'] jenkins_password = Redmine::Configuration['jenkins_password'] - logger.info("22222222222222222222222222222222") # connect jenkins @client_jenkins = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password) - logger.info("333333333333333333333333333333") rescue => e logger.error("failed to connect Jenkins ==> #{e}") end diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index ff7863ce8..d6c8c0a56 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -127,7 +127,7 @@

    <%= @ha["functions"].to_i %>

    -<% unless @user_quality_infos.blank? %> +<% if !@user_quality_infos.blank? %>
    贡献统计
      @@ -141,7 +141,7 @@ <% @user_quality_infos.each do |author_info| %> <% user = get_user_by_mail(author_info[:email]) %> - <% unless author_info[:changes] == 0 %> + <%# unless author_info[:changes] == 0 %>
      • @@ -155,7 +155,7 @@
      • <%= author_info[:ratio] %>
      - <% end %> + <%# end %> <% end %>
    diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index b80d9ee5b..ec63a1c73 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -3,8 +3,12 @@

    <%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>

    <% unless @entries.nil? %> ZIP下载 - <% if quality_analysis(User.current.try(:login), @repository.id).nil? && User.current.member_of?(@project) && @project.is_public? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %> + <% if User.current.member_of?(@project) && @project.is_public? %> + <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> + <% else %> + <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> + <% end %> <% end %> <% end %> From 40f5510195a360e2f35cd35f2f4f213f685208c8 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 1 Sep 2016 16:01:16 +0800 Subject: [PATCH 45/71] =?UTF-8?q?=E4=BE=A7=E5=AF=BC=E8=88=AA=E6=96=87?= =?UTF-8?q?=E5=AD=97=E5=92=8C=E6=8C=89=E9=92=AE=E4=B8=8D=E9=87=8D=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/structure.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 7004c0928..31464673e 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -499,7 +499,7 @@ a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;} .user_leftnav{ width:240px;} .users_accordion li > a { display: block; - padding: 0 10px 0 32px; + padding: 0 25px 0 32px; height:49px; line-height:49px; color: #333; From e798381feb81ffb52a16a530b219679cfa1b23cf Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 16:39:09 +0800 Subject: [PATCH 46/71] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=95=B0=E6=94=B9=E6=88=90=E5=AE=9E=E6=97=B6=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_development_group.html.erb | 5 +++-- app/views/projects/_friend_group.html.erb | 5 +++-- app/views/projects/_research_team.html.erb | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 52f4e002a..17742f023 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -1,3 +1,4 @@ +<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %> diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 85b3a901a..5c933aee2 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -72,7 +72,12 @@ -
    +
    +
    +
    +
    {{homework.praise_count}}
    +
    {{homework.praise_count}}
    +
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 7fa8459c4..ba3dd6553 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -61,7 +61,12 @@ -
    +
    +
    +
    +
    {{homework.praise_count}}
    +
    {{homework.praise_count}}
    +
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index efc7ed64d..ed5e0cf09 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -78,7 +78,12 @@ -
    +
    +
    +
    +
    {{homework.praise_count}}
    +
    {{homework.praise_count}}
    +
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index e2e65ca58..922b6dbfb 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -56,7 +56,12 @@ -
    +
    +
    +
    +
    {{homework.praise_count}}
    +
    {{homework.praise_count}}
    +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 30d464802..f1e492d8b 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -57,7 +57,12 @@ -
    +
    +
    +
    +
    {{homework.praise_count}}
    +
    {{homework.praise_count}}
    +
    From a6bb19eb60fdae025c81de26fa34bdb8572e8d74 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 2 Sep 2016 10:54:40 +0800 Subject: [PATCH 50/71] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=A2=9E=E5=8A=A0=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/issue.rb | 4 ++++ app/api/mobile/entities/news.rb | 4 ++++ public/assets/wechat/blog_detail.html | 6 +++--- public/assets/wechat/course_discussion.html | 6 +++--- public/assets/wechat/course_notice.html | 6 +++--- public/assets/wechat/homework_detail.html | 6 +++--- public/assets/wechat/issue_detail.html | 6 +++--- public/assets/wechat/jour_message_detail.html | 6 +++--- public/assets/wechat/project_discussion.html | 6 +++--- 9 files changed, 29 insertions(+), 21 deletions(-) diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb index e3dbb5023..a46e10da5 100644 --- a/app/api/mobile/entities/issue.rb +++ b/app/api/mobile/entities/issue.rb @@ -52,6 +52,10 @@ module Mobile time_from_now issue.created_on when :act_id issue.id + when :act_type + 'Journal' + when :praise_count + get_activity_praise_num(issue) end end end diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index a64081d8a..d8c4dcab3 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -36,6 +36,10 @@ module Mobile time_from_now f.created_on when :act_id f.id + when :praise_count + get_activity_praise_num(f) + when :act_type + 'Comment' end elsif f.is_a?(Hash) && !f.key?(field) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 3b082e7b4..54dda1568 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -61,9 +61,9 @@
    -
    -
    {{homework.praise_count}}
    -
    {{homework.praise_count}}
    +
    +
    {{journal.praise_count}}
    +
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 8e0c11c1f..0daf0e1bb 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -59,9 +59,9 @@
    -
    -
    {{homework.praise_count}}
    -
    {{homework.praise_count}}
    +
    +
    {{journal.praise_count}}
    +
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 5c933aee2..a24321b5e 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -74,9 +74,9 @@
    -
    -
    {{homework.praise_count}}
    -
    {{homework.praise_count}}
    +
    +
    {{journal.praise_count}}
    +
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index ba3dd6553..9ffdcea4a 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -63,9 +63,9 @@
    -
    -
    {{homework.praise_count}}
    -
    {{homework.praise_count}}
    +
    +
    {{journal.praise_count}}
    +
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index ed5e0cf09..8aefc8d17 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -80,9 +80,9 @@
    -
    -
    {{homework.praise_count}}
    -
    {{homework.praise_count}}
    +
    +
    {{journal.praise_count}}
    +
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 922b6dbfb..8062ccccc 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -58,9 +58,9 @@
    -
    -
    {{homework.praise_count}}
    -
    {{homework.praise_count}}
    +
    +
    {{journal.praise_count}}
    +
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index f1e492d8b..e29b062dc 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -59,9 +59,9 @@
    -
    -
    {{homework.praise_count}}
    -
    {{homework.praise_count}}
    +
    +
    {{journal.praise_count}}
    +
    {{journal.praise_count}}
    From fa25a78f6278086df01216a9efc5a13fb97eba51 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 2 Sep 2016 11:27:35 +0800 Subject: [PATCH 51/71] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=20=E6=B7=BB=E5=8A=A0=E7=A7=81=E6=9C=89=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=8F=90=E7=A4=BA=E5=8F=8A=E5=B1=80=E9=83=A8=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 44 +- app/controllers/files_controller.rb | 550 +++++++++--------- .../attachments/update_file_dense.js.erb | 10 +- app/views/files/_course_file.html.erb | 31 +- app/views/files/_project_file.html.erb | 23 +- app/views/files/_resource_detail.html.erb | 6 +- .../files/_tip_attachment_count.html.erb | 2 +- app/views/files/_tool_settings.html.erb | 13 +- app/views/files/search_tag_attachment.js.erb | 10 +- app/views/layouts/base_courses.html.erb | 4 +- 10 files changed, 371 insertions(+), 322 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 7ec532d79..f149ad9b2 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -203,16 +204,49 @@ class AttachmentsController < ApplicationController @attachment.save @newfiledense = filedense end - if @project + tip_attachment_update - elsif @course - - end respond_to do |format| format.js end end + def tip_attachment_update + if params[:course_id] + @tip_all_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id]) + @tip_all_public_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id], :is_public => 1) + @tip_all_private_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id], :is_public => 0) + @course = Course.find(params[:course_id]) + elsif params[:project_id] + @tip_all_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id]) + @tip_all_public_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 1) + @tip_all_private_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 0) + @project = Project.find(params[:project_id]) + end + @tag_name = params[:tag_name] + @other = params[:other] + unless @tag_name.blank? + if @other + if @project + @tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') } + @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') } + @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') } + elsif @course + @tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') } + @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') } + @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') } + end + else + @tip_all_attachments = @tip_all_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)} + @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)} + @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)} + end + end + @tip_all_attachments = @tip_all_attachments.count + @tip_all_public_attachments = @tip_all_public_attachments.count + @tip_all_private_attachments = @tip_all_private_attachments.count + end + def thumbnail if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size]) if stale?(:etag => thumbnail) @@ -281,6 +315,7 @@ class AttachmentsController < ApplicationController @attachment.delete @flag = true end + # tip_attachment_update respond_to do |format| format.js @@ -591,6 +626,7 @@ class AttachmentsController < ApplicationController def attachment_versions @attachment = Attachment.find(params[:id]) @attachment_histories = @attachment.attachment_histories + @container_tip = Project.find(params[:project_id]) respond_to do |format| format.js end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 988768414..2ed17a76f 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -86,7 +86,7 @@ class FilesController < ApplicationController else @result = find_course_attache q,@course,sort @result = visable_attachemnts @result - # @searched_attach = paginateHelper @result,10 + # @searched_attach = paginateHelper @result,10 @tag_list = get_course_tag_list @course end @all_attachments = @result @@ -96,9 +96,9 @@ class FilesController < ApplicationController @offset ||= @feedback_pages.offset #@curse_attachments_all = @all_attachments[@offset, @limit] @obj_attachments = paginateHelper @all_attachments,10 - #rescue Exception => e - # #render 'stores' - # redirect_to search_course_files_url + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url end end @@ -176,52 +176,52 @@ 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}" + 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 - # 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 = attachment_tag_list @result - end - #rescue Exception => e - # #render 'stores' - # redirect_to search_course_files_url - end - @page = params[:page] || 1 + 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 = attachment_tag_list @result + end + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url + end + @page = params[:page] || 1 + end def find_course_attache keywords,course,sort = "" if sort == "" sort = "created_on DESC" end if keywords != "%%" - resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort) + resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort) else resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort) end @@ -250,7 +250,7 @@ class FilesController < ApplicationController else resultSet = Attachment.where("attachments.container_type = 'Project' And attachments.container_id = '#{project.id}' "). reorder(sort) end - end + end def find_public_attache keywords,sort = "" # StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map @@ -260,7 +260,7 @@ class FilesController < ApplicationController sort = "created_on DESC" end resultSet = Attachment.where("attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like ", like: "%#{keywords}%"). - reorder(sort) + reorder(sort) end def index @@ -325,7 +325,7 @@ class FilesController < ApplicationController @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] show_attachments @containers - # get_attachment_for_tip(@all_attachments) + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -355,7 +355,7 @@ class FilesController < ApplicationController when "quotes" attribute = "quotes" else - attribute = "created_on" + attribute = "created_on" end @sort = order_by[0] @order = order_by[1] @@ -378,7 +378,7 @@ class FilesController < ApplicationController @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers - # get_attachment_for_tip(@all_attachments) + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -501,228 +501,228 @@ class FilesController < ApplicationController end def create - if params[:add_tag] - @addTag=true - #render :back + if params[:add_tag] + @addTag=true + #render :back tag_saveEx #render :text =>"success" respond_to do |format| - format.js - end - else - #modify by nwb - if @project - @addTag=false - if params[:in_project_toolbar] - @in_project_toolbar = params[:in_project_toolbar] - end - attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type]) - if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - # 发送邮件 - Mailer.run.attachments_added(attachments[:files]) - # 生成动态 - attachments[:files].each do |file| - ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment") - end - # 更新资源总数, 根据上传的附件数累加 - @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil? - end - # end - if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array) - params[:project_attachment_type].each do |type| - tag_name = get_project_tag_name_by_type_nmuber type - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - else - if params[:project_attachment_type] && params[:project_attachment_type] != "6" - tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type] - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + format.js + end + else + #modify by nwb + if @project + @addTag=false + if params[:in_project_toolbar] + @in_project_toolbar = params[:in_project_toolbar] + end + attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type]) + if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') + # 发送邮件 + Mailer.run.attachments_added(attachments[:files]) + # 生成动态 + attachments[:files].each do |file| + ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment") + end + # 更新资源总数, 根据上传的附件数累加 + @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil? + end + # end + if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array) + params[:project_attachment_type].each do |type| + tag_name = get_project_tag_name_by_type_nmuber type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + else + if params[:project_attachment_type] && params[:project_attachment_type] != "6" + tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + end + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 - respond_to do |format| - format.js - format.html { - redirect_to project_files_url(@project) - } - end - elsif @course - @addTag=false - if params[:in_course_toolbar] - @in_course_toolbar = params[:in_course_toolbar] - end - attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type]) + @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + @attachtype = 0 + @contenttype = 0 + respond_to do |format| + format.js + format.html { + redirect_to project_files_url(@project) + } + end + elsif @course + @addTag=false + if params[:in_course_toolbar] + @in_course_toolbar = params[:in_course_toolbar] + end + attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type]) - if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - Mailer.run.attachments_added(attachments[:files]) - end - if !attachments.empty? && attachments[:files] - attachments[:files].each do |attachment| - if params[:publish_time] - if params[:publish_time] == "" - attachment.publish_time = Date.today - else - attachment.publish_time = params[:publish_time] - end - else - attachment.publish_time = Date.today - end - if attachment.publish_time > Date.today - attachment.is_publish = 0 - end - attachment.description = params[:description] - attachment.save - end - end - if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) - params[:course_attachment_type].each do |type| - tag_name = get_tag_name_by_type_number type - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.save - end - end - end - else - if params[:course_attachment_type] && params[:course_attachment_type] != "5" - tag_name = get_tag_name_by_type_number params[:course_attachment_type] - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.save - end - end - end - end - # 更新课程英雄榜得分 - course_member_score(@course.id, attachments[:files].first.author_id, "Attachment") - # end - # end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') + Mailer.run.attachments_added(attachments[:files]) + end + if !attachments.empty? && attachments[:files] + attachments[:files].each do |attachment| + if params[:publish_time] + if params[:publish_time] == "" + attachment.publish_time = Date.today + else + attachment.publish_time = params[:publish_time] + end + else + attachment.publish_time = Date.today + end + if attachment.publish_time > Date.today + attachment.is_publish = 0 + end + attachment.description = params[:description] + attachment.save + end + end + if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) + params[:course_attachment_type].each do |type| + tag_name = get_tag_name_by_type_number type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + else + if params[:course_attachment_type] && params[:course_attachment_type] != "5" + tag_name = get_tag_name_by_type_number params[:course_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + end + # 更新课程英雄榜得分 + course_member_score(@course.id, attachments[:files].first.author_id, "Attachment") + # end + # end + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] + @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 + @attachtype = 0 + @contenttype = 0 - respond_to do |format| - format.js - format.html { - redirect_to course_files_url(@course) - } - end - elsif @org_subfield - @addTag=false - attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) + respond_to do |format| + format.js + format.html { + redirect_to course_files_url(@course) + } + end + elsif @org_subfield + @addTag=false + attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) - if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array) - params[:org_subfield_attachment_type].each do |type| - tag_name = get_tag_name_by_type_number type - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - else - if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5" - tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type] - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.description = params[:description] - attachment.save - end - end - end - end + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array) + params[:org_subfield_attachment_type].each do |type| + tag_name = get_tag_name_by_type_number type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + else + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5" + tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.description = params[:description] + attachment.save + end + end + end + end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] + @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + @attachtype = 0 + @contenttype = 0 - respond_to do |format| - format.js - # format.html { - # redirect_to org_subfield_files_url(@org_subfield) - # } - end - # 组织添加附件,为了修改图片 - elsif params[:organization_id] - @organization = Organization.find(params[:organization_id]) - @addTag=false - # atttchment_type = 0为logo 1为banner - if params[:logo] - attachments = Attachment.attach_filesex(@organization, params[:attachments], false) - else - attachments = Attachment.attach_filesex(@organization, params[:attachments], true) - end - # TODO: 临时用 nyan - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + respond_to do |format| + format.js + # format.html { + # redirect_to org_subfield_files_url(@org_subfield) + # } + end + # 组织添加附件,为了修改图片 + elsif params[:organization_id] + @organization = Organization.find(params[:organization_id]) + @addTag=false + # atttchment_type = 0为logo 1为banner + if params[:logo] + attachments = Attachment.attach_filesex(@organization, params[:attachments], false) + else + attachments = Attachment.attach_filesex(@organization, params[:attachments], true) + end + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)] + @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)] - show_attachments @containers - @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 - @contenttype = 0 + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + @attachtype = 0 + @contenttype = 0 - respond_to do |format| - format.js - # format.html { - # redirect_to org_subfield_files_url(@org_subfield) - # } - end - end - end + respond_to do |format| + format.js + # format.html { + # redirect_to org_subfield_files_url(@org_subfield) + # } + end + end + end end def get_project_tag_name_by_type_nmuber type @@ -798,13 +798,13 @@ class FilesController < ApplicationController else #捕获异常 end - end + end # 返回指定资源类型的资源列表 # added by nwb def getattachtype - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", 'filename' => "#{Attachment.table_name}.filename", 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" @@ -842,27 +842,27 @@ class FilesController < ApplicationController end end - if @project - @isproject = true - @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] - @containers += @project.versions.includes(:attachments).reorder(sort).all - show_attachments @containers - @attachtype = params[:type].to_i - @contenttype = params[:contentType].to_s + if @project + @isproject = true + @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] + @containers += @project.versions.includes(:attachments).reorder(sort).all + show_attachments @containers + @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s respond_to do |format| format.js - format.html { - render :layout => 'base_projects' - } + format.html { + render :layout => 'base_projects' + } end - elsif @course + elsif @course @isproject = false @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers @attachtype = params[:type].to_i @contenttype = params[:contentType].to_s - # render layout: 'base_courses' + # render layout: 'base_courses' @left_nav_type = 5 respond_to do |format| format.js @@ -870,19 +870,19 @@ class FilesController < ApplicationController render :layout => 'base_courses' } end - else - show_attachments @containers - @attachtype = params[:type].to_i - @contenttype = params[:contentType].to_s + else + show_attachments @containers + @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s - respond_to do |format| + respond_to do |format| format.js format.html - end - end + end + end end - #查找指定TAG的按条件过滤的资源列表,只有课程内搜索有此功能 + #查找指定TAG的按条件过滤的资源列表,只有课程内搜索有此功能 def search_tag_attachment @q,@tag_name,@order = params[:q],params[:tag_name] @is_remote = true diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb index 7709ee288..635fbe8bf 100644 --- a/app/views/attachments/update_file_dense.js.erb +++ b/app/views/attachments/update_file_dense.js.erb @@ -1,16 +1,18 @@ <% if @attachment.container_type == 'Course' %> -$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id, :course_id => @attachment.container_id, :tag_name => @tag_name, :other => @other,:newtype=>(@attachment.is_public? ? 0:1)), :remote=>true,:class=>"postOptionLink",:method => :post) %>"); + $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); <% elsif @attachment.container_type == 'Project' %> - $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :newtype => (@attachment.is_public? ? 0:1)), + $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :project_id => @attachment.container_id, :tag_name => @tag_name, :other => @other ,:newtype => (@attachment.is_public? ? 0:1)), :remote => true, :class => "postOptionLink", :method => :post) %>"); + $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); <% else %> -$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), :remote=>true,:class=>"postOptionLink",:method => :post) %>"); <% end %> <% if @attachment.is_public? %> $("#image_private_<%= @attachment.id%>").html('') <%else%> -$("#image_private_<%= @attachment.id%>").html('私有') + $("#image_private_<%= @attachment.id%>").html('私有') <% end %> \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index b5a15bc1f..d3cc58c71 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -1,9 +1,9 @@ - - - - - -<% is_current_user = User.current.logged?%> - -
    - -
    -
    -
    - <%=render :partial => 'layouts/syllabus_info' %> -
    -
    - -
    -
    - <%= yield %> -
    -
    -
    - <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %> -
    -
    - <%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %> -
    -
    -
    -
    - -
    -
    -<%= render :partial => 'layouts/footer' %> -
    - - - - - - + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public',:media => 'all'%> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> + <%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + <%= yield :header_tags -%> + + + + + + + +<% is_current_user = User.current.logged?%> + +
    +
    +

    + 位置:   + <%= link_to "尹刚", :class => 'sy_cgrey' %> +  >  + <%=link_to "课程", :class => 'sy_cgrey' %> +  >  + <%=link_to "课程名称", :class => 'sy_cgrey' %> +

    +
    +
    +
    +
    + <%=render :partial => 'layouts/syllabus_info' %> +
    +
    + +
    +
    + <%= yield %> +
    +
    +
    + <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %> +
    +
    + <%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %> +
    +
    +
    +
    + +
    +
    +<%= render :partial => 'layouts/footer' %> +
    + + + + + + diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index d28ab1037..f6a8e8e6e 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -113,12 +113,13 @@ a.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bott /* 课程大纲头部 */ .sy_top{ background:#f5f5f5; - width: 100%; + width: 1000px; height: 138px; + margin: 0 auto; } .sy_top_con{ background: url(../images/sy/bg_sy.jpg) no-repeat; - width: 1280px; + width: 1000px; margin: 0 auto; height: 108px; text-align:center; From 9e317c4a8f8fcc6b6c6ab1d88c147ad12a7deeef Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 2 Sep 2016 13:54:34 +0800 Subject: [PATCH 54/71] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E8=8B=B1=E6=96=87=E5=8D=95=E8=AF=8D=E8=BF=87=E9=95=BF=E4=B8=8D?= =?UTF-8?q?=E6=8A=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/public.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 28f89a24f..e08d9a1da 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1386,7 +1386,7 @@ a.content-username:hover{ color:#297fb8;} .orig_index{ float:right; color:#666; font-family:Arial; padding-right:5px;line-height:30px;} .orig_user{ margin:10px 15px 10px 5px;} .orig_user span{ color:#999; padding-right:5px;} -.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; } +.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; word-wrap:break-word; } .orig_content img {max-width:100%;} .orig_right{ width:80%; margin-top:5px;} a.comment_ding_link{ height:24px;line-height:24px;display:inline-block;padding-left:2px;vertical-align:middle; color:#333; } From d0a2ea02f2fa193f91f9cebf31450909388e14f4 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 2 Sep 2016 14:27:49 +0800 Subject: [PATCH 55/71] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E5=AD=A6=E5=8F=B7=E8=BF=87=E9=95=BF=E7=9C=81?= =?UTF-8?q?=E7=95=A5=E5=8F=B7=E6=98=BE=E7=A4=BA=EF=BC=9B=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=95=99=E5=B8=88=E5=9B=A2=E9=98=9F=E5=90=8D=E7=A7=B0=E8=BF=87?= =?UTF-8?q?=E9=95=BF=E7=9C=81=E7=95=A5=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_new_member_list.html.erb | 4 +- .../layouts/_syllabus_teacher_list.html.erb | 40 +++++++++---------- public/stylesheets/css/public.css | 1 + 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index 720dfceea..08df18175 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -54,11 +54,11 @@
    • - <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.show_name}".html_safe,user_path(member.user)) %> + <%= link_to("#{l(:label_bidding_user_studentname)}:".html_safe,user_path(member.user)) %>

    • <% unless member.user.user_extensions.student_id == ''%> -
    • <%= link_to("#{l(:label_bidding_user_studentcode)}:#{member.user.user_extensions.student_id}".html_safe,user_path(member.user)) %>
    • +
    • <%= link_to("#{l(:label_bidding_user_studentcode)}:".html_safe,user_path(member.user)) %>
    • <% end%>
    <% unless @course.course_groups.empty? %> diff --git a/app/views/layouts/_syllabus_teacher_list.html.erb b/app/views/layouts/_syllabus_teacher_list.html.erb index 71fd67a75..344036ccf 100644 --- a/app/views/layouts/_syllabus_teacher_list.html.erb +++ b/app/views/layouts/_syllabus_teacher_list.html.erb @@ -1,21 +1,21 @@ -

    教师团队 - 增加教师 -
    -

    -
      - <% teacher = syllabus.user %> - <%# teachers.each do |teacher| %> -
    • - <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %> -
      - <%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name", :target => "_blank" %> - - <% if teacher.user_extensions && teacher.user_extensions.identity %> - <%= get_user_roll teacher %> - <% end%> - -
      -
      -
    • - <%# end %> +

      教师团队 + 增加教师 +
      +

      +
        + <% teacher = syllabus.user %> + <%# teachers.each do |teacher| %> +
      • + <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %> +
        + <%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name hidden", :target => "_blank", :title => teacher.show_name %> + + <% if teacher.user_extensions && teacher.user_extensions.identity %> + <%= get_user_roll teacher %> + <% end%> + +
        +
        +
      • + <%# end %>
      \ No newline at end of file diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index e08d9a1da..9565a9e26 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -751,6 +751,7 @@ a:hover.st_add{ color:#ff8e15;} .classbox_on{ border:1px solid #f8df8c; background:#f6f098; padding:0 3px; float:left; margin-left:15px;} .classbox_on a{ color:#716cad;} .st_list_score {width:105px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; vertical-align:middle; font-size:12px; text-align:center;} +.st_info_block {width:150px; display:inline-block; vertical-align:bottom;} /* 创建作品 homework,项目配置 */ .hwork_new{ color:#4c4c4c;} From 11f3060ca511498ed813d601ad8e0cde95380af3 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 2 Sep 2016 14:40:40 +0800 Subject: [PATCH 56/71] =?UTF-8?q?=E8=87=AA=E5=B7=B1=E5=BB=BA=E7=9A=84issue?= =?UTF-8?q?=E6=8C=87=E5=90=91=E8=87=AA=E5=B7=B1=E4=B8=8D=E5=8F=91=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 4c9411538..b97699058 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -196,8 +196,9 @@ class IssuesController < ApplicationController priority_id = params[:issue][:priority_id] ps = ProjectsService.new - ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id - + if senduser.id != User.current.id + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + end call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| format.html { From 51ef4a96e6107902fd59756b1c2781d222ddac57 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Sep 2016 14:42:59 +0800 Subject: [PATCH 57/71] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_syllabus.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/base_syllabus.html.erb b/app/views/layouts/base_syllabus.html.erb index 8f71e2ec2..d470c8a40 100644 --- a/app/views/layouts/base_syllabus.html.erb +++ b/app/views/layouts/base_syllabus.html.erb @@ -41,11 +41,11 @@

      位置:   - <%= link_to "尹刚", :class => 'sy_cgrey' %> + <%= link_to User.current, user_path(User.current.id), :class => 'sy_cgrey', :target => '_blank' %>  >  - <%=link_to "课程", :class => 'sy_cgrey' %> -  >  - <%=link_to "课程名称", :class => 'sy_cgrey' %> + <%= link_to '课程', user_courselist_user_path(User.current.id), :class => "sy_cgrey", :target => '_blank' %> +  >  + <%= link_to @syllabus.title, syllabus_path(@syllabus.id), :class => "sy_cgrey" %>

      From 396664d4e7434de71b739091f2677ec817723908 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 2 Sep 2016 14:45:01 +0800 Subject: [PATCH 58/71] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8B=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_syllabus.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_syllabus.html.erb b/app/views/layouts/base_syllabus.html.erb index 8f71e2ec2..deddaa34f 100644 --- a/app/views/layouts/base_syllabus.html.erb +++ b/app/views/layouts/base_syllabus.html.erb @@ -59,7 +59,7 @@
      <%= yield %>
      -
      +
      <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
      From 3881e5c5c5fb11e6cf71b9142a0fe668d6fca8ef Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 2 Sep 2016 14:50:06 +0800 Subject: [PATCH 59/71] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=9A=84=E6=98=AF=E6=97=B6=E5=80=99tip=E5=B1=80=E9=83=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0=20=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=85=AC=E5=BC=80=E7=A7=81=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 5 +++-- app/controllers/files_controller.rb | 2 ++ app/views/files/search.js.erb | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index cee08ffa9..5d1345f24 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -204,7 +204,9 @@ class AttachmentsController < ApplicationController @attachment.save @newfiledense = filedense end - tip_attachment_update + if @attachment.container_type == "Project" || @attachment.container_type == "Course" + tip_attachment_update + end respond_to do |format| format.js @@ -626,7 +628,6 @@ class AttachmentsController < ApplicationController def attachment_versions @attachment = Attachment.find(params[:id]) @attachment_histories = @attachment.attachment_histories - @container_tip = Project.find(params[:project_id]) respond_to do |format| format.js end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 2ed17a76f..7318a4dc2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -90,6 +90,7 @@ class FilesController < ApplicationController @tag_list = get_course_tag_list @course end @all_attachments = @result + get_attachment_for_tip(@all_attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @@ -164,6 +165,7 @@ class FilesController < ApplicationController end @all_attachments = @project_attachment_result + get_attachment_for_tip(@all_attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/views/files/search.js.erb b/app/views/files/search.js.erb index 011b3bb25..4c32a1044 100644 --- a/app/views/files/search.js.erb +++ b/app/views/files/search.js.erb @@ -1,3 +1,4 @@ $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); + $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); \ No newline at end of file From 613f974440db5486d872499bf07a3efb9a662220 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Sep 2016 15:22:09 +0800 Subject: [PATCH 60/71] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E5=92=8C=E8=AF=BE=E7=A8=8B=E7=9A=84=E8=80=81?= =?UTF-8?q?=E5=B8=88=E9=83=BD=E6=9C=89=E6=9D=83=E9=99=90=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=92=8C=E6=96=B0=E9=97=BB/=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E7=9A=84=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_project_show.html.erb | 23 ++++++++++------------- app/views/news/_course_show.html.erb | 2 +- app/views/news/_news_all_replies.html.erb | 2 +- app/views/news/_project_show.html.erb | 2 +- app/views/users/_message_replies.html.erb | 2 +- app/views/users/_news_replies.html.erb | 3 ++- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 41c2f7d1f..2769594c5 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -104,18 +104,15 @@
        • - -
        • - <%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %> -
        • - <% if @topic.author.id == User.current.id %> -
        • - <%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'postOptionLink' - ) if @message.destroyable_by?(User.current) %> -
        • - <% end %> +
        • + <%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %> +
        • +
        • + <%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if @message.destroyable_by?(User.current) %> +
        • <% if hidden_unproject_infos %>
        • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
        • <% else %> @@ -202,7 +199,7 @@ :class => 'fr mr20', :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) - ) if reply.course_destroyable_by?(User.current) %> + ) if reply.destroyable_by?(User.current) %>
          diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index c8068e425..7fb6bad7f 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -82,7 +82,7 @@
      - <%= render :partial => 'news/news_all_replies' %> + <%= render :partial => 'news/news_all_replies', :locals => {:object => @course} %>