diff --git a/Gemfile b/Gemfile
index c739e1085..2b12860f0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -17,7 +17,7 @@ gem 'daemons'
gem 'grape', '~> 0.9.0'
gem 'grape-entity'
gem 'seems_rateable', '~> 1.0.13'
-gem "rails", "3.2.13"
+gem "rails", "~> 3.2.13"
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem 'coderay', '~> 1.1.0'
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index f8ca1d0e2..c7aa42b9e 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -24,7 +24,7 @@ class AdminController < ApplicationController
before_filter :require_admin
helper :sort
helper :Users
- helper :Settings
+ helper :Settings,SchoolHelper
include SortHelper
def index
@@ -65,7 +65,17 @@ class AdminController < ApplicationController
#管理员界面课程资源列表
def course_resource_list
- @resource = Attachment.where(:container_type => 'Course')
+
+ if params[:sort] == 'file_size'
+ @resource = Attachment.where(:container_type => 'Course').order("filesize desc")
+ elsif params[:sort] == 'file_upload'
+ @resource = Attachment.where(:container_type => 'Course').order("created_on desc")
+ elsif params[:sort] == 'file_download_times'
+ @resource = Attachment.where(:container_type => 'Course').order("downloads desc")
+ else
+ @resource = Attachment.where(:container_type => 'Course').order("created_on desc")
+ end
+
@resource = paginateHelper @resource,30
@page = (params['page'] || 1).to_i - 1
@@ -76,7 +86,17 @@ class AdminController < ApplicationController
#管理员界面項目资源列表
def project_resource_list
- @pro_resource = Attachment.where(:container_type => 'Project')
+
+ if params[:sort] == 'file_size'
+ @pro_resource = Attachment.where(:container_type => 'Project').order("filesize desc")
+ elsif params[:sort] == 'file_upload'
+ @pro_resource = Attachment.where(:container_type => 'Project').order("created_on desc")
+ elsif params[:sort] == 'file_download_times'
+ @pro_resource = Attachment.where(:container_type => 'Project').order("downloads desc")
+ else
+ @pro_resource = Attachment.where(:container_type => 'Project').order("created_on desc")
+ end
+
@pro_resource = paginateHelper @pro_resource,30
@page = (params['page'] || 1).to_i - 1
@@ -92,9 +112,9 @@ class AdminController < ApplicationController
case params[:format]
when 'xml', 'json'
- @offset, @limit = api_offset_and_limit({:limit => 15})
+ @offset, @limit = api_offset_and_limit({:limit => 50})
else
- @limit = 15#per_page_option
+ @limit = 50 #per_page_option
end
@status = params[:status] || 1
@@ -374,7 +394,13 @@ class AdminController < ApplicationController
#组织
def organization
- @organizations = Organization.all
+ @organizations = Organization.find_by_sql("SELECT * FROM organizations ORDER BY created_at DESC")
+ #@organizations = Organization.all.order("created_at desc")
+ @organization_count = @organizations.count
+ @organization_pages = Paginator.new @organization_count, 30, params['page'] || 1
+ @organizations = paginateHelper @organizations,30
+
+ @page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
@@ -382,17 +408,14 @@ class AdminController < ApplicationController
#学校列表
def schools
- @school_name = params[:school_name]
- if @school_name && @school_name != ''
- @schools = School.where("name like '%#{@school_name}%'")
- elsif @school_name.nil?
- @schools = []
- else @school_name && @school_name == ' '
- @schools = School.where('1=1')
- end
+
+ @schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC")
@school_count = @schools.count
- @school_pages = Paginator.new @school_count, 100, params['page'] || 1
- @schools = paginateHelper @schools,100
+
+ @school_pages = Paginator.new @school_count, 30, params['page'] || 1
+ @schools = paginateHelper @schools,30
+
+ @page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb
index 456306c64..fe16385f4 100644
--- a/app/controllers/at_controller.rb
+++ b/app/controllers/at_controller.rb
@@ -8,6 +8,15 @@ class AtController < ApplicationController
users = find_at_users(params[:type], params[:id])
@users = users
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
+
+ #加上all
+ if @users.size > 0
+ allUser = Struct.new(:id, :name).new
+ allUser.id = @users.map{|u| u.id}.join(",")
+ allUser.name = "all"
+ @users.insert(0, allUser)
+ end
+ @users
end
private
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index b878a14ac..9853b4dc1 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -103,6 +103,9 @@ class AttachmentsController < ApplicationController
direct_download_history
end
else
+ # 记录用户行为
+ record_user_actions(params[:id])
+ # 直接下载历史版本
direct_download_history
end
end
@@ -113,6 +116,14 @@ class AttachmentsController < ApplicationController
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
end
+ def record_user_actions id
+ if params[:action] == "download_history"
+ UserActions.create(:action_id => id, :action_type => "AttachmentHistory", :user_id => User.current.id) unless id.nil?
+ elsif params[:action] == "download"
+ UserActions.create(:action_id => id, :action_type => "Attachment", :user_id => User.current.id) unless id.nil?
+ end
+ end
+
def download
# modify by nwb
# 下载添加权限设置
@@ -135,6 +146,8 @@ class AttachmentsController < ApplicationController
direct_download
end
else
+ # 记录用户行为
+ record_user_actions(params[:id])
direct_download
end
end
@@ -572,6 +585,15 @@ class AttachmentsController < ApplicationController
end
end
+ #找到文件的所有的历史版本及当前版本
+ def attachment_history_download
+ @attachment = Attachment.find(params[:id])
+ @attachment_histories = @attachment.attachment_histories
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
def find_project
@attachment = Attachment.find(params[:id])
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index f06a782bc..dfa30915e 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -7,6 +7,7 @@ class CoursesController < ApplicationController
helper :members
helper :words
helper :attachments
+ helper :files
helper :activity_notifys
before_filter :auth_login1, :only => [:show, :course_activity, :feedback]
@@ -902,10 +903,7 @@ class CoursesController < ApplicationController
end
def feedback
- @course.journals_for_messages.each do |messages|
- query = messages.course_messages.where("user_id = ?", User.current.id)
- query.update_all(:viewed => true);
- end
+ CourseMessage.where("user_id = ? and course_id = ?", User.current, @course.id).update_all(:viewed => true)
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
page = params[:page]
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index b6ac99f11..7ae1b85f8 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -207,8 +207,7 @@ class FilesController < ApplicationController
sort = "created_on DESC"
end
if keywords != "%%"
- resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").
- reorder(sort)
+ resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort)
else
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort)
end
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index eb78c4c5b..44f0d15f4 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -118,6 +118,9 @@ class IssuesController < ApplicationController
end
def show
+ # 打开编辑内容
+ @is_edit = true unless params[:edit].nil?
+
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
query.update_attribute(:viewed, true) unless query.nil?
@@ -387,6 +390,9 @@ class IssuesController < ApplicationController
end
def destroy
+ # 增加删除页面类型,如果是个人主页,则返回该主页,项目动态则返回项目动态页眉
+ page_classify = params[:page_classify] unless params[:page_classify].nil?
+ page_id = params[:page_id] unless params[:page_id].nil?
@hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
if @hours > 0
case params[:todo]
@@ -415,7 +421,11 @@ class IssuesController < ApplicationController
end
end
respond_to do |format|
- format.html { redirect_back_or_default _project_issues_path(@project) }
+ if page_classify
+ format.html { redirect_back_or_default _project_issues_path(@project, page_classify, page_id) }
+ else
+ format.html { redirect_back_or_default _project_issues_path(@project) }
+ end
format.api { render_api_ok }
end
end
diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb
index f250b46de..d1a8b23dd 100644
--- a/app/controllers/org_document_comments_controller.rb
+++ b/app/controllers/org_document_comments_controller.rb
@@ -1,6 +1,6 @@
class OrgDocumentCommentsController < ApplicationController
before_filter :find_organization, :only => [:new, :create, :show, :index]
- helper :attachments
+ helper :attachments,:organizations
layout 'base_org'
def new
diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb
index 9337c5fd2..ba4c1f18f 100644
--- a/app/controllers/org_subfields_controller.rb
+++ b/app/controllers/org_subfields_controller.rb
@@ -5,9 +5,8 @@ class OrgSubfieldsController < ApplicationController
def create
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
@res = true
- @subfield = OrgSubfield.create(:name => params[:name])
@organization = Organization.find(params[:organization_id])
- @organization.org_subfields << @subfield
+ @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1)
if !params[:sub_dir].blank?
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
@@ -15,7 +14,7 @@ class OrgSubfieldsController < ApplicationController
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir])
end
end
- @subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
+ @subfield.update_attributes(:field_type => params[:field_type])
else
@res = false
end
@@ -125,6 +124,12 @@ class OrgSubfieldsController < ApplicationController
end
end
+ def update_priority
+ @org_subfield = OrgSubfield.find(params[:id])
+ @org_subfield.update_attribute(:priority, params[:priority].to_i)
+ @organization = @org_subfield.organization
+ end
+
def show_attachments obj
@attachments = []
obj.each do |container|
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 711663c3d..239253d82 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -317,7 +317,7 @@ class OrganizationsController < ApplicationController
@organization = Organization.find(params[:id])
admins = User.where("admin=1")
admins.each do |admin|
- OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain])
+ OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase)
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 05c80a9fc..2ced977be 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -300,66 +300,27 @@ class ProjectsController < ApplicationController
end
# 统计访问量
@project.update_attribute(:visits, @project.visits.to_i + 1)
-=begin
- cond = @project.project_condition(Setting.display_subprojects_issues?)
- has = {
- "show_issues" => true ,
- "show_files" => true,
- "show_documents" => true,
- "show_messages" => true,
- "show_news" => true,
- "show_bids" => true,
- "show_contests" => true,
- "show_wiki_edits"=>true,
- "show_journals_for_messages" => true
- }
- # 读取项目默认展示的动态时间天数
- @days = Setting.activity_days_default.to_i
- @date_to ||= Date.today + 1
- # 时间跨度不能太大,不然很慢,所以删掉了-1.years
- @date_from = @date_to - @days
- @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
-=end
-
@author = params[:user_id].blank? ? nil : User.active.find(params[:user_id])
- # 决定显示所用用户或单个用户活动
-=begin
- @activity = Redmine::Activity::Fetcher.new(User.current,
- :project => @project,
- :with_subprojects => @with_subprojects,
- :author => @author)
- @activity.scope_select {|t| !has["show_#{t}"].nil?}
-=end
-
@page = params[:page] ? params[:page].to_i + 1 : 0
# 根据私密性,取出符合条件的所有数据
if User.current.member_of?(@project) || User.current.admin?
case params[:type]
when nil
- @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo')",@project).order("updated_at desc").limit(10).offset(@page * 10)
+ @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo', 'Attachment')",@project).order("updated_at desc").limit(10).offset(@page * 10)
when 'issue'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10)
when 'news'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10)
when 'message'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10)
+ when 'attachment'
+ @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'",@project).order("updated_at desc").limit(10).offset(@page * 10)
end
-
- #events = @activity.events(@date_from, @date_to)
else
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
= ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc")
.page(params['page'|| 1]).per(10);
- # @events = @activity.events(@date_from, @date_to, :is_public => 1)
end
-
-=begin
- @events_pages = Paginator.new events.count, 10, params['page']
- # 总的数据中取出某一页
- events = events.slice(@events_pages.offset,10)
- # 按天分组
- @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
-=end
boards = @project.boards.includes(:last_message => :author).all
@topic_count = @project.boards.count
# 根据对应的请求,返回对应的数据
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 79ecd6932..9039fd041 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -110,8 +110,7 @@ class UsersController < ApplicationController
elsif @user != User.current && !User.current.admin?
return render_403
end
- # 初始化/更新 点击按钮时间
- # 24小时内显示系统消息
+ # 初始化/更新 点击按钮时间, 24小时内显示系统消息
update_onclick_time
# 全部设为已读
if params[:viewed] == "all"
@@ -190,17 +189,19 @@ class UsersController < ApplicationController
# 消息设置为已读
def update_message_viewed(user)
- course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0)
- forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
- user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
- forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
- org_querys = OrgMessage.where("user_id=? and viewed=0", user)
if User.current.id == @user.id
- course_querys.update_all(:viewed => true)
- forge_querys.update_all(:viewed => true)
- user_querys.update_all(:viewed => true)
- forum_querys.update_all(:viewed => true)
- org_querys.update_all(:viewed => true)
+ course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0)
+ forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
+ user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
+ forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
+ org_querys = OrgMessage.where("user_id=? and viewed=0", user)
+ at_querys = AtMessage.where("user_id=? and viewed=0", user)
+ course_querys.update_all(:viewed => true) unless course_querys.nil?
+ forge_querys.update_all(:viewed => true) unless forge_querys.nil?
+ user_querys.update_all(:viewed => true) unless user_querys.nil?
+ forum_querys.update_all(:viewed => true) unless forum_querys.nil?
+ org_querys.update_all(:viewed => true) unless org_querys.nil?
+ at_querys.update_all(:viewed => true) unless at_querys.nil?
end
end
@@ -572,7 +573,7 @@ class UsersController < ApplicationController
@r_sort = @b_sort == "desc" ? "asc" : "desc"
@user = User.current
search = params[:name].to_s.strip.downcase
- type_ids = params[:property]=="" ? "(1, 2, 3)" : "(" + params[:property] + ")"
+ type_ids = params[:property]=="" || params[:property].nil? ? "(1, 2, 3)" : "(" + params[:property] + ")"
if(params[:type].blank? || params[:type] == "1") #全部
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@@ -840,20 +841,33 @@ class UsersController < ApplicationController
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
- if(params[:type].blank? || params[:type] == "1") #全部
+ if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
- elsif params[:type] == "2" # 课程资源
- @attachments = get_course_resources(params[:id], user_course_ids)
- elsif params[:type] == "3" # 项目资源
- @attachments = get_project_resources(params[:id], user_project_ids)
- elsif params[:type] == "4" #附件
- @attachments = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
+ if params[:status] == "2"
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources(params[:id], @order, @score)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources(params[:id], @order, @score)
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
+ end
elsif params[:type] == "6" # 公共资源
- # 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_public(@order, @score)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_public(@order, @score)
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
+ end
end
@type = params[:type]
@limit = 7
@@ -963,12 +977,7 @@ class UsersController < ApplicationController
return
end
# 自己访问自己的页面才更新消息状态
- if User.current == @user
- journals_messages = UserFeedbackMessage.where("user_id =? and journals_for_message_type =? and viewed =?", User.current.id, "JournalsForMessage", 0)
- journals_messages.each do |journals_message|
- journals_message.update_attributes(:viewed => true)
- end
- end
+ UserFeedbackMessage.where("user_id =? and viewed =? and journals_for_message_type =? ", User.current.id, 0, "JournalsForMessage").update_all(:viewed => true)
# end
@page = params[:page] ? params[:page].to_i + 1 : 0
if params[:type].present?
@@ -1570,43 +1579,39 @@ class UsersController < ApplicationController
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
@user = User.find(params[:id])
- #@user.save_attachments(params[:attachments],User.current)
- # Container_type为Principal
+ # 保存文件
attach = Attachment.attach_filesex_public(@user, params[:attachments], params[:attachment_type], is_public = true)
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
+ user_course_ids = User.current.courses.map { |c| c.id}
+ user_project_ids = User.current.projects.map {|p| p.id}
+ # user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- if params[:status] == 2
- @attachments = get_course_resources(params[:id], user_course_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources(params[:id], user_project_ids)
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources params[:id]
+ @attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources params[:id]
+ @attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
- elsif params[:type] == "2" # 课程资源
- @attachments = get_course_resources(params[:id], user_course_ids)
- elsif params[:type] == "3" # 项目资源
- @attachments = get_project_resources(params[:id], user_project_ids)
- elsif params[:type] == "4" #附件
- @attachments = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
- @attachments = get_course_resources_public( user_course_ids)
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources_public(user_project_ids)
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources_public
+ @attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources_public
+ @attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@@ -1626,49 +1631,44 @@ class UsersController < ApplicationController
# 删除用户资源,分为批量删除 和 单个删除,只能删除自己上传的资源
def user_resource_delete
if params[:resource_id].present?
- Attachment.where("author_id = #{User.current.id}").delete(params[:resource_id])
+ Attachment.where("author_id =? and id =?", User.current.id, params[:resource_id]).first.destroy
elsif params[:checkbox1].present?
params[:checkbox1].each do |id|
- Attachment.where("author_id = #{User.current.id}").delete(id)
+ Attachment.where("author_id =? and id =?", User.current.id, id).first.destroy
end
end
+ @user = User.current
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- if params[:status] == 2
- @attachments = get_course_resources(params[:id], user_course_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources(params[:id], user_project_ids)
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources params[:id]
+ @attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources params[:id]
+ @attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
- elsif params[:type] == "2" # 课程资源
- @attachments = get_course_resources(params[:id], user_course_ids)
- elsif params[:type] == "3" # 项目资源
- @attachments = get_project_resources(params[:id], user_project_ids)
- elsif params[:type] == "4" #附件
- @attachments = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
- @attachments = get_course_resources_public( user_course_ids)
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources_public(user_project_ids)
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources_public
+ @attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources_public
+ @attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@@ -1691,10 +1691,10 @@ class UsersController < ApplicationController
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search)
- .select { |course| @user.allowed_to?(:as_teacher,course)}
+ .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
else
@course = @user.courses
- .select { |course| @user.allowed_to?(:as_teacher,course)}
+ .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
end
@search = params[:search]
#这里仅仅是传递需要发送的资源id
@@ -1712,7 +1712,7 @@ class UsersController < ApplicationController
search = "%#{params[:search].to_s.strip.downcase}%"
@projects = @user.projects.where(" #{Project.table_name}.id = #{params[:search].to_i } or #{Project.table_name}.name like :p",:p=>search)
else
- @projects = @user.projects
+ @projects = @user.projects.visible
end
@search = params[:search]
#这里仅仅是传递需要发送的资源id
@@ -2356,59 +2356,125 @@ class UsersController < ApplicationController
end
# 获取公共资源
- def get_public_resources user_course_ids, user_project_ids
- 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("created_on desc")
+ def get_public_resources user_course_ids, user_project_ids, 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
+
+ # 获取公共资源搜索
+ def get_public_resources_search user_course_ids, user_project_ids, order, score, search
+ attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的资源
- def get_my_resources author_id, user_course_ids, user_project_ids
+ def get_my_resources author_id, user_course_ids, user_project_ids, order, score
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','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 is_publish = 1 and container_id is not null)" +
- "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("created_on desc")
+ "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
+
+ # 获取我的资源查询结果
+ def get_my_resources_search (author_id, user_course_ids, user_project_ids, order, score, search)
+ @attachments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','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 is_publish = 1 and container_id is not null)" +
+ "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)) and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的课程资源
- def get_course_resources author_id, user_course_ids
- attchments = Attachment.where("(author_id = #{author_id} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
+ 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(',')})
+ and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
- # 获取公共资源课程
- def get_course_resources_public user_course_ids
- attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("created_on desc")
+ # 获取我的课程资源中搜索结果
+ def get_course_resources_search author_id, user_course_ids, order, score, search
+ 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(',')})
+ and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取公共资源中课程资源
+ 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 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 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
- attchments = Attachment.where("(author_id = #{author_id} and container_type = 'Project') or (container_type = 'Course' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
+ 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(',')})
+ and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取我的项目资源搜索
+ def get_project_resources_search author_id, user_project_ids, order, score, search
+ 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(',')})
+ and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源的项目资源
- def get_project_resources_public user_project_ids
- attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("created_on desc")
+ def get_project_resources_public user_project_ids, 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 is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我上传的附件
- def get_attch_resources author_id
- attchments = Attachment.where("author_id = #{author_id} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
+ def get_attch_resources author_id, order, score
+ attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
+ 'Document','Message','News','StudentWorkScore','HomewCommon'))").order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取我上传的附件搜索结果
+ def get_attch_resources_search author_id, order, score, search
+ attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
+ 'Document','Message','News','StudentWorkScore','HomewCommon')) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中我上传的附件
- def get_attch_resources_public
- attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal') and container_id is not null and is_public =1").order("created_on desc")
+ 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 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 is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
- def get_principal_resources author_id
- attchments = Attachment.where("author_id = #{author_id} and container_type = 'Principal'").order("created_on desc")
+ def get_principal_resources author_id, order, score
+ attchments = Attachment.where("author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal'").order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取我的用户类型资源搜索
+ def get_principal_resources_search author_id, order, score, search
+ attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
- def get_principal_resources_public
- attchments = Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").order("created_on desc")
+ def get_principal_resources_public order, score
+ attchments = Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").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 is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 资源库 分为全部 课程资源 项目资源 附件
def user_resource
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
@@ -2420,37 +2486,29 @@ class UsersController < ApplicationController
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
- @attachments = get_course_resources(params[:id], user_course_ids)
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources(params[:id], user_project_ids)
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources params[:id]
+ @attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources params[:id]
+ @attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
- elsif params[:type] == "2" # 课程资源
- @attachments = get_course_resources(params[:id], user_course_ids)
- elsif params[:type] == "3" # 项目资源
- @attachments = get_project_resources(params[:id], user_project_ids)
- elsif params[:type] == "4" #附件
- @attachments = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
- @attachments = get_course_resources_public( user_course_ids)
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources_public(user_project_ids)
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources_public
+ @attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources_public
+ @attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@@ -2475,16 +2533,21 @@ class UsersController < ApplicationController
render_403
return
end
+ @resource_id = params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id]
+ @resource_type = params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"
+ @user = User.find(params[:id])
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
user_course_ids = User.current.courses.map { |c| c.id}
- user_project_ids = User.current.projects.map {|p| p.id}
- # user_org_ids = User.current.organizations.map {|o| o.id}
+ user_project_ids = User.current.projects.map {|p| p.id} # user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
+ @status = params[:status]
@type = params[:type]
@limit = 10
@is_remote = true
@@ -2500,26 +2563,28 @@ class UsersController < ApplicationController
end
def import_resources_search
- search = "%#{params[:search].strip.downcase}%"
+ @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[:name].nil? ? " " : params[:name]
+ search = "%#{@switch_search.strip.downcase}%"
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
return
end
- user_course_ids = User.current.courses.map { |c| c.id}
- user_project_ids = User.current.projects.map {|p| p.id}
- # user_org_ids = User.current.organizations.map {|o| o.id}
+ @resource_id = params[:mul_id]
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
- @attachments = Attachment.where("((author_id = #{params[:id]} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','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 is_publish = 1 and container_id is not null)" +
- "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)) and (filename like :p)" ,:p => search).order("created_on desc")
+ @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search)
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
end
@type = params[:type]
@limit = 10
@@ -2528,10 +2593,10 @@ class UsersController < ApplicationController
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
- @attachments = paginateHelper @attachments,10
+ @attachments = paginateHelper @attachments, 10
respond_to do |format|
format.js
- format.html {render :layout => 'new_base'}
+ # format.html {render :layout => 'new_base'}
end
end
@@ -2589,55 +2654,41 @@ class UsersController < ApplicationController
# 根据资源关键字进行搜索
def resource_search
- search = "%#{params[:search].strip.downcase}%"
- user_course_ids = User.current.courses.map { |c| c.id}
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "desc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
+ @user = User.current
+ @switch_search = params[:search].nil? ? " " : params[:search]
+ search = "%#{@switch_search.strip.downcase}%"
+ user_course_ids = User.current.courses.map {|c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
- # user_org_ids = User.current.organizations.map {|o| o.id}
- if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
- if User.current.id.to_i == params[:id].to_i
-
- @attachments = Attachment.where("((author_id = #{params[:id]} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','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 is_publish = 1 and container_id is not null)" +
- "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)) and (filename like :p)" ,:p => search).order("created_on desc")
+ if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') # 全部
+ if params[:status] == "2"
+ @attachments = get_course_resources_search(params[:id], user_course_ids, @order, @score, search)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_search(params[:id], user_project_ids, @order, @score, search)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_search(params[:id], @order, @score, search)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_search(params[:id], @order, @score, search)
else
- user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
- @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type in" +
- " ('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon'))"+
- " or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )" +
- " and (filename like :p) ",:p=>search).order("created_on desc")
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search)
end
- elsif params[:type] == "2" #课程资源
- if User.current.id.to_i == params[:id].to_i
- user_course_ids = User.current.courses.map { |c| 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 :p) ",:p=>search).order("created_on desc")
+ elsif params[:type] == "6" # 公共资源
+ if params[:status] == "2"
+ @attachments = get_course_resources_public_search(user_course_ids, @order, @score, search)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_public_search(user_project_ids, @order, @score, search)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_public_search(@order, @score, search)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_public_search(@order, @score, search)
else
- user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
- @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type = 'Course') "+
- "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )"+
- " and (filename like :p) ",:p=>search).order("created_on desc")
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
end
- elsif params[:type] == "3" #项目资源
- if User.current.id.to_i == params[:id].to_i
- @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like :p)",:p=>search).order("created_on desc")
- else
- @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' and (filename like :p) ",:p=>search).order("created_on desc")
- end
- elsif params[:type] == "4" #附件
- if User.current.id.to_i == params[:id].to_i
- @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like :p)",:p=>search).order("created_on desc")
- else
- @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like :p)",:p=>search).order("created_on desc")
- end
- elsif params[:type] == "5" #用户资源
- if User.current.id.to_i == params[:id].to_i
- @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like :p)",:p=>search).order("created_on desc")
- else
- @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Principal' and (filename like :p)",:p=>search).order("created_on desc")
- end
- elsif params[:type] == "6" #全部资源
- # 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("created_on desc")
end
+ @status = params[:status]
@type = params[:type]
@limit = 25
@is_remote = true
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index cc093ad7a..3a5cdb1a1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -370,7 +370,7 @@ module ApplicationHelper
def link_to_short_attachment(attachment, options={})
length = options[:length] ? options[:length]:23
text = h(truncate(options.delete(:text) || attachment.filename, length: length, omission: '...'))
- route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
+ route_method = options.delete(:download) ? :download_named_attachment_url_without_domain : :named_attachment_url_without_domain
html_options = options.slice!(:only_path)
url = send(route_method, attachment, attachment.filename, options)
link_to text, url, html_options
@@ -841,7 +841,7 @@ module ApplicationHelper
def project_member_check_box_tags_ex name, principals
s = ''
principals.each do |principal|
- s << "
#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id)} \n"
+ s << "#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_url_in_org( principal.id)} \n"
end
s.html_safe
end
@@ -2069,7 +2069,7 @@ module ApplicationHelper
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)
- candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1)
+ 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
@@ -2582,9 +2582,9 @@ module ApplicationHelper
elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
- link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
+ link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
when 2
- link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
+ link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
@@ -2631,7 +2631,7 @@ module ApplicationHelper
def user_for_homework_common homework,is_teacher
if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量
- link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
+ link_to "作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
@@ -2639,30 +2639,30 @@ module ApplicationHelper
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
else
- link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
+ link_to "提交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
end
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
else
- link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
+ link_to "补交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
- link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
+ link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
- link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
+ link_to "查看作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
- link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
+ link_to "修改作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
- link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
+ link_to "修改作品(#{homework.student_works.count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
else
- link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
+ link_to "查看作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
end
end
end
else
- link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
+ link_to "作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
end
end
@@ -2943,37 +2943,104 @@ int main(int argc, char** argv){
end
def user_url_in_org(user_id)
- if Rails.env.development?
- return "http://localhost:3000/users/" + user_id.to_s
- else
- return "https://" + Setting.host_name + "/users/" + user_id.to_s
- end
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s
+end
+
+def project_issues_url_in_org(project_id)
+ Setting.protocol + "://" + Setting.host_name + "/projects/" + project_id.to_s + "/issues"
+end
+
+def issue_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/issues/" + id.to_s
+end
+
+def project_boards_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/projects/" + id.to_s + "/boards"
+end
+
+def board_message_url_in_org(board_id, message_id)
+ Setting.protocol + "://" + Setting.host_name + "/boards/" + board_id.to_s + "/topics/" + message_id.to_s
+end
+
+def project_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/projects/" + id.to_s
+end
+
+def homework_common_index_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
+end
+
+def student_work_index_url_in_org(homework_id)
+ Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
+end
+
+def course_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s
+end
+
+def user_watchlist_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + id.to_s + "/user_watchlist"
+end
+
+def user_fanslist_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + id.to_s + "/user_fanslist"
+end
+
+def user_blogs_url_in_org(user_id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/blogs"
+end
+
+def feedback_url_in_org(user_id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/user_newfeedback"
+end
+
+def user_activities_url_in_org(user_id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/user_activities"
+end
+
+def course_news_index_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s + "/news"
+end
+
+def news_url_in_org(news_id)
+ Setting.protocol + "://" + Setting.host_name + "/news/" + news_id.to_s
+end
+
+def course_boards_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s + "/boards"
end
def logout_url_without_domain
- if Rails.env.development?
- return "http://localhost:3000/logout"
- else
- return "https://" + Setting.host_name + "/logout"
- end
+ Setting.protocol + "://" + Setting.host_name + "/logout"
end
def signin_url_without_domain
- if Rails.env.development?
- return "http://localhost:3000/login?login=true"
- elsif Rails.env.test?
- return "https://test.forge.trustie.net/login?login=true"
- else
- return "https://www.trustie.net/login?login=true"
- end
+ Setting.protocol + "://" + Setting.host_name + "/login?login=true"
end
def register_url_without_domain
- if Rails.env.development?
- return "http://localhost:3000/login?login=false"
- elsif Rails.env.test?
- return "https://test.forge.trustie.net/login?login=false"
- else
- return "https://www.trustie.net/login?login=false"
- end
+ Setting.protocol + "://" + Setting.host_name + "/login?login=false"
end
+
+def new_student_work_url_without_domain(homework_id)
+ Setting.protocol + "://" + Setting.host_name + "/student_work/new?homework=" + homework_id.to_s
+end
+
+def edit_student_work_url_without_domain(homework_id)
+ Setting.protocol + "://" + Setting.host_name + "/student_work/" + homework_id.to_s + "/edit"
+end
+
+def download_named_attachment_url_without_domain(id, filename, option={})
+ attachment_id = (Attachment === id ? id.id : id)
+ Setting.protocol + "://" + Setting.host_name + "/attachments/download/" + attachment_id.to_s + "/" + filename
+end
+
+def named_attachment_url_without_domain(id, filename, option={})
+ attachment_id = (Attachment === id ? id.id : id)
+ Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/" + filename
+end
+#判断是否为默认的组织栏目
+def is_default_field? field
+ (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default'
+end
+
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index d98de27f6..37c7deb4c 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -865,7 +865,7 @@ module CoursesHelper
# 学生按作业总分排序,取前8个
def hero_homework_score(course, score_sort_by)
sql_select = "SELECT members.*,(
- SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
+ SELECT SUM(IF(student_works.final_score is null,null,IF(student_works.final_score = 0, 0, student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{course.id}
diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb
index 15c809964..8d08f22da 100644
--- a/app/helpers/routes_helper.rb
+++ b/app/helpers/routes_helper.rb
@@ -22,10 +22,18 @@ module RoutesHelper
# Returns the path to project issues or to the cross-project
# issue list if project is nil
def _project_issues_path(project, *args)
- if project
- project_issues_path(project, *args)
+ if args[0].to_s.include? '_page'
+ if args[0].to_s == "user_page"
+ user_activities_path(args[1].to_i)
+ else
+ project_path(project)
+ end
else
- issues_path(*args)
+ if project
+ project_issues_path(project, *args)
+ else
+ issues_path(*args)
+ end
end
end
diff --git a/app/helpers/school_helper.rb b/app/helpers/school_helper.rb
index 0528cb7ac..075d2b039 100644
--- a/app/helpers/school_helper.rb
+++ b/app/helpers/school_helper.rb
@@ -1,2 +1,15 @@
module SchoolHelper
+ def schoolMember_num school
+ count = student_num(school) + teacher_num(school)
+ count.to_s
+ end
+
+ def student_num school
+ UserExtensions.find_by_sql("SELECT * FROM user_extensions WHERE occupation = '#{school.name}' AND identity = '1'").count
+ end
+
+ def teacher_num school
+ UserExtensions.find_by_sql("SELECT * FROM user_extensions AS ue, schools AS s WHERE ue.school_id = s.id AND s.name = '#{school.name}' AND ue.identity = '0'").count
+ end
+
end
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 1cc0d3b7a..714da9920 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -90,8 +90,8 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
- after_save :act_as_course_activity
- after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
+ after_save :act_as_course_activity,:act_as_forge_activity
+ after_create :office_conver, :be_user_score,:create_attachment_ealasticsearch_index
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score
@@ -606,7 +606,7 @@ class Attachment < ActiveRecord::Base
# Author lizanle
# Description 上传该项目的文档资料也要保存一份在公共表中
def act_as_forge_activity
- if self.container_type == 'Project'
+ if self.container_type == 'Project' && self.forge_acts.empty?
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.container_id)
end
diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb
index 94eb097b8..96ec6e355 100644
--- a/app/models/course_activity.rb
+++ b/app/models/course_activity.rb
@@ -5,7 +5,7 @@ class CourseActivity < ActiveRecord::Base
belongs_to :course
belongs_to :user
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
- after_save :add_user_activity, :add_course_activity
+ after_save :add_user_activity, :add_org_activity
after_create :add_course_lead
before_destroy :destroy_user_activity, :destroy_org_activity
@@ -31,14 +31,16 @@ class CourseActivity < ActiveRecord::Base
end
end
- def add_course_activity
+ def add_org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'").first
if org_activity
+ org_activity.updated_at = self.updated_at
org_activity.save
else
if self.course_act_type == 'Message' && !self.course_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.course_act.parent.id}").first
org_activity.created_at = self.created_at
+ org_activity.updated_at = self.updated_at
org_activity.save
else
OrgActivity.create(:user_id => self.user_id,
@@ -64,16 +66,16 @@ class CourseActivity < ActiveRecord::Base
# 发布新课导语
# 导语要放置在课程创建信息之后
- # 导语
def add_course_lead
- if self.course_act_type == "Course"
+ # 避免空数据迁移报错问题
+ if self.course_act_type == "Course" and Message.where("id=12440").any?
lead_message = Message.find(12440)
name = lead_message.subject
content = lead_message.content
# message的status状态为0为正常,为1表示创建课程时发送的message
# author_id 默认为课程使者创建
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => 1 , :sticky => true, :status => true )
- # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直
+ # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一致
message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first
end
end
diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb
index c98c5475b..c044392a0 100644
--- a/app/models/forge_activity.rb
+++ b/app/models/forge_activity.rb
@@ -48,7 +48,7 @@ class ForgeActivity < ActiveRecord::Base
def add_org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
if org_activity
- org_activity.created_at = self.created_at
+ org_activity.updated_at = self.updated_at
org_activity.save
else
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
diff --git a/app/models/issue.rb b/app/models/issue.rb
index c82f6f0be..0d72407ba 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -84,7 +84,9 @@ class Issue < ActiveRecord::Base
attr_reader :current_journal
# fq
- after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message, :add_issues_count
+ after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message,
+ act_as_at_message(:description, :author_id), :add_issues_count
+
after_update :be_user_score,:update_activity
after_destroy :down_user_score, :decrease_issues_count
# after_create :be_user_score
@@ -165,12 +167,12 @@ class Issue < ActiveRecord::Base
end
# at 功能添加消息提醒
- def act_as_at_message
- users = self.description.scan //m
- users && users.flatten.uniq.each do |uid|
- self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
- end
- end
+ # def act_as_at_message
+ # users = self.description.scan //m
+ # users && users.flatten.uniq.each do |uid|
+ # self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
+ # end
+ # end
# 创建issue的时候,issues_count加1
def add_issues_count
diff --git a/app/models/journal.rb b/app/models/journal.rb
index c37b8d2c5..fd67e8a62 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -51,7 +51,7 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes, :add_journals_count
# fq
- after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
+ after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id)
after_create :update_issue_time
# end
#after_destroy :down_user_score
@@ -186,13 +186,6 @@ class Journal < ActiveRecord::Base
end
end
- def act_as_at_message
- users = self.notes.scan //m
- users && users.flatten.uniq.each do |uid|
- self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id)
- end
- end
-
# 更新用户分数 -by zjc
def be_user_score
#新建了缺陷留言且留言不为空,不为空白
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index dae779b65..fa5beb813 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -68,7 +68,9 @@ class JournalsForMessage < ActiveRecord::Base
has_many :at_messages, as: :at_message, dependent: :destroy
validates :notes, presence: true, if: :is_homework_jour?
- after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score
+ after_create :act_as_activity, :act_as_course_activity, :act_as_course_message,
+ act_as_at_message(:notes, :user_id), :act_as_user_feedback_message,
+ :act_as_principal_activity, :act_as_student_score
after_create :reset_counters!
#after_update :update_activity
after_destroy :reset_counters!
@@ -253,12 +255,7 @@ class JournalsForMessage < ActiveRecord::Base
end
end
- def act_as_at_message
- users = self.notes.scan //m
- users && users.flatten.uniq.each do |uid|
- self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id)
- end
- end
+
# 用户留言消息通知
def act_as_user_feedback_message
# 主留言
diff --git a/app/models/message.rb b/app/models/message.rb
index 0ddc6f8e0..d697db236 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -81,7 +81,8 @@ class Message < ActiveRecord::Base
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_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
+ after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity,
+ :act_as_system_message, :send_mail, :act_as_student_score, act_as_at_message(:content, :author_id)
#before_save :be_user_score
scope :visible, lambda {|*args|
@@ -287,13 +288,6 @@ class Message < ActiveRecord::Base
end
end
- def act_as_at_message
- users = self.content.scan //m
- users && users.flatten.uniq.each do |uid|
- self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
- end
- end
-
#更新用户分数 -by zjc
def be_user_score
#新建message且无parent的为发帖
diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb
index c62cbf4f8..8cec49686 100644
--- a/app/models/org_subfield.rb
+++ b/app/models/org_subfield.rb
@@ -9,6 +9,7 @@ class OrgSubfield < ActiveRecord::Base
has_many :news, :dependent => :destroy
acts_as_attachable
after_create :create_board_sync
+ after_destroy :update_priority
# 创建资源栏目讨论区
def create_board_sync
@board = self.boards.build
@@ -25,4 +26,11 @@ class OrgSubfield < ActiveRecord::Base
def project
end
+
+ def update_priority
+ OrgSubfield.where("organization_id=? and priority>?", self.organization_id, self.priority).each do |field|
+ field.decrement(:priority)
+ field.save
+ end
+ end
end
\ No newline at end of file
diff --git a/app/models/organization.rb b/app/models/organization.rb
index fcb777fb6..248783a26 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -16,8 +16,8 @@ class Organization < ActiveRecord::Base
end
def add_default_subfields
- OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default')
- OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default')
- OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default')
+ OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1)
+ OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2)
+ OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3)
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index a74c20751..78d823ea7 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -116,7 +116,7 @@ class User < Principal
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
has_one :blog, :class_name => 'Blog', :foreign_key => "author_id"
- has_many :org_document_comments, :dependent =>:destroy
+ has_many :org_document_comments, :dependent =>:destroy, :foreign_key => "creator_id"
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
belongs_to :auth_source
has_many :org_members
@@ -822,6 +822,9 @@ class User < Principal
end
def member_of_org?(org)
+ if !self.logged?
+ return false
+ end
OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count > 0
end
@@ -1064,6 +1067,16 @@ class User < Principal
anonymous_user
end
+ # refactor User model find function,
+ # return anonymous user when can not find user id = user_id
+ def self.find (*args, &block)
+ begin
+ super
+ rescue
+ self.anonymous
+ end
+ # super
+ end
# Salts all existing unsalted passwords
# It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))
# This method is used in the SaltPasswords migration and is to be kept as is
diff --git a/app/models/user_actions.rb b/app/models/user_actions.rb
new file mode 100644
index 000000000..de2388911
--- /dev/null
+++ b/app/models/user_actions.rb
@@ -0,0 +1,4 @@
+class UserActions < ActiveRecord::Base
+ attr_accessible :action_id, :action_type, :user_id
+ has_many :users
+end
diff --git a/app/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb
index 4316555f7..2e83a96aa 100644
--- a/app/views/admin/course_resource_list.html.erb
+++ b/app/views/admin/course_resource_list.html.erb
@@ -10,16 +10,16 @@
资源名称
- 资源大小
+ <%= link_to "资源大小",admin_course_resource_list_path(:sort => "file_size") %>
资源类型
- 上传时间
+ <%= link_to "上传时间",admin_course_resource_list_path(:sort => "file_upload") %>
- 下载次数
+ <%= link_to "下载次数",admin_course_resource_list_path(:sort => "file_download_times") %>
上传者
@@ -61,4 +61,6 @@
\ No newline at end of file
+
+
+<% html_title(l(:label_course_resource_list)) -%>
\ No newline at end of file
diff --git a/app/views/admin/excellent_courses.html.erb b/app/views/admin/excellent_courses.html.erb
index e21ba32aa..59426455a 100644
--- a/app/views/admin/excellent_courses.html.erb
+++ b/app/views/admin/excellent_courses.html.erb
@@ -72,4 +72,6 @@
<% end %>
-
\ No newline at end of file
+
+
+<% html_title(l(:label_excellent_courses_list)) -%>
\ No newline at end of file
diff --git a/app/views/admin/latest_login_teachers.html.erb b/app/views/admin/latest_login_teachers.html.erb
index 05f20ba8d..c1889bce1 100644
--- a/app/views/admin/latest_login_teachers.html.erb
+++ b/app/views/admin/latest_login_teachers.html.erb
@@ -45,6 +45,9 @@
用户身份
+
+ 用户单位
+
@@ -59,7 +62,7 @@
<%=format_time(teacher.last_login_on) %>
- <%=teacher.user_id %>
+ <%= teacher.user_id %>
<%= teacher.login%><% else %><%=teacher.try(:realname) %><% end %>'>
<% if teacher.try(:realname) == ' '%>
@@ -69,11 +72,14 @@
<% end %>
- <%=link_to(teacher.login, user_path(teacher.user_id)) %>
+ <%= link_to(teacher.login, user_path(teacher.user_id)) %>
老师
+
+ <%= teacher.school_id.nil? ? "" : (School.find teacher.school_id).try(:name) %>
+
<% end %>
@@ -82,3 +88,5 @@
+
+<% html_title(l(:label_latest_login_teacher_list)) -%>
\ No newline at end of file
diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb
index 17680a8c8..a9e8e2feb 100644
--- a/app/views/admin/latest_login_users.html.erb
+++ b/app/views/admin/latest_login_users.html.erb
@@ -46,6 +46,9 @@
用户身份
+
+ 用户单位
+
@@ -88,6 +91,17 @@
<% end %>
<% end%>
+
+ <% unless user.user_extensions.nil? %>
+ <% if user.user_extensions.identity.to_i == 0 %>
+
+ <% occupation = user.user_extensions.school_id.nil? ? "" : (School.where("id =?", user.user_extensions.school_id)).first.try(:name) %>
+ <%= occupation.blank? ? user.user_extensions.occupation : occupation %>
+ <% else %>
+ <%= user.user_extensions.occupation %>
+ <% end %>
+ <% end %>
+
<% end %>
diff --git a/app/views/admin/organization.html.erb b/app/views/admin/organization.html.erb
index 582b8b44a..02b897f80 100644
--- a/app/views/admin/organization.html.erb
+++ b/app/views/admin/organization.html.erb
@@ -40,4 +40,8 @@
-<% html_title(l(:label_project_plural)) -%>
+
+ <%= pagination_links_full @organization_pages, @organization_count ,:per_page_links => true, :remote => false, :flag => true %>
+
+
+
diff --git a/app/views/admin/project_resource_list.html.erb b/app/views/admin/project_resource_list.html.erb
index c245f73b8..8e8bd8c92 100644
--- a/app/views/admin/project_resource_list.html.erb
+++ b/app/views/admin/project_resource_list.html.erb
@@ -10,16 +10,16 @@
资源名称
- 资源大小
+ <%= link_to "资源大小",admin_project_resource_list_path(:sort => "file_size") %>
资源类型
- 上传时间
+ <%= link_to "上传时间",admin_project_resource_list_path(:sort => "file_upload") %>
- 下载次数
+ <%= link_to "下载次数",admin_project_resource_list_path(:sort => "file_download_times") %>
上传者
@@ -61,4 +61,6 @@
\ No newline at end of file
+
+
+<% html_title(l(:label_project_resource_list)) -%>
\ No newline at end of file
diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb
index d19e9b3b9..f52d1f060 100644
--- a/app/views/admin/schools.html.erb
+++ b/app/views/admin/schools.html.erb
@@ -1,43 +1,64 @@
<%=l(:label_school_plural)%>
-<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %>
- <%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%>
-
-<% end %>
+
+
+
+
-
+
序号
-
+
LOGO
-
+
学校名称
-
+
+ 用户数
+
+
+ 创建时间
+
+
+ 编辑高校信息
+
- <% @schools.each do |school|%>
+ <% @count=@page * 30 %>
+ <% @schools.each do |school| %>
">
-
- <%= school.id %>
+
+
+ <% @count +=1 %>
+
+ <%=@count %>
+
<%= image_tag(school.logo_link,width:40,height:40) %>
+
+
- <%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %>
+ <%= link_to school.name,"http://#{Setting.host_name}/?school_id=#{school.id}" %>
-
+
+ <%= schoolMember_num(school) %>
+
+
+ <%= format_time(school.created_at) %>
+
+
<%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %>
<%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
@@ -50,4 +71,4 @@
<%= pagination_links_full @school_pages, @school_count ,:per_page_links => true, :remote => false, :flag => true %>
-<% html_title(l(:label_project_plural)) -%>
+<% html_title(l(:label_school_plural)) -%>
diff --git a/app/views/admin/users.html.erb b/app/views/admin/users.html.erb
index 12aa95a16..2a757fdee 100644
--- a/app/views/admin/users.html.erb
+++ b/app/views/admin/users.html.erb
@@ -40,7 +40,10 @@
<%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
<%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
<%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
-
+ <%#= sort_header_tag('user_occupation', :caption => l(:field_occupation), :default_order => 'desc') %>
+ 用户单位
+
+
@@ -53,8 +56,11 @@
<%= checked_image user.admin? %>
<%= format_time(user.created_on) %>
<%= format_time(user.last_login_on) unless user.last_login_on.nil? %>
- <%= change_status_link(user) %>
- <%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %>
+ <% occupation = user.user_extensions.identity == 0 ? School.where("id=?",user.user_extensions.school_id).first.try(:name) : user.user_extensions.occupation %>
+ <%= truncate( occupation, :length => 12 ) %>
+ <%= change_status_link(user) %>
+ <%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %>
+
<% end -%>
diff --git a/app/views/at/show.json.erb b/app/views/at/show.json.erb
index 5341f251e..6e2a244e4 100644
--- a/app/views/at/show.json.erb
+++ b/app/views/at/show.json.erb
@@ -1,6 +1,11 @@
[
<% @users && @users.each_with_index do |person,index| %>
+ <% if index == 0 %>
+ {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"}
+ <%= index != @users.size-1 ? ',' : '' %>
+ <% else %>
{"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
<%= index != @users.size-1 ? ',' : '' %>
<% end %>
+ <% end %>
]
diff --git a/app/views/attachments/_attachment_history_download.html.erb b/app/views/attachments/_attachment_history_download.html.erb
new file mode 100644
index 000000000..c805960f0
--- /dev/null
+++ b/app/views/attachments/_attachment_history_download.html.erb
@@ -0,0 +1,30 @@
+
+选择版本
+注:该文件有历史版本,请选择您需要的文件,点击文件名下载。
+版本及序号
+
+
+
+ <%= link_to truncate(@attachment.filename,length: 35, omission: '...'),
+ download_named_attachment_path(@attachment.id, @attachment.filename),
+ :title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
+
+
版本号:当前
+
+ <% @attachment_histories.each do |history| %>
+
+ <%= link_to truncate(history.filename,length: 35, omission: '...'),
+ download_history_attachment_path(history.id, history.filename),
+ :title => history.filename+"\n"+history.description.to_s,
+ :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
+
+
版本号:<%= history.version %>
+
+ <% end %>
+
diff --git a/app/views/attachments/attachment_history_download.js.erb b/app/views/attachments/attachment_history_download.js.erb
new file mode 100644
index 000000000..352a2ef93
--- /dev/null
+++ b/app/views/attachments/attachment_history_download.js.erb
@@ -0,0 +1,7 @@
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/attachment_history_download' )%>');
+showModal('ajax-modal', '452px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+$('#ajax-modal').parent().css("top","40%").css("left","50%");
+$('#ajax-modal').parent().addClass("resourceUploadPopup");
+$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb
index d65c0b3ab..bdbcabff0 100644
--- a/app/views/courses/_course_activity.html.erb
+++ b/app/views/courses/_course_activity.html.erb
@@ -2,6 +2,8 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
-<% else %>
-
温馨提示:<%= l(:label_repository_no_data) %>
<% end %>
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index a58aeb281..f2b6cadeb 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -18,7 +18,7 @@
<%= link_to "问题动态", {:controller => "projects", :action => "show", :type => "issue"}, :class => "homepagePostTypeMessage postTypeGrey" %>
<%= link_to "新闻动态", {:controller => "projects", :action => "show", :type => "news"}, :class => "homepagePostTypeNotice postTypeGrey" %>
-
+
<%= link_to "资源库动态", {:controller => "projects", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey" %>
<%= link_to "讨论区动态", {:controller => "projects", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey" %>
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb
index 7477eaabd..aed741ce5 100644
--- a/app/views/users/_course_message.html.erb
+++ b/app/views/users/_course_message.html.erb
@@ -41,14 +41,6 @@
<% content = activity.parent.content%>
<% end %>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
- <% if activity.status == 1 %>
-
<%= activity.created_on.year %>
-
年
-
<%= activity.created_on.month %>
-
月
-
<%= activity.created_on.day %>
-
日
- <% end %>
diff --git a/app/views/users/_homework_repository_list.html.erb b/app/views/users/_homework_repository_list.html.erb
index 99e6d4e27..678bf65d7 100644
--- a/app/views/users/_homework_repository_list.html.erb
+++ b/app/views/users/_homework_repository_list.html.erb
@@ -25,9 +25,9 @@
<% end%>
- <%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "fl",:remote => true%>
- <% if @order == "created_at"%>
- <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
+ <%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "fl",:remote => true%>
+ <% if @order == "publish_time"%>
+ <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
<% end%>
diff --git a/app/views/users/_import_resource_info.html.erb b/app/views/users/_import_resource_info.html.erb
index bc1152ce4..0a9d92b5c 100644
--- a/app/views/users/_import_resource_info.html.erb
+++ b/app/views/users/_import_resource_info.html.erb
@@ -26,11 +26,14 @@
公共资源
我的资源
<% end %>
- <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
- :remote => true , :method => 'get', :id => 'resource_search_form') do %>
+
+ <%=render :partial=>'users/user_import_resource_search', :locals => {:type => @type, :search => '', :mul_id => @resource_id, :mul_type => @resource_type} %>
+
+
- <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
- <%# end %>
+
+
+
@@ -42,25 +45,10 @@
上传者
上传时间
- <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
- :mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id],
- :mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}),
- :method => 'post', :id => 'resource_import_container_form') do %>
- <% @attachments.each do |attach| %>
-
- <% end %>
- <% end %>
+
+ <%= render :partial => 'users/user_import_resource_list',:locals => {:project_id => params[:project_id], :subfield_file_id => params[:subfield_file_id], :course_id => params[:course_id]} %>
+
+
diff --git a/app/views/users/_project_attachment.html.erb b/app/views/users/_project_attachment.html.erb
index b98356c7b..deb0cb4c6 100644
--- a/app/views/users/_project_attachment.html.erb
+++ b/app/views/users/_project_attachment.html.erb
@@ -1,18 +1,32 @@
+
+
-
+
-
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
-
-
-
-
-
截止时间:2015-08-20
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %>
+ TO
+ <%= link_to activity.project.name.to_s+" | 项目资源", project_files_path(activity.course), :class => "newsBlue ml15" %>
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
-
+
+ <%= link_to activity.filename, project_files_path(activity.course), :class => "postGrey" %>
+
+
+
+ 文件大小:
+ <%= number_to_human_size activity.filesize%>
+
+
上传时间:<%= format_time(activity.created_on) %>
+
+
diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb
index 1ce03da17..5d472497d 100644
--- a/app/views/users/_project_issue.html.erb
+++ b/app/views/users/_project_issue.html.erb
@@ -13,6 +13,29 @@
<% end %> TO
<%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
+
+
+
+
+
+ <%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
+
+
+ <% if !defined?(project_id) && !defined?(user_id) %>
+ <%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
+ <% elsif defined?(project_id) %>
+ <%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
+ <% elsif defined?(user_id) %>
+ <%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "user_page", :page_id => user_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
+ <% end %>
+
+
+ <%= link_to l(:button_copy), project_copy_issue_path(activity.project, activity), :class => 'postOptionLink' if User.current.allowed_to?(:add_issues, activity.project) %>
+
+
+
+
+
<% case activity.tracker_id %>
<% when 1%>
@@ -51,6 +74,10 @@
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
<%# 局部刷新:修改xissue属性 %>
<% if User.current.member_of?(activity.project) %>
<% unless params[:action] == "index" %>
@@ -59,10 +86,7 @@
<% end %>
<% end %>
-
-
-
-
+
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index f679f9c8c..a545038f1 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -16,7 +16,7 @@
<%= attach.quotes.nil? ? 0 : attach.quotes %>
<%= attach.downloads %>
<%= attach.author_id %>
-
<%= number_to_human_size(attach.filesize) %>
+
<%= (number_to_human_size(attach.filesize)).gsub("ytes", "") %>
<%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
<%= get_resource_type(attach.container_type)%>
<%= get_resource_origin(attach) %>
diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb
index 3ebcab21e..7d4919149 100644
--- a/app/views/users/_show_detail_info.html.erb
+++ b/app/views/users/_show_detail_info.html.erb
@@ -21,18 +21,18 @@
-
<%= link_to User.watched_by(user.id).count, {:controller=>"users", :action=>"user_watchlist",:id=>user.id}, :class => 'homepageImageNumber',:target => "_blank" %>
-
<%= link_to '关注',{:controller=>"users", :action=>"user_watchlist",:id=>user.id},:target => "_blank" %>
+
<%= link_to User.watched_by(user.id).count, user_watchlist_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %>
+
<%= link_to '关注',user_watchlist_url_in_org(user.id),:target => "_blank" %>
-
<%= link_to user.watcher_users.count,{:controller=>"users", :action=>"user_fanslist",:id=>user.id}, :class => "homepageImageNumber fans_count_#{user.id}",:target => "_blank" %>
-
<%= link_to '粉丝', {:controller=>"users", :action=>"user_fanslist",:id=>user.id},:target => "_blank" %>
+
<%= link_to user.watcher_users.count,user_fanslist_url_in_org(user.id), :class => "homepageImageNumber fans_count_#{user.id}",:target => "_blank" %>
+
<%= link_to '粉丝', user_fanslist_url_in_org(user.id),:target => "_blank" %>
-
<%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_path(user), :class => 'homepageImageNumber',:target => "_blank" %>
-
<%= link_to '博客', user_blogs_path(user),:target => "_blank" %>
+
<%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %>
+
<%= link_to '博客', user_blogs_url_in_org(user.id),:target => "_blank" %>
<% if User.current != user %>
@@ -40,8 +40,8 @@
<%= render :partial => 'users/watch_btn_for_picture', :locals => {:user => user} %>
- <%= link_to "留言", feedback_path(user), :class => 'greyBtn fr', :target => "_blank" %>
- <%= link_to "私信", feedback_path(user), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %>
+ <%= link_to "留言", feedback_url_in_org(user.id), :class => 'greyBtn fr', :target => "_blank" %>
+ <%= link_to "私信", feedback_url_in_org(user.id), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %>
<% end %>
diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb
index 0e55c246c..eb73f9226 100644
--- a/app/views/users/_user_activities.html.erb
+++ b/app/views/users/_user_activities.html.erb
@@ -9,19 +9,6 @@
$("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none");
})
- $(".homepagePostPortrait").mouseover(function(){
- $(this).children(".userCard").css("display","block");
- })
- $(".homepagePostPortrait").mouseout(function(){
- $(this).children(".userCard").css("display","none");
- })
- $(".userCard").mouseover(function(){
-
- $(this).css("display","block");
- })
- $(".userCard").mouseout(function(){
- $(this).css("display","none");
- })
$(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff");
})
@@ -89,7 +76,7 @@
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'Issue' %>
- <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
+ <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %>
<% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
<% when 'ProjectCreateInfo'%>
diff --git a/app/views/users/_user_at_message.html.erb b/app/views/users/_user_at_message.html.erb
index d8649cabe..089171c3d 100644
--- a/app/views/users/_user_at_message.html.erb
+++ b/app/views/users/_user_at_message.html.erb
@@ -8,15 +8,15 @@
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
<%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id),
- :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %>
+
+
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
<%= link_to ma.subject.html_safe, project_boards_path(ma.at_message.project,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id),
- :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %>
+
+
<% else %>
<%= link_to ma.subject.html_safe, ma.url, :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
<% end %>
diff --git a/app/views/users/_user_import_resource_list.html.erb b/app/views/users/_user_import_resource_list.html.erb
new file mode 100644
index 000000000..f48e6c8fb
--- /dev/null
+++ b/app/views/users/_user_import_resource_list.html.erb
@@ -0,0 +1,19 @@
+<%= 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 %>
+ <% @attachments.each do |attach| %>
+
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_import_resource_search.html.erb b/app/views/users/_user_import_resource_search.html.erb
new file mode 100644
index 000000000..fc86ec26e
--- /dev/null
+++ b/app/views/users/_user_import_resource_search.html.erb
@@ -0,0 +1,29 @@
+
+
\ No newline at end of file
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index 62568d505..7de1ce417 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -1,692 +1,707 @@
-<% if ma.class == CourseMessage %>
- <% if ma.course_message_type == "News" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
-
- <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
标题: <%= ma.course_message.title %>
- <% unless ma.course_message.description.nil? %>
-
内容:
-
<%= ma.course_message.description.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "Comment" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
-
- <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
评论对象: <%= ma.course_message.commented.title %>
- <% unless ma.course_message.comments.nil? %>
-
评论内容:
-
<%= ma.course_message.comments.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布了课程作业:
-
-
- <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
- <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
- <% else %>
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
- <% end %>
-
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= User.current.lastname + User.current.firstname %>老师您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
-
-
- 课程名称:<%= ma.course_message.course.name %>
- (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
-
-
- 您可以修改作业内容、评分规则、匿评过程等,谢谢!
-
- <% else %>
-
<%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:
-
- 课程名称:<%= ma.course_message.course.name %>
- (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
-
-
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
- ">发布的作业:
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= User.current.lastname + User.current.firstname %>同学您好!
- <%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动了作业匿评:
-
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
-
- <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
-
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
-
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
- <% end%>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- 该作业已经关闭了匿评。作业信息如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
-
-
-
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
-
祝您的教学活动高效、顺利、愉快!
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动作业匿评失败
-
-
- <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time%> 23:59
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Poll" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布了问卷:
-
- <%= link_to format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_path(ma.course_message.id),
- :class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
- <%= ma.course_message.polls_name %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "Message" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
-
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
- <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
- <% if ma.course_message.parent_id.nil? %>
-
- <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% else %>
-
- <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
-
- <% end %>
- <% if ma.course_message_type == "StudentWorksScore" %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
- <% else %>
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <% end %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- 匿名用户
- <% else %>
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- <% end %>
- ">
- <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
-
-
-
- <% unless ma.content.nil? %>
- <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= User.current.show_name %>同学您好!
- <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
-
-
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.student_work.homework_common.name %>
- <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
- 作品评分:<%= content[0] %>分
- <% if content.size > 1 %>
-
作品评语:
- <%= content[1] %>
- <% end %>
-
-
- 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
-
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JournalsForMessage" %>
- <% if ma.course_message.jour_type == 'Course' %>
- <% if params[:type] != 'homework' %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">在课程中留言了:
-
-
- <%= link_to ma.course_message.notes.html_safe, course_feedback_path(:id => ma.course_id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= ma.course_message.notes.html_safe %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% else %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
- "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">回复了作品评论:
-
-
- <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.show_name %>老师您好!
- <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
-
-
- 回复内容:<%= ma.course_message.notes %>
- 您的评论:<%= ma.course_message.jour.comment %>
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% end %>
-
- <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
-
- <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布的作业:
-
-
- <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %>
- <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
-
-
- 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
- 作业标题:<%= ma.course_message.homework_common.name %>
- 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
- 提交时间:<%= format_time(ma.course_message.created_at) %>
- 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
-
-
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
-
- 您成功提交了作品(但被标记为迟交啦)
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Course" %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您成功创建了课程:
-
-
- <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
-
-
课程名称:<%= ma.course_message.name %>
-
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
-
课程ID:<%= ma.course_message.id %>
-
课程密码:<%= ma.course_message.password %>
-
学时总数:<%= ma.course_message.class_period %>
-
创建时间:<%= format_time(ma.course_message.created_at) %>
-
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
- <% if ma.course_message.is_public %>
-
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
- <% else %>
-
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JoinCourseRequest" %>
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
- 系统提示
- ">您有了新的课程成员申请:
-
-
- <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
-
-
真实姓名:<%= User.find(ma.course_message_id).realname %>
-
申请课程:<%= Course.find(ma.course_id).name%>
-
课程描述:
-
<%= Course.find(ma.course_id).description.html_safe %>
-
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
-
-
-
- <% if ma.status == 0 || ma.status.nil?%>
- <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
- |
- <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
- <% elsif ma.status == 1%>
- 您已经同意了该申请
- <% elsif ma.status == 2%>
- 您已经拒绝了该申请
- <%end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "CourseRequestDealResult" %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您加入了课程:
-
-
- <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
- <% teacher = User.find(ma.course_message_id) %>
-
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您增加了新的课程成员:
-
-
- <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
-
您增加了新的课程成员,详情如下:
-
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "RemoveFromCourse" %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您移出了课程:
-
-
- <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
-
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
- <% if !ma.content.nil? %>
-
担任角色:<%= ma.content %>
- <% end %>
-
学时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
-
-
-
-
-
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
- 请记得在截止时间前完成测验噢,辛苦啦!
- <% end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
- 请及时完成课程测验,辛苦啦!
-
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
+<% if ma.class == CourseMessage %>
+ <% if ma.course_message_type == "News" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
+
+ <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
标题: <%= ma.course_message.title %>
+ <% unless ma.course_message.description.nil? %>
+
内容:
+
<%= ma.course_message.description.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Comment" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
+
+ <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
评论对象: <%= ma.course_message.commented.title %>
+ <% unless ma.course_message.comments.nil? %>
+
评论内容:
+
<%= ma.course_message.comments.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布了课程作业:
+
+
+ <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
+ <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+ <% else %>
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+ <% end %>
+
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
+
+
+ 课程名称:<%= ma.course_message.course.name %>
+ (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+
+
+ 您可以修改作业内容、评分规则、匿评过程等,谢谢!
+
+ <% else %>
+
<%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:
+
+ 课程名称:<%= ma.course_message.course.name %>
+ (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+
+
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
+ ">发布的作业:
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= User.current.lastname + User.current.firstname %>同学您好!
+ <%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动了作业匿评:
+
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+
+ <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
+
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
+
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
+ <% end%>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ 该作业已经关闭了匿评。作业信息如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+
+
+
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+
祝您的教学活动高效、顺利、愉快!
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动作业匿评失败
+
+
+ <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}" %>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time%> 23:59
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Poll" %>
+
+ <% end %>
+ <% if ma.course_message_type == "Message" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
+ <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
+ <% if ma.course_message.parent_id.nil? %>
+
+ <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% else %>
+
+ <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+
+ <% end %>
+ <% if ma.course_message_type == "StudentWorksScore" %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
+ <% else %>
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <% end %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ 匿名用户
+ <% else %>
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ <% end %>
+ ">
+ <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
+
+
+
+ <% unless ma.content.nil? %>
+ <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <%= User.current.show_name %>同学您好!
+ <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
+
+
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.student_work.homework_common.name %>
+ <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
+ 作品评分:<%= content[0] %>分
+ <% if content.size > 1 %>
+
作品评语:
+ <%= content[1] %>
+ <% end %>
+
+
+ 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
+
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JournalsForMessage" %>
+ <% if ma.course_message.jour_type == 'Course' %>
+ <% if params[:type] != 'homework' %>
+
+ <% end %>
+ <% else %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
+ "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">回复了作品评论:
+
+
+ <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.show_name %>老师您好!
+ <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
+
+
+ 回复内容:<%= ma.course_message.notes %>
+ 您的评论:<%= ma.course_message.jour.comment %>
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% end %>
+
+ <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
+
+ <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布的作业:
+
+
+ <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %>
+ <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
+ 作业标题:<%= ma.course_message.homework_common.name %>
+ 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
+ 提交时间:<%= format_time(ma.course_message.created_at) %>
+ 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
+
+
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
+
+ 您成功提交了作品(但被标记为迟交啦)
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Course" %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您成功创建了课程:
+
+
+ <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
+
+
课程名称:<%= ma.course_message.name %>
+
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
+
课程ID:<%= ma.course_message.id %>
+
课程密码:<%= ma.course_message.password %>
+
学时总数:<%= ma.course_message.class_period %>
+
创建时间:<%= format_time(ma.course_message.created_at) %>
+
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
+ <% if ma.course_message.is_public %>
+
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
+ <% else %>
+
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JoinCourseRequest" %>
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+ 系统提示
+ ">您有了新的课程成员申请:
+
+
+ <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
+
+
真实姓名:<%= User.find(ma.course_message_id).realname %>
+
申请课程:<%= Course.find(ma.course_id).name%>
+
课程描述:
+
<%= Course.find(ma.course_id).description.html_safe %>
+
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
+
+
+
+ <% if ma.status == 0 || ma.status.nil?%>
+ <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
+ |
+ <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
+ <% elsif ma.status == 1%>
+ 您已经同意了该申请
+ <% elsif ma.status == 2%>
+ 您已经拒绝了该申请
+ <%end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "CourseRequestDealResult" %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您加入了课程:
+
+
+ <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+ <% teacher = User.find(ma.course_message_id) %>
+
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您增加了新的课程成员:
+
+
+ <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+
您增加了新的课程成员,详情如下:
+
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "RemoveFromCourse" %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您移出了课程:
+
+
+ <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
+
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+ <% if !ma.content.nil? %>
+
担任角色:<%= ma.content %>
+ <% end %>
+
学时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+
+
+
+
+
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+ 请记得在截止时间前完成测验噢,辛苦啦!
+ <% end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
+ 请及时完成课程测验,辛苦啦!
+
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb
index 967941a88..574411055 100644
--- a/app/views/users/_user_message_forge.html.erb
+++ b/app/views/users/_user_message_forge.html.erb
@@ -10,9 +10,10 @@
">申请加入项目:
- <%= link_to ma.project, settings_project_path(:id => ma.project, :tab => "members"), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ <%= link_to ma.project, settings_project_path(:id => ma.project, :tab => "members"), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
<%= ma.project %>
@@ -32,9 +33,10 @@
">将您加入了项目:
- <%= link_to ma.project, project_member_path(ma.project), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ <%= link_to ma.project, project_member_path(ma.project), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
@@ -67,9 +69,10 @@
">将您移出了项目:
- <%= link_to ma.project, member_project_path(ma.project), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ <%= link_to ma.project, member_project_path(ma.project), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
@@ -107,9 +110,9 @@
<% end %>
<%= link_to ma.project, project_path(ma.project),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
<%= ma.project %>
@@ -136,9 +139,10 @@
"><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%>
- <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
主题: <%= ma.forge_message.subject %>
@@ -160,9 +164,10 @@
"><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%>
- <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
主题: <%= ma.forge_message.subject %>
@@ -187,9 +192,10 @@
<%= link_to ma.forge_message.journalized.subject,
- issue_path(:id => ma.forge_message.journalized_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ issue_path(:id => ma.forge_message.journalized_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
问题标题: <%= ma.forge_message.journalized.subject %>
@@ -208,9 +214,10 @@
<%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project,
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
- :topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ :topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
主题: <%= ma.forge_message.subject %>
<% unless ma.forge_message.content.nil? %>
@@ -222,9 +229,10 @@
<%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project,
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
- :topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ :topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
帖子主题: <%= ma.forge_message.subject %>
<% unless ma.forge_message.content.nil? %>
@@ -247,9 +255,10 @@
<%= link_to ("#{ma.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ma.forge_message.id},
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
标题: <%= ma.forge_message.title %>
@@ -268,9 +277,9 @@
">评论了新闻:
<%= link_to "#{ma.forge_message.commented.title}",
- {:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ {:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
新闻标题: <%= ma.forge_message.commented.title %>
diff --git a/app/views/users/_user_message_forum.html.erb b/app/views/users/_user_message_forum.html.erb
index 102b4a155..d18292068 100644
--- a/app/views/users/_user_message_forum.html.erb
+++ b/app/views/users/_user_message_forum.html.erb
@@ -10,9 +10,10 @@
<% if ma.memo.parent_id.nil? %>
- <%= link_to ma.memo.subject, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ <%= link_to ma.memo.subject, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
标题: <%= ma.memo.subject %>
@@ -23,9 +24,10 @@
<% else %>
- <%= link_to ma.memo.content.html_safe, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
+ <%= link_to ma.memo.content.html_safe, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
标题: <%= ma.memo.subject %>
diff --git a/app/views/users/_user_message_system.html.erb b/app/views/users/_user_message_system.html.erb
index e3037f227..a80d35bd4 100644
--- a/app/views/users/_user_message_system.html.erb
+++ b/app/views/users/_user_message_system.html.erb
@@ -11,10 +11,9 @@
<%= link_to ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject, user_system_messages_path(User.current),
- :id => "content_link_#{ma.id}",
- :onmouseover =>"message_titile_show($(this),event);",
- :onmouseout => "message_titile_hide($(this));"
- %>
+ :id => "content_link_#{ma.id}" %>
+
+
<% unless ma.subject.blank? %>
diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb
index 6bc169f21..894eedbfc 100644
--- a/app/views/users/_user_message_userfeedaback.html.erb
+++ b/app/views/users/_user_message_userfeedaback.html.erb
@@ -1,30 +1,30 @@
-<% if ma.class == UserFeedbackMessage %>
- <% if ma.journals_for_message_type == "JournalsForMessage" %>
-
-
- <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
-
-
- <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
- "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
-
-
- <%= link_to ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.journals_for_message.reply_id == 0 %>
- <%= ma.journals_for_message.notes.html_safe %>
- <% else %>
-
您的留言:
-
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
-
回复内容:
-
<%= ma.journals_for_message.notes.html_safe %>
- <% end %>
-
- <%= time_tag(ma.journals_for_message.created_on).html_safe %>
-
-
- <% end %>
+<% if ma.class == UserFeedbackMessage %>
+ <% if ma.journals_for_message_type == "JournalsForMessage" %>
+
+
+ <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
+
+
+ <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
+
+
+ <%= link_to ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}"%>
+
+
+
+
+ <% if ma.journals_for_message.reply_id == 0 %>
+ <%= ma.journals_for_message.notes.html_safe %>
+ <% else %>
+
您的留言:
+
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
+
回复内容:
+
<%= ma.journals_for_message.notes.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.journals_for_message.created_on).html_safe %>
+
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb
index 6eddf1e05..bea78130a 100644
--- a/app/views/users/_user_resource_info.html.erb
+++ b/app/views/users/_user_resource_info.html.erb
@@ -1,21 +1,11 @@
- <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
+ <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type, :order => @order, :sort => @score, :status => @status} %>
-
-
- 资源名称
- 上传时间
- 引用数
- 下载数
- 大小
- 上传者
- 类别
- 来源
-
+<%= render :partial => 'users/user_resource_tip_list', :locals => { :type => @type, :status => @status} %>