Merge branch 'develop' into yuanke

This commit is contained in:
yuanke 2016-05-27 15:37:11 +08:00
commit 5b7011e07b
128 changed files with 1193 additions and 1604 deletions

2
.gitignore vendored
View File

@ -30,4 +30,6 @@ vendor/cache
/public/files
/tags
/config/initializers/gitlab_config.rb
/config/wechat.yml
/config/menu.yml
1234567

View File

@ -1,25 +0,0 @@
<html>
<head>
<title>
Client
</title>
</head>
<body>
<hr />
<h2>这是一张图片</h2>
<p>photo<a href="http://10.0.47.15:3000/shares/new?access_token='2d3dda45dsd'&comment='verygood'&title=davide&share_type=1&url=http://www.baidu.com"> Share A </a></p>
<hr />
<h2>这是一段视频</h2>
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=kaka&share_type=2&url=http://www.sina.com"> Share B </a></p>
<hr />
<h2>这是一篇文章</h2>
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=pepe&share_type=3&url=http://www.sina.com"> Share C </a></p>
<hr />
</body>
</html>

View File

@ -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

112
Gemfile~
View File

@ -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

View File

@ -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?

View File

@ -363,7 +363,11 @@ class ApplicationController < ActionController::Base
when "contest"
return true
when "Course"
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
if @attachment.get_status_by_attach(User.current.id) == 2
return true
else
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
end
else
return true
end

View File

@ -341,7 +341,7 @@ class CoursesController < ApplicationController
def export_course_member_excel
@all_members = student_homework_score(0,0,0,"desc")
@homeworks = @course.homework_commons.order("created_at asc")
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at asc")
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
respond_to do |format|

View File

@ -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]

View File

@ -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'
@ -101,6 +102,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

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -320,7 +320,7 @@ class UsersController < ApplicationController
case params[:agree]
when 'Y'
ar.update_column('status', 2)
@msg.update_attributes(:apply_result => 1, :viewed => 1)
@msg.update_attributes(:apply_result => 1, :viewed => 1)
ar.course_messages << CourseMessage.new(:user_id => ar.user_id, :course_id => -1, :viewed => false, :apply_result => 2, :status => 1)
when 'N'
ar.update_column('status', 3)
@ -539,28 +539,28 @@ class UsersController < ApplicationController
end
def student_homeworks
if User.current == @user
@page = params[:page] ? params[:page].to_i + 1 : 0
user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
if User.current == @user
@page = params[:page] ? params[:page].to_i + 1 : 0
user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
#判断当前用户在当前课程的身份
visibleCourse = @user.courses.empty? ? [] : @user.courses.where("is_delete = 0").visible
homework_ids = []
visibleCourse.each do |course|
homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'")
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
end
visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")"
@homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10)
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
@is_in_course = params[:is_in_course].to_i || 0
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
else
render_403
#判断当前用户在当前课程的身份
visibleCourse = @user.courses.empty? ? [] : @user.courses.where("is_delete = 0").visible
homework_ids = []
visibleCourse.each do |course|
homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'")
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
end
visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")"
@homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10)
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
@is_in_course = params[:is_in_course].to_i || 0
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
else
render_403
end
end
def choose_user_course
@ -727,21 +727,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
@ -1095,22 +1095,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
@ -1982,7 +1987,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
@ -2058,18 +2063,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2"
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
# elsif params[:type] == "2"
# apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
# if params[:status] == "2"
# resource_type = "'Course'"
# elsif params[:status] == "3"
# resource_type = "'Project'"
# elsif params[:status] == "5"
# resource_type = "'Principal'"
# else
# resource_type = "'Project','OrgSubfield','Principal','Course'"
# end
# @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@type = params[:type]
@limit = 25
@ -2100,7 +2105,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
@ -2133,7 +2139,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
@ -2211,18 +2217,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2"
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
# elsif params[:type] == "2"
# apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
# if params[:status] == "2"
# resource_type = "'Course'"
# elsif params[:status] == "3"
# resource_type = "'Project'"
# elsif params[:status] == "5"
# resource_type = "'Principal'"
# else
# resource_type = "'Project','OrgSubfield','Principal','Course'"
# end
# @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@status = params[:status]
@type = params[:type]
@ -2280,7 +2286,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
@ -2352,18 +2358,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2"
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
# elsif params[:type] == "2"
# apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
# if params[:status] == "2"
# resource_type = "'Course'"
# elsif params[:status] == "3"
# resource_type = "'Project'"
# elsif params[:status] == "5"
# resource_type = "'Principal'"
# else
# resource_type = "'Project','OrgSubfield','Principal','Course'"
# end
# @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@type = params[:type]
@limit = 25
@ -2700,7 +2706,7 @@ class UsersController < ApplicationController
# 获取公共资源
def get_public_resources user_course_ids, user_project_ids, order, score
attachments = Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil? ? 'created_on' : order} #{score}")
attachments = Attachment.where("(is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源搜索
@ -2725,19 +2731,19 @@ class UsersController < ApplicationController
# 获取我的课程资源
def get_course_resources author_id, user_course_ids, order, score
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的私有资源分享结果
def get_my_private_resources apply_ids, resource_type, order, score
attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的私有资源分享搜索结果
def get_my_private_resources_search apply_ids, resource_type, order, score, search
attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type}) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# # 获取我的私有资源分享结果
# def get_my_private_resources apply_ids, resource_type, order, score
# attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil? ? 'created_on' : order} #{score}")
# end
#
# # 获取我的私有资源分享搜索结果
# def get_my_private_resources_search apply_ids, resource_type, order, score, search
# attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type}) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
# end
# 获取我的课程资源中搜索结果
def get_course_resources_search author_id, user_course_ids, order, score, search
@ -2748,18 +2754,18 @@ class UsersController < ApplicationController
# 获取公共资源中课程资源
def get_course_resources_public user_course_ids, order, score
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1)").order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中课程资源搜索结果
def get_course_resources_public_search user_course_ids, order, score, search
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的项目资源
def get_project_resources author_id, user_project_ids, order, score
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}")
end
@ -2772,12 +2778,12 @@ class UsersController < ApplicationController
# 获取公共资源的项目资源
def get_project_resources_public user_project_ids, order, score
attchments = Attachment.where("container_type = 'Project' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源的项目资源搜索
def get_project_resources_public_search user_project_ids, order, score, search
attchments = Attachment.where("(container_type = 'Project' and container_id is not null) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Project' and container_id is not null and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我上传的附件
@ -2795,13 +2801,13 @@ class UsersController < ApplicationController
# 获取公共资源中我上传的附件
def get_attch_resources_public order, score
attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')
and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中我上传的附件
def get_attch_resources_public_search order, score, search
attchments = Attachment.where("(container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')
and container_id is not null) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
@ -2816,12 +2822,12 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
def get_principal_resources_public order, score
attchments = Attachment.where("container_type = 'Principal' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("container_type = 'Principal' and is_public =1 and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
def get_principal_resources_public_search order, score, search
attchments = Attachment.where("(container_type = 'Principal'and container_id is not null) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Principal'and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 资源库 分为全部 课程资源 项目资源 附件
@ -2863,18 +2869,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2" # 私有资源
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
# elsif params[:type] == "2" # 私有资源
# apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
# if params[:status] == "2"
# resource_type = "'Course'"
# elsif params[:status] == "3"
# resource_type = "'Project'"
# elsif params[:status] == "5"
# resource_type = "'Principal'"
# else
# resource_type = "'Project','OrgSubfield','Principal','Course'"
# end
# @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@status = params[:status]
@type = params[:type]
@ -3052,21 +3058,21 @@ class UsersController < ApplicationController
@attachments = get_principal_resources_public_search(@order, @score, search)
else
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
@attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
end
elsif params[:type] == "2" # 私有资源
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources_search(apply_ids, resource_type, @order, @score, search)
@attachments
# elsif params[:type] == "2" # 私有资源
# apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
# if params[:status] == "2"
# resource_type = "'Course'"
# elsif params[:status] == "3"
# resource_type = "'Project'"
# elsif params[:status] == "5"
# resource_type = "'Principal'"
# else
# resource_type = "'Project','OrgSubfield','Principal','Course'"
# end
# @attachments = get_my_private_resources_search(apply_ids, resource_type, @order, @score, search)
# @attachments
end
@status = params[:status]
@type = params[:type]
@ -3121,6 +3127,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]

View File

@ -139,99 +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}
### controller method
module Controllers
def get_open_id
begin
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 bind
begin
raise "非法操作, code不存在" unless params[:code]
openid = get_openid_from_code(params[:code])
raise "无法获取到openid" unless openid
raise "此微信号已绑定用户, 不能重复绑定" if user_binded?(openid)
def bind
begin
user, last_login_on = User.try_to_login(params[:username], params[:password])
raise "用户名或密码错误,请重新登录" unless user
#补全用户信息
code = params[:code] || session[:wechat_code]
openid = get_openid_from_code(code)
raise "此用户已经绑定了公众号" if user.user_wechat
raise "无法获取到openid" unless openid
raise "此微信号已绑定用户, 不能重复绑定" if user_binded?(openid)
UserWechat.create!(
openid: openid,
user: user
)
request.reply.text "欢迎加入Trustie创新实践社区"
render :json => {status:0, msg: "绑定成功"}
rescue Exception=>e
render :json => {status: -1, msg: e.message}
user, last_login_on = User.try_to_login(params[:username], params[:password])
raise "用户名或密码错误,请重新登录" unless user
#补全用户信息
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
@code = params[:code] #TODO 安全性
render 'wechats/login', layout: 'base_wechat'
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)
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
private
def get_openid_from_code(code)
openid = session[:wechat_openid]
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}"]
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

View File

@ -58,12 +58,21 @@ module ApplicationHelper
when "Course"
User.current.member_of_course?(attachment.container) ? true : false
when "OrgSubfield"
User.current.member_of_org?(attachment.container) ? true : false
User.current.member_of_org?(attachment.container.organization) ? true : false
when "Principal"
User.current.id == attachment.author_id ? true : false
end
end
# 判断某个私有资源是否可以发送下载权限
# 结果为true不能下载false可以下载
def private_attachment_allow attachment_id
attach = Attachment.find(attachment_id)
# 条件取否result结果为true则不能下载
result = attach.is_public == 0 && attach.author != User.current && !attach.get_apply_resource_status(attach.id, User.current.id) && !attach_show_allow(attach)
return result
end
# Time 2015-03-24 15:27:29
# Author lizanle
# Description 从硬盘上删除对应的资源文件
@ -2089,12 +2098,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
@ -2109,20 +2118,20 @@ module ApplicationHelper
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
elsif attachment.container.is_a?(Project)
project = attachment.container
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
candown = User.current.member_of?(project) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
attachment.container.board.project
project = attachment.container.board.project
candown = User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
elsif (attachment.container.has_attribute?(:course) ||attachment.container.has_attribute?(:course_id) ) && attachment.container.course
course = attachment.container.course
candown = User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
candown = User.current.member_of_course?(course) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
elsif attachment.container.is_a?(Course)
course = attachment.container
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
candown= User.current.member_of_course?(course) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
elsif attachment.container.is_a?(OrgSubfield)
org = attachment.container.organization
candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1)
candown = User.current.member_of_org?(org) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
elsif attachment.container.is_a?(OrgDocumentComment)
org = attachment.container.organization
candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1)

View File

@ -142,7 +142,8 @@ class Attachment < ActiveRecord::Base
end
def get_apply_resource_status attachment_id, author_id
ApplyResource.where("attachment_id =? and apply_user_id =?", attachment_id, author_id).first.try(:status)
status = ApplyResource.where("attachment_id =? and user_id =?", attachment_id, author_id).first.try(:status)
status == 2 ? true :false
end
# add by nwb

View File

@ -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的为发帖

View File

@ -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
@ -163,8 +163,8 @@ class News < ActiveRecord::Base
end
end
#课程/项目通知 消息发送
#消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒
# 课程/项目通知 消息发送
# 消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒
def act_as_system_message
if self.course
self.course.members.each do |m|
@ -174,7 +174,7 @@ class News < ActiveRecord::Base
if count == 0
ws = WechatService.new
content = strip_html self.author.try(:realname) + " 发布了通知:" + self.title.html_safe, 200
ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.author.try(:realname) + " 发布了通知:" + content, format_time(self.created_on)
ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", content, format_time(self.created_on)
end
end
end
@ -189,6 +189,20 @@ class News < ActiveRecord::Base
end
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
# Description 删除news后删除对应的资源

View File

@ -5,7 +5,7 @@ class WechatService
data = {
touser:openid,
template_id:template_id,
url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect",
url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect",
topcolor:"#FF0000",
data:{
first: {
@ -44,7 +44,6 @@ class WechatService
end
Rails.logger.info "send over. #{req}"
end
Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
end
def topic_publish_template(user_id, type, id, first, key1, key2, key3, remark="")
@ -59,7 +58,6 @@ class WechatService
end
Rails.logger.info "send over. #{req}"
end
Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
end
def comment_template(user_id,type, id, first, key1, key2, key3, remark="")
@ -74,7 +72,6 @@ class WechatService
end
Rails.logger.info "send over. #{req}"
end
Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
end
def message_update_template(user_id, type, id, first, key1, key2, remark="")
@ -83,7 +80,7 @@ class WechatService
data = {
touser:uw.openid,
template_id:"YTyNPZnQD8uZFBFq-Q6cCOWaq5LA9vL6RFlF2JuD5Cg",
url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect",
url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect",
topcolor:"#FF0000",
data:{
first: {
@ -112,6 +109,5 @@ class WechatService
end
Rails.logger.info "send over. #{req}"
end
Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
end
end

View File

@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#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");

View File

@ -122,11 +122,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@article.id %>">
<% if @article.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@article) > 0 ? "#{get_praise_num(@article)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%>
<% end %>
</span>
</div>
<div class="homepagePostReplyBannerTime"></div>
@ -162,12 +158,8 @@
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
<% end %>
</span>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
<div class="fr mr10" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
l(:button_reply),

View File

@ -1,17 +1,17 @@
<script type="text/javascript">
function submit_copy_course() {
if(regex_course_name()&&regex_course_class_period()&&regex_time_term()&&regex_course_password())
if(regex_course_name('new')&&regex_course_class_period('new')&&regex_time_term('new')&&regex_course_password('new'))
{
$("#new_course").submit();
document.getElementById("submit_copy_course").onclick = "";
}
}
$(document).ready(function(){
$("#time").change(function(){
document.getElementById("end_time").options[document.getElementById("time").selectedIndex].selected = true;
$("#new_time").change(function(){
document.getElementById("new_end_time").options[document.getElementById("new_time").selectedIndex].selected = true;
});
$("#term").change(function(){
document.getElementById("end_term").options[document.getElementById("term").selectedIndex].selected = true;
$("#new_term").change(function(){
document.getElementById("new_end_term").options[document.getElementById("new_term").selectedIndex].selected = true;
});
var popupHeight = $(".referenceResourcesPopup").outerHeight(true);
@ -56,35 +56,35 @@
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input grey_border" maxlength="100" onkeyup="regex_course_name();" value="<%=@course.name %>">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
<input type="text" name="course[name]" id="new_course_name" class="courses_input grey_border" maxlength="100" onkeyup="regex_course_name('new');" value="<%=@course.name %>">
<span class="c_red" id="new_course_name_notice" style="display: none;">课程名称不能为空</span>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
<input type="text" name="class_period" id="class_period" class="hwork_input02 grey_border" onkeyup="regex_course_class_period();" maxlength="6" value="<%=@course.class_period %>">
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
<input type="text" name="class_period" id="new_class_period" class="hwork_input02 grey_border" onkeyup="regex_course_class_period('new');" maxlength="6" value="<%=@course.class_period %>">
<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@new_course.time),@new_course.time), {} %>
<%= select_tag :term,options_for_select(course_term_option,@new_course.term || cur_course_term),{} %>
<span class="c_red" id="course_time_term_notice"></span>
<%= select_tag :time,options_for_select(course_time_option(@new_course.time),@new_course.time), {:id=>"new_time"} %>
<%= select_tag :term,options_for_select(course_term_option,@new_course.term || cur_course_term),{:id=>"new_term"} %>
<span class="c_red" id="new_course_time_term_notice"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@new_course.end_time),@new_course.end_time), {} %>
<%= select_tag :end_term,options_for_select(course_term_option,@new_course.end_term || cur_course_term),{} %>
<%= select_tag :end_time,options_for_select(course_time_option(@new_course.end_time),@new_course.end_time), {:id=>"new_end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@new_course.end_term || cur_course_term),{:id=>"new_end_term"} %>
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="text" style="display: none;">
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02 grey_border" onkeyup="regex_course_password();" value="<%=@course.password %>">
<input type="text" name="course[password]" id="new_course_course_password" class="hwork_input02 grey_border" onkeyup="regex_course_password('new');" value="<%=@course.password %>">
<!--<a id="psw_btn" href="javascript:void(0)">显示明码</a>-->
<span class="c_red" id="course_course_password_notice"></span>
<span class="c_red" id="new_course_course_password_notice"></span>
<div class="cl"></div>
<span class="ml95 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>

View File

@ -25,6 +25,9 @@
<div class="ping_disfoot f14">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span id="reply_praise_count_<%=journal.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%>
</span>
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},

View File

@ -22,9 +22,9 @@
<div class="st_box">
<ul class="st_box_top">
<li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li>
<li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li>
<li style="padding-right: 55px; margin-left: 160px;"><a href="">分班</a></li>
<li class="ml50" style="padding-right: 5px;"><span class="fontGrey6 fb">姓名</span></li>
<li class="ml10" style="padding-right: 15px;"><span class="fontGrey6 fb">学号</span></li>
<li style="padding-right: 55px; margin-left: 160px;"><span class="fontGrey6 fb">分班</span></li>
<li class="st_list_score ml10">
<%= link_to '作业积分', member_score_sort_course_path(:sort_type => 'score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true, :class => 'ml25'%>
<% if @sort_type == "score" && @score_sort_by == 'desc' %>
@ -41,7 +41,7 @@
<a id="pic" href="javascript:" class= "st_up"></a>
<% end %>
</li>
<li class="ml20"><a href="javascript:void(0)" >加入时间</a></li>
<li class="ml20"><span class="fontGrey6 fb">加入时间</span></li>
</ul>
<div class="cl"></div><!--st_box_top end-->

View File

@ -8,19 +8,19 @@
.tscore_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; text-align: center; padding-top:5px;}
.tscore_box{ width:350px; margin:15px auto;}
.tscore_box{ width:370px; margin:15px auto;}
.tscore_box li{ height:25px;}
</style>
<div class="tscore_con" id="user_score">
<h2><%= @member_score.user.name %> 历次作业积分</h2>
<ul class="tscore_box">
<ul class="tscore_box" style="max-height: 400px; overflow: auto;">
<li ><span class="c_blue02 w280">作业名称</span><span class="c_blue02 w70">得分</span></li>
<% @member_score.homework_common_list.each do |homework_common| %>
<% @member_score.homework_common_list.each_with_index do |homework_common, index| %>
<li>
<span class="c_grey02 w280 hiddent">
<%= homework_common.name %>
作业<%=index + 1 %><%= homework_common.name %>
</span>
<span class="c_red w70">
<% final_score = @member_score.homework_common_score(homework_common).first%>

View File

@ -8,36 +8,36 @@
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name('new');">
<span class="c_red" id="new_course_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
</li>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6">
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
<input type="text" name="class_period" id="new_class_period" class="hwork_input02" onkeyup="regex_course_class_period('new');" maxlength="6">
<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
<span class="c_red" id="course_time_term_notice"></span>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"new_time"} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"new_term"} %>
<span class="c_red" id="new_course_time_term_notice"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{} %>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"new_end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"new_end_term"} %>
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="text" style="display: none;">
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" onkeyup="regex_course_password();">
<input type="password" name="course[password]" id="new_course_course_password" class="hwork_input02" onkeyup="regex_course_password('new');">
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
<span class="c_red" id="course_course_password_notice"></span>
<span class="c_red" id="new_course_course_password_notice"></span>
<div class="cl"></div>
<span class="ml80 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>
@ -75,11 +75,11 @@
<div class="cl"></div>
<script>
$(function(){
$("#time").change(function(){
document.getElementById("end_time").options[document.getElementById("time").selectedIndex].selected = true;
$("#new_time").change(function(){
document.getElementById("new_end_time").options[document.getElementById("new_time").selectedIndex].selected = true;
});
$("#term").change(function(){
document.getElementById("end_term").options[document.getElementById("term").selectedIndex].selected = true;
$("#new_term").change(function(){
document.getElementById("new_end_term").options[document.getElementById("new_term").selectedIndex].selected = true;
});
});
</script>

View File

@ -33,35 +33,35 @@
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
<input type="text" name="course[name]" id="edit_course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name('edit');" value="<%= @course.name%>">
<span class="c_red" id="edit_course_name_notice" style="display: none;">课程名称不能为空</span>
<input type="password" style="top: -100000px;position: fixed;">
</li>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6" value="<%= @course.class_period%>">
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
<input type="text" name="class_period" id="edit_class_period" class="hwork_input02" onkeyup="regex_course_class_period('edit');" maxlength="6" value="<%= @course.class_period%>">
<span class="c_red" id="edit_course_class_period_notice" style="display: none;"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time"} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term"} %>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"edit_time"} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"edit_term"} %>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term"} %>
<span class="c_red" id="course_time_term_notice"></span>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"edit_end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"edit_end_term"} %>
<span class="c_red" id="edit_course_time_term_notice"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" value="<%= @course.password%>" onkeyup="regex_course_password();">
<input type="password" name="course[password]" id="edit_course_course_password" class="hwork_input02" value="<%= @course.password%>" onkeyup="regex_course_password('edit');">
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
<span class="c_red" id="course_course_password_notice"></span>
<span class="c_red" id="edit_course_course_password_notice"></span>
<div class="cl"></div>
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>

View File

@ -17,7 +17,7 @@
</div>-->
<%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<%# end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示测验信息 ]</a> </span>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" onclick="show_or_hide_info();" style="display: none">[ 显示测验信息 ]</a> </span>
</div>
<div class="cl"></div>

View File

@ -17,7 +17,7 @@
</div>-->
<%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<%# end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示测验信息 ]</a> </span>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" onclick="show_or_hide_info();" style="display: none">[ 显示测验信息 ]</a> </span>
</div>
<div class="cl"></div>

View File

@ -15,46 +15,23 @@
</th>
</tr>
<% @exercise_users_list.each do |exercise|%>
<script type="text/javascript">
$(".student_work_<%= exercise.id%>").mouseenter(function(){
$("#work_click_<%= exercise.id%>").show();
}).mouseleave(function(){
$("#work_click_<%= exercise.id%>").hide();
});
$(function(){
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$("#show_student_result_div_<%= exercise.id%>").on('click',function() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
});
<% else %>
$("#show_student_result_div_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_name_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
});
/*function show_result(id) {
window.location.href = '<%#=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';
}*/
</script>
<% @exercise_users_list.each_with_index do |exercise, index|%>
<tr class="hworkListRow" id="student_work_<%= exercise.id%>">
<td class="pl5 pr5" style="width:28px; text-align:center;">1</td>
<td class="pl5 pr5" style="width:28px; text-align:center;"><%=index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %>
</td>
<td class="hworkStName" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
<td class="hworkStName student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
<%=exercise.user.show_name %>
</td>
<td class="hworkStID pl15 pr10 float-none" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
<td class="hworkStID student_work_<%= exercise.id%> pl15 pr10 float-none" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
<span class="hidden fl" style="width:80px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
</td>
<td class="hworkStID float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
<td class="hworkStID student_work_<%= exercise.id%> float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
--
</td>
<td width="200">&nbsp;</td>
<td class="hworkList130 c_grey student_work_<%= exercise.id%>">
<td class="hworkList130 c_grey">
<% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if @exercise.end_time <= exercise.created_at %>
@ -65,7 +42,31 @@
<td class="hworkList50 <%= score_color exercise.score%> student_final_scor_info">
<%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%>
</td>
<td class="hworkTip" style="display: none" id="work_click_<%= exercise.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= exercise.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr>
<% end%>
<script type="text/javascript">
$(".student_work_<%= exercise.id%>").mouseenter(function(){
$("#work_click_<%= exercise.id%>").show();
}).mouseleave(function(){
$("#work_click_<%= exercise.id%>").hide();
}).mouse;
$(function(){
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$("#student_name_<%= exercise.id%>,#student_id_<%= exercise.id%>,#student_class_<%= exercise.id%>").on('click',function() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
});
<% else %>
//$("#show_student_result_div_<%#= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_name_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
});
/*function show_result(id) {
window.location.href = '<%#=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';
}*/
</script>
<% end%>
</table>

View File

@ -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 %>
<span class="grey_homework_btn_cir ml5">已截止</span>
<% end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_hidden">[ 隐藏测验信息 ]</a> </span>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" onclick="show_or_hide_info();" id="homework_info_hidden">[ 隐藏测验信息 ]</a> </span>
<div class="cl"></div>
<div class="fontGrey2 db mb5">发布者:<%= @exercise.user.show_name %></div>
<div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">

View File

@ -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} %>
<div style="width:210px; text-align:center; margin:0 auto;">
<ul class="wlist" style=" border:none; display:inline-block; float:none; margin-top:10px;">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div>

View File

@ -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 %>
<input type="text" name="search" placeholder="输入作业名称进行搜索" class="searchResource" />
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>

View File

@ -71,13 +71,8 @@
<% end%>
</div><!----HomeWork end-->
<% end%>
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %>
<div style="width:210px; text-align:center; margin:0 auto;">
<ul class="wlist" style=" border:none; display:inline-block; float:none; margin-top:10px;">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<div id="homework_index_list">
<%= render :partial => 'homework_common/homework_index_list', :locals => {:homework_commons => @homeworks,:course_id => @course.id} %>
</div>
</div>
<div class="cl"></div>

View File

@ -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} )%>");
/*
$("#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}) %>");

View File

@ -6,15 +6,15 @@
<p class="pro_page_tit" style="word-break:break-all;">
<% case @issue.tracker_id %>
<% when 1%>
<span class="issues fl" title="缺陷"></span>
<span class="fl" title="缺陷">【缺陷】</span>
<% when 2%>
<span class="issues-function fl" title="功能"></span>
<span class="fl" title="功能">【功能】</span>
<% when 3%>
<span class="support fl" title="支持"></span>
<span class="fl" title="支持">【支持】</span>
<% when 4%>
<span class="duty fl" title="任务"></span>
<span class="fl" title="任务">【任务】</span>
<% when 5%>
<span class="weekly fl" title="周报"></span>
<span class="fl" title="周报">【周报】</span>
<% end %>
</span> <span style="padding-left: 5px;"><%= @issue.subject %></span>
<span class='<%= "#{get_issue_priority(@issue.priority_id)[0]} " %>'><%= get_issue_priority(@issue.priority_id)[1] %></span></p>

View File

@ -20,9 +20,9 @@
</div>
<div class="cl"></div>
<div >
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<a class="pr_info_name fl c_dark fb" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<div>
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<a class="pr_info_name c_dark fb fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<span id="course_outline_bar">

View File

@ -95,11 +95,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= @reply_count>0 ? "#{@reply_count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@topic.id %>">
<% if @topic.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@topic) > 0 ? "#{get_praise_num(@topic)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@topic, :user_activity_id=>@topic.id,:type=>"activity"}%>
<% end %>
</span>
</div>
</div>
@ -131,11 +127,7 @@
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr newsGrey" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
<%= link_to(
l(:button_reply),

View File

@ -151,11 +151,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= @reply_count>0 ? "#{@reply_count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@topic.id %>">
<% if @topic.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@topic) > 0 ? "#{get_praise_num(@topic)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@topic, :user_activity_id=>@topic.id,:type=>"activity"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@topic, :user_activity_id=>@topic.id,:type=>"activity"}%>
</span>
</div>
</div>
@ -187,11 +183,7 @@
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr newsGrey" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
<%= link_to(
l(:button_reply),

View File

@ -101,11 +101,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= @comments.count>0 ? "#{@comments.count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@news.id %>">
<% if @news.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@news) > 0 ? "#{get_praise_num(@news)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%>
</span>
</div>
</div>
@ -137,11 +133,7 @@
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr newsGrey" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
<%= link_to_if_authorized_course(
l(:button_delete),

View File

@ -71,11 +71,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@document.id %>">
<% if @document.creator_id.to_i == User.current.id.to_i %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@document) > 0 ? "#{get_praise_num(@document)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
</div>
@ -100,11 +96,7 @@
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_at) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.creator_id.to_i == User.current.id.to_i %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(

View File

@ -46,7 +46,7 @@
</div>
</div>
<% end %>
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
<% if act.org_act_type == 'OrgDocumentComment' %>
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %>
<% end %>
<% end %>

View File

@ -290,12 +290,8 @@
<span class="reply_iconup" > ︿</span>
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.user == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<% end %>
</span>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"></div>
<%if count>3 %>
@ -359,11 +355,7 @@
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(

View File

@ -74,11 +74,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
@ -117,11 +113,7 @@
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">

View File

@ -44,12 +44,8 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<% end %>
</span>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>3 %>
@ -86,11 +82,7 @@
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">

View File

@ -1,6 +1,6 @@
<% members.each do |member|%>
<ul class="orgListRow">
<li class="orgListUser"><a href="<%= user_url_in_org(member.user_id) %>" class="linkBlue"><%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %></a></li>
<li class="orgListUser hidden"><a href="<%= user_url_in_org(member.user_id) %>" class="linkBlue"><%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %></a></li>
<li class="orgListRole">
<%= get_org_member_role_name member %>
<%= form_for(member, {:as => :org_member, :remote => true, :url => Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,

View File

@ -55,11 +55,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -97,11 +93,7 @@
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">

View File

@ -84,11 +84,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<%if count>3 %>
@ -122,11 +118,7 @@
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">

View File

@ -64,11 +64,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%= user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -106,11 +102,7 @@
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">

View File

@ -57,11 +57,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
@ -96,11 +92,7 @@
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">

View File

@ -69,11 +69,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=document.id %>">
<% if document.creator_id.to_i == User.current.id.to_i %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(document) > 0 ? "#{get_praise_num(document)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<% 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) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.creator_id.to_i == User.current.id.to_i %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<% unless comment.content.blank? %>

View File

@ -16,6 +16,9 @@
</div>
<div class="ping_disfoot f14">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span id="reply_praise_count_<%=journal.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%>
</span>
<% if journal.user == User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
@ -28,7 +31,6 @@
<%= link_to l(:label_bid_respond_quote),'javascript:;', {:nhname=>"reply_btn"} %>
<% end %>
</span>
</div>
<div class="cl"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%>

View File

@ -44,11 +44,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -86,11 +82,7 @@
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">

View File

@ -2,8 +2,8 @@
<tr class="b_grey hworkH30" style="border-bottom:1px solid #eaeaea;">
<th class="hworkList30 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<th class="hworkList260" style="text-align:left;">作品名称</th>
<% if @homework.homework_type != 3 %>
<th class="hworkList260" style="text-align:left;">作品名称</th>
<th class="hworkList80">
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
</th>
@ -11,9 +11,12 @@
<span class="HomeworkStuTitle f14 fb fl">学号</span>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<th class="hworkList260" style="text-align:left;">作品名称</th>
<th class="hworkList160">
<span class="HomeworkStuTitle f14 fb fl">关联项目</span>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<th class="hworkList420" style="text-align:left;">作品名称</th>
<% end %>
<th class="hworkList130 pl10">
时间
@ -23,7 +26,7 @@
系统
</th>
<% end%>
<th class="hworkList50 pr10 pl10">
<th class="hworkList50 pr10 pl10" style="font-size:12px;">
我的评分
</th>
</tr>

View File

@ -21,7 +21,7 @@
</li>
<% end%>
<li class="hworkList50 hworkH30 fb mr10 ml10">
<li class="hworkList50 hworkH30 fb mr10 ml10" style="font-size:12px;">
我的评分
</li>
</ul>

View File

@ -2,9 +2,9 @@
<tr class="b_grey hworkH30" style="border-bottom:1px solid #eaeaea;">
<th class="hworkList30 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<th class="<%= @homework.homework_type == 2 ? 'hworkList80 pr10' : 'hworkList130 pr10'%>" style="text-align:left;">作品名称</th>
<% if @homework.homework_type != 3 %>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList60'%> pr10">
<th class="<%= @homework.homework_type == 2 ? 'hworkList80 pr10' : 'hworkList130 pr10'%>" style="text-align:left;">作品名称</th>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList60'%> pr10">
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl #{@homework.anonymous_comment == 1 ? 'ml35' : 'ml18'}" ,:remote => true%>
<% if @show_all && @order == "lastname"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
@ -17,9 +17,12 @@
<% end%>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<th class="hworkList160">
<th class="hworkList130 pr10" style="text-align:left;">作品名称</th>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList220' : 'hworkList160'%>">
<span class="c_dark f14 fb">关联项目</span>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList340' : 'hworkList290' %> pr10" style="text-align:left;">作品名称</th>
<% end %>
<th class="hworkList130">
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%>

View File

@ -1,26 +1,32 @@
<!-- 匿评作品列表,显示某一个作品的信息 -->
<a name="<%= student_work.id%>"></a>
<tr class="hworkListRow" id="student_work_<%= student_work.id%>">
<td class="none"><a name="<%= student_work.id%>"></a></td>
<td class="hworkList30 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %>
</td>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%= @homework.homework_type == 2 ? '' : 'width130'%>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% if @homework.homework_type != 3 %>
<% if @homework.homework_type != 3 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%= @homework.homework_type == 2 ? '' : 'width130'%>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkStName100' : 'hworkStName'%> pr10 student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.show_name%>
</td>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkStID90' : 'hworkStID'%> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<span style="width:90px; float:left;" class="hidden"><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%></span>
<span style="width:80px;" class="hidden fl"><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%></span>
</td>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> width130" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<td class="hworkPrName student_work_<%= student_work.id%>" title="项目名称">
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</td>
<% else %>
@ -28,7 +34,14 @@
<%= student_work.project.name %>
</td>
<% end %>
<% end %>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%=@homework.anonymous_comment == 1 ? 'width340' : 'width290' %>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% end %>
<td class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.created_at && @homework.end_time%>
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
@ -96,7 +109,7 @@
</div>
<% end%>
</td>
<td class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr>
<script type="text/javascript">
$(".student_work_<%= student_work.id%>").mouseenter(function(){

View File

@ -1,5 +1,6 @@
<!-- 匿评作品列表,显示某一个作品的信息 -->
<tr class="hworkListRow" id="student_work_<%= student_work.id%>">
<td class="none"><a name="<%= student_work.id%>"></a></td>
<% if @homework.homework_type != 3 %>
<% is_my_work = student_work.user == User.current%>
<% else %>
@ -11,21 +12,27 @@
<td class="hworkList30 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40", style: "display:block;") %>
</td>
<td class="hworkName pr10 w250 float-none student_work_<%= student_work.id%>">
<div>
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
</div>
</td>
<% if @homework.homework_type != 3 %>
<td class="hworkName pr10 w250 float-none student_work_<%= student_work.id%>">
<div>
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
</div>
</td>
<td class="hworkStName float-none w80 student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<%= student_work.user.show_name%>
</td>
<td class="hworkStID float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
<span class="hidden fl" style="width:80px;"><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%></span>
</td>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<td class="hworkName pr10 w250 float-none student_work_<%= student_work.id%>">
<div>
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<td class="hworkPrName float-none mr10 student_work_<%= student_work.id%>" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
@ -35,6 +42,13 @@
<%= student_work.project.name %>
</td>
<% end %>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<td class="hworkName pr10 w410 float-none student_work_<%= student_work.id%>">
<div>
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
</div>
</td>
<% end %>
<% else%>
<td class="hworkList30 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
@ -78,7 +92,7 @@
<td class="hworkList50 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score)%> mr10 ml10">
<%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
</td>
<td class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr>
<script type="text/javascript">
$(".student_work_<%= student_work.id%>").mouseenter(function(){

View File

@ -24,7 +24,7 @@
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %>
<% end %>
<% end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示作业信息 ]</a> </span>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" onclick="show_or_hide_info();" style="display: none">[ 显示作业信息 ]</a> </span>
</div>
<div class="cl"></div>

View File

@ -11,9 +11,9 @@ var num = $("#work_num_<%= @work.id%>").html();
$("#score_list_<%= @work.id%>").removeAttr("style");
<% if @is_teacher %>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>");
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>");
$("#work_num_<%= @work.id%>").html(num);
<% else %>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>");
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>");
$("#work_num_<%= @work.id%>").html(num);
<% end%>

View File

@ -33,8 +33,14 @@
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9");
}
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();
@ -43,7 +49,7 @@
$("#homework_info_show").hide();
$("#homeworkInformation").show();
$("#homework_info_hidden").show();
});
});*/
if($("#homework_description").height() > 54) {
$("#homeworkDetailShow").show();
@ -69,16 +75,21 @@
<ul class="menu_r">
<li>
<a href="javascript:void(0);" class="parent">
<% @all_homework_commons.each_with_index do |homework_common,index |%>
<% if @is_teacher %>
<% hcommons = @all_homework_commons %>
<% else %>
<% hcommons = @homework_commons %>
<% end %>
<% hcommons.each_with_index do |homework_common,index |%>
<% if homework_common.id == @homework.id %>
<%="作业 #{@all_homework_commons.count - index}" %>
<%="作业 #{hcommons.count - index}" %>
<% end %>
<% end%>
</a>
<ul>
<% @all_homework_commons.each_with_index do |homework_common,index |%>
<% hcommons.each_with_index do |homework_common,index |%>
<li class="pr10">
<%= link_to "作业#{@all_homework_commons.count - index}#{homework_common.name}",student_work_index_path(:homework => homework_common.id)%>
<%= link_to "作业#{hcommons.count - index}#{homework_common.name}",student_work_index_path(:homework => homework_common.id)%>
<%#= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
</li>
<% end%>
@ -156,7 +167,7 @@
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% end%>
<% end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_hidden">[ 隐藏作业信息 ]</a> </span>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" onclick="show_or_hide_info();" id="homework_info_hidden">[ 隐藏作业信息 ]</a> </span>
<div class="cl"></div>
<div class="fontGrey2 db mb5">发布者:<%= @homework.user.show_name %></div>
<div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">

View File

@ -296,11 +296,7 @@
<span class="reply_iconup" > ︿</span>
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.user == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"></div>
@ -365,11 +361,7 @@
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(

View File

@ -33,10 +33,12 @@
</div>
<% count = fetch_user_leaveWord_reply(activity).count %>
<div class="homepagePostReply">
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount">
回复(<%= count %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"></div>
<%if count>3 %>
@ -72,6 +74,9 @@
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %>

View File

@ -91,11 +91,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
@ -134,11 +130,7 @@
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
</div>

View File

@ -69,11 +69,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -111,11 +107,7 @@
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">

View File

@ -1,7 +1,7 @@
<div class="subjectDetail fl mt10">
<div class="subjectInfo">题目信息</div>
<div class="subject-content-wrapper">
<% if homework.nil? && status == 0 %>
<% if homework.nil? %>
<span id="homework_notice_span"><span class="center db">本题库遵循创作共用许可证</span><br>
教师给学生出题本质上是一种创作行为,题目的作者通常为此付出大量时间和精力。好的题目不仅能加深学生对知识点的理解,还能激发学生兴趣,提升学习效率。为此,本网站的题库许可证基于创作共用许可证( Creative Commons License )建立,其核心条款包括:<br/><br/>
@ -14,14 +14,14 @@
对此许可证的支持或反对,请在网站中留言,我们不断完善,谢谢!
</span>
<% elsif homework.nil? && status == 1 %>
<!-- <%# elsif homework.nil? && status == 1 %>
<span class="c_red">您选中的作业目前为私有作业,您的分享请求已发送至老师,请耐心等待老师的同意。</span>
<% elsif homework.nil? && status == 2 %>
<%# elsif homework.nil? && status == 2 %>
<span class="c_red">您选中的作业目前为私有作业,请点击“请求分享”按钮向题目的作者发送分享请求吧!<br/>
祝您成功:)
</span>
<% elsif homework.nil? && status == 3 %>
<span class="c_red">您选中的作业目前为私有作业,您的分享请求已被老师拒绝,暂时不可查看作业详情。</span>
<%# elsif homework.nil? && status == 3 %>
<span class="c_red">您选中的作业目前为私有作业,您的分享请求已被老师拒绝,暂时不可查看作业详情。</span>-->
<% else %>
<div class="subjectIntro mb15">标题:<%=homework.name %><br />
来源:<%=homework.course.name %><br />

View File

@ -1,4 +1,4 @@
<%= form_tag add_exist_file_to_org_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'orgs_list_form' do %>
<%= form_tag add_exist_file_to_org_user_path(user, :type => @type ),:remote=>true,:id=>'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">

View File

@ -1,4 +1,4 @@
<%= form_tag add_exist_file_to_project_user_path(user, :type => defined?(type) ? type : "6" ), :remote => true, :id => 'projects_list_form' %>
<%= form_tag add_exist_file_to_project_user_path(user, :type => @type ), :remote => true, :id => 'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>

View File

@ -38,16 +38,16 @@
</div>
<div class="homepagePostTitle break_word">
<% case activity.tracker_id %>
<% when 1%>
<span class="issues fl" title="缺陷"></span>
<% when 1%>
<span class="fl" title="缺陷">【缺陷】</span>
<% when 2%>
<span class="issues-function fl" title="功能"></span>
<span class="fl" title="功能">【功能】</span>
<% when 3%>
<span class="support fl" title="支持"></span>
<span class="fl" title="支持">【支持】</span>
<% when 4%>
<span class="duty fl" title="任务"></span>
<span class="fl" title="任务">【任务】</span>
<% when 5%>
<span class="weekly fl" title="周报"></span>
<span class="fl" title="周报">【周报】</span>
<% end %>
<%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey ml5" %>
<span class='<%= get_issue_priority(activity.priority_id)[0] %>'>
@ -100,4 +100,4 @@
$(function(){
user_card_show_hide();
});
</script>
</script>

View File

@ -4,11 +4,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -46,12 +42,8 @@
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%= reply.id %>">
<% if reply.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
<% end %>
</span>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
<% if reply.details.any? %>

View File

@ -90,11 +90,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
@ -129,11 +125,7 @@
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">

View File

@ -1,13 +1,16 @@
<div >
<div class="relateText fl mb10 mr5">发送到</div>
<div class="resourcesSendTo mr15">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','file');">
<% unless send_ids.blank? %>
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">课程</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
</div>
<%= form_tag search_user_org_user_path(user),:method => 'get',
<%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
@ -19,5 +22,5 @@
<div class="cl"></div>
</div>
<div id="org_file_form">
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => type} %>
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => @type} %>
</div>

View File

@ -2,7 +2,10 @@
<div>
<div class="sendText fl mr10" style="width: auto">发送到</div>
<div class="resourcesSendTo">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file');">
<% unless send_ids.blank? %>
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">课程</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
@ -12,7 +15,7 @@
</div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
<div class="fl">
<%= form_tag search_user_project_user_path(user),:method => 'get',
<%= form_tag search_user_project_user_path(user, :type => @type),:method => 'get',
:remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>

View File

@ -4,7 +4,10 @@
<div>
<div class="sendText fl mr10" style="width: auto">发送到</div>
<div class="resourcesSendTo">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','file');">
<% unless send_ids.blank? %>
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">课程</option>
<option value="2">项目</option>
<option value="3">组织</option>
@ -14,10 +17,9 @@
</div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
<div class="fl">
<%= form_tag search_user_course_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<%= form_tag search_user_course_user_path(user),:method => 'get', :remote=>true, :id=> 'search_user_course_form', :class=> 'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','file')

View File

@ -6,49 +6,20 @@
<% attachments.each do |attach| %>
<ul class="resource-list" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
<li class="resource-list-checkbox fl">
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current && attach.get_apply_resource_status(attach.id, attach.author_id) != 2 %>
<input name="checkbox1[]" type="checkbox" disabled="disabled" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
<% else %>
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
<% end %>
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
<!--<input name="checkbox2" type="checkbox" value="" class="resourcesCheckbox" />-->
</li>
<li class="resource-list-name fl">
<% if attach.is_public == 0 && attach.get_apply_resource_status(attach.id, attach.author_id) != 2 %>
<a href="" style="cursor: default" class = "resourcesBlack resource-list-middle hidden mw280" title="<%= attach.filename %>"><%= attach.filename %> </a>
<% else %>
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
<% end %>
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %>
<img src="/images/locked.png" alt="私有" title="私有" class="resource-list-middle" height="16" width="16">
<% end %>
</li>
<li class="resource-list-apply fr" id="resource_apply_status_<%=attach.id %>">
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current && !attach_show_allow(attach) %>
<% ah = attach.get_status_by_attach(User.current.id) %>
<% if ah.nil? %>
<%= link_to("请求分享", apply_resource_user_path(User.current.id, :attachment_id => attach.id), :class => 'green_btn_share c_white', :remote => true) %>
<% elsif ah == 1 %>
等待回复
<% elsif ah == 2 %>
可引用
<% elsif ah == 3 %>
已拒绝
<% end %>
<% else %>
--
<% end %>
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
</li>
<li class="resource-list-time fr"><%= format_date(attach.created_on) %></li>
<li class="resource-list-quote fr"><%= attach.quotes.nil? ? 0 : attach.quotes %></li>
<li class="resource-list-download fr"><%= attach.downloads %></li>
<li style="display: none"><%= attach.author_id %></li>
<li class="resource-list-size fr"><%= (number_to_human_size(attach.filesize)).gsub("ytes", "") %></li>
<li class="resource-list-uploader fr hidden"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
<li class="resource-list-uploader fr hidden"><%= User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
<li class="resource-list-type fr"><%= get_resource_type(attach.container_type)%></li>
<li class="resource-list-from fr hidden" title="<%= get_resource_origin(attach) %>"><%= get_resource_origin(attach) %></li>
<li style="display: none"><%= attach.is_public %></li>
<li style="display: none"><%= attach.get_apply_resource_status(attach.id, attach.author_id) %></li>
<li style="display: none"><%= attach.id %></li>
</ul>
<div class="cl"></div>
@ -70,14 +41,15 @@
//批量删除
function batch_delete(){
var data = $("#resources_list_form").serialize();
if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){
alert("您无法删除此资源!");
return;
}
if($("input[type=checkbox][data-has-history=Y]:checked").length != 0){
alert("您只能删除没有历史记录的资源,请重新选择后再删除。");
return;
}
if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){
alert("您只能删除自己上传的资源,请重新选择后再删除。");
return;
}
if(data != "" && confirm('确认要删除这些资源吗?')) {
$.post(
@ -97,10 +69,9 @@
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
is_public = line.children().eq(11).html();
user_id = line.children().eq(6).html();
apply_status = line.children().eq(12).html();
if(is_public == 0 && user_id != '<%= User.current.id %>' && apply_status != 2){
user_id = line.children().eq(5).html();
allow = line.children().eq(13).html();
if( allow == 0){
alert('您无权发送私有资源')
}else{
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
@ -128,13 +99,26 @@
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type%>",
url: '<%= search_user_project_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
data:{send_type:'file'}
});
}else{
}else if (lastSendType === '1'){
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type%>",
url: '<%= search_user_course_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
data:{send_type:'file'}
});
}else if (lastSendType === '3'){
$.ajax({
type: 'get',
url: '<%= search_user_org_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
data:{send_type:'file'}
});
}
else{
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type %>",
data:{send_type:'file'}
});
@ -213,20 +197,22 @@
}
line.children().css("background-color", 'white');
id = line.children().last().html();
user_id = line.children().eq(6).html();
if(line.children().first().children().data('hasHistory') == 'Y'){
alert('该资源存在历史版本,不能删除');
return;
}
user_id = line.children().eq(5).html();
if(user_id === '<%= User.current.id%>') {
if(line.children().first().children().data('hasHistory') == 'Y'){
alert('该资源存在历史版本,不能删除');
return;
}
if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) {
$.ajax({
type: 'post',
url: '<%= user_resource_delete_user_path(User.current.id)%>' + '?resource_id=' + id + '&type=<%=@type %>&status=<%=@status %>'
url: '<%= user_resource_delete_user_path(User.current.id) %>' + '?resource_id=' + id + '&type=<%= @type %>&status=<%= @status %>'
});
}
}else{
alert('您无法删除此资源!')
}
}
</script>

View File

@ -3,6 +3,8 @@
<div class="subject-list fl mr10">
<a href="<%= user_homework_type_user_path(@user,:is_import => 1) %>" id="public_homeworks_choose" class="resource-tab resource-tab-active fl" data-remote="true">公共题库</a>
<a href="<%= user_homework_type_user_path(@user,:type=>'2',:is_import => 1) %>" id="user_homeworks_choose" class="resource-tab fl" data-remote="true">我的题库</a>
<!--<a href="<%#= user_homework_type_user_path(@user,:type=>'3',:is_import => 1) %>" id="apply_homeworks_choose" class="resource-tab fl" data-remote="true">申请题库</a>-->
<div id="homework_search_input">
<%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 1} %>
</div>
@ -43,11 +45,18 @@
</div>
<script type="text/javascript">
$("#public_homeworks_choose").click(function(){
$(this).toggleClass("resource-tab-active");
$("#user_homeworks_choose").toggleClass("resource-tab-active");
$(this).addClass("resource-tab-active");
$("#user_homeworks_choose").removeClass("resource-tab-active");
//$("#apply_homeworks_choose").removeClass("resource-tab-active");
});
$("#user_homeworks_choose").click(function(){
$(this).toggleClass("resource-tab-active");
$("#public_homeworks_choose").toggleClass("resource-tab-active");
$(this).addClass("resource-tab-active");
$("#public_homeworks_choose").removeClass("resource-tab-active");
//$("#apply_homeworks_choose").removeClass("resource-tab-active");
});
// $("#apply_homeworks_choose").click(function(){
// $(this).addClass("resource-tab-active");
// $("#public_homeworks_choose").removeClass("resource-tab-active");
// $("#user_homeworks_choose").removeClass("resource-tab-active");
// });
</script>

View File

@ -10,11 +10,16 @@
// });
$(document).ready(function(){
<% if type == "1" %>
$("#my_resources_choose_homework").addClass("referenceTypeActive");
$("#public_resources_choose_homework").removeClass("referenceTypeActive");
<% else %>
$(".referenceTypeBlock").click(function(){
var activeBlock = $(".referenceResourceType").children(".referenceTypeActive");
activeBlock.removeClass("referenceTypeActive");
$(this).addClass("referenceTypeActive");
});
<% end %>
});
// 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
@ -36,14 +41,12 @@ function store_seleted_resource(dom){
</div>
<div>
<div class="referenceResourceType fl">
<a href="<%= user_resource_type_user_path(user)%>" class="referenceTypeBlock referenceTypeActive" data-remote="true" >资源库</a>
<a href="<%= user_resource_type_user_path(user,:type=>'2')%>" class="referenceTypeBlock" data-remote="true">课程资源</a>
<a href="<%= user_resource_type_user_path(user,:type=>'3')%>" class="referenceTypeBlock" data-remote="true">项目资源</a>
<a href="<%= user_resource_type_user_path(user,:type=>'5')%>" class="referenceTypeBlock" data-remote="true">用户资源</a>
<a href="<%= user_resource_type_user_path(user,:type=>'4')%>" class="referenceTypeBlock" data-remote="true">附件</a> </div>
<a href="<%= user_ref_resource_search_user_path(User.current, :type => '6') %>" id="public_resources_choose_homework" class="referenceTypeBlock referenceTypeActive" data-remote="true">公共资源</a>
<a href="<%= user_ref_resource_search_user_path(User.current, :type => '1') %>" id="my_resources_choose_homework" class="referenceTypeBlock" data-remote="true">我的资源</a>
</div>
<div class="fr">
<!--<form class="referenceSearchBox">-->
<%= form_tag(user_ref_resource_search_user_path(user),:method => 'get',:remote=>'true',:class=>'referenceSearchBox') do%>
<%= form_tag(user_ref_resource_search_user_path(user, :type => @type),:method => 'get',:remote=>'true',:class=>'referenceSearchBox') do%>
<input type="text" name="search" placeholder="输入资源关键词进行搜索" class="searchReferencePopup" />
<a href="javascript:void(0);" onclick="$(this).parent().submit();" class="referenceSearchIcon"></a>
<% end %>

View File

@ -5,24 +5,24 @@
$(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block");
})
});
$("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none");
})
});
$(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff");
})
});
$(".coursesLineGrey").mouseout(function(){
$(this).css("color","#808080");
})
});
$(".homepagePostSetting,.coursesLineGrey").mouseover(function(){
$(this).prev().css("color","#ffffff");
$(this).css("z-index", "9999");
})
});
$(".homepagePostSetting").mouseout(function(){
$(this).prev().css("color","#808080");
$(this).css("z-index", "1");
})
});
})
</script>

View File

@ -50,11 +50,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -92,11 +88,7 @@
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">

View File

@ -70,7 +70,7 @@
<div class="mt5 fl">
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr15" onclick="$('#_file').click();" title="请选择文件上传">上传附件</a>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%>
<%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作品的附件", :remote => true %>
<% if defined?(has_program) && has_program %>
<div id="program_setting" class="fl">
<a href="javascript:void(0);" class="ProBtn fl mt3"title="请设置编程语言和输入测试集">编程</a>

View File

@ -201,7 +201,7 @@
<% end %>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
<% projects = homework_common.student_work_projects.where("is_leader = 1") %>
<% projects = homework_common.student_work_projects.where("is_leader = 1 and project_id != -1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=homework_common.id %>">
@ -306,11 +306,7 @@
<span class="reply_iconup" > ︿</span>
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=homework_common.id %>">
<% if homework_common.user == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(homework_common) > 0 ? "#{get_praise_num(homework_common)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"></div>
@ -379,11 +375,7 @@
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(

View File

@ -1,13 +1,15 @@
<%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
:mul_id => @resource_id,
:mul_type => @resource_type}),
:method => 'post', :id => 'resource_import_container_form') do %>
:mul_id => @resource_id,
:mul_type => @resource_type}),
:method => 'post', :id => 'resource_import_container_form') do %>
<% @attachments.each do |attach| %>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="mr5" style="vertical-align:middle;" />
<span><%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename%></span>
<span>
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename%>
</span>
</label>
</li>
<li class="subjectType fl"><%= get_resource_type(attach.container_type)%></li>

View File

@ -64,11 +64,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.user == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% 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"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"></div>
@ -106,11 +102,7 @@
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<div id="message_delete_<%=comment.id %>" style="display: none" class="mr10 fr">
<% if comment.user == User.current|| User.current.admin? %>

View File

@ -1,6 +1,6 @@
<div id="users_setting">
<div id="upload_private_resource">
<%= render :partial => "show_new_upload", :locals => {:type => @type, :status => @status} %>
<%= render :partial => "show_new_upload", :locals => {:type => @type, :status => @status} %>
</div>
<div id="search_div">
<%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type, :order => @order, :sort => @score, :status => @status} %>
@ -11,7 +11,7 @@
<div class="cl"></div>
<form id="resources_list_form">
<div id="resources_list">
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments} %>
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments, :type => @type} %>
</div>
<div class="cl"></div>
@ -19,7 +19,8 @@
<div class="resource-check-all">
<input id="checkboxAll" type="checkbox" value="" onclick="all_select();" class="resourcesCheckbox" />
</div>
<a href="javascript:void(0);" class="replyGrey mr15" onclick="all_select();">全选</a> <a href="javascript:void(0);" class="replyGrey" onclick="batch_delete();">删除</a> </div>
<a href="javascript:void(0);" class="replyGrey mr15" onclick="all_select();">全选</a>
<a href="javascript:void(0);" class="replyGrey" onclick="batch_delete();">删除</a> </div>
<div class="cl"></div>
<div class="resourcesSelectSend mt10 fl">
<div class="resourcesSelectSendButton fl mr15 inactive-border" onclick="batch_send();">
@ -214,7 +215,7 @@
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
user_id = line.children().eq(6).html();
user_id = line.children().eq(5).html();
if(user_id === '<%= User.current.id %>') {
res_name = line.children().eq(1).children().attr('title');
res_link = line.children().eq(1).html();
@ -231,7 +232,7 @@
}
}
//发送至按钮控制
//发送至按钮控制
$("input[name='checkbox1[]']").click(function(){
if($("input[name='checkbox1[]']:checked").length >= 1){
$(".resourcesSelectSendButton").removeClass("inactive-border");

View File

@ -1,7 +1,7 @@
<ul class="resource-list-tab mt10" id="resource_tip_list">
<li class="resource-list-checkbox fl"> </li>
<li class="resource-list-name fl">资源名称</li>
<li class="resource-list-apply fr">操作</li>
<!--<li class="resource-list-apply fr">操作</li>-->
<li class="resource-list-time fr">
<%= link_to "上传时间", resource_search_user_path(:type => @type, :status => @status, :sort => @score, :order => "created_on", :search => " "), :class => "fl", :remote => true %>
<% if @order == "created_on" %>

View File

@ -1,5 +1,3 @@
<% if params[:is_observe].nil? %>
<% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');

View File

@ -1,5 +1,5 @@
<% if @is_import.to_i == 1 %>
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>");
<% else %>
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework,:status=>@status}) %>");
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>@homework}) %>");
<% end %>

View File

@ -6,7 +6,7 @@ $("#homework_search_input").html("<%=escape_javascript(render :partial=>'homewor
<% else %>
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>''})%>');
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil, :status => 0}) %>");
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
$("#homework_type_all").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>');
$("#homework_type_nor").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>');

View File

@ -71,7 +71,7 @@
<%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %>
</div>
<div id="homework_repository_detail">
<%=render :partial => 'homework_repository_detail', :locals => {:homework => nil, :status => 0} %>
<%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
</div>
<div class="cl"></div>
<div>

View File

@ -1,4 +1,4 @@
/*$("#homework_repository").html('<%#= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');*/
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => 0,:property => @property,:search=>''})%>');
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil, :status => 0}) %>");
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_resource',:locals => {:user => @user,:homework_id=>@homework_id,:seleted_resources=>@seleted_resources}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_resource',:locals => {:user => @user, :homework_id => @homework_id, :seleted_resources=> @seleted_resources, :type => @type}) %>');
showModal('ajax-modal', '730px');
$('#ajax-modal').css('height','500px').css("width","730px");
$('#ajax-modal').siblings().remove();

View File

@ -1,2 +1,11 @@
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'homework_ref_resources_list',:locals=>{:attachments => @attachments,:seleted_resources=>@seleted_resources})%>');
$("#resource_ref_pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_resource',:locals => {:user => @user, :homework_id => @homework_id, :seleted_resources=> @seleted_resources, :type => @type}) %>');
showModal('ajax-modal', '730px');
$('#ajax-modal').css('height','auto').css("width","730px");
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<div class='resourcePopupClose mt5 mr-5'>" + "<a href='javascript:void(0)' class='resourceClose' onclick='hideResource();'></a></div>");
$('#ajax-modal').parent().css("top","30%").css("left","").css("position","fixed");
$('#ajax-modal').parent().addClass("popbox").addClass("referenceResourcesPopup");
$("#public_resources_choose_homework").attr('href','<%= user_ref_resource_search_user_path(@user, :type => '6') %>');
$("#my_resources_choose_homework").attr('href','<%= user_ref_resource_search_user_path(@user, :type => '1') %>');

View File

@ -8,11 +8,11 @@
}
$(document).ready(function(){
$(".resource-switch").click(function(){
$(".resource-switch").children().removeClass("resource-tab-active");
$(this).children().addClass("resource-tab-active");
});
$(".resource-switch").click(function(){
$(".resource-switch").children().removeClass("resource-tab-active");
$(this).children().addClass("resource-tab-active");
});
});
function remote_search(){
$("#resource_search_form").submit();
}
@ -55,10 +55,10 @@
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '1', :status => 6) %>" class="resource-tab" id="my_resource_list" data-remote="true">我的资源</a>
</li>
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '2', :status => 6) %>" class="resource-tab" id="private_resource_list" data-remote="true">私有资源</a>
</li>
<li class="fl w680 border-bottom h34">&nbsp;</li>
<!--<li class="fl resource-switch">-->
<!--<a href="<%#= user_resource_user_path(@user, :type => '2', :status => 6) %>" class="resource-tab" id="private_resource_list" data-remote="true">申请资源</a>-->
<!--</li>-->
<li class="fl w770 border-bottom h34">&nbsp;</li>
<li class="fr resource-banner-li border-bottom h34">
<div id="user_resource_type_filter">
<%= render :partial => 'user_resource_type_filter' %>

View File

@ -5,5 +5,5 @@ $("#homework_detail_information").html("<%=escape_javascript(render :partial =>
<% else %>
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>@search})%>');
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil, :status => 0}) %>");
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
<% end %>

View File

@ -12,19 +12,16 @@
<div class="weui_cell">
<div class="weui_cell_hd"><label class="weui_label">用户名</label></div>
<div class="weui_cell_bd weui_cell_primary">
<input class="weui_input" autocapitalize="off" type="text" name="username" placeholder="请输入邮箱地址或昵称"/>
</div>
<input class="weui_input" autocapitalize="off" type="text" name="username" placeholder="请输入邮箱/登录名"/> </div>
</div>
<div class="weui_cell">
<div class="weui_cell_hd"><label class="weui_label">密码</label></div>
<div class="weui_cell_bd weui_cell_primary">
<input class="weui_input" type="password" name="password" placeholder="请输密码"/>
<input class="weui_input" type="password" name="password" placeholder="请输密码"/>
</div>
</div>
<input type="hidden" value="<%=@code%>" name="code">
<div class="weui_btn_area">
<a class="weui_btn weui_btn_primary" id="submitForm">确定</a>
</div>

View File

@ -30,6 +30,9 @@
<%= format_time reply.created_on %>
</span>
<div class="ping_disfoot" style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
<span id="reply_praise_count_<%=reply.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
<% if User.current.admin? || reply.user.id == User.current.id || allow_delete%>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
@ -59,4 +62,4 @@
showNormalImage('reply__<%= reply.id %>');
autoUrl('reply_<%= reply.id %>');
});
</script>
</script>

View File

@ -2,7 +2,7 @@ button:
-
type: "view"
name: "最新动态"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/activities?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.course.trustie.net/assets/wechat/app.html#/activities?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
-
type: "click"
name: "意见反馈"
@ -13,8 +13,8 @@ button:
-
type: "view"
name: "进入网站"
url: "https://www.trustie.net/"
url: "https://test.course.trustie.net/"
-
type: "view"
name: "使用手册"
url: "https://www.trustie.net/organizations/1/downloads"
url: "https://test.course.trustie.net/organizations/1/downloads"

View File

@ -0,0 +1,11 @@
class DeleteAnonymousReply < ActiveRecord::Migration
def up
anonymous_replys = OrgDocumentComment.where("organization_id = 23 AND creator_id = 2")
if anonymous_replys
anonymous_replys.destroy_all
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160519070718) do
ActiveRecord::Schema.define(:version => 20160526093715) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -77,6 +77,18 @@ ActiveRecord::Schema.define(:version => 20160519070718) do
t.datetime "updated_at", :null => false
end
create_table "apply_resources", :force => true do |t|
t.integer "status"
t.integer "user_id"
t.integer "attachment_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "container_id"
t.string "container_type"
t.text "content"
t.integer "apply_user_id"
end
create_table "at_messages", :force => true do |t|
t.integer "user_id"
t.integer "at_message_id"
@ -1107,23 +1119,6 @@ ActiveRecord::Schema.define(:version => 20160519070718) do
t.integer "viewed_count", :default => 0
end
create_table "mess", :id => false, :force => true do |t|
t.string "课程名"
t.integer "课程ID", :default => 0, :null => false
t.string "教师姓", :default => "", :null => false
t.string "教师名", :limit => 30, :default => "", :null => false
t.string "主贴名", :default => "", :null => false
t.integer "主贴或回帖ID", :default => 0, :null => false
t.integer "回帖对应主贴ID"
t.integer "帖子点赞数"
t.integer "主贴回复数", :default => 0, :null => false
t.text "主贴或回帖内容"
t.datetime "发帖时间", :null => false
t.integer "发帖或回帖用户ID", :default => 0, :null => false
t.string "发帖或回帖用户姓", :default => "", :null => false
t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false
end
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"

Some files were not shown because too many files have changed in this diff Show More