diff --git a/.gitignore b/.gitignore
index 0727a920a..38f29a661 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,4 +30,6 @@ vendor/cache
/public/files
/tags
/config/initializers/gitlab_config.rb
+/config/wechat.yml
+/config/menu.yml
1234567
diff --git a/Client.html b/Client.html
deleted file mode 100644
index fbb7cec52..000000000
--- a/Client.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-Client
-
-
-
-
-
- 这是一张图片
- photo Share A
-
-
- 这是一段视频
- Text Share B
-
-
- 这是一篇文章
- Text Share C
-
-
-
-
-
\ No newline at end of file
diff --git a/Gemfile.lock~ b/Gemfile.lock~
deleted file mode 100644
index 7d6563465..000000000
--- a/Gemfile.lock~
+++ /dev/null
@@ -1,386 +0,0 @@
-GIT
- remote: http://github.com/guange2015/wechat.git
- revision: a18c3d6603cb1aa7bd1fe887b17f67426be01f35
- specs:
- wechat (0.7.1)
- activerecord (>= 3.2, < 5.1.x)
- http (~> 1.0, >= 1.0.1)
- nokogiri (>= 1.6.0)
- thor
-
-PATH
- remote: lib/gitlab-cli
- specs:
- gitlab (3.2.0)
- httparty
- terminal-table
-
-PATH
- remote: lib/grack
- specs:
- grack (2.0.2)
- rack (~> 1.4.5)
-
-PATH
- remote: lib/rails_kindeditor
- specs:
- rails_kindeditor (0.4.5)
- carrierwave
- mini_magick
-
-GEM
- remote: https://ruby.taobao.org/
- specs:
- actionmailer (3.2.22.2)
- actionpack (= 3.2.22.2)
- mail (~> 2.5.4)
- actionpack (3.2.22.2)
- activemodel (= 3.2.22.2)
- activesupport (= 3.2.22.2)
- builder (~> 3.0.0)
- erubis (~> 2.7.0)
- journey (~> 1.0.4)
- rack (~> 1.4.5)
- rack-cache (~> 1.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.2.1)
- activemodel (3.2.22.2)
- activesupport (= 3.2.22.2)
- builder (~> 3.0.0)
- activerecord (3.2.22.2)
- activemodel (= 3.2.22.2)
- activesupport (= 3.2.22.2)
- arel (~> 3.0.2)
- tzinfo (~> 0.3.29)
- activeresource (3.2.22.2)
- activemodel (= 3.2.22.2)
- activesupport (= 3.2.22.2)
- activesupport (3.2.22.2)
- i18n (~> 0.6, >= 0.6.4)
- multi_json (~> 1.0)
- acts-as-taggable-on (2.4.1)
- rails (>= 3, < 5)
- addressable (2.4.0)
- ansi (1.5.0)
- arel (3.0.3)
- axiom-types (0.1.1)
- descendants_tracker (~> 0.0.4)
- ice_nine (~> 0.11.0)
- thread_safe (~> 0.3, >= 0.3.1)
- better_errors (1.1.0)
- coderay (>= 1.0.0)
- erubis (>= 2.6.6)
- binding_of_caller (0.7.2)
- debug_inspector (>= 0.0.1)
- builder (3.0.0)
- byebug (8.2.2)
- carrierwave (0.10.0)
- activemodel (>= 3.2.0)
- activesupport (>= 3.2.0)
- json (>= 1.7)
- mime-types (>= 1.16)
- chinese_pinyin (1.0.0)
- climate_control (0.0.3)
- activesupport (>= 3.0)
- cocaine (0.5.8)
- climate_control (>= 0.0.3, < 1.0)
- coderay (1.1.1)
- coercible (1.0.0)
- descendants_tracker (~> 0.0.1)
- coffee-rails (3.2.2)
- coffee-script (>= 2.2.0)
- railties (~> 3.2.0)
- coffee-script (2.4.1)
- coffee-script-source
- execjs
- coffee-script-source (1.10.0)
- daemons (1.2.3)
- debug_inspector (0.0.2)
- delayed_job (4.1.1)
- activesupport (>= 3.0, < 5.0)
- delayed_job_active_record (4.1.0)
- activerecord (>= 3.0, < 5)
- delayed_job (>= 3.0, < 5)
- descendants_tracker (0.0.4)
- thread_safe (~> 0.3, >= 0.3.1)
- diff-lcs (1.2.5)
- domain_name (0.5.20160216)
- unf (>= 0.0.5, < 1.0.0)
- elasticsearch (1.0.15)
- elasticsearch-api (= 1.0.15)
- elasticsearch-transport (= 1.0.15)
- elasticsearch-api (1.0.15)
- multi_json
- elasticsearch-model (0.1.8)
- activesupport (> 3)
- elasticsearch (> 0.4)
- hashie
- elasticsearch-rails (0.1.8)
- elasticsearch-transport (1.0.15)
- faraday
- multi_json
- equalizer (0.0.11)
- erubis (2.7.0)
- execjs (2.6.0)
- factory_girl (4.5.0)
- activesupport (>= 3.0.0)
- factory_girl_rails (4.6.0)
- factory_girl (~> 4.5.0)
- railties (>= 3.0.0)
- faraday (0.9.2)
- multipart-post (>= 1.2, < 3)
- fastercsv (1.5.5)
- grape (0.9.0)
- activesupport
- builder
- hashie (>= 2.1.0)
- multi_json (>= 1.3.2)
- multi_xml (>= 0.5.2)
- rack (>= 1.3.0)
- rack-accept
- rack-mount
- virtus (>= 1.0.0)
- grape-entity (0.4.8)
- activesupport
- multi_json (>= 1.3.2)
- grape-swagger (0.10.4)
- grape (>= 0.8.0)
- grape-entity (< 0.5.0)
- hashie (3.4.3)
- hike (1.2.3)
- htmlentities (4.3.4)
- http (1.0.2)
- addressable (~> 2.3)
- http-cookie (~> 1.0)
- http-form_data (~> 1.0.1)
- http_parser.rb (~> 0.6.0)
- http-cookie (1.0.2)
- domain_name (~> 0.5)
- http-form_data (1.0.1)
- http_parser.rb (0.6.0)
- httparty (0.13.7)
- json (~> 1.8)
- multi_xml (>= 0.5.2)
- i18n (0.6.11)
- ice_nine (0.11.2)
- iconv (1.0.4)
- journey (1.0.4)
- jquery-rails (2.0.3)
- railties (>= 3.1.0, < 5.0)
- thor (~> 0.14)
- json (1.8.3)
- kaminari (0.16.3)
- actionpack (>= 3.0.0)
- activesupport (>= 3.0.0)
- libv8 (3.16.14.13)
- mail (2.5.4)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- method_source (0.8.2)
- mime-types (1.25.1)
- mini_magick (4.4.0)
- mini_portile2 (2.0.0)
- multi_json (1.11.2)
- multi_xml (0.5.5)
- multipart-post (2.0.0)
- mysql2 (0.3.18)
- net-ldap (0.3.1)
- netrc (0.11.0)
- nokogiri (1.6.7.2)
- mini_portile2 (~> 2.0.0.rc2)
- paperclip (3.5.4)
- activemodel (>= 3.0.0)
- activesupport (>= 3.0.0)
- cocaine (~> 0.5.3)
- mime-types
- polyglot (0.3.5)
- pry (0.10.3)
- coderay (~> 1.1.0)
- method_source (~> 0.8.1)
- slop (~> 3.4)
- pry-byebug (3.3.0)
- byebug (~> 8.0)
- pry (~> 0.10)
- pry-rails (0.3.4)
- pry (>= 0.9.10)
- pry-stack_explorer (0.4.9.2)
- binding_of_caller (>= 0.7)
- pry (>= 0.9.11)
- rack (1.4.7)
- rack-accept (0.4.5)
- rack (>= 0.4)
- rack-cache (1.6.1)
- rack (>= 0.4)
- rack-cors (0.4.0)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
- rack-openid (1.4.2)
- rack (>= 1.1.0)
- ruby-openid (>= 2.1.8)
- rack-raw-upload (1.1.1)
- multi_json
- rack-ssl (1.3.4)
- rack
- rack-test (0.6.3)
- rack (>= 1.0)
- rails (3.2.22.2)
- actionmailer (= 3.2.22.2)
- actionpack (= 3.2.22.2)
- activerecord (= 3.2.22.2)
- activeresource (= 3.2.22.2)
- activesupport (= 3.2.22.2)
- bundler (~> 1.0)
- railties (= 3.2.22.2)
- railties (3.2.22.2)
- actionpack (= 3.2.22.2)
- activesupport (= 3.2.22.2)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (>= 0.14.6, < 2.0)
- rake (10.5.0)
- rdoc (3.12.2)
- json (~> 1.4)
- redis (3.2.2)
- redis-actionpack (3.2.4)
- actionpack (~> 3.2.0)
- redis-rack (~> 1.4.4)
- redis-store (~> 1.1.4)
- redis-activesupport (3.2.5)
- activesupport (~> 3.2.0)
- redis-store (~> 1.1.0)
- redis-rack (1.4.4)
- rack (~> 1.4.0)
- redis-store (~> 1.1.4)
- redis-rails (3.2.4)
- redis-actionpack (~> 3.2.4)
- redis-activesupport (~> 3.2.4)
- redis-store (~> 1.1.4)
- redis-store (1.1.7)
- redis (>= 2.2)
- ref (2.0.0)
- rest-client (1.8.0)
- http-cookie (>= 1.0.2, < 2.0)
- mime-types (>= 1.16, < 3.0)
- netrc (~> 0.7)
- rich (1.4.6)
- jquery-rails
- kaminari
- mime-types
- paperclip
- rack-raw-upload
- rails (>= 3.2.0)
- sass-rails
- rspec-core (3.4.3)
- rspec-support (~> 3.4.0)
- rspec-expectations (3.4.0)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.4.0)
- rspec-mocks (3.4.1)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.4.0)
- rspec-rails (3.4.2)
- actionpack (>= 3.0, < 4.3)
- activesupport (>= 3.0, < 4.3)
- railties (>= 3.0, < 4.3)
- rspec-core (~> 3.4.0)
- rspec-expectations (~> 3.4.0)
- rspec-mocks (~> 3.4.0)
- rspec-support (~> 3.4.0)
- rspec-support (3.4.1)
- ruby-ole (1.2.12)
- ruby-openid (2.1.8)
- rubyzip (1.2.0)
- sass (3.4.21)
- sass-rails (3.2.6)
- railties (~> 3.2.0)
- sass (>= 3.1.10)
- tilt (~> 1.3)
- seems_rateable (1.0.13)
- jquery-rails
- rails
- slop (3.6.0)
- spreadsheet (1.1.1)
- ruby-ole (>= 1.0)
- sprockets (2.2.3)
- hike (~> 1.2)
- multi_json (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- terminal-table (1.5.2)
- therubyracer (0.12.2)
- libv8 (~> 3.16.14.0)
- ref
- thor (0.19.1)
- thread_safe (0.3.5)
- tilt (1.4.1)
- treetop (1.4.15)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.46)
- uglifier (2.7.2)
- execjs (>= 0.3.0)
- json (>= 1.8.0)
- unf (0.1.4)
- unf_ext
- unf_ext (0.0.7.2)
- virtus (1.0.5)
- axiom-types (~> 0.1)
- coercible (~> 1.0)
- descendants_tracker (~> 0.0, >= 0.0.3)
- equalizer (~> 0.0, >= 0.0.9)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- acts-as-taggable-on (= 2.4.1)
- ansi
- better_errors (~> 1.1.0)
- binding_of_caller
- builder (= 3.0.0)
- chinese_pinyin
- coderay (~> 1.1.0)
- coffee-rails (~> 3.2.1)
- daemons
- delayed_job_active_record
- elasticsearch-model
- elasticsearch-rails
- factory_girl_rails
- fastercsv (~> 1.5.0)
- gitlab!
- grack!
- grape (~> 0.9.0)
- grape-entity
- grape-swagger
- htmlentities
- i18n (~> 0.6.0)
- iconv
- jquery-rails (~> 2.0.2)
- kaminari
- mysql2 (= 0.3.18)
- net-ldap (~> 0.3.1)
- paperclip (~> 3.5.4)
- pry-byebug
- pry-rails
- pry-stack_explorer
- rack-cors
- rack-openid
- rails (~> 3.2)
- rails_kindeditor!
- redis-rails
- rest-client
- rich (= 1.4.6)
- rspec-rails (~> 3.0)
- ruby-ole
- ruby-openid (~> 2.1.4)
- rubyzip
- sass-rails (~> 3.2.3)
- seems_rateable (~> 1.0.13)
- spreadsheet
- therubyracer
- uglifier (>= 1.0.3)
- wechat!
-
-BUNDLED WITH
- 1.10.6
diff --git a/Gemfile~ b/Gemfile~
deleted file mode 100644
index 24869e72b..000000000
--- a/Gemfile~
+++ /dev/null
@@ -1,112 +0,0 @@
-source 'http://rubygems.org/'
-### ִbundle config mirror.https://rubygems.org https://gems.ruby-china.org лruby-chinaԴ
-
-unless RUBY_PLATFORM =~ /w32/
- # unix-like only
- gem 'iconv'
-end
-
-gem 'certified'
-
-gem 'wechat',path: 'lib/wechat'
-gem 'grack', path:'lib/grack'
-gem 'gitlab', path: 'lib/gitlab-cli'
-gem 'rest-client'
-gem "mysql2", "= 0.3.18"
-gem 'redis-rails'
-gem 'rubyzip'
-gem 'delayed_job_active_record'#, :group => :production
-gem 'daemons'
-gem 'grape', '~> 0.9.0'
-gem 'grape-entity'
-gem 'rack-cors', :require => 'rack/cors'
-gem 'seems_rateable', '~> 1.0.13'
-gem 'rails', '~> 3.2'
-gem "jquery-rails", "~> 2.0.2"
-gem "i18n", "~> 0.6.0"
-gem 'coderay', '~> 1.1.0'
-gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
-gem "builder", "3.0.0"
-gem 'acts-as-taggable-on', '2.4.1'
-gem 'spreadsheet'
-gem 'ruby-ole'
-gem 'rails_kindeditor',path:'lib/rails_kindeditor'
-#gem "rmagick", ">= 2.0.0"
-gem 'binding_of_caller'
-gem 'chinese_pinyin'
-# gem 'sunspot_rails', '~> 1.3.3'
-# gem 'sunspot_solr'
-# gem 'sunspot'
-# gem 'progress_bar'
-gem 'ansi'
-
-gem 'kaminari'
-gem 'elasticsearch-model'
-gem 'elasticsearch-rails'
-
-
-### profile
-#gem 'oneapm_rpm'
-
-group :development do
- gem 'grape-swagger'
- gem 'better_errors', '~> 1.1.0'
- # gem "query_reviewer"
- # gem 'rack-mini-profiler', '~> 0.9.3'
- if RUBY_PLATFORM =~ /w32/
- gem 'win32console'
- end
-end
-
-group :development, :test do
- unless RUBY_PLATFORM =~ /w32/
- gem 'pry-rails'
- if RUBY_VERSION >= '2.0.0'
- gem 'pry-byebug'
- end
- gem 'pry-stack_explorer'
- if RUBY_PLATFORM =~ /darwin/
- gem 'puma'
- end
- end
-
- gem 'rspec-rails', '~> 3.0'
- gem 'factory_girl_rails'
-end
-
-# Gems used only for assets and not required
-# in production environments by default.
-group :assets do
- gem 'sass-rails', '~> 3.2.3'
- gem 'coffee-rails', '~> 3.2.1'
-
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
- gem 'therubyracer', :platforms => :ruby
-
- gem 'uglifier', '>= 1.0.3'
-end
-
-# Optional gem for LDAP authentication
-group :ldap do
- gem "net-ldap", "~> 0.3.1"
-end
-
-
-# Optional gem for OpenID authentication
-group :openid do
- gem "ruby-openid", "~> 2.1.4", :require => "openid"
- gem "rack-openid"
-end
-
-
-database_file = File.join(File.dirname(__FILE__), "config/database.yml")
-if File.exist?(database_file)
-else
- warn("Please configure your config/database.yml first")
-end
-
-# Load plugins' Gemfiles
-Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
- puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
- instance_eval File.read(file)
-end
diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb
index 3ba82bcb9..a90ff323d 100644
--- a/app/api/mobile/entities/activity.rb
+++ b/app/api/mobile/entities/activity.rb
@@ -41,11 +41,11 @@ module Mobile
end
when :description
if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News"
- ac.act.description unless ac.nil? || ac.act.nil?
+ strip_html(ac.act.description) unless ac.nil? || ac.act.nil?
elsif ac.act_type == "Message" || ac.act_type == "BlogComment"
- ac.act.content unless ac.nil? || ac.act.nil?
+ strip_html(ac.act.content) unless ac.nil? || ac.act.nil?
elsif ac.act_type == "JournalsForMessage"
- ac.act.notes unless ac.nil? || ac.act.nil?
+ strip_html(ac.act.notes) unless ac.nil? || ac.act.nil?
end
when :latest_update
time_from_now ac.updated_at unless ac.nil?
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 9da4b90b9..376f8d5c2 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -14,6 +14,7 @@ class HomeworkCommonController < ApplicationController
#unless params[:page]
# update_homework_time(@course.homework_commons)
#end
+ search = "%#{params[:search].to_s.strip.downcase}%"
@new_homework = HomeworkCommon.new
@new_homework.homework_detail_manual = HomeworkDetailManual.new
@new_homework.course = @course
@@ -21,10 +22,10 @@ class HomeworkCommonController < ApplicationController
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @is_teacher
#@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
- @homework_commons = @course.homework_commons.order("created_at desc")
+ @homework_commons = @course.homework_commons.where("name like '%#{search}%'").order("created_at desc")
else
#@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
- @homework_commons = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc")
+ @homework_commons = @course.homework_commons.where("name like '%#{search}%' and publish_time <= '#{Date.today}'").order("created_at desc")
end
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
@is_new = params[:is_new]
diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb
index b012ba901..dd237de17 100644
--- a/app/controllers/org_document_comments_controller.rb
+++ b/app/controllers/org_document_comments_controller.rb
@@ -1,5 +1,6 @@
class OrgDocumentCommentsController < ApplicationController
before_filter :find_organization, :only => [:new, :create, :show, :index]
+ before_filter :authorize_allowed, :only => [:create, :add_reply]
helper :attachments,:organizations
layout 'base_org'
@@ -102,6 +103,13 @@ class OrgDocumentCommentsController < ApplicationController
@organization = Organization.find(params[:organization_id])
end
+ def authorize_allowed
+ unless User.current.logged?
+ redirect_to signin_url
+ return
+ end
+ end
+
def destroy
@org_document_comment = OrgDocumentComment.find(params[:id])
@org_sub_id = @org_document_comment.org_subfield_id
diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb
index 96eeab884..0c665341a 100644
--- a/app/controllers/praise_tread_controller.rb
+++ b/app/controllers/praise_tread_controller.rb
@@ -25,14 +25,14 @@ class PraiseTreadController < ApplicationController
return
end
@horizontal = params[:horizontal].downcase == "false" ? false:true if params[:horizontal]
- if @obj.respond_to?("author_id")
- author_id = @obj.author_id
- elsif @obj.respond_to?("user_id")
- author_id = @obj.user_id
- end
- unless author_id == User.current.id
- praise_tread_plus(@obj_type,@obj_id,1)
- end
+ # if @obj.respond_to?("author_id")
+ # author_id = @obj.author_id
+ # elsif @obj.respond_to?("user_id")
+ # author_id = @obj.user_id
+ # end
+ # unless author_id == User.current.id
+ praise_tread_plus(@obj_type,@obj_id,1)
+ # end
respond_to do |format|
format.js
end
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index f518f81da..dd178a1ce 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -374,7 +374,7 @@ class StudentWorkController < ApplicationController
end
end
##################################################################################################################
- @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group]
+ @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group]
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
@all_homework_commons = @course.homework_commons.order("created_at desc")
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb
index cdf153a20..80c14f004 100644
--- a/app/controllers/sub_document_comments_controller.rb
+++ b/app/controllers/sub_document_comments_controller.rb
@@ -1,6 +1,7 @@
class SubDocumentCommentsController < ApplicationController
before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index, :destroy, :edit]
before_filter :find_subfield_content, :only => [:show, :index]
+ before_filter :authorize_allowed, :only => [:create, :add_reply]
helper :attachments,:organizations
layout 'base_sub_domain'
@@ -207,4 +208,11 @@ class SubDocumentCommentsController < ApplicationController
def find_subfield_content
@subfield_content = @organization.org_subfields.order("priority")
end
+
+ def authorize_allowed
+ unless User.current.logged?
+ redirect_to signin_url
+ return
+ end
+ end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index da1fffde0..52c5f70bc 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -722,21 +722,21 @@ class UsersController < ApplicationController
end
def show_homework_detail
- homework = HomeworkCommon.find params[:homework].to_i
- if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) && User.current != homework.user
- ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework].to_i)
- if ah.empty?
- @status = 2
- @homework = nil
- elsif ah.first.status != 2
- @status = ah.first.status
- @homework = nil
- elsif ah.first.status == 2
- @homework = homework
- end
- else
- @homework = homework
- end
+ @homework = HomeworkCommon.find params[:homework].to_i
+ # if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) && User.current != homework.user
+ # ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework].to_i)
+ # if ah.empty?
+ # @status = 2
+ # @homework = nil
+ # elsif ah.first.status != 2
+ # @status = ah.first.status
+ # @homework = nil
+ # elsif ah.first.status == 2
+ # @homework = homework
+ # end
+ # else
+ # @homework = homework
+ # end
@is_import = params[:is_import]
respond_to do |format|
format.js
@@ -1090,22 +1090,27 @@ class UsersController < ApplicationController
#引入资源列表根据关键词过滤
def user_ref_resource_search
- search = params[:search].to_s.strip.downcase
- if(params[:type].blank? || params[:type] == "1") #全部
- user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
- @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
- " or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like '%#{search}%') ").order("created_on desc")
- elsif params[:type] == "2" #课程资源
+ if User.current.id.to_i != params[:id].to_i
+ render_403
+ return
+ end
+ @resource_id = params[:mul_id]
+ @resource_type = params[:mul_type]
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
+ @user = User.current
+ @switch_search = params[:search].nil? ? " " : params[:search]
+ search = "%#{@switch_search.strip.downcase}%"
+ # 别人的资源库是没有权限去看的
+ if(params[:type] == "1") # 我的资源
+ # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
- @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) and (filename like '%#{search}%') ").order("created_on desc")
- elsif params[:type] == "3" #项目资源
- @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc")
- elsif params[:type] == "4" #附件
- @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc")
- elsif params[:type] == "5" #用户资源
- @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc")
- elsif params[:type] == "6" #公共资源
- @attachments = Attachment.where("(is_public =1 and is_publish = 1 and container_id is not null)" + "or (author_id = #{params[:id]} and is_publish = 0)").order("created_on desc")
+ user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
+ # user_org_ids = User.current.organizations.map {|o| o.id}
+ @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search)
+ elsif (params[:type].blank? || params[:type] == "6") # 公共资源
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
end
@type = params[:type]
@limit = 7
@@ -1977,7 +1982,7 @@ class UsersController < ApplicationController
end
end
elsif params[:send_ids].present?
- send_ids = params[:send_ids].split(" ")
+ send_ids = params[:send_ids].split(",")
course_ids = params[:course_ids]
if course_ids.nil?
@flag = false
@@ -2095,7 +2100,8 @@ class UsersController < ApplicationController
project_ids.each do |project_id|
next if ori.blank?
@exist = false
- Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
+ # 如果对象中包含该资源
+ Project.find(project_id).attachments.each do |att|
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@@ -2128,7 +2134,7 @@ class UsersController < ApplicationController
@ori = ori
end
elsif params[:send_ids].present?
- send_ids = params[:send_ids].split(" ")
+ send_ids = params[:send_ids].split(",")
project_ids = params[:projects_ids]
if project_ids.nil?
@flag = false
@@ -2275,7 +2281,7 @@ class UsersController < ApplicationController
end
@ori = ori
elsif params[:send_ids].present?
- send_ids = params[:send_ids].split(" ")
+ send_ids = params[:send_ids].split(",")
subfield_id = params[:subfield]
if subfield_id.nil?
@flag = false
@@ -3116,6 +3122,7 @@ class UsersController < ApplicationController
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
end
end
+ @type = params[:type]
@search = params[:search]
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb
index 7ee0552fb..a37b5aaa2 100644
--- a/app/controllers/wechats_controller.rb
+++ b/app/controllers/wechats_controller.rb
@@ -139,98 +139,127 @@ class WechatsController < ActionController::Base
end
def sendBind(request)
- news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "您还未绑定确实的用户,请先绑定." } }
+ news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "欢迎使用Trustie创新实践服务平台!
+在这里您可以随时了解您的课程和项目动态,随时点赞和回复。
+我们将会与微信不断结合,为您提供更有价值的服务。
+
+您还未绑定确实的用户,请先绑定,谢谢!" } }
request.reply.news(news) do |article, n, index| # article is return object
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{login_wechat_url}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
+ pic_url = "#{Setting.protocol}://#{Setting.host_name}/images/weixin_pic.jpg"
article.item title: "#{n[:title]}",
description: n[:content],
- pic_url: 'https://www.trustie.net/images/trustie_logo2.png',
+ pic_url: pic_url,
url: url
end
end
- def get_open_id
- begin
- raise "非法操作, code不存在" unless params[:code]
- openid = get_openid_from_code(params[:code])
- raise "无法获取到openid" unless openid
- render :json => {status:0, openid: openid}
- rescue Exception=>e
- render :json => {status: -1, msg: e.message}
- end
- end
- def bind
- begin
- raise "非法操作, code不存在" unless params[:code]
- openid = get_openid_from_code(params[:code])
- raise "无法获取到openid" unless openid
- raise "此微信号已绑定用户, 不能重复绑定" if user_binded?(openid)
- user, last_login_on = User.try_to_login(params[:username], params[:password])
- raise "用户名或密码错误,请重新登录" unless user
- #补全用户信息
+ ### controller method
+
- raise "此用户已经绑定了公众号" if user.user_wechat
+ module Controllers
+ def get_open_id
+ begin
- UserWechat.create!(
- openid: openid,
- user: user
- )
- render :json => {status:0, msg: "绑定成功"}
- rescue Exception=>e
- render :json => {status: -1, msg: e.message}
+ code = params[:code] || session[:wechat_code]
+ openid = get_openid_from_code(code)
+
+
+ raise "无法获取到微信openid" unless openid
+ render :json => {status:0, openid: openid}
+ rescue Exception=>e
+ render :json => {status: -1, msg: e.message}
+ end
end
- end
- def login
- @code = params[:code] #TODO 安全性
- render 'wechats/login', layout: 'base_wechat'
- end
+ def bind
+ begin
- private
- def get_openid_from_code(code)
- url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=#{Wechat.config.appid}&secret=#{Wechat.config.secret}&code=#{code}&grant_type=authorization_code"
- logger.debug url
- body = URI.parse(url).read
- logger.debug body
- JSON.parse(body)["openid"]
- end
+ code = params[:code] || session[:wechat_code]
+ openid = get_openid_from_code(code)
- def user_binded?(openid)
- uw = UserWechat.where(openid: openid).first
- end
+ raise "无法获取到openid" unless openid
+ raise "此微信号已绑定用户, 不能重复绑定" if user_binded?(openid)
- def user_activity(user)
- @user = user
- shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
- shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
- @page = params[:page] ? params[:page].to_i + 1 : 0
- user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
- user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
- course_types = "('Message','News','HomeworkCommon','Poll','Course')"
- project_types = "('Message','Issue','Project')"
- principal_types = "JournalsForMessage"
+ user, last_login_on = User.try_to_login(params[:username], params[:password])
+ raise "用户名或密码错误,请重新登录" unless user
+ #补全用户信息
- blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
- @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
- "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
- "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
- "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
+ raise "此用户已经绑定过公众号, 请换一个帐户试试" if user.user_wechat
+ UserWechat.create!(
+ openid: openid,
+ user: user
+ )
+ render :json => {status:0, msg: "绑定成功"}
+ rescue Exception=>e
+ render :json => {status: -1, msg: e.message}
+ end
+ end
- end
+ def login
+ session[:wechat_code] = params[:code] if params[:code]
+ render 'wechats/login', layout: 'base_wechat'
+ end
+
+ private
+ def get_openid_from_code(code)
+ openid = session[:wechat_openid]
- def process_activity(user_activity)
- act= user_activity.act
- case user_activity.container_type.to_s
- when 'Course'
- when 'Project'
- case user_activity.act_type.to_s
- when 'Issue'
- [act.project.name.to_s+" | 项目问题", act.subject.to_s, url_to_avatar(act.author),"http://wechat.trustie.net/app.html#/issue/#{act.id}"]
+ unless openid
+ if code
+ openid = wechat.web_access_token(code)["openid"]
end
+ end
+
+ if openid
+ session[:wechat_openid] = openid
+ end
+
+ return openid
+ end
+
+ def user_binded?(openid)
+ uw = UserWechat.where(openid: openid).first
+ end
+
+ def user_activity(user)
+ @user = user
+ shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
+ shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
+ @page = params[:page] ? params[:page].to_i + 1 : 0
+ user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
+ user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
+ course_types = "('Message','News','HomeworkCommon','Poll','Course')"
+ project_types = "('Message','Issue','Project')"
+ principal_types = "JournalsForMessage"
+
+ blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
+ @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
+ "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
+ "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
+ "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
+
+
+ end
+
+ def process_activity(user_activity)
+ act= user_activity.act
+ case user_activity.container_type.to_s
+ when 'Course'
+ when 'Project'
+ case user_activity.act_type.to_s
+ when 'Issue'
+ [act.project.name.to_s+" | 项目问题", act.subject.to_s, url_to_avatar(act.author),"http://wechat.trustie.net/app.html#/issue/#{act.id}"]
+ end
+ end
end
end
+
+
+ include Controllers
+
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ce6d2259c..a2285a678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2097,12 +2097,12 @@ module ApplicationHelper
def attachment_history_candown attachment_history
if attachment_history.container_type == "Course"
course = Course.find(attachment_history.container_id)
- candown = User.current.member_of?(course) || (course.is_public && attachment_history.is_public == 1)
+ candown = User.current.member_of_course?(course) || (course.is_public && attachment_history.is_public == 1)
elsif attachment_history.container_type == "Project"
project = Project.find(attachment_history.container_id)
candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1)
elsif attachment_history.container_type == "OrgSubfield"
- org = OrgSubfield.find(attachment_history.container_id)
+ org = OrgSubfield.find(attachment_history.container_id).organization
candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1 && (User.current.logged? || org.organization.allow_guest_download?))
end
end
diff --git a/app/models/message.rb b/app/models/message.rb
index fdc3c6bdc..cf9adab4e 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -83,7 +83,7 @@ class Message < ActiveRecord::Base
# after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
after_update :update_messages_board, :update_activity
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score
- after_create :act_as_course_activity, :act_as_forge_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count, :act_as_system_message
+ after_create :act_as_course_activity, :act_as_forge_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count, :act_as_system_message, :delay_message_send
#before_save :be_user_score
scope :visible, lambda {|*args|
@@ -308,6 +308,22 @@ class Message < ActiveRecord::Base
end
end
+ def delay_message_send
+ if self.course
+ if self.parent_id.nil? # 发帖
+ self.delay.contain_messages_message
+ end
+ end
+ end
+
+ def contain_messages_message
+ self.course.members.includes(:user).each do |m|
+ if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
+ self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
+ end
+ end
+ end
+
#更新用户分数 -by zjc
def be_user_score
#新建message且无parent的为发帖
diff --git a/app/models/news.rb b/app/models/news.rb
index 877d799bf..0b03dcc48 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -62,7 +62,7 @@ class News < ActiveRecord::Base
:author_key => :author_id
acts_as_watchable
- after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message
+ after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :delay_news_send
after_update :update_activity
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
@@ -169,7 +169,7 @@ class News < ActiveRecord::Base
if self.course
self.course.members.each do |m|
if m.user_id != self.author_id
- # self.delay.send_message(m.user_id, self.course_id)
+ #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
@@ -189,9 +189,19 @@ class News < ActiveRecord::Base
end
end
- # def send_message user_id, course_id
- # self.course_messages << CourseMessage.new(:user_id => user_id, :course_id => course_id, :viewed => false)
- # end
+ def delay_news_send
+ if self.course
+ self.delay.contain_news_message
+ end
+ end
+
+ def contain_news_message
+ self.course.members.each do |m|
+ if m.user_id != self.author_id
+ self.course_messages << CourseMessage.new(:user_id => user_id, :course_id => container_id, :viewed => false)
+ end
+ end
+ end
# Time 2015-03-31 13:50:54
# Author lizanle
diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb
index a5bb6672b..ff704a869 100644
--- a/app/views/attachments/attachment_versions.js.erb
+++ b/app/views/attachments/attachment_versions.js.erb
@@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before(" ");
-$('#ajax-modal').parent().css("top","40%").css("left","50%");
+$('#ajax-modal').parent().css("top","40%").css("left","50%").css("position","fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb
index d3763abf3..9617b7f76 100644
--- a/app/views/blog_comments/show.html.erb
+++ b/app/views/blog_comments/show.html.erb
@@ -122,11 +122,7 @@
回复
<%= count>0 ? "(#{count})" : "" %> ▪
- <% if @article.author == User.current %>
- 赞 <%= get_praise_num(@article) > 0 ? "(#{get_praise_num(@article)})" : "" %>
- <% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%>
- <% end %>
@@ -162,12 +158,8 @@
<%= format_time(reply.created_on) %>
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+
diff --git a/app/views/exercise/_student_exercise_archive.html.erb b/app/views/exercise/_student_exercise_archive.html.erb
index abc604b73..3afac2dc2 100644
--- a/app/views/exercise/_student_exercise_archive.html.erb
+++ b/app/views/exercise/_student_exercise_archive.html.erb
@@ -17,7 +17,7 @@
-->
<%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<%# end%>
- [ 显示测验信息 ]
+ [ 显示测验信息 ]
diff --git a/app/views/exercise/_student_table.html.erb b/app/views/exercise/_student_table.html.erb
index 3022b83a6..cbb56025e 100644
--- a/app/views/exercise/_student_table.html.erb
+++ b/app/views/exercise/_student_table.html.erb
@@ -15,46 +15,23 @@
- <% @exercise_users_list.each do |exercise|%>
-
-
+ <% @exercise_users_list.each_with_index do |exercise, index|%>
- 1
+ <%=index + 1 %>
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %>
-
+
<%=exercise.user.show_name %>
-
+
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
-
+
--
-
+
<% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
<% if @exercise.end_time <= exercise.created_at %>
@@ -67,5 +44,29 @@
- <% end%>
+
+
+
+<% end%>
\ No newline at end of file
diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb
index c96f8156a..02f161589 100644
--- a/app/views/exercise/student_exercise_list.html.erb
+++ b/app/views/exercise/student_exercise_list.html.erb
@@ -5,8 +5,14 @@
$("#Container").css("width","1000px");
});
+ function show_or_hide_info(){
+ $("#homeworkInformation").toggle();
+ $("#homework_info_hidden").toggle();
+ $("#homework_info_show").toggle();
+ }
+
$(function(){
- $("#homework_info_hidden").click(function(){
+ /*$("#homework_info_hidden").click(function(){
$("#homeworkInformation").hide();
$("#homework_info_hidden").hide();
$("#homework_info_show").show();
@@ -15,7 +21,7 @@
$("#homework_info_show").hide();
$("#homeworkInformation").show();
$("#homework_info_hidden").show();
- });
+ });*/
if($("#homework_description").height() > 54) {
$("#homeworkDetailShow").show();
@@ -88,7 +94,7 @@
<% elsif @exercise.exercise_status == 3 %>
已截止
<% end%>
- [ 隐藏测验信息 ]
+ [ 隐藏测验信息 ]
发布者:<%= @exercise.user.show_name %>
diff --git a/app/views/homework_common/_homework_index_list.html.erb b/app/views/homework_common/_homework_index_list.html.erb
new file mode 100644
index 000000000..9b11017e8
--- /dev/null
+++ b/app/views/homework_common/_homework_index_list.html.erb
@@ -0,0 +1,8 @@
+<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => homework_commons,:page => 0,:is_in_course => 1,:course_id => course_id} %>
+
+
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
+
+
\ No newline at end of file
diff --git a/app/views/homework_common/_homework_search_form.html.erb b/app/views/homework_common/_homework_search_form.html.erb
index f71cec9a5..250d72467 100644
--- a/app/views/homework_common/_homework_search_form.html.erb
+++ b/app/views/homework_common/_homework_search_form.html.erb
@@ -1,4 +1,4 @@
-<%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id),
+<%= form_tag( homework_common_index_url_in_org(course.id),
:remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %>
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index 29cff8933..35f4658f9 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -71,13 +71,8 @@
<% end%>
<% end%>
- <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %>
-
-
-
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
-
-
+
+ <%= render :partial => 'homework_common/homework_index_list', :locals => {:homework_commons => @homeworks,:course_id => @course.id} %>
diff --git a/app/views/homework_common/index.js.erb b/app/views/homework_common/index.js.erb
index 7a038eb5c..4a9ec6ad3 100644
--- a/app/views/homework_common/index.js.erb
+++ b/app/views/homework_common/index.js.erb
@@ -1 +1,4 @@
-$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id} )%>");
\ No newline at end of file
+/*
+$("#user_show_more_homework").replaceWith("<%#= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id} )%>");*/
+
+$("#homework_index_list").html("<%=escape_javascript(render :partial => 'homework_common/homework_index_list', :locals => {:homework_commons => @homeworks,:course_id => @course.id}) %>");
diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb
index 30f527595..c04c2effb 100644
--- a/app/views/layouts/_project_info.html.erb
+++ b/app/views/layouts/_project_info.html.erb
@@ -20,9 +20,9 @@
-
+
-
+
<%= @course.name %>
diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb
index 443440455..746881bdc 100644
--- a/app/views/messages/_course_show.html.erb
+++ b/app/views/messages/_course_show.html.erb
@@ -95,11 +95,7 @@
回复
<%= @reply_count>0 ? "(#{@reply_count})" : "" %> ▪
- <% if @topic.author == User.current %>
- 赞 <%= get_praise_num(@topic) > 0 ? "(#{get_praise_num(@topic)})" : "" %>
- <% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@topic, :user_activity_id=>@topic.id,:type=>"activity"}%>
- <% end %>
@@ -131,11 +127,7 @@
<%= format_time(reply.created_on) %>
@@ -187,11 +183,7 @@
<%= format_time(reply.created_on) %>
@@ -137,11 +133,7 @@
<%= format_time(reply.created_on) %>
@@ -100,11 +96,7 @@
<%= format_time(reply.created_at) %>
- <% if reply.creator_id.to_i == User.current.id.to_i %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
<%if count>3 %>
@@ -359,11 +355,7 @@
<%= link_to(
diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb
index e68745f7a..03e986716 100644
--- a/app/views/organizations/_org_course_message.html.erb
+++ b/app/views/organizations/_org_course_message.html.erb
@@ -74,11 +74,7 @@
回复
<%= count>0 ? "(#{count})" : "" %> ▪
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<%#=format_date(activity.updated_on)%>
@@ -117,11 +113,7 @@
<% end %>
<%= format_time(reply.created_on) %>
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb
index acf0f0377..8c260c21c 100644
--- a/app/views/organizations/_org_course_news.html.erb
+++ b/app/views/organizations/_org_course_news.html.erb
@@ -44,12 +44,8 @@
回复
<%= count>0 ? "(#{count})" : "" %> ▪
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+
<%#= format_date(activity.updated_on) %>
<%if count>3 %>
@@ -86,11 +82,7 @@
<% end %>
<%= format_time(comment.created_on) %>
diff --git a/app/views/organizations/_org_subfield_leftMD.html.erb b/app/views/organizations/_org_subfield_leftMD.html.erb
index d0439439a..afa7d0716 100644
--- a/app/views/organizations/_org_subfield_leftMD.html.erb
+++ b/app/views/organizations/_org_subfield_leftMD.html.erb
@@ -28,7 +28,7 @@
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "resources-title sn-hidden" %>
- <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28} %>
+ <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to activity.description.to_s.html_safe, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
<%#= link_to "更多", student_work_index_url_in_org(activity.id), :class => "more-btn", :target => "_blank" %>
@@ -50,7 +50,7 @@
<% end %>
- <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.content, :maxheight=>54, :maxwordsnum => 28} %>
+ <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.content, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to activity.content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %>
@@ -67,7 +67,7 @@
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "resources-title sn-hidden" %>
- <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28} %>
+ <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
<%#= link_to "更多", news_url_in_org(activity.id), :class => "more-btn", :target => "_blank" %>
@@ -130,7 +130,7 @@
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "resources-title sn-hidden" %>
- <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28} %>
+ <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to activity.description.to_s.html_safe, issue_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
@@ -151,7 +151,7 @@
<% end %>
- <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.content, :maxheight=>54, :maxwordsnum => 28} %>
+ <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.content, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to activity.content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %>
@@ -168,7 +168,7 @@
<%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-title sn-hidden" %>
- <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28} %>
+ <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => activity.id, :content=> activity.description, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to activity.content.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
<%#= link_to "更多", news_url_in_org(activity.id), :class => "more-btn", :target => "_blank" %>
@@ -214,7 +214,7 @@
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "resources-title sn-hidden" %>
- <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => document.id, :content=> document.content, :maxheight=>54, :maxwordsnum => 28} %>
+ <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => document.id, :content=> document.content, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to document.content.to_s.html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "resources-tag" %>
<%#= link_to "更多", org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :class => "more-btn", :target => "_blank" %>
@@ -244,7 +244,7 @@
<% end %>
- <%= render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => message.id, :content=> content, :maxheight=>54, :maxwordsnum => 28} %>
+ <%= render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => message.id, :content=> content, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %>
<%#= link_to "更多", board_message_url_in_org(message.board.id,message.id), :class => "more-btn", :target => "_blank" %>
@@ -264,7 +264,7 @@
<% end %>
- <%= render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => message.id, :content=> content, :maxheight=>54, :maxwordsnum => 28} %>
+ <%= render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => message.id, :content=> content, :maxheight=>54, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to content.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "resources-tag" %>
<%#= link_to "更多", board_message_path(message.board,activity), :class => "more-btn", :target => "_blank" %>
@@ -285,7 +285,7 @@
<%#= link_to news.description.to_s.html_safe, news_path(news), :target => '_blank', :class => "resources-tag" %>
- <%= render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => news.id, :content=> news.description, :maxheight=>54, :maxwordsnum => 28, :maxwordsnum => 28} %>
+ <%= render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id => news.id, :content=> news.description, :maxheight=>54, :maxwordsnum => 28, :maxwordsnum => 28, :maxwidth=>0} %>
<%#= link_to "更多", news_path(news), :class => "more-btn", :target => "_blank" %>
diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb
index 61bc5bc7f..bcc43610e 100644
--- a/app/views/organizations/_org_subfield_message.html.erb
+++ b/app/views/organizations/_org_subfield_message.html.erb
@@ -84,11 +84,7 @@
回复
<%= count>0 ? "(#{count})" : "" %> ▪
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<%if count>3 %>
@@ -122,11 +118,7 @@
<% end %>
<%= format_time(reply.created_on) %>
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb
index 5d6c38542..662a965e9 100644
--- a/app/views/organizations/_org_subfield_news.html.erb
+++ b/app/views/organizations/_org_subfield_news.html.erb
@@ -64,11 +64,7 @@
回复
<%= count>0 ? "(#{count})" : "" %> ▪
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<%#= format_date(activity.updated_on) %>
@@ -106,11 +102,7 @@
<% end %>
<%= format_time(comment.created_on) %>
diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb
index e8f531206..3042ca9ae 100644
--- a/app/views/organizations/_show_org_document.html.erb
+++ b/app/views/organizations/_show_org_document.html.erb
@@ -69,11 +69,7 @@
回复
<%= count>0 ? "(#{count})" : "" %> ▪
- <% if document.creator_id.to_i == User.current.id.to_i %>
- 赞 <%= get_praise_num(document) > 0 ? "(#{get_praise_num(document)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>document, :user_activity_id=>document.id,:type=>"activity"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>document, :user_activity_id=>document.id,:type=>"activity"}%>
<% if count > 3 %>
@@ -102,11 +98,7 @@
<%= link_to User.find(comment.creator_id), user_url_in_org(comment.creator_id), :class => "newsBlue mr10 f14" %>
<%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %>
<% unless comment.content.blank? %>
diff --git a/app/views/projects/_history.html.erb b/app/views/projects/_history.html.erb
index b31445fdc..4f7fb7f4a 100644
--- a/app/views/projects/_history.html.erb
+++ b/app/views/projects/_history.html.erb
@@ -10,10 +10,15 @@
<%= format_time(journal.created_on) %>
- <%=journal.notes.html_safe%>
+
+
<%=journal.notes.html_safe%>
+
<% ids = 'project_respond_form_'+ journal.id.to_s%>
@@ -42,6 +46,12 @@
+
<% end %>
<% end %>
diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb
index 6d97b252d..7baf93e4f 100644
--- a/app/views/projects/_project_news.html.erb
+++ b/app/views/projects/_project_news.html.erb
@@ -44,11 +44,7 @@
回复
<%= count>0 ? "(#{count})" : "" %> ▪
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<%#= format_date(activity.updated_on) %>
@@ -86,11 +82,7 @@
<% end %>
<%= format_time(comment.created_on) %>