diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 783e7d323..d6470ce51 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -770,6 +770,7 @@ class ApplicationController < ActionController::Base
end
def api_request?
+ return false if params[:controller] == 'at'
%w(xml json).include? params[:format]
end
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 23fe19333..cf4e6a8e9 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -74,6 +74,45 @@ class AttachmentsController < ApplicationController
:disposition => 'attachment' #inline can open in browser
end
+ def direct_download_history
+ @attachment_history = AttachmentHistory.find(params[:id])
+ @attachment_history.increment_download
+ send_file @attachment_history.diskfile_history, :filename => filename_for_content_disposition(@attachment_history.filename),
+ :type => detect_content_type(@attachment_history),
+ :disposition => 'attachment' #inline can open in browser
+ end
+
+ def download_history
+ @attachment_history = AttachmentHistory.find(params[:id])
+ candown = attachment_history_candown @attachment_history
+ if candown || User.current.admin? || User.current.id == @attachment_history.author_id
+ if stale?(:etag => @attachment_history.digest)
+ if params[:preview] == 'true'
+ convered_file = @attachment_history.diskfile_history
+ #如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化
+ unless pdf?(convered_file)
+ convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
+ unless File.exist?(convered_file)
+ office = Trustie::Utils::Office.new(@attachment_history.diskfile)
+ office.conver(convered_file)
+ end
+ end
+ if File.exist?(convered_file) && pdf?(convered_file)
+ send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
+ else
+ direct_download_history
+ end
+ else
+ direct_download_history
+ end
+ end
+ else
+ render_403 :message => :notice_not_authorized
+ end
+ rescue => e
+ redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
+ end
+
def download
# modify by nwb
# 下载添加权限设置
@@ -212,7 +251,7 @@ class AttachmentsController < ApplicationController
@history.version = @old_history.nil? ? 1 : @old_history.version + 1
@history.save #历史记录保存完毕
#将最新保存的记录 数据替换到 需要修改的文件记录
- @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public")
+ @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads")
@old_attachment.save
#删除当前记录
@attachment.delete
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 97dacb178..36060d41c 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -442,10 +442,14 @@ class CoursesController < ApplicationController
@course = cs.create_course(params,User.current)[:course]
if params[:copy_course]
copy_course = Course.find params[:copy_course].to_i
- @course.is_copy = 1
+ @course.is_copy = params[:copy_course].to_i
@course.open_student = copy_course.open_student
@course.publish_resource = copy_course.publish_resource
@course.save
+
+ #copy avatar
+ copy_avatar(@course, copy_course)
+
if params[:checkAll]
attachments = copy_course.attachments
attachments.each do |attachment|
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index c4932b1b2..ca37e445c 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -26,7 +26,7 @@ class FilesController < ApplicationController
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
- :search_files_in_subfield,:upload_files_menu]
+ :search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file]
helper :sort
include SortHelper
@@ -96,6 +96,33 @@ class FilesController < ApplicationController
end
end
+ def file_hidden
+ @file = Attachment.find params[:id]
+ @course = Course.find params[:course_id]
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def republish_file
+ @file = Attachment.find params[:id]
+ @course = Course.find params[:course_id]
+ if params[:publish_time]
+ unless params[:publish_time] == ""
+ @file.publish_time = params[:publish_time]
+ end
+ end
+ if @file.publish_time > Date.today
+ @file.is_publish = 0
+ else
+ @file.is_publish = 1
+ end
+ @file.save
+ respond_to do |format|
+ format.js
+ end
+ end
+
def search_project
sort = ""
@sort = ""
@@ -488,6 +515,23 @@ class FilesController < ApplicationController
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.run.attachments_added(attachments[:files])
end
+ if !attachments.empty? && attachments[:files]
+ attachments[:files].each do |attachment|
+ if params[:publish_time]
+ if params[:publish_time] == ""
+ attachment.publish_time = Date.today
+ else
+ attachment.publish_time = params[:publish_time]
+ end
+ else
+ attachment.publish_time = Date.today
+ end
+ if attachment.publish_time > Date.today
+ attachment.is_publish = 0
+ end
+ attachment.save
+ end
+ end
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
params[:course_attachment_type].each do |type|
tag_name = get_tag_name_by_type_number type
diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb
index bae0232a5..2a4bcf9c8 100644
--- a/app/controllers/org_subfields_controller.rb
+++ b/app/controllers/org_subfields_controller.rb
@@ -30,7 +30,8 @@ class OrgSubfieldsController < ApplicationController
if params[:id]
@organization = Organization.find(params[:id])
else
- @organization = Organization.where("domain=?",request.subdomain).first
+ domain = Secdomain.where("subname=?", request.subdomain).first
+ @organization = Organization.find(domain.pid)
end
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 6e2da311f..f225e7f50 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -139,7 +139,7 @@ class OrganizationsController < ApplicationController
end
def check_uniq_domain
- @is_exist = (Organization.where("domain=?", params[:org_domain]).count > 0)
+ @is_exist = (Secdomain.where("subname=?",params[:org_domain]).count > 0)
end
def find_organization
@@ -322,7 +322,12 @@ class OrganizationsController < ApplicationController
def agree_apply_subdomain
@organization = Organization.find(params[:organization_id])
OrgMessage.find(params[:act_id]).update_attribute(:viewed, 1)
- @organization.update_attribute(:domain, params[:org_domain])
+ if Secdomain.where("pid=? and sub_type=2",@organization.id).count > 0
+ domain = Secdomain.where("pid=? and sub_type=2",params[:organization_id]).first
+ Secdomain.update(domain.id, :subname => params[:org_domain])
+ else
+ Secdomain.create(:sub_type => 2, :pid => params[:organization_id], :subname => params[:org_domain])
+ end
if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0
OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
end
diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb
index 78babc43c..1d7b4117d 100644
--- a/app/controllers/poll_controller.rb
+++ b/app/controllers/poll_controller.rb
@@ -214,6 +214,7 @@ class PollController < ApplicationController
def publish_poll
@poll.polls_status = 2
@poll.published_at = Time.now
+ @poll.show_result = params[:show_result]
if @poll.save
if params[:is_remote]
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f2de6085f..2d1f8d771 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -112,7 +112,6 @@ class ProjectsController < ApplicationController
@project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
else
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
- @project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
end
@projects = @project_pages.order("created_on desc")
@limit = 10#per_page_option
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index e0afc38ae..e6ff904f3 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -98,14 +98,22 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
- @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ if pro.nil?
+ @stundet_works = []
+ else
+ @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ end
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
- my_work = @homework.student_works.where(:id => pro.student_work_id)
+ if pro.nil?
+ my_work = []
+ else
+ my_work = @homework.student_works.where(:id => pro.student_work_id)
+ end
else
my_work = @homework.student_works.where(:user_id => User.current.id)
end
@@ -113,7 +121,11 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
- my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ if pro.nil?
+ my_work = []
+ else
+ my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ end
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
@@ -134,14 +146,22 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
- @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ if pro.nil?
+ @stundet_works = []
+ else
+ @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ end
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
- my_work = @homework.student_works.where(:id => pro.student_work_id)
+ if pro.nil?
+ my_work = []
+ else
+ my_work = @homework.student_works.where(:id => pro.student_work_id)
+ end
else
my_work = @homework.student_works.where(:user_id => User.current.id)
end
@@ -149,7 +169,11 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
- my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ if pro.nil?
+ my_work = []
+ else
+ my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
+ end
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 9eabc95f2..fb35d8495 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -2144,22 +2144,22 @@ class UsersController < ApplicationController
if(params[:type].blank? || params[:type] == "1") #全部
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 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(',')}))").order("created_on desc")
+ @attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 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)").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
- @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
+ @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and is_publish = 1 " +
"and container_type in('Project','OrgSubfield','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(',')}))").order("created_on desc")
+ "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
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(',')})) ").order("created_on desc")
+ @attachments = Attachment.where("(author_id = #{params[: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")
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(',')}))").order("created_on desc")
+ @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and is_publish = 1)"+
+ "or (container_type = 'Course' and is_public = 1 and is_publish = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "3" #项目资源
if User.current.id.to_i == params[:id].to_i
@@ -2283,7 +2283,7 @@ class UsersController < ApplicationController
@orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
end
else
- if params[:send_type].present? and params[:send_type] == 'news'
+ if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message')
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0}
else
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 351be4e64..d1aa67483 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -74,9 +74,10 @@ class WordsController < ApplicationController
# render 'test/index'
# }
format.js {
+ #@reply_type = params[:reply_type]
@user_activity_id = params[:user_activity_id]
@activity = JournalsForMessage.find(parent_id)
- @is_activity = params[:is_activity]
+ @is_activity = params[:is_activity] if params[:is_activity]
}
end
@@ -98,6 +99,10 @@ class WordsController < ApplicationController
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@is_activity = params[:is_activity].to_i if params[:is_activity]
@activity = @journal_destroyed.parent if @journal_destroyed.parent
+ unless @activity
+ redirect_to feedback_path(@user)
+ return
+ end
elsif @journal_destroyed.jour_type == 'HomeworkCommon'
@homework = HomeworkCommon.find @journal_destroyed.jour_id
if params[:user_activity_id]
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 9f516ae1a..9d08be378 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -67,7 +67,7 @@ module ApplicationHelper
# 获取项目/课程总分
# 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分
def static_project_score obj
- score = obj.issue_num * 4 + obj.issue_journal_num + obj.changeset_num * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5
+ score = obj.issue_num * 4 + obj.issue_journal_num + (obj.changeset_num||0) * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5
end
# 获取组织成员中文名字
@@ -1997,6 +1997,18 @@ module ApplicationHelper
courses_doing
end
+ def attachment_history_candown attachment_history
+ if attachment_history.container_type == "Course"
+ course = Course.find(attachment_history.container_id)
+ candown = User.current.member_of?(course) || (course.is_public && attachment_history.is_public == 1)
+ elsif attachment_history.container_type == "Project"
+ project = Project.find(attachment_history.container_id)
+ candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1)
+ elsif attachment_history.container_type == "OrgSubfield"
+ org = OrgSubfield.find(attachment_history.container_id)
+ candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1)
+ end
+ end
def attachment_candown attachment
candown = false
@@ -2808,7 +2820,7 @@ int main(int argc, char** argv){
end
if opt[:init_activity]
- ss += javascript_include_tag "init_activity_KindEditor"
+ ss += javascript_include_tag "create_kindeditor"
end
ss.html_safe
diff --git a/app/helpers/avatar_helper.rb b/app/helpers/avatar_helper.rb
index 3f6802f59..5c3ffd950 100644
--- a/app/helpers/avatar_helper.rb
+++ b/app/helpers/avatar_helper.rb
@@ -1,9 +1,24 @@
module AvatarHelper
AVATAR_SIZE="50x50"
+
+ def copy_avatar(des, src)
+ src_file = disk_filename(src.class,src.id)
+ des_file = disk_filename(des.class,des.id)
+
+ FileUtils.cp(src_file, des_file) if File.exist?(src_file)
+ end
- def avatar_image(source)
- File.join(relative_path, avatar_directory(source.class), source.id.to_s)
+ def avatar_image(source, copyed=false)
+ source_type = source.class
+ source_id = source.id
+
+ course = Course.find(source_id) rescue nil
+ if course && copyed
+ source_id = course.is_copy
+ end
+
+ File.join(relative_path, avatar_directory(source_type), source_id.to_s)
end
def relative_path
@@ -23,7 +38,18 @@ module AvatarHelper
end
def disk_filename(source_type,source_id,image_file=nil)
- File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file))
+ File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file))
+ end
+
+ def copy_course?(source_type, source_id)
+ file= disk_filename(source_type, source_id)
+ if source_type == Course && !File.exist?(file)
+ course = Course.find(source_id) rescue nil
+ if course && course.is_copy>0
+ return true
+ end
+ end
+ false
end
def file_extension(filename=nil)
@@ -35,7 +61,9 @@ module AvatarHelper
return File.join(relative_path,'AnonymousUser','0')
end
if source.class && source.id && File.exist?(disk_filename(source.class,source.id))
- avatar_image(source)
+ avatar_image(source, false)
+ elsif copy_course?(source.class, source.id)
+ get_avatar(Course.find(source.is_copy)) rescue nil
else
File.join(relative_path,avatar_directory(source.class),'0')
end
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 1e4cedf14..2cdb277be 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -116,6 +116,34 @@ module CoursesHelper
@course.journals_for_messages.where('m_parent_id IS NULL').count
end
+ #当前学期
+ def current_time_and_term course
+ str = ""
+ term = cur_course_term
+ if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
+ str = course.time.to_s + course.term.to_s
+ elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
+ str = course.time.to_s + course.term.to_s
+ elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
+ str = course.end_time.to_s + course.end_term.to_s
+ else
+ str = Time.now.year.to_s + cur_course_term.to_s
+ end
+ str
+ end
+
+ def set_term_value term
+ val = 0
+ if term == "春季学期"
+ val = 1
+ elsif term == "夏季学期"
+ val = 2
+ elsif term == "秋季学期"
+ val = 3
+ end
+ val
+ end
+
# 返回学生数量,即roles表中定义的Reporter
#def studentCount project
# searchStudent(project).count
@@ -562,7 +590,7 @@ module CoursesHelper
type = []
month = Time.now.month
now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year)
- year = month < 3 && now_year >=Time.now.year ? now_year - 1 : now_year
+ year = month < 2 && now_year >=Time.now.year ? now_year - 1 : now_year
for i in (year..year + 10)
option = []
option << i
@@ -592,8 +620,10 @@ module CoursesHelper
def cur_course_term
month = Time.now.month
- if month >= 9 || month < 3
+ if month >= 9 || month < 2
term = "秋季学期"
+ elsif (month >= 7 && Time.now.day >= 15) || month == 8
+ term = "夏季学期"
else
term = "春季学期"
end
@@ -603,7 +633,7 @@ module CoursesHelper
def course_in_current_or_next_term course
is_current_term = false
is_next_term = false
- year_now = Time.now.month < 3 ? Time.now.year - 1:Time.now.year
+ year_now = Time.now.month < 2 ? Time.now.year - 1:Time.now.year
if course.time == year_now && course.term == cur_course_term
is_current_term = true
end
@@ -612,6 +642,7 @@ module CoursesHelper
elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "夏季学期"
is_next_term = true
elsif cur_course_term == "夏季学期" && course.time == year_now && course.term == "秋季学期"
+ is_next_term = true
end
is_current_term || is_next_term
end
@@ -715,7 +746,7 @@ module CoursesHelper
return[] unless course
result = []
course.attachments.each do |attachment|
- if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin?
+ if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
result << attachment
end
end
diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb
index bd023f6d0..6b748649b 100644
--- a/app/helpers/files_helper.rb
+++ b/app/helpers/files_helper.rb
@@ -123,7 +123,8 @@ module FilesHelper
attachments.each do |attachment|
if attachment.is_public? ||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
- (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
+ (attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
+ (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
attachment.author_id == User.current.id ||
attachment.container_type == "OrgSubfield"
result << attachment
diff --git a/app/models/attachment_history.rb b/app/models/attachment_history.rb
index 2160d242d..fb4e762ba 100644
--- a/app/models/attachment_history.rb
+++ b/app/models/attachment_history.rb
@@ -1,3 +1,14 @@
class AttachmentHistory < ActiveRecord::Base
belongs_to :attachment,foreign_key: 'attachment_id'
+ cattr_accessor :storage_history_path
+ @@storage_history_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files")
+
+ # Returns file's location on disk
+ def diskfile_history
+ File.join(self.class.storage_history_path, disk_directory.to_s, disk_filename.to_s)
+ end
+
+ def increment_download
+ increment!(:downloads)
+ end
end
diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb
index 194e1183a..9c1431d5d 100644
--- a/app/models/course_activity.rb
+++ b/app/models/course_activity.rb
@@ -67,12 +67,13 @@ class CourseActivity < ActiveRecord::Base
# 导语
def add_course_lead
if self.course_act_type == "Course"
- name = Redmine::Configuration['course_message_lead_subject']
- content = Redmine::Configuration['course_message_lead_content']
+ lead_message = Message.find(12440)
+ name = lead_message.subject
+ content = lead_message.content
# message的status状态为0为正常,为1表示创建课程时发送的message
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直
- message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1)
+ message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first
end
end
end
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 2da815a44..b184c82e6 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -52,6 +52,7 @@ class Journal < ActiveRecord::Base
# fq
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
+ after_create :update_issue_time
# end
#after_destroy :down_user_score
#before_save :be_user_score
@@ -230,4 +231,12 @@ class Journal < ActiveRecord::Base
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
end
end
+
+ # 回复issue的时候,更新issue的时候
+ def update_issue_time
+ if self.journalized_type == "Issue"
+ forge_activity = ForgeActivity.where("forge_act_id =? and forge_act_type =?", self.issue, "Issue").first
+ forge_activity.update_attribute(:created_at, self.created_on) unless forge_activity.nil?
+ end
+ end
end
diff --git a/app/models/secdomain.rb b/app/models/secdomain.rb
new file mode 100644
index 000000000..4d0abe5db
--- /dev/null
+++ b/app/models/secdomain.rb
@@ -0,0 +1,18 @@
+class Secdomain < ActiveRecord::Base
+ attr_accessible :pid, :subname, :sub_type, :desc
+
+ validates_presence_of :subname, :sub_type
+ validates_uniqueness_of :subname
+
+ def controller
+ return 'organizations' if sub_type == 2
+ return 'users' if sub_type == 3
+ nil
+ end
+
+ def action
+ return 'show' if sub_type == 2
+ return 'show' if sub_type == 3
+ nil
+ end
+end
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index ef0c2eb16..2c8387349 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -252,6 +252,7 @@ class CoursesService
def edit_course(params,course,current_user)
course.send(:safe_attributes=, params[:course], current_user)
#course.safe_attributes = params[:course]
+ course.password = params[:course][:password]
course.time = params[:time]
course.term = params[:term]
course.end_time = params[:end_time]
diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb
index c1a6464e8..fb2afd308 100644
--- a/app/views/attachments/_show_attachment_history.html.erb
+++ b/app/views/attachments/_show_attachment_history.html.erb
@@ -1,54 +1,57 @@
-
-更新资源版本
-
-
-
-
当前版本
-
-
-
-
- <% unless @attachment_histories.empty? %>
-
-
历史版本
-
- <% @attachment_histories.each do |history| %>
-
-
- 版本号:<%= history.version %>
-
-
- <% end %>
-
- <% end %>
-
-
- <%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
- <%= hidden_field_tag :old_attachment_id,@attachment.id %>
-
-
-
-
-
-
- <%= render :partial => 'attachments/upload_attachment_new_version' %>
-
-
-
-
-
-
(未选择文件)
-
您可以上传小于50MB 的文件
-
-
-
-
-
-
- <%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
-
-
-
- <% end %>
-
+
+更新资源版本
+
+
+
+
当前版本
+
+
+
+
+ <% unless @attachment_histories.empty? %>
+
+
历史版本
+
+ <% @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 f_14 f_b link_file_a2 fl" %>
+ 版本号:<%= history.version %>
+
+
+
+ <% end %>
+
+ <% end %>
+
+
+ <%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
+ <%= hidden_field_tag :old_attachment_id,@attachment.id %>
+
+
+
+
+
+
+ <%= render :partial => 'attachments/upload_attachment_new_version' %>
+
+
+
+
+
+
(未选择文件)
+
您可以上传小于50MB 的文件
+
+
+
+
+
+
+ <%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
+
+
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb
index 4f3bf41c3..a5bb6672b 100644
--- a/app/views/attachments/attachment_versions.js.erb
+++ b/app/views/attachments/attachment_versions.js.erb
@@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before(" ");
-$('#ajax-modal').parent().css("top","40%").css("left","46%");
+$('#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/blog_comments/_simple_ke_reply_form.html.erb b/app/views/blog_comments/_simple_ke_reply_form.html.erb
index 61669058b..e222d8e56 100644
--- a/app/views/blog_comments/_simple_ke_reply_form.html.erb
+++ b/app/views/blog_comments/_simple_ke_reply_form.html.erb
@@ -1,16 +1,3 @@
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
@@ -21,8 +8,8 @@
<% end %>
+
-
发送
diff --git a/app/views/blog_comments/quote.js.erb b/app/views/blog_comments/quote.js.erb
index cd53707d5..9bd226ce1 100644
--- a/app/views/blog_comments/quote.js.erb
+++ b/app/views/blog_comments/quote.js.erb
@@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
- init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>");
+ sd_create_editor_from_data(<%= @blogComment.id%>,null,"100%", "<%=@blogComment.class.to_s%>");
});
}else if($("#reply_to_message_<%= @blogComment.id%>").length >0) {
$("#reply_to_message_<%= @blogComment.id%>").replaceWith("");
diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb
index 2a4e71f1c..915ab892d 100644
--- a/app/views/blog_comments/reply.js.erb
+++ b/app/views/blog_comments/reply.js.erb
@@ -5,4 +5,4 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
//init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
<% end %>
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
\ No newline at end of file
+sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');
\ No newline at end of file
diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb
index 4a407089f..c80274db4 100644
--- a/app/views/blog_comments/show.html.erb
+++ b/app/views/blog_comments/show.html.erb
@@ -1,6 +1,7 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
- <%= javascript_include_tag "init_activity_KindEditor",'blog' %>
+ <%#= javascript_include_tag "init_activity_KindEditor",'blog' %>
+ <%= javascript_include_tag "create_kindeditor",'blog' %>
<% end %>
diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb
index 4ca86e7ae..05f69055f 100644
--- a/app/views/blogs/_article.html.erb
+++ b/app/views/blogs/_article.html.erb
@@ -198,8 +198,8 @@
+
-
发送
diff --git a/app/views/blogs/_article_list.html.erb b/app/views/blogs/_article_list.html.erb
index ca85c0ba2..f3fd1aa61 100644
--- a/app/views/blogs/_article_list.html.erb
+++ b/app/views/blogs/_article_list.html.erb
@@ -1,19 +1,19 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
- <%= javascript_include_tag "init_activity_KindEditor" %>
+ <%= javascript_include_tag "create_kindeditor" %>
<% end %>
<% if topic %>
diff --git a/app/views/boards/_course_show_detail.html.erb b/app/views/boards/_course_show_detail.html.erb
index 1898fce02..bc7b9667e 100644
--- a/app/views/boards/_course_show_detail.html.erb
+++ b/app/views/boards/_course_show_detail.html.erb
@@ -1,19 +1,19 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
- <%= javascript_include_tag "init_activity_KindEditor" %>
+ <%= javascript_include_tag "create_kindeditor" %>
<% end %>
<% if topics%>
<% topics.each do |topic| %>
@@ -40,7 +40,7 @@
}
$(function () {
- init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
+ sd_create_editor_from_data(<%= topic.id%>, null, "100%", "<%=topic.class.to_s%>");
});
<% if topic %>
diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb
index 367f0552c..1d5cc3b75 100644
--- a/app/views/boards/_project_show_detail.html.erb
+++ b/app/views/boards/_project_show_detail.html.erb
@@ -1,18 +1,18 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
- <%= javascript_include_tag "init_activity_KindEditor" %>
+ <%= javascript_include_tag "create_kindeditor" %>
<% end %>
<% if topics%>
<% topics.each do |topic| %>
@@ -39,7 +39,7 @@
}
$(function () {
- init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
+ sd_create_editor_from_data(<%= topic.id%>, null, "100%");
});
<% if topic %>
diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb
index f94eda065..0814b5f50 100644
--- a/app/views/comments/create.js.erb
+++ b/app/views/comments/create.js.erb
@@ -5,4 +5,4 @@
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% end %>
-init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%", "UserActivity");
+sd_create_editor_from_data('<%= @user_activity_id%>',"","100%", "UserActivity");
diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb
index a759946f6..c7547adcd 100644
--- a/app/views/courses/_copy_course.html.erb
+++ b/app/views/courses/_copy_course.html.erb
@@ -39,12 +39,13 @@
- <%= image_tag(url_to_avatar(@new_course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
+ <%= image_tag(url_to_avatar(@course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
+
* <%= l(:label_tags_course_name)%> :
diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb
index 1b0d5330d..d65c0b3ab 100644
--- a/app/views/courses/_course_activity.html.erb
+++ b/app/views/courses/_course_activity.html.erb
@@ -38,54 +38,6 @@
})
<% course_activities.each do |activity| if course_activities %>
<% if activity && activity.course_act%>
diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb
index 0c4f4c1e0..c7e4a7428 100644
--- a/app/views/courses/_courses_jours.html.erb
+++ b/app/views/courses/_courses_jours.html.erb
@@ -32,9 +32,9 @@
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
+
-
取消
留言
<% end %>
diff --git a/app/views/courses/_user_homework_search_list.html.erb b/app/views/courses/_user_homework_search_list.html.erb
index 585d8761a..750e7537c 100644
--- a/app/views/courses/_user_homework_search_list.html.erb
+++ b/app/views/courses/_user_homework_search_list.html.erb
@@ -2,18 +2,6 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
-
<% homework_commons.each do |homework_common|%>
diff --git a/app/views/courses/settings/_join_org.html.erb b/app/views/courses/settings/_join_org.html.erb
index fff0f807c..f7b4d7551 100644
--- a/app/views/courses/settings/_join_org.html.erb
+++ b/app/views/courses/settings/_join_org.html.erb
@@ -15,8 +15,8 @@
-
关联
-
取消
+
关联
+
取消
<% end %>
\ No newline at end of file
diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb
index 47c08d2fb..7724bb861 100644
--- a/app/views/files/_course_list.html.erb
+++ b/app/views/files/_course_list.html.erb
@@ -1,79 +1,8 @@
-
-<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
<% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
-
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
-
-
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
- <%= file_preview_eye(file, class: 'preview') %>
-
- <% if file.is_public? == false%>
- 私有
- <%end %>
-
-
-
-
上传时间:<%= format_time(file.created_on)%>
- <% if file.tag_list.length > 0%>
-
上传类型:<%= file.tag_list[0] %>
- <% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
-
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
-
-
-
-
-
- <% if User.current.logged? %>
-
- <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
- <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
-
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
- <% if @course.is_public? %>
-
-
- <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
-
-
- <%end%>
-
- <%= link_to( '删除资源', attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
-
-
-
- <% end %>
- <%else%>
-
- <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
-
+
+ <%=render :partial=>'files/resource_detail',:locals => {:file => file} %>
+
<% else %>
<%= file.filename %>是私有资源
<% end %>
diff --git a/app/views/files/_hidden_file.html.erb b/app/views/files/_hidden_file.html.erb
new file mode 100644
index 000000000..8e359c605
--- /dev/null
+++ b/app/views/files/_hidden_file.html.erb
@@ -0,0 +1,55 @@
+
+
发布设置
+
+<%= form_tag(republish_file_course_file_path(@course,@file), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
+
+
延迟发布:
+
+
+ <%#= calendar_for('attachment_publish_time')%>
+
+
+
+
+
+
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb
index 7a5d95125..866cf6fd8 100644
--- a/app/views/files/_org_subfield_list.html.erb
+++ b/app/views/files/_org_subfield_list.html.erb
@@ -72,7 +72,7 @@
<%=link_to "点击展开更多", search_files_in_subfield_org_subfield_files_path(:org_subfield_id => org_subfield.id,:page => @page.to_i + 1, :name => params[:name],:insite => params[:insite]),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<% else %>
- <%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
+ <%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page.to_i + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<%end%>
<% end%>
diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb
new file mode 100644
index 000000000..fd0a165aa
--- /dev/null
+++ b/app/views/files/_resource_detail.html.erb
@@ -0,0 +1,77 @@
+<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+ <% if file.is_publish == 0 %>
+ <%=file.publish_time %> 0点发布
+ <% end %>
+
+
+
上传时间:<%= format_time(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+
+
+
+
+
+ <% if User.current.logged? %>
+
+ <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
+ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
+
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
+ <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
+ <% if @course.is_public? %>
+
+
+ <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
+
+
+ <%end%>
+
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
+
+
+
+ <% end %>
+ <%else%>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb
index 6cce4bf2e..de43977cd 100644
--- a/app/views/files/_upload_course_files.erb
+++ b/app/views/files/_upload_course_files.erb
@@ -1,3 +1,4 @@
+
<%= l(:label_upload_files)%>
@@ -21,10 +22,20 @@
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
-
-
<%= l(:button_cancel)%>
-
- <%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
+ <% if User.current.allowed_to?(:as_teacher,course) %>
+
+
延迟发布:
+
+
+ <%#= calendar_for('attachment_publish_time')%>
+
+
+
+
+ <% end %>
+
<%= l(:button_cancel)%>
+
<%= l(:button_confirm)%>
+ <%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
<% end %>
@@ -35,8 +46,39 @@
\ No newline at end of file
diff --git a/app/views/files/file_hidden.js.erb b/app/views/files/file_hidden.js.erb
new file mode 100644
index 000000000..b95ab5104
--- /dev/null
+++ b/app/views/files/file_hidden.js.erb
@@ -0,0 +1,6 @@
+$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>');
+showModal('ajax-modal', '311px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
+$('#ajax-modal').parent().addClass("popbox_polls");
\ No newline at end of file
diff --git a/app/views/files/republish_file.js.erb b/app/views/files/republish_file.js.erb
new file mode 100644
index 000000000..e85e5eb50
--- /dev/null
+++ b/app/views/files/republish_file.js.erb
@@ -0,0 +1,2 @@
+hideModal();
+$("#resource_detail_<%=@file.id %>").html("<%= escape_javascript(render :partial=>'files/resource_detail',:locals => {:file => @file}) %>")
\ No newline at end of file
diff --git a/app/views/files/search_org_subfield_tag_attachment.js.erb b/app/views/files/search_org_subfield_tag_attachment.js.erb
index deed2d5d3..fe4aed937 100644
--- a/app/views/files/search_org_subfield_tag_attachment.js.erb
+++ b/app/views/files/search_org_subfield_tag_attachment.js.erb
@@ -1,2 +1,3 @@
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list',
- :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
\ No newline at end of file
+ :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
+$("#attachment_count").html("<%= @result.count %>");
\ No newline at end of file
diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb
index 73436750c..987abd351 100644
--- a/app/views/homework_common/set_evaluation_attr.js.erb
+++ b/app/views/homework_common/set_evaluation_attr.js.erb
@@ -1,8 +1,8 @@
clickCanel();
<% if @user_activity_id != -1 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
+sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
-init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
+sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
\ No newline at end of file
diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb
index 8b2e9ed04..91a68011e 100644
--- a/app/views/homework_common/start_anonymous_comment.js.erb
+++ b/app/views/homework_common/start_anonymous_comment.js.erb
@@ -3,11 +3,11 @@
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
$("#evaluation_start_time_<%=@homework.id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
- init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
+ sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
$("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
- init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
+ sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% end %>
/*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/
<% elsif @statue == 2 %>
diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb
index 2f8d8c6d6..874374476 100644
--- a/app/views/homework_common/stop_anonymous_comment.js.erb
+++ b/app/views/homework_common/stop_anonymous_comment.js.erb
@@ -2,11 +2,11 @@ alert('关闭成功');
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
$("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>");
-init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
+sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
$("#evaluation_end_time_<%=@user_activity_id %>").html("匿评关闭时间:<%=format_time(Time.now) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
+sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');
<% end %>
/*
$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb
index 2a1ae56d4..3ee20ee2a 100644
--- a/app/views/issues/_list.html.erb
+++ b/app/views/issues/_list.html.erb
@@ -18,7 +18,7 @@
}
$(function () {
- init_activity_KindEditor_data(<%= issue.id%>, null, "87%", "<%= issue.class.name %>");
+ sd_create_editor_from_data(<%= issue.id%>, null, "100%", "<%= issue.class.name %>");
});
<%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %>
diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb
index 9099c31b6..21519d5a1 100644
--- a/app/views/issues/add_journal.js.erb
+++ b/app/views/issues/add_journal.js.erb
@@ -2,7 +2,7 @@
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>");
$("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>')
- sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
+ sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%=@issue.class.name%>");
issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%",
"resizeType":0,
@@ -18,9 +18,10 @@
"fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
- sd_create_editor_from_data(<%= @issue.id %>, null, "100%");
+ sd_create_editor_from_data(<%= @issue.id %>, null, "100%","<%=@issue.class.name%>");
<%else%>
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
- init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity');
+ sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");
+//init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity');
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
<%end %>
diff --git a/app/views/issues/add_journal_in_org.js.erb b/app/views/issues/add_journal_in_org.js.erb
index 34e874f13..ed4666d0c 100644
--- a/app/views/issues/add_journal_in_org.js.erb
+++ b/app/views/issues/add_journal_in_org.js.erb
@@ -1,3 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
\ No newline at end of file
+sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
\ No newline at end of file
diff --git a/app/views/issues/add_reply.js.erb b/app/views/issues/add_reply.js.erb
index 0ee9d30e7..500451781 100644
--- a/app/views/issues/add_reply.js.erb
+++ b/app/views/issues/add_reply.js.erb
@@ -1,3 +1,3 @@
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)')
-sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
\ No newline at end of file
+sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
\ No newline at end of file
diff --git a/app/views/issues/delete_journal.js.erb b/app/views/issues/delete_journal.js.erb
index 63a1a5f96..7c7f25c1c 100644
--- a/app/views/issues/delete_journal.js.erb
+++ b/app/views/issues/delete_journal.js.erb
@@ -1,3 +1,3 @@
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
-sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
\ No newline at end of file
+sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
\ No newline at end of file
diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb
index 4217ca44e..b63897951 100644
--- a/app/views/issues/index.html.erb
+++ b/app/views/issues/index.html.erb
@@ -1,18 +1,7 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
-
+
\ No newline at end of file
diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb
index 022b8c76b..49207d5c5 100644
--- a/app/views/messages/_course_show.html.erb
+++ b/app/views/messages/_course_show.html.erb
@@ -27,14 +27,18 @@
}
}
$(function() {
- init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>");
+ sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>");
showNormalImage('message_description_<%= @topic.id %>');
});
- <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
+ <% if @topic.status == 1 %>
+ <%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %>
+ <% else %>
+ <%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50,:alt=>'图像' ), user_path(@topic.author) %>
+ <% end %>
<% if User.current.logged? %>
@@ -72,10 +76,14 @@
- <% if @topic.try(:author).try(:realname) == ' ' %>
- <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% if @topic.status == 1 %>
+ 确实团队
<% else %>
- <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% if @topic.try(:author).try(:realname) == ' ' %>
+ <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% else %>
+ <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% end %>
<% end %>
<%= format_time( @topic.created_on)%>
@@ -171,8 +179,13 @@
+
diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb
index fab0f752e..4d5af61dd 100644
--- a/app/views/messages/_org_subfield_show.html.erb
+++ b/app/views/messages/_org_subfield_show.html.erb
@@ -58,7 +58,8 @@
}
$(function() {
- init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>");
+ //init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>");
+ sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>");
showNormalImage('message_description_<%= @topic.id %>');
});
@@ -201,8 +202,13 @@
diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb
index a0e9db171..3a306ba74 100644
--- a/app/views/messages/_project_show.html.erb
+++ b/app/views/messages/_project_show.html.erb
@@ -88,7 +88,7 @@
}
}
$(function() {
- init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>");
+ sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>");
showNormalImage('message_description_<%= @topic.id %>');
});
@@ -227,8 +227,13 @@
diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb
index a859a088a..2d957dbda 100644
--- a/app/views/messages/_reply_message.html.erb
+++ b/app/views/messages/_reply_message.html.erb
@@ -1,15 +1,3 @@
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
@@ -18,8 +6,8 @@
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
+
-
发送
diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb
index b0e8ecb85..89f953bb9 100644
--- a/app/views/messages/quote.js.erb
+++ b/app/views/messages/quote.js.erb
@@ -11,7 +11,7 @@ if($("#reply_message_<%= @message.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
- init_activity_KindEditor_data(<%= @message.id%>,null,"85%", "<%=@message.class.to_s%>");
+ sd_create_editor_from_data(<%= @message.id%>,null,"100%", "<%=@message.class.to_s%>");
});
}else if($("#reply_to_message_<%= @message.id%>").length >0) {
$("#reply_to_message_<%= @message.id%>").replaceWith("
");
diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb
index f61de74f0..385a49a82 100644
--- a/app/views/messages/reply.js.erb
+++ b/app/views/messages/reply.js.erb
@@ -5,4 +5,4 @@
<% elsif @org_subfield %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
-init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", "UserActivity");
\ No newline at end of file
+sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");
\ No newline at end of file
diff --git a/app/views/news/_course_news_detail.html.erb b/app/views/news/_course_news_detail.html.erb
index 954f7dbf1..bd3215fb3 100644
--- a/app/views/news/_course_news_detail.html.erb
+++ b/app/views/news/_course_news_detail.html.erb
@@ -1,20 +1,8 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
- <%= javascript_include_tag "init_activity_KindEditor" %>
+ <%= javascript_include_tag "create_kindeditor" %>
<% end %>
-
<% if newss%>
<% newss.each do |news| %>
diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb
index 05a430d57..3236aa6a0 100644
--- a/app/views/news/_course_show.html.erb
+++ b/app/views/news/_course_show.html.erb
@@ -184,8 +184,13 @@
diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb
index 3189b03bf..0a7770ac0 100644
--- a/app/views/news/_organization_show.html.erb
+++ b/app/views/news/_organization_show.html.erb
@@ -1,181 +1,186 @@
-<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
-<% end %>
-
-
-
-
-
-
-
- <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %>
-
-
- <% if User.current.logged? %>
-
-
-
-
- <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %>
-
- <%= link_to(
- l(:button_edit),
- {:action => 'edit', :id => @news},
- :class => 'postOptionLink'
- ) if @news.author == User.current %>
-
-
- <%= delete_link(
- news_path(@news),
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if @news.author == User.current %>
-
-
-
-
-
- <%end%>
-
-
-
-
- <% if @news.try(:author).try(:realname) == ' ' %>
- <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
- <% else %>
- <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
- <% end %>
-
-
<%= format_time( @news.created_on)%>
-
-
- <%= @news.description.html_safe%>
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %>
-
-
-
-
-
-
- <% unless @comments.empty? %>
-
-
回复(<%=@comments.count %>)
-
-
-
- <% @comments.each_with_index do |reply,i| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
-
-
- <%= reply.comments.html_safe%>
-
-
- <%= format_time(reply.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if @news.commentable? %>
-
- <% end %>
-
-
-
+<%= content_for(:header_tags) do %>
+ <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
+<% end %>
+
+
+
+
+
+
+
+ <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %>
+
+
+ <% if User.current.logged? %>
+
+
+
+
+ <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %>
+
+ <%= link_to(
+ l(:button_edit),
+ {:action => 'edit', :id => @news},
+ :class => 'postOptionLink'
+ ) if @news.author == User.current %>
+
+
+ <%= delete_link(
+ news_path(@news),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if @news.author == User.current %>
+
+
+
+
+
+ <%end%>
+
+
+
+
+ <% if @news.try(:author).try(:realname) == ' ' %>
+ <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% else %>
+ <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% end %>
+
+
<%= format_time( @news.created_on)%>
+
+
+ <%= @news.description.html_safe%>
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %>
+
+
+
+
+
+
+ <% unless @comments.empty? %>
+
+
回复(<%=@comments.count %>)
+
+
+
+ <% @comments.each_with_index do |reply,i| %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% end %>
+
+
+ <%= reply.comments.html_safe%>
+
+
+ <%= format_time(reply.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+ <% if @news.commentable? %>
+
+ <% end %>
+
+
+
diff --git a/app/views/news/_project_news_detail.html.erb b/app/views/news/_project_news_detail.html.erb
index fdb035bf5..b3e6de5cf 100644
--- a/app/views/news/_project_news_detail.html.erb
+++ b/app/views/news/_project_news_detail.html.erb
@@ -1,20 +1,8 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
- <%= javascript_include_tag "init_activity_KindEditor" %>
+ <%= javascript_include_tag "create_kindeditor" %>
<% end %>
-
<% if all_news %>
<% all_news.each do |news| %>
diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb
index 144b93b28..74378e3fd 100644
--- a/app/views/news/_project_show.html.erb
+++ b/app/views/news/_project_show.html.erb
@@ -184,8 +184,13 @@
diff --git a/app/views/org_document_comments/_attachment.html.erb b/app/views/org_document_comments/_attachment.html.erb
index 86298a330..9acdc2dc8 100644
--- a/app/views/org_document_comments/_attachment.html.erb
+++ b/app/views/org_document_comments/_attachment.html.erb
@@ -7,7 +7,7 @@
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
- <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><%= l(:field_is_public) %>:
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><%= l(:field_is_public) %>:
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
<%= if attachment.id.nil?
#待补充代码
diff --git a/app/views/org_document_comments/_reply_form.html.erb b/app/views/org_document_comments/_reply_form.html.erb
index 8808ff8b7..60db259c6 100644
--- a/app/views/org_document_comments/_reply_form.html.erb
+++ b/app/views/org_document_comments/_reply_form.html.erb
@@ -1,2 +1,2 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
+sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
diff --git a/app/views/org_document_comments/_simple_ke_reply_form.html.erb b/app/views/org_document_comments/_simple_ke_reply_form.html.erb
index cfa197ff4..44eb71500 100644
--- a/app/views/org_document_comments/_simple_ke_reply_form.html.erb
+++ b/app/views/org_document_comments/_simple_ke_reply_form.html.erb
@@ -1,16 +1,3 @@
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
@@ -18,8 +5,8 @@
<%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
+
-
发送
diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb
index 968d7295d..79858dd03 100644
--- a/app/views/org_document_comments/add_reply.js.erb
+++ b/app/views/org_document_comments/add_reply.js.erb
@@ -1,2 +1,2 @@
$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => params[:flag], :act => @act}) %>");
-init_activity_KindEditor_data(<%= @act.id %>,"","87%", "<%=@act.class.to_s%>");
+sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");
diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb
index 71ab98764..ed7413850 100644
--- a/app/views/org_document_comments/edit.html.erb
+++ b/app/views/org_document_comments/edit.html.erb
@@ -1,6 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
- <%= javascript_include_tag "des_KindEditor" %>
+ <%= javascript_include_tag "des_kindEditor" %>
<% end %>
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %>
diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb
index ba06e8589..2a261bd5f 100644
--- a/app/views/org_document_comments/new.html.erb
+++ b/app/views/org_document_comments/new.html.erb
@@ -1,6 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
- <%= javascript_include_tag "des_KindEditor" %>
+ <%= javascript_include_tag "des_kindEditor" %>
<% end %>
@@ -150,9 +150,14 @@
<% if act.container_type == 'Organization' %>
diff --git a/app/views/org_subfields/_show_post_type.html.erb b/app/views/org_subfields/_show_post_type.html.erb
index bc95c0774..59d39067e 100644
--- a/app/views/org_subfields/_show_post_type.html.erb
+++ b/app/views/org_subfields/_show_post_type.html.erb
@@ -4,19 +4,6 @@
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
-
-
diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb
index 6579ccbca..20b98ffa0 100644
--- a/app/views/organizations/_org_activities.html.erb
+++ b/app/views/organizations/_org_activities.html.erb
@@ -38,7 +38,7 @@
<% org_activities.each do |act| %>
<% if act.container_type == 'Organization' %>
diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb
index 3dccdcc2b..b5e3c6958 100644
--- a/app/views/organizations/_org_course_homework.html.erb
+++ b/app/views/organizations/_org_course_homework.html.erb
@@ -326,8 +326,8 @@
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
+
-
发送
diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb
index 339ff8b26..4f13e1b4f 100644
--- a/app/views/organizations/_org_course_message.html.erb
+++ b/app/views/organizations/_org_course_message.html.erb
@@ -142,8 +142,8 @@
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
+
-
发送
diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb
index b6e2f74ef..665f5c1ae 100644
--- a/app/views/organizations/_org_course_news.html.erb
+++ b/app/views/organizations/_org_course_news.html.erb
@@ -108,8 +108,8 @@
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
-
发送
diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb
index ffd86baa3..449d95f4c 100644
--- a/app/views/organizations/_org_left_subfield_list.html.erb
+++ b/app/views/organizations/_org_left_subfield_list.html.erb
@@ -71,7 +71,7 @@