Merge branch 'develop' into hjq_new_course
This commit is contained in:
commit
3394af7ad5
|
@ -185,7 +185,6 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
|
||||
saved = @attachment.save
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.api {
|
||||
|
@ -198,12 +197,43 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def upload_attachment_version
|
||||
@flag = false
|
||||
Attachment.transaction do
|
||||
@old_attachment = Attachment.find params[:old_attachment_id]
|
||||
#取出当前上传的文件
|
||||
@attachment = Attachment.find(params[:attachments ].first[1][:attachment_id])
|
||||
#将需要修改的记录保存到历史记录
|
||||
@history = AttachmentHistory.new
|
||||
@history.attributes = @old_attachment.attributes.dup.except("id")
|
||||
@history.attachment_id = params[:old_attachment_id]
|
||||
#需要更新版本号,需要拿到原来该文件最大的历史版本号
|
||||
@old_history = @old_attachment.attachment_histories.reorder('version desc').first
|
||||
@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.save
|
||||
#删除当前记录
|
||||
@attachment.delete
|
||||
@flag = true
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @attachment.container.respond_to?(:init_journal)
|
||||
@attachment.container.init_journal(User.current)
|
||||
end
|
||||
if @attachment.container
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
if @attachment.container_type == "Issue"
|
||||
@attachment.destroy
|
||||
else
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
end
|
||||
else
|
||||
@attachment.destroy
|
||||
end
|
||||
|
@ -255,7 +285,7 @@ class AttachmentsController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def delete_homework
|
||||
@bid = @attachment.container.bid
|
||||
# Make sure association callbacks are called
|
||||
|
@ -318,13 +348,13 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:error_attachment_empty)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -494,6 +524,15 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#找到文件的所有的历史版本
|
||||
def attachment_versions
|
||||
@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])
|
||||
|
|
|
@ -450,7 +450,7 @@ class ExerciseController < ApplicationController
|
|||
if params[:answer_text].nil? || params[:answer_text].blank?
|
||||
#用户提交空答案,视作不作答
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
|
||||
render :json => {:text => "",:percent => format("%.2f", @percent)}
|
||||
else
|
||||
#添加答案
|
||||
ea = ExerciseAnswer.new
|
||||
|
@ -476,7 +476,7 @@ class ExerciseController < ApplicationController
|
|||
# 用户提交空答案,视为删除答案
|
||||
if ea.delete
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
|
||||
render :json => {:text => "",:percent => format("%.2f", @percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
|
|
|
@ -745,7 +745,16 @@ class FilesController < ApplicationController
|
|||
q = "%#{@q.strip}%"
|
||||
@result = find_course_attache q,@course,sort
|
||||
@result = visable_attachemnts @result
|
||||
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
|
||||
if params[:other]
|
||||
@result = @result.select{|attachment|
|
||||
!attachment.tag_list.include?('课件') &&
|
||||
!attachment.tag_list.include?('软件') &&
|
||||
!attachment.tag_list.include?('媒体') &&
|
||||
!attachment.tag_list.include?('代码') &&
|
||||
!attachment.tag_list.include?('论文') }
|
||||
else
|
||||
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
|
||||
end
|
||||
@searched_attach = paginateHelper @result,10
|
||||
@tag_list = get_course_tag_list @course
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
|
||||
|
||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
|
||||
|
|
|
@ -85,7 +85,7 @@ class IssuesController < ApplicationController
|
|||
params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
|
||||
@offset ||= @issue_pages.offset
|
||||
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
|
||||
:order => sort_clause,
|
||||
:order => 'issues.updated_on desc',
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
if params[:set_filter]
|
||||
|
|
|
@ -75,7 +75,7 @@ class MessagesController < ApplicationController
|
|||
@replies = paginateHelper messages_replies,10
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
render :action => "show", :layout => "base_courses"#by young
|
||||
else
|
||||
elsif @project
|
||||
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
|
||||
@replies = @topic.children.
|
||||
includes(:author, :attachments, {:board => :project}).
|
||||
|
@ -86,6 +86,18 @@ class MessagesController < ApplicationController
|
|||
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
render :action => "show", :layout => "base_projects"#by young
|
||||
else
|
||||
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
|
||||
@replies = @topic.children.
|
||||
includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.created_on DESC").
|
||||
limit(@reply_pages.per_page).
|
||||
offset(@reply_pages.offset).
|
||||
all
|
||||
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
@organization = @org_subfield.organization
|
||||
render :action => "show", :layout => "base_org"#by young
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -199,6 +211,8 @@ class MessagesController < ApplicationController
|
|||
end
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@is_course = params[:is_course]
|
||||
@is_board = params[:is_board]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -219,17 +233,27 @@ class MessagesController < ApplicationController
|
|||
@isReply = false
|
||||
if @project
|
||||
(render_403; return false) unless @message.editable_by?(User.current)
|
||||
else
|
||||
elsif @course
|
||||
(render_403; return false) unless @message.course_editable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.org_subfield_editable_by?(User.current)
|
||||
end
|
||||
|
||||
@message.safe_attributes = params[:message]
|
||||
if request.post? && @message.save
|
||||
attachments = Attachment.attach_files(@message, params[:attachments])
|
||||
render_attachment_warning_if_needed(@message)
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
#flash[:notice] = l(:notice_successful_update)
|
||||
@message.reload
|
||||
if params[:is_board]
|
||||
if params[:is_course] && params[:is_course].to_i == 0
|
||||
redirect_to user_activities_path(User.current.id)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||
if @project
|
||||
redirect_to project_path(@project)
|
||||
elsif @course
|
||||
redirect_to course_activity_path(@course)
|
||||
end
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
if @project
|
||||
redirect_to project_boards_path(@project)
|
||||
elsif @course
|
||||
|
@ -239,19 +263,22 @@ class MessagesController < ApplicationController
|
|||
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
|
||||
end
|
||||
elsif request.get? || request.post?
|
||||
if params[:is_board]
|
||||
if @project
|
||||
redirect_to project_boards_path(@project)
|
||||
elsif @course
|
||||
redirect_to course_boards_path(@course)
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
render :layout => layout_file
|
||||
}
|
||||
end
|
||||
if params[:is_course] && params[:is_board]
|
||||
@is_course = params[:is_course]
|
||||
@is_board = params[:is_board]
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if @project
|
||||
layout_file = 'base_projects'
|
||||
elsif @course
|
||||
layout_file = 'base_courses'
|
||||
elsif @org_subfield
|
||||
@organization = @org_subfield.organization
|
||||
layout_file = 'base_org'
|
||||
end
|
||||
render :layout => layout_file
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -260,31 +287,46 @@ class MessagesController < ApplicationController
|
|||
def destroy
|
||||
if @project
|
||||
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||
else
|
||||
elsif @course
|
||||
(render_403; return false) unless @message.course_destroyable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.org_subfield_editable_by?(User.current)
|
||||
end
|
||||
r = @message.to_param
|
||||
@message.destroy
|
||||
# modify by nwb
|
||||
if @project
|
||||
if params[:is_board]
|
||||
redirect_to project_boards_url(@project)
|
||||
if params[:is_course] && params[:is_course].to_i == 0
|
||||
redirect_to user_activities_path(User.current.id)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||
redirect_to project_path(@project)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
redirect_to project_boards_path(@project)
|
||||
elsif @message.parent
|
||||
redirect_to board_message_url(@board, @message.parent, :r => r)
|
||||
else
|
||||
if @message.parent
|
||||
redirect_to board_message_url(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to project_board_url(@project, @board)
|
||||
end
|
||||
# redirect_to board_message_url(@board, @topic, :r => @reply)
|
||||
redirect_to project_board_url(@project, @board)
|
||||
end
|
||||
elsif @course
|
||||
if params[:is_course] && params[:is_course].to_i == 0
|
||||
redirect_to user_activities_path(User.current.id)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||
redirect_to course_activity_path(@course)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
redirect_to course_boards_path(@course)
|
||||
elsif @message.parent
|
||||
redirect_to board_message_url(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to course_boards_path(@course)
|
||||
end
|
||||
elsif @org_subfield
|
||||
if params[:is_board]
|
||||
redirect_to course_boards_url(@course)
|
||||
redirect_to organization_path(:id => @org_subfield.organization_id, :org_subfield_id => @org_subfield.id)
|
||||
else
|
||||
if @message.parent
|
||||
redirect_to board_message_url(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to course_board_url(@course, @board)
|
||||
redirect_to organization_path(:id => @org_subfield.organization_id, :org_subfield_id => @org_subfield.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -319,15 +361,25 @@ class MessagesController < ApplicationController
|
|||
org_subfield_ids = params[:org_subfields]
|
||||
@message = Message.find(params[:id])
|
||||
# @message.update_attribute(:updated_on, Time.now)
|
||||
type = @message.board.course_id.nil? ? "Project":"Course"
|
||||
# type = @message.board.course_id.nil? ? "Project":"Course"
|
||||
org_subfield_ids.each do |field_id|
|
||||
OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => @message.id, :message_type => type)
|
||||
org_acts = OrgActivity.where("container_type='OrgSubfield' and container_id=? and org_act_type='Message' and org_act_id=?", field_id.to_i, @message.id)
|
||||
if org_acts.all.size() > 0
|
||||
org_acts.first.update_attribute(:updated_at, Time.now)
|
||||
else
|
||||
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => @message.id, :user_id => User.current.id)
|
||||
@message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1)
|
||||
@message.save
|
||||
board = OrgSubfield.find(field_id).boards.first
|
||||
mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id,
|
||||
:created_on => Time.now, :updated_on => Time.now, :locked => @message.locked, :sticky => @message.sticky)
|
||||
@message.attachments.each do |attach|
|
||||
mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
# OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => mes.id, :message_type => type)
|
||||
# org_acts = OrgActivity.where("container_type='OrgSubfield' and container_id=? and org_act_type='Message' and org_act_id=?", field_id.to_i, @message.id)
|
||||
# if org_acts.all.size() > 0
|
||||
# org_acts.first.update_attribute(:updated_at, Time.now)
|
||||
# else
|
||||
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id)
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -347,6 +399,9 @@ class MessagesController < ApplicationController
|
|||
@project = @board.project
|
||||
elsif @board.course_id
|
||||
@course = @board.course
|
||||
else
|
||||
@org_subfield = @board.org_subfield
|
||||
@organization = @org_subfield
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -1,284 +1,303 @@
|
|||
# encoding: utf-8
|
||||
class OrganizationsController < ApplicationController
|
||||
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
include AvatarHelper
|
||||
include WordsHelper
|
||||
include GitlabHelper
|
||||
include UserScoreHelper
|
||||
|
||||
include PollHelper
|
||||
helper :user_score
|
||||
helper :journals
|
||||
|
||||
# added by liuping 关注
|
||||
|
||||
helper :watchers
|
||||
helper :activities
|
||||
|
||||
### added by william
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
|
||||
# fq
|
||||
helper :words
|
||||
helper :project_score
|
||||
helper :issues
|
||||
include UsersHelper
|
||||
before_filter :find_organization, :only => [:show, :members]
|
||||
layout 'base_org'
|
||||
def index
|
||||
|
||||
end
|
||||
def new
|
||||
@organization = Organization.new
|
||||
render :layout => 'new_base'
|
||||
end
|
||||
|
||||
def edit
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def destroy
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.destroy
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to admin_organization_path }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@organization = Organization.new
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.is_public = params[:organization][:is_public]
|
||||
@organization.creator_id = User.current.id
|
||||
member = OrgMember.new(:user_id => User.current.id)
|
||||
|
||||
@organization.org_members << member
|
||||
if @organization.save
|
||||
OrgMemberRole.create(:org_member_id => member.id, :role_id => 11)
|
||||
redirect_to organization_path(@organization)
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@organization = Organization.find(params[:id])
|
||||
if params[:org_subfield_id]
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
else
|
||||
project_ids = @organization.projects.map(&:id) << 0
|
||||
course_ids = @organization.courses.map(&:id) << 0
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
case params[:type]
|
||||
when nil
|
||||
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
|
||||
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
|
||||
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
|
||||
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_issue'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'org'
|
||||
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_homework'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_news'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_poll'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
end
|
||||
end
|
||||
@page = params[:page]
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.domain = params[:organization][:domain]
|
||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||
#@organization.name = params[:organization][:name]
|
||||
@organization.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to setting_organization_path(@organization)}
|
||||
end
|
||||
end
|
||||
|
||||
def check_uniq
|
||||
@check = false;
|
||||
@org_name = params[:org_name].strip
|
||||
@config_page = params[:config_page]
|
||||
sameName = @config_page ? Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count == 0 : Organization.where('name = ?',params[:org_name]).count == 0
|
||||
if sameName == true
|
||||
@check = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def find_organization
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def setting
|
||||
@organization = Organization.find(params[:id])
|
||||
|
||||
if User.current.admin? || User.current.admin_of_org?(@organization)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def clear_org_avatar_temp
|
||||
|
||||
end
|
||||
|
||||
def set_homepage
|
||||
@org = Organization.find(params[:id])
|
||||
@org.home_id = params[:home_id]
|
||||
@org.save
|
||||
# respond_to do |format|
|
||||
# format.html {redirect_to organization_path(org)}
|
||||
# end
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
@org = Organization.find(params[:id])
|
||||
@org.home_id = nil
|
||||
@org.save
|
||||
end
|
||||
|
||||
def autocomplete_search
|
||||
@project = Project.find(params[:project_id])
|
||||
#@flag = params[:flag] || false
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def members
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@members = OrgMember.where("organization_id =?", @organization.id)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_projects
|
||||
@organization = Organization.find params[:id]
|
||||
@page = params[:page]
|
||||
@org_projects = @organization.projects.reorder('created_at').uniq.page((params[:page].to_i || 1) +1).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
@page = params[:page]
|
||||
@org_courses = @organization.courses.reorder('created_at').uniq.page((params[:page].to_i || 1) + 1 ).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_course_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+
|
||||
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})"
|
||||
#user_courses = Course.find_by_sql(sql)
|
||||
@courses = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.courses.map(&:id)
|
||||
# @courses = []
|
||||
# user_courses.each do |course|
|
||||
# if !@added_course_ids.include?(course.id)
|
||||
# @courses << course
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
course_ids = params[:courseNames]
|
||||
course_ids.each do |id|
|
||||
OrgCourse.create(:organization_id => @organization.id, :course_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_project_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def logout
|
||||
logout_user
|
||||
respond_to do |format|
|
||||
format.html {redirect_to organization_path(params[:id])}
|
||||
end
|
||||
end
|
||||
|
||||
def search_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" +
|
||||
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})"
|
||||
#user_projects = Course.find_by_sql(sql)
|
||||
@projects = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.projects.map(&:id)
|
||||
# @projects = []
|
||||
# user_projects.each do |project|
|
||||
# if !@added_course_ids.include?(project.id)
|
||||
# @projects << project
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
project_ids = params[:projectNames]
|
||||
project_ids.each do |id|
|
||||
OrgProject.create(:organization_id => @organization.id, :project_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
class OrganizationsController < ApplicationController
|
||||
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
include AvatarHelper
|
||||
include WordsHelper
|
||||
include GitlabHelper
|
||||
include UserScoreHelper
|
||||
|
||||
include PollHelper
|
||||
helper :user_score
|
||||
helper :journals
|
||||
helper :attachments
|
||||
# added by liuping 关注
|
||||
|
||||
helper :watchers
|
||||
helper :activities
|
||||
|
||||
### added by william
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
|
||||
# fq
|
||||
helper :words
|
||||
helper :project_score
|
||||
helper :issues
|
||||
include UsersHelper
|
||||
before_filter :find_organization, :only => [:show, :members]
|
||||
layout 'base_org'
|
||||
def index
|
||||
|
||||
end
|
||||
def new
|
||||
@organization = Organization.new
|
||||
render :layout => 'new_base'
|
||||
end
|
||||
|
||||
def edit
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def destroy
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.destroy
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to admin_organization_path }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@organization = Organization.new
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.is_public = params[:organization][:is_public]
|
||||
@organization.creator_id = User.current.id
|
||||
member = OrgMember.new(:user_id => User.current.id)
|
||||
|
||||
@organization.org_members << member
|
||||
if @organization.save
|
||||
OrgMemberRole.create(:org_member_id => member.id, :role_id => 11)
|
||||
redirect_to organization_path(@organization)
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@organization = Organization.find(params[:id])
|
||||
if params[:org_subfield_id]
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
else
|
||||
project_ids = @organization.projects.map(&:id) << 0
|
||||
course_ids = @organization.courses.map(&:id) << 0
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
case params[:type]
|
||||
when nil
|
||||
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
|
||||
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
|
||||
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
|
||||
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_issue'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'org'
|
||||
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_homework'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_news'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_poll'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
end
|
||||
end
|
||||
@page = params[:page]
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.domain = params[:organization][:domain]
|
||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||
#@organization.name = params[:organization][:name]
|
||||
@organization.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to setting_organization_path(@organization)}
|
||||
end
|
||||
end
|
||||
|
||||
def check_uniq
|
||||
@check = false;
|
||||
@org_name = params[:org_name].strip
|
||||
@config_page = params[:config_page]
|
||||
sameName = @config_page ? Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count == 0 : Organization.where('name = ?',params[:org_name]).count == 0
|
||||
if sameName == true
|
||||
@check = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def find_organization
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def setting
|
||||
@organization = Organization.find(params[:id])
|
||||
|
||||
if User.current.admin? || User.current.admin_of_org?(@organization)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def clear_org_avatar_temp
|
||||
|
||||
end
|
||||
|
||||
def set_homepage
|
||||
@org = Organization.find(params[:id])
|
||||
@org.home_id = params[:home_id]
|
||||
@org.save
|
||||
# respond_to do |format|
|
||||
# format.html {redirect_to organization_path(org)}
|
||||
# end
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
@org = Organization.find(params[:id])
|
||||
@org.home_id = nil
|
||||
@org.save
|
||||
end
|
||||
|
||||
def autocomplete_search
|
||||
@project = Project.find(params[:project_id])
|
||||
#@flag = params[:flag] || false
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def members
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@members = OrgMember.where("organization_id =?", @organization.id)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_projects
|
||||
@organization = Organization.find params[:id]
|
||||
@page = params[:page]
|
||||
@org_projects = @organization.projects.reorder('created_at').uniq.page((params[:page].to_i || 1) +1).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
@page = params[:page]
|
||||
@org_courses = @organization.courses.reorder('created_at').uniq.page((params[:page].to_i || 1) + 1 ).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_course_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+
|
||||
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})"
|
||||
#user_courses = Course.find_by_sql(sql)
|
||||
@courses = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.courses.map(&:id)
|
||||
# @courses = []
|
||||
# user_courses.each do |course|
|
||||
# if !@added_course_ids.include?(course.id)
|
||||
# @courses << course
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
course_ids = params[:courseNames]
|
||||
course_ids.each do |id|
|
||||
OrgCourse.create(:organization_id => @organization.id, :course_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_project_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def logout
|
||||
logout_user
|
||||
respond_to do |format|
|
||||
format.html {redirect_to organization_path(params[:id])}
|
||||
end
|
||||
end
|
||||
|
||||
def search_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" +
|
||||
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})"
|
||||
#user_projects = Course.find_by_sql(sql)
|
||||
@projects = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.projects.map(&:id)
|
||||
# @projects = []
|
||||
# user_projects.each do |project|
|
||||
# if !@added_course_ids.include?(project.id)
|
||||
# @projects << project
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
project_ids = params[:projectNames]
|
||||
project_ids.each do |id|
|
||||
OrgProject.create(:organization_id => @organization.id, :project_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def hide_org_subfield
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield.update_attribute(:hide, 1)
|
||||
end
|
||||
|
||||
def show_org_subfield
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield.update_attribute(:hide, 0)
|
||||
end
|
||||
|
||||
def org_resources_subfield
|
||||
@org = Organization.find(params[:id])
|
||||
@subfield = @org.org_subfields.where('field_type = "Resource" ')
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -499,7 +499,7 @@ class UsersController < ApplicationController
|
|||
|
||||
#提交作品时,计算是否迟交
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = 1
|
||||
student_work.late_penalty = homework.late_penalty
|
||||
else
|
||||
student_work.late_penalty = 0
|
||||
end
|
||||
|
@ -524,7 +524,7 @@ class UsersController < ApplicationController
|
|||
else
|
||||
homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1
|
||||
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
|
||||
homework.homework_type = params[:homework_type].to_i || 1
|
||||
homework.late_penalty = 10
|
||||
homework.teacher_priority = 1
|
||||
|
@ -621,7 +621,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
@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")
|
||||
elsif params[:type] == "2" #课程资源
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
|
@ -1329,12 +1329,12 @@ 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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
@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")
|
||||
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 " +
|
||||
"and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
|
||||
"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")
|
||||
end
|
||||
elsif params[:type] == "2" #课程资源
|
||||
|
@ -1391,12 +1391,12 @@ class UsersController < ApplicationController
|
|||
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
|
||||
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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
@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")
|
||||
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 " +
|
||||
"and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
|
||||
"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")
|
||||
end
|
||||
elsif params[:type] == "2" #课程资源
|
||||
|
@ -1491,11 +1491,23 @@ class UsersController < ApplicationController
|
|||
unless course_ids.nil?
|
||||
course_ids.each do |id|
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
Course.find(id).attachments.each do |att| #如果课程中包含该资源
|
||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||
att.created_on = Time.now
|
||||
att.save
|
||||
@exist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
next if @exist
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = Course.find(id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.is_public = 0
|
||||
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
|
@ -1515,11 +1527,23 @@ class UsersController < ApplicationController
|
|||
unless course_ids.nil?
|
||||
course_ids.each do |id|
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
Course.find(id).attachments.each do |att| #如果课程中包含该资源
|
||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||
att.created_on = Time.now
|
||||
att.save
|
||||
@exist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
next if @exist
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = Course.find(id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.is_public = 0
|
||||
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
|
@ -1532,7 +1556,7 @@ class UsersController < ApplicationController
|
|||
@flag = false
|
||||
end
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
@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")
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
|
@ -1561,11 +1585,23 @@ class UsersController < ApplicationController
|
|||
unless project_ids.nil?
|
||||
project_ids.each do |project_id|
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
|
||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||
att.created_on = Time.now
|
||||
att.save
|
||||
@exist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
next if @exist
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = Project.find(project_id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.is_public = 0
|
||||
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
|
@ -1584,11 +1620,23 @@ class UsersController < ApplicationController
|
|||
unless project_ids.nil?
|
||||
project_ids.each do |project_id|
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
|
||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||
att.created_on = Time.now
|
||||
att.save
|
||||
@exist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
next if @exist
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = Project.find(project_id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.is_public = 0
|
||||
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
|
@ -1600,7 +1648,7 @@ class UsersController < ApplicationController
|
|||
@flag=true
|
||||
end
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
@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")
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
|
@ -1616,6 +1664,97 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_org
|
||||
@flag = true
|
||||
if params[:send_id].present?
|
||||
send_id = params[:send_id]
|
||||
subfield_id = params[:subfield]
|
||||
if subfield_id.nil?
|
||||
@flag = false
|
||||
end
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
unless subfield_id.nil?
|
||||
attach_copied_obj = ori.copy
|
||||
@exist = false
|
||||
OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
|
||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||
att.created_on = Time.now
|
||||
att.save
|
||||
@exist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if @exist == false #如果不存在该资源
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = OrgSubfield.find(subfield_id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.is_public = 0
|
||||
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
attach_copied_obj.save
|
||||
end
|
||||
end
|
||||
elsif params[:send_ids].present?
|
||||
send_ids = params[:send_ids].split(" ")
|
||||
subfield_id = params[:subfield]
|
||||
if subfield_id.nil?
|
||||
@flag = false
|
||||
end
|
||||
send_ids.each do |send_id|
|
||||
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
unless subfield_id.nil?
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
|
||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||
att.created_on = Time.now
|
||||
att.save
|
||||
@exist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
next if @exist
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = OrgSubfield.find(subfield_id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.is_public = 0
|
||||
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
attach_copied_obj.save
|
||||
end
|
||||
end
|
||||
else
|
||||
@flag=true
|
||||
end
|
||||
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")
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
@user = User.current
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@attachments = paginateHelper @attachments,25
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def change_org_subfield
|
||||
|
||||
end
|
||||
|
||||
# 资源预览
|
||||
def resource_preview
|
||||
preview_id = params[:resource_id]
|
||||
|
@ -1828,12 +1967,12 @@ 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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
@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")
|
||||
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 " +
|
||||
"and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
|
||||
"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")
|
||||
end
|
||||
elsif params[:type] == "2" #课程资源
|
||||
|
@ -1884,7 +2023,7 @@ class UsersController < ApplicationController
|
|||
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
|
||||
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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
@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(',')}))) and (filename like :p) ",:p=>search).order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
|
||||
|
@ -1957,6 +2096,23 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def search_user_org
|
||||
@user = User.current
|
||||
if !params[:search].nil? #发送到有栏目类型为资源的组织中
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||
else
|
||||
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||
end
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@send_id = params[:send_id]
|
||||
@send_ids = params[:checkbox1] || params[:send_ids]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_user
|
||||
|
|
|
@ -2588,6 +2588,12 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def file_preview_eye(file, html_options={})
|
||||
if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)}
|
||||
link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options
|
||||
end
|
||||
end
|
||||
|
||||
#将文本内的/n转换为<br>
|
||||
def text_format text
|
||||
text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","<br/>").html_safe
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
module OrgSubfieldsHelper
|
||||
include OrganizationsHelper
|
||||
end
|
||||
|
|
|
@ -17,6 +17,15 @@ module OrganizationsHelper
|
|||
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" )
|
||||
end
|
||||
|
||||
|
||||
def get_default_name field
|
||||
case field.name
|
||||
when 'activity' then
|
||||
return '动态'
|
||||
when 'course' then
|
||||
return '课程'
|
||||
when 'project' then
|
||||
return '项目'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -49,6 +49,8 @@ module UsersHelper
|
|||
'批改附件'
|
||||
when 'Principal'
|
||||
'用户资源'
|
||||
when 'OrgSubfield'
|
||||
'组织资源'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ class Attachment < ActiveRecord::Base
|
|||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
include UserScoreHelper
|
||||
has_many :attachment_histories
|
||||
|
||||
validates :filename, presence: true, length: {maximum: 254}
|
||||
validates :author, presence: true
|
||||
|
@ -348,11 +349,18 @@ class Attachment < ActiveRecord::Base
|
|||
|
||||
# Deletes the file from the file system if it's not referenced by other attachments
|
||||
def delete_from_disk
|
||||
if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty?
|
||||
#资源存在,且历史记录为0 且 该资源没有存在任何拷贝才能删除资源
|
||||
if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? && self.attachment_histories.count == 0 && Attachment.where('copy_from = ?',self.id) .count == 0
|
||||
delete_from_disk!
|
||||
end
|
||||
end
|
||||
|
||||
#有了历史记录的数据记录是不能被删除的。
|
||||
#true 能被删除 false 不能被删除
|
||||
def destroyable
|
||||
self.attachment_histories.count == 0
|
||||
end
|
||||
|
||||
# Returns file's location on disk
|
||||
def diskfile
|
||||
File.join(self.class.storage_path, disk_directory.to_s, disk_filename.to_s)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class AttachmentHistory < ActiveRecord::Base
|
||||
belongs_to :attachment,foreign_key: 'attachment_id'
|
||||
end
|
|
@ -19,6 +19,7 @@ class Board < ActiveRecord::Base
|
|||
include Redmine::SafeAttributes
|
||||
belongs_to :project,:touch => true
|
||||
belongs_to :course,:touch=>true
|
||||
belongs_to :org_subfield, :touch => true
|
||||
has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC"
|
||||
has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC"
|
||||
belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
class Journal < ActiveRecord::Base
|
||||
include UserScoreHelper
|
||||
belongs_to :journalized, :polymorphic => true
|
||||
belongs_to :journalized, :polymorphic => true,:touch => true
|
||||
# added as a quick fix to allow eager loading of the polymorphic association
|
||||
# since always associated to an issue, for now
|
||||
belongs_to :issue, :foreign_key => :journalized_id
|
||||
belongs_to :issue, :foreign_key => :journalized_id,:touch => true
|
||||
|
||||
belongs_to :user
|
||||
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
|
||||
|
|
|
@ -155,7 +155,6 @@ class Mailer < ActionMailer::Base
|
|||
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
||||
def send_for_user_activities(user, date_to, days)
|
||||
date_from = date_to - days.days
|
||||
subject = "[ #{user.show_name}#{l(:label_day_mail)}]"
|
||||
date_from = "#{date_from} 17:59:59"
|
||||
date_to = "#{date_to} 17:59:59"
|
||||
# 生成token用于直接点击登录
|
||||
|
@ -270,10 +269,11 @@ class Mailer < ActionMailer::Base
|
|||
total_count = @issues.count + @issues_journals.count + @course_messages.count + @project_messages.count + @course_news.count + @course_news_comments.count + @project_news.count + @project_news_comments.count +
|
||||
@project_attachments.count + @course_journal_messages.count + @user_journal_messages.count + @project_journal_messages.count + @forums.count + @memos.count + @attachments.count +
|
||||
@bids.count + @wiki_contents.count
|
||||
subject = "[ #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}]"
|
||||
@subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}"
|
||||
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
||||
#有内容才发,没有不发
|
||||
mail :to => user.mail,:subject => subject if has_content
|
||||
mail :to => user.mail,:subject => @subject if has_content
|
||||
end
|
||||
|
||||
# 作业截止时间邮件提醒
|
||||
|
|
|
@ -23,8 +23,8 @@ class Message < ActiveRecord::Base
|
|||
belongs_to :board,:touch => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
has_many :org_subfield_messages, :dependent => :destroy
|
||||
has_many :org_subfields, :through => :org_subfield_messages
|
||||
# has_many :org_subfield_messages, :dependent => :destroy
|
||||
# has_many :org_subfields, :through => :org_subfield_messages
|
||||
|
||||
acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
|
||||
acts_as_attachable
|
||||
|
@ -44,6 +44,8 @@ class Message < ActiveRecord::Base
|
|||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
||||
after_destroy :delete_org_activities
|
||||
|
||||
acts_as_searchable :columns => ['subject', 'content'],
|
||||
:include => {:board => :project},
|
||||
:project_key => "#{Board.table_name}.project_id",
|
||||
|
@ -150,6 +152,10 @@ class Message < ActiveRecord::Base
|
|||
usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course)))
|
||||
end
|
||||
|
||||
def org_subfield_editable_by?(usr)
|
||||
usr && usr.logged? && (usr.admin? || self.author == usr ||usr.admin_of_org?(self.board.org_subfield.organization))
|
||||
end
|
||||
|
||||
def course_destroyable_by?(usr)
|
||||
usr && usr.logged? && (usr.allowed_to?(:delete_messages, course) || (self.author == usr && usr.allowed_to?(:delete_own_messages, course)))
|
||||
end
|
||||
|
@ -192,7 +198,7 @@ class Message < ActiveRecord::Base
|
|||
# Description
|
||||
def act_as_forge_activity
|
||||
# 如果project为空,那么就是课程相关的消息
|
||||
if !self.board.project.nil? && self.parent_id.nil?
|
||||
if self.board.project_id != -1 && self.parent_id.nil?
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.board.project.id)
|
||||
end
|
||||
|
@ -227,7 +233,7 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
else # 项目相关
|
||||
elsif self.project # 项目相关
|
||||
if self.parent_id.nil? # 主贴
|
||||
self.project.members.each do |m|
|
||||
if m.user_id != self.author_id
|
||||
|
@ -312,4 +318,8 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_org_activities
|
||||
OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,22 @@ class OrgSubfield < ActiveRecord::Base
|
|||
has_many :files
|
||||
has_many :org_subfield_messages, :dependent => :destroy
|
||||
has_many :messages, :through => :org_subfield_messages
|
||||
has_many :boards, :dependent => :destroy
|
||||
acts_as_attachable
|
||||
after_create :create_board_sync
|
||||
# 创建资源栏目讨论区
|
||||
def create_board_sync
|
||||
@board = self.boards.build
|
||||
#self.name=" #{l(:label_borad_course) }"
|
||||
@board.name = " #{l(:label_borad_org_subfield) }"#self.name
|
||||
@board.description = self.name.to_s
|
||||
@board.project_id = -1
|
||||
if @board.save
|
||||
logger.debug "[OrgSubfield Model] ===> #{@board.to_json}"
|
||||
else
|
||||
logger.error "[OrgSubfield Model] ===> Auto create board when org_subfield saved, because #{@board.full_messages}"
|
||||
end
|
||||
end
|
||||
|
||||
def project
|
||||
end
|
||||
|
|
|
@ -9,9 +9,15 @@ class Organization < ActiveRecord::Base
|
|||
has_many :org_subfields, :dependent => :destroy
|
||||
has_many :users, :through => :org_members
|
||||
validates_uniqueness_of :name
|
||||
after_create :save_as_org_activity
|
||||
after_create :save_as_org_activity, :add_default_subfields
|
||||
|
||||
def save_as_org_activity
|
||||
OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization')
|
||||
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')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -196,6 +196,8 @@ class CoursesService
|
|||
@course.tea_id = current_user.id
|
||||
@course.term = params[:term]
|
||||
@course.time = params[:time]
|
||||
@course.end_term = params[:end_term]
|
||||
@course.end_time = params[:end_time]
|
||||
#@course.school_id = params[:occupation]
|
||||
@course.school_id = current_user.user_extensions.school_id
|
||||
@course.setup_time = params[:setup_time]
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<!--<div class="resourceUploadPopup">-->
|
||||
<span class="uploadDialogText">更新资源版本</span>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div class="uploadBoxContainer mt0">
|
||||
<div>
|
||||
<div>当前版本
|
||||
<span class="attachment" >
|
||||
<input readonly="readonly" name="attachments[1][filename]" value="<%=@attachment.filename%>" class="upload_filename readonly" type="text">
|
||||
</span>
|
||||
</div>
|
||||
<% unless @attachment_histories.empty? %>
|
||||
|
||||
<div >历史版本</div>
|
||||
<div style="max-height: 95px;overflow-y:auto; background-color: #e3e3e3;" class="mb10 p10">
|
||||
<% @attachment_histories.each do |history| %>
|
||||
<span class="attachment">
|
||||
<input readonly="readonly" name="attachments_versions_<%= history.id%>" value="<%=history.filename%>" class="upload_filename readonly" type="text">
|
||||
<span>版本号:<%= history.version %></span>
|
||||
</span>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<%= 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 %>
|
||||
<div>
|
||||
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||
</span>
|
||||
</div>
|
||||
<div class="uploadBox">
|
||||
<input type="hidden" name="attachment_type" value="1">
|
||||
<%= render :partial => 'attachments/upload_attachment_new_version' %>
|
||||
<div class="cl"></div>
|
||||
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
</div>
|
||||
<div class="uploadResourceIntr">
|
||||
<div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
|
||||
<div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div style="margin-top: 10px" >
|
||||
<div class="courseSendSubmit">
|
||||
<!--<a href="javascript:void(0);" class="sendSourceText" onclick="">确定</a>-->
|
||||
<%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="hideModal();">取消</a></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<!--</div>-->
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
|
||||
<!--<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" style="<%#= ie8? ? 'display:none' : ''%>" type="button" ><%#= l(:label_browse) %></button>-->
|
||||
<a href="javascript:void(0);" class="uploadIcon f14" name="button" onclick="_file.click()" onmouseover="" style="<%= ie8? ? 'display:none' : ''%>">
|
||||
<span class="chooseFile">选择文件</span></a>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => ie8? ? '':'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");',
|
||||
:style => ie8? ? '': 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js',:old_attachment_id=>@attachment.id),
|
||||
:description_placeholder => l(:label_optional_description),
|
||||
:field_is_public => l(:field_is_public),
|
||||
:are_you_sure => l(:text_are_you_sure),
|
||||
:file_count => l(:label_file_count),
|
||||
:lebel_file_uploding => l(:lebel_file_uploding),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
} %>
|
|
@ -0,0 +1,7 @@
|
|||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/show_attachment_history' )%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","46%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
|
@ -1,2 +1,12 @@
|
|||
<% if @attachment.container_type == 'Course' %>
|
||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
|
||||
<%else%>
|
||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||
:remote=>true,:class=>"f_l re_open",:method => :post) %>");
|
||||
<%end %>
|
||||
<%if @attachment.is_public? %>
|
||||
$("#image_private_<%= @attachment.id%>").html('')
|
||||
<%else%>
|
||||
$("#image_private_<%= @attachment.id%>").html('<span class="img_private ml5">私有</span>')
|
||||
<%end%>
|
|
@ -11,4 +11,5 @@ fileSpan.find('a.remove-upload')
|
|||
})
|
||||
.off('click');
|
||||
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
|
||||
$('<input>',{type:'hidden',name:'attachments[<%= j params[:attachment_id] %>][attachment_id]'}).val('<%= @attachment.id %>').appendTo(fileSpan);
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<% if @flag %>
|
||||
hideModal();
|
||||
alert('更新成功')
|
||||
$(".re_search").submit();
|
||||
<%else%>
|
||||
$("#upload_file_count").html('(更新失败)')
|
||||
<%end %>
|
|
@ -54,7 +54,7 @@
|
|||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
$("#message_subject").focus();
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
编辑帖子
|
||||
</div>
|
||||
</div>
|
||||
<%= render :partial => 'boards/org_subfield_new',
|
||||
:locals => {:f => f, :edit_mode => edit_mode, :topic => topic, :org_subfield => org_subfield} %>
|
||||
</div>
|
|
@ -0,0 +1,74 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false) %>
|
||||
<% end %>
|
||||
|
||||
<%= error_messages_for 'message' %>
|
||||
<div class="resources mt10">
|
||||
<div id="new_course_topic">
|
||||
<div class="homepagePostBrief c_grey">
|
||||
<div>
|
||||
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
|
||||
<p id="subjectmsg"></p>
|
||||
</div>
|
||||
<div id="topic_editor" style="display: none;">
|
||||
<%if User.current.member_of_org?(org_subfield.organization)%>
|
||||
<div class="mt10">
|
||||
<%= f.check_box :sticky, :value => topic.sticky%>
|
||||
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
|
||||
<%= f.check_box :locked, :value => topic.locked%>
|
||||
<%= label_tag 'message_locked', l(:label_board_locked) %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="mt10">
|
||||
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => topic.nil? ? 0: topic.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '100%',
|
||||
:height => 300,
|
||||
:minHeight=>300,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 },
|
||||
at_id: topic.id, at_type: topic.class.to_s
|
||||
%>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<div class="fl" id="topic_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<%if !edit_mode %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<%#= render :partial => 'course_new_topic', :locals => {:f => f, :topic => @message} %>
|
||||
<!--<li>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%#= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0);" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px">
|
||||
<%#= l(:button_submit)%>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
</li>-->
|
||||
</div>
|
||||
</div>
|
|
@ -53,7 +53,7 @@
|
|||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<% when 'News' %>
|
||||
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
|
|
|
@ -4,64 +4,82 @@
|
|||
<div class="hwork_new">
|
||||
<ul>
|
||||
<%= labelled_form_for @course do |f| %>
|
||||
<li class="ml45">
|
||||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();">
|
||||
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6">
|
||||
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" style="display: none;">
|
||||
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" onkeyup="regex_course_password();">
|
||||
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
|
||||
<span class="c_red" id="course_course_password_notice"></span>
|
||||
<li class="ml45">
|
||||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();">
|
||||
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6">
|
||||
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml80">
|
||||
<label >公开 :</label>
|
||||
<input id="course_is_public" name="course[is_public]" type="checkbox" value="1">
|
||||
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)</span>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
|
||||
<span class="c_red" id="course_time_term_notice"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml30">
|
||||
<label >学生列表公开 :</label>
|
||||
<input id="course_open_student" name="course[open_student]" type="checkbox" value="1">
|
||||
<span class="c_grey">(打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)</span>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> 结束学期 :</label>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{} %>
|
||||
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml30">
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" style="display: none;">
|
||||
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" onkeyup="regex_course_password();">
|
||||
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
|
||||
<span class="c_red" id="course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="ml80 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml80">
|
||||
<label >公开 :</label>
|
||||
<input id="course_is_public" name="course[is_public]" type="checkbox" value="1">
|
||||
<span class="c_grey">(选中后课外用户可见该课程,否则仅对课内成员可见)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml30">
|
||||
<label >学生列表公开 :</label>
|
||||
<input id="course_open_student" name="course[open_student]" type="checkbox" value="1">
|
||||
<span class="c_grey">(选中后课外用户可见学生列表,否则仅对课内成员可见)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml30">
|
||||
<label >学生上传资源 :</label>
|
||||
<input <%= @course.publish_resource == 1 ? 'checked' : ''%> id="course_publish_resource" name="course[publish_resource]" type="checkbox" />
|
||||
<span class="c_grey">(打钩为"允许学生上传资源",不打钩为"不允许学生上传资源")</span>
|
||||
<span class="c_grey">(选中后允许学生上传课程资源,否则不允许)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
|
||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
|
||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end%>
|
||||
</ul>
|
||||
</div><!--talknew end-->
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
$("#time").change(function(){
|
||||
document.getElementById("end_time").options[document.getElementById("time").selectedIndex].selected = true;
|
||||
});
|
||||
$("#term").change(function(){
|
||||
document.getElementById("end_term").options[document.getElementById("term").selectedIndex].selected = true;
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -2,11 +2,11 @@
|
|||
<h2 class="project_h2"><%= l(:label_course_modify_settings)%></h2>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
<% if @select_tab == 'member'%>
|
||||
$("#tb_2").click();
|
||||
<% end %>
|
||||
})
|
||||
$(function(){
|
||||
<% if @select_tab == 'member'%>
|
||||
$("#tb_2").click();
|
||||
<% end %>
|
||||
})
|
||||
</script>
|
||||
<div class="hwork_new">
|
||||
<div id="tb_" class="hwork_tb_">
|
||||
|
@ -50,6 +50,12 @@
|
|||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term_selected"} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> 结束学期 :</label>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time_selected"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term_selected"} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" value="<%= @course.password%>" onkeyup="regex_course_password();">
|
||||
|
@ -123,15 +129,17 @@
|
|||
</div><!--talknew end-->
|
||||
<div class="cl"></div>
|
||||
<script type="text/javascript">
|
||||
function select() {
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$("#time_selected").click(select);
|
||||
$("#term_selected").click(select);
|
||||
function select() {
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$("#time_selected").click(select);
|
||||
$("#term_selected").click(select);
|
||||
$("#end_time_selected").click(select);
|
||||
$("#end_term_selected").click(select);
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
|
||||
<script>
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id")
|
||||
$("#container").css('width',"1000px")
|
||||
});
|
||||
function searchone4reload(fileid){
|
||||
var url = "<%= searchone4reload_course_files_path(@course)%>";
|
||||
var data = {};data.fileid=fileid;
|
||||
|
@ -64,33 +69,61 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="resource"><!--资源库内容开始--->
|
||||
<div class="re_top">
|
||||
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">资源库</div>
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','','<%= @q%>','<%= @course.id%>');" class="resourcesTypeAll resourcesGrey">全部</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','课件','<%= @q%>','<%= @course.id%>');" class="homepagePostTypeAssignment postTypeGrey">课件</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','软件','<%= @q%>','<%= @course.id%>');" class="softwareIcon postTypeGrey">软件</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','媒体','<%= @q%>','<%= @course.id%>');" class="mediaIcon resourcesGrey">媒体</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','代码','<%= @q%>','<%= @course.id%>');" class="codeIcon resourcesGrey">代码</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','论文','<%= @q%>','<%= @course.id%>');" class="thesisIcon resourcesGrey">论文</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course,:other=>true)%>','其他','<%= @q%>','<%= @course.id%>');" class="othersIcon resourcesGrey">其它</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="resources mt10" style="padding-bottom:5px;">
|
||||
<div class="reTop mb5">
|
||||
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "课内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
|
||||
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="course_files_upload();">
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> <!-- show_window('light','fade','20%','35%')-->
|
||||
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||
<p class="c_grey fr mt10 mr5">
|
||||
上传:
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
|
||||
|
||||
<!-- show_window('light','fade','20%','35%')-->
|
||||
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||
</div>
|
||||
<div>
|
||||
<div class="fileTagWrap" id="files_tag">
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count%></span> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div><!---re_top end-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="re_con" id="course_list">
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
</div>
|
||||
<div id="course_list">
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
</div>
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
|
@ -1,79 +1,90 @@
|
|||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="files_tag" id="files_tag">
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="for_img_thumbnails">
|
||||
<% curse_attachments.each do |file| %>
|
||||
<% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
|
||||
<div class="re_con_box" id="container_files_<%= file.id %>">
|
||||
<div class="">
|
||||
<%= 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 => "c_dblue f_14 f_b f_l" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
<div class="resources mt10"><!--资源库内容开始--->
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%= 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') %>
|
||||
<span id="image_private_<%= file.id%>">
|
||||
<% if file.is_public? == false%>
|
||||
<span class="img_private ml5">私有</span>
|
||||
<%end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(file.created_on)%></span>
|
||||
<% if file.tag_list.length > 0%>
|
||||
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
|
||||
<% end %>
|
||||
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
<%= 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} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
|
||||
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<% if @course.is_public? %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
|
||||
</span>
|
||||
<% else %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<span class="f_l re_open c_blue">私有</span>
|
||||
</span>
|
||||
<% end %>
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
|
||||
<% else %>
|
||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
<% end %>
|
||||
<%= file_preview_tag(file, class: 'f_l re_open') %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
<%= 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} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% 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" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if @course.is_public? %>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= 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 %>
|
||||
</span>
|
||||
</li>
|
||||
<%end%>
|
||||
<li>
|
||||
<%= 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 %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<% end %>
|
||||
<%else%>
|
||||
<ul class="resourceSendO">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if curse_attachments.count == 10%>
|
||||
<% if params[:action] == 'search' %>
|
||||
<%=link_to "点击展开更多", search_course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%else%>
|
||||
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
|
||||
<%=link_to "点击展开更多", course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%end%>
|
||||
<% end%>
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
<% tag_list.each do |k,v|%>
|
||||
<% if tag_name && tag_name == k%>
|
||||
<!-- 鼠标不能移动是因为 href="javascript:void(0);"导致的 -->
|
||||
<span> <a class="files_tag_select" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>(<%= v%>)</a></span>
|
||||
<span> <a class="files_tag_select" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%></a></span>
|
||||
<% else%>
|
||||
<span class="files_tag_icon" >
|
||||
<a title="双击可编辑"
|
||||
onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(course)%>','<%= k%>','<%= @q%>','<%= course.id%>');"
|
||||
ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>(<%= v%>)</a></span>
|
||||
ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%></a></span>
|
||||
<% end%>
|
||||
<% end%>
|
||||
<% end%>
|
|
@ -1,12 +1,18 @@
|
|||
<div id="resource_list">
|
||||
|
||||
<% if @container_type == 0 %>
|
||||
<%= render :partial => 'project_file_new', locals: {project: @project} %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'project_file_new', locals: {project: @project} %>
|
||||
</div>
|
||||
<% elsif @container_type == 1 %>
|
||||
<%= render :partial => 'course_file', locals: {course: @course} %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'course_file', locals: {course: @course} %>
|
||||
</div>
|
||||
<% elsif @container_type == 2 %>
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<script type='text/javascript'>
|
||||
var slideHeight = 29;
|
||||
|
@ -179,6 +185,20 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
function org_id_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
$(".orgDirection").text(orgDirection + sendText);
|
||||
}
|
||||
function subfield_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
var sendColumn = $("input[name='subfield']:checked").next().text();
|
||||
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
|
||||
}
|
||||
|
||||
|
||||
function course_attachmenttypes_change(id, type) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
|
@ -225,6 +245,105 @@
|
|||
});
|
||||
|
||||
}
|
||||
function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) {
|
||||
$('#'+fieldId).each(function() {
|
||||
var $this = $(this);
|
||||
$this.addClass('autocomplete');
|
||||
$this.attr('data-value-was', $this.val());
|
||||
var check = function() {
|
||||
var val = $this.val();
|
||||
if ($this.attr('data-value-was') != val){
|
||||
$this.attr('data-value-was', val);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
data: {search: $this.val(),send_id:send_id,send_ids:send_ids},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $this.addClass('ajax-loading'); },
|
||||
complete: function(){ $this.removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
};
|
||||
var reset = function() {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
timer = setInterval(check, 300);
|
||||
}
|
||||
};
|
||||
var timer = setInterval(check, 300);
|
||||
$this.bind('keyup click mousemove', reset);
|
||||
});
|
||||
}
|
||||
function check_des(event){
|
||||
if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址组织不能为空')
|
||||
return false;
|
||||
}else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址栏目不能为空')
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
<% if User.current.logged? %>
|
||||
var sendType = '1';
|
||||
var lastSendType ;//初始为发送到我的课程
|
||||
function show_send(id){
|
||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if(lastSendType == '1'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if( lastSendType == '3'){//组织
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//id 发送的id
|
||||
//发送的id数组
|
||||
function chooseSendType(res_id,res_ids){
|
||||
|
||||
sendType = $(".resourcesSendType").val();
|
||||
if (sendType === lastSendType) {
|
||||
return;
|
||||
} else if(lastSendType != null) { //不是第一次点击的时候
|
||||
if (sendType == '1') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
} else if(sendType == '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}else if(sendType == '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
lastSendType = sendType;
|
||||
}
|
||||
<% end %>
|
||||
<% if @course %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
|
@ -368,6 +487,27 @@
|
|||
}
|
||||
<%end %>
|
||||
|
||||
function show_attachments_history(){
|
||||
|
||||
}
|
||||
|
||||
//更新文件版本 表单提交确认,原则是只能有一个更新文件
|
||||
function upload_attachment_version(event){
|
||||
if($("#upload_form").find('.upload_filename').length > 1){
|
||||
$("#upload_file_count").html('(只能上传一个更新文件)')
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}else if($("#upload_form").find('.upload_filename').length == 0){
|
||||
$("#upload_file_count").html('(请上传一个更新文件)')
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}else{
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
<% if @course %>
|
||||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
|
||||
<%end %>
|
|
@ -1 +1,6 @@
|
|||
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
<% if (@obj_pages &&( @obj_pages.page > 1)) || (@feedback_pages && (@feedback_pages.page > 1)) %> //搜索的时候有时候是需要加载下一页,有时候是直接替换当前 #course_list。这个根据 page来判定
|
||||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach} )%>");
|
||||
<% else %>
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
$("#attachment_count").html("<%= @result.count%>")
|
||||
<% end %>
|
|
@ -1 +1,2 @@
|
|||
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
$("#attachment_count").html("<%= @result.count%>")
|
|
@ -13,7 +13,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','courses','org' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%>
|
||||
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
|
@ -120,19 +120,21 @@
|
|||
<!--</div>-->
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="f12 fontGrey3">
|
||||
<%= link_to '文章', organization_org_document_comments_path(@organization) %>
|
||||
<% if User.current.logged? %>
|
||||
(
|
||||
<%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %>
|
||||
)
|
||||
<% end %>
|
||||
|
|
||||
<%= link_to '成员', members_organization_path(@organization.id) %>
|
||||
<% if User.current.logged? %>
|
||||
(<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>)
|
||||
<% end %>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div class="f12 fontGrey3">
|
||||
<%= link_to '文章', organization_org_document_comments_path(@organization) %>
|
||||
<% if User.current.logged? %>
|
||||
(
|
||||
<%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %>
|
||||
)
|
||||
<% end %>
|
||||
|
|
||||
<%= link_to '成员', members_organization_path(@organization.id) %>
|
||||
<% if User.current.logged? %>
|
||||
(<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>)
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuContainer" id="sub_field_left_lists">
|
||||
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
|
||||
|
|
|
@ -37,28 +37,30 @@
|
|||
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if @topic.author.id == User.current.id%>
|
||||
<% if User.current.logged? %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => @topic},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.course_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => @topic},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.course_destroyable_by?(User.current) %>
|
||||
<%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
<% if @topic.author.id == User.current.id %>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => @topic},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.course_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => @topic},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.course_destroyable_by?(User.current) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li> <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
$(".postRightContainer").css("margin-left", "0px");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
|
||||
function course_board_canel_message_replay()
|
||||
{
|
||||
message_content_editor.html("");
|
||||
}
|
||||
|
||||
function course_board_submit_message_replay()
|
||||
{
|
||||
if(MessageReplayVevify())
|
||||
{
|
||||
message_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
||||
$("#message_form").submit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function MessageReplayVevify() {
|
||||
var content = message_content_editor.html();//$.trim($("#message_content").val());
|
||||
if (message_content_editor.isEmpty()) {
|
||||
$("#message_content_span").text("回复不能为空");
|
||||
$("#message_content_span").css('color', '#ff0000');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$("#message_content_span").text("填写正确");
|
||||
$("#message_content_span").css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @topic.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
|
||||
<div class="postThemeContainer">
|
||||
<div class="postDetailPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if @message.org_subfield_editable_by?(User.current) %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => @topic},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => @topic},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
<!--<li> <%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="postDetailTitle fl">
|
||||
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<% 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 %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="memo-content upload_img break_word" id="message_description_<%= @topic.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @topic.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @topic, :author => false %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostReply">
|
||||
<% unless @replies.empty? %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @topic.id %>">
|
||||
<% @replies.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% 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 %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => reply},
|
||||
:method => :post,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.org_subfield_editable_by?(User.current) %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
|
||||
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %>
|
||||
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -99,21 +99,23 @@
|
|||
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if @topic.author.id == User.current.id%>
|
||||
<% if User.current.logged? %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.destroyable_by?(User.current) %>
|
||||
<%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
<% if @topic.author.id == User.current.id %>
|
||||
<li>
|
||||
<%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.destroyable_by?(User.current) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li> <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -2,10 +2,14 @@
|
|||
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
|
||||
<% if !org.nil? %>
|
||||
<span class="fontBlue pl10">组织:<%= org.name %></span>
|
||||
<% org.org_subfields.where("field_type='Post'").each do |subfield| %>
|
||||
<li>
|
||||
<label><input type="checkbox" name='org_subfields[]' value='<%= subfield.id %>' class="mt3 fl mr5"/><span><%= subfield.name %></span></label>
|
||||
</li>
|
||||
<% if org.org_subfields.where("field_type='Post'").count > 0 %>
|
||||
<% org.org_subfields.where("field_type='Post'").each do |subfield| %>
|
||||
<li>
|
||||
<label><input type="checkbox" name='org_subfields[]' value='<%= subfield.id %>' class="mt3 fl mr5"/><span><%= subfield.name %></span></label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<li><span class="mt3 fl mr5">暂无帖子栏目</span></li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="fontBlue pl10">请在左侧选择组织</span>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% if @message.project %>
|
||||
<%= form_for @message, {:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
|
@ -14,7 +14,7 @@
|
|||
<% elsif @message.course %>
|
||||
<%= form_for @message, {
|
||||
:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
|
@ -22,6 +22,18 @@
|
|||
<%= render :partial => 'boards/course_message_edit',
|
||||
:locals => {:f => f, :edit_mode => true, :topic => @message, :course => @message.course} %>
|
||||
<% end %>
|
||||
|
||||
<% elsif @message.board.org_subfield %>
|
||||
<%= form_for @message, {
|
||||
:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
} do |f| %>
|
||||
<%= render :partial => 'boards/org_subfield_message_edit',
|
||||
:locals => {:f => f, :edit_mode => true, :topic => @message, :org_subfield => @message.board.org_subfield} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div id="preview" class="wiki"></div>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<%if @project%>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
|
||||
<%elsif @course%>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
|
||||
<% 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");
|
|
@ -2,4 +2,6 @@
|
|||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
<% elsif @course %>
|
||||
<%= render :partial => 'course_show', locals: {course: @course} %>
|
||||
<% else %>
|
||||
<%= render :partial => 'org_subfield_show', :locals => {:org_subfield => @org_subfield} %>
|
||||
<% end %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
showNormalImage('message_description_<%= @document.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="resources mt10" id="organization_document_<%= @document.id %>">
|
||||
<div class="resources" id="organization_document_<%= @document.id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_path(@document.creator_id) %>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
|
||||
:locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||||
:subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
|
||||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#subfield_name").val("");
|
|
@ -1,4 +1,6 @@
|
|||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
|
||||
:locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||||
:subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
|
||||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
|
@ -50,31 +50,22 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'OrgSubfield' %>
|
||||
<% if act.org_act_type == 'Message' %>
|
||||
<% if act.org_act_type == 'Message' and act.org_act_id and Message.where("id=#{act.org_act_id}").count > 0 %>
|
||||
<% message = Message.find(act.org_act_id) %>
|
||||
<% if !message.board.course_id.nil? %>
|
||||
<%= render :partial => 'org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% else %>
|
||||
<% elsif message.board.project_id != -1 %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% elsif message.board.org_subfield_id %>
|
||||
<%= render :partial => 'organizations/org_subfield_message', :locals => {:activity => message, :user_activity_id => act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--<ul class="wlist" style=" border:none; padding-top: 15px;">-->
|
||||
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
<!--</ul>-->
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if org_act_count == 10 %>
|
||||
<!--<div id="show_more_activities" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", organization_path(org,:page => page.to_i + 1, :show_homepage =>params[:show_homepage],:type => params[:type]),:id => "more_org_activities_link",:remote => "true",:class => "none" %></div>-->
|
||||
<%= link_to "点击展开更多",organization_path(org,:page => page.to_i + 1, :show_homepage =>params[:show_homepage],:type => params[:type]),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||
<% end%>
|
||||
|
||||
<!--
|
||||
<script>
|
||||
$(function(){
|
||||
$("#show_more_activities").mouseover(function(){
|
||||
$("#more_org_activities_link").click();
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -1,34 +1,43 @@
|
|||
<div class="homepageLeftMenuBlock">
|
||||
<% org_activity_field = organization.org_subfields.where('field_type="default" and name="activity" and field_type="default"').first %>
|
||||
<% org_course_field = organization.org_subfields.where('field_type="default" and name="course" and field_type="default"').first %>
|
||||
<% org_project_field = organization.org_subfields.where('field_type="default" and name="project" and field_type="default"').first %>
|
||||
<div class="homepageLeftMenuBlock" style="display:<%= org_activity_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_activity_field.id %>">
|
||||
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
|
||||
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
|
||||
<%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuProjects" style="display:<%= organization.projects.count == 0?'none':'' %>">
|
||||
<ul >
|
||||
|
||||
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
|
||||
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
|
||||
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
|
||||
<ul >
|
||||
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
<% organization.org_subfields.each do |field| %>
|
||||
<div style="display:<%= org_project_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_project_field.id %>">
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
|
||||
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
|
||||
<%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuProjects" style="display:<%= organization.projects.count == 0?'none':'' %>">
|
||||
<ul >
|
||||
|
||||
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:<%= org_course_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_course_field.id %>">
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
|
||||
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
|
||||
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
|
||||
<ul >
|
||||
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% organization.org_subfields.where("field_type != 'default'").each do |field| %>
|
||||
<div class="homepageLeftMenuBlock" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
|
||||
<% if field.field_type == "Post" %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||
<% if User.current.member_of_org?organization %>
|
||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
||||
<% if User.current.member_of_org?organization %>
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% 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.board.org_subfield.name.to_s+" | 帖子栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%>
|
||||
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.board.org_subfield.name %>(项目讨论区)</a>-->
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate">
|
||||
时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
|
||||
<div id="intro_content_<%= user_activity_id%>">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= activity.content.to_s.html_safe%>
|
||||
<% else %>
|
||||
<%= activity.parent.content.to_s.html_safe%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = 0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
|
||||
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
||||
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
|
||||
<%=count %>
|
||||
)</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= 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|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,16 +1,16 @@
|
|||
<div class="resources mt10" id="organization_document_<%= document.id %>">
|
||||
<div class="resources <%= User.current.logged? ? 'mt10' :'' %>" id="organization_document_<%= document.id %>">
|
||||
<div class="homepagePostBrief">
|
||||
|
||||
<div class="homepagePostDes" style="width:690px;">
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<div class="homepagePostTitle postGrey"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></div>
|
||||
|
||||
<% end %>
|
||||
<% unless document.content.blank? %>
|
||||
<div class="homepagePostIntro" >
|
||||
<%= document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if params[:show_homepage].nil? %>
|
||||
<% if params[:show_homepage].nil? and User.current.logged? %>
|
||||
<div class="homepagePostDate" style="float:right;">
|
||||
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
|
||||
</div>
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
<%= document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course document, :author => false %>
|
||||
</div>
|
||||
<!-- <%# if defined?(home_id) %>
|
||||
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
||||
<%# end %>-->
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
<ul class="orgListRow">
|
||||
<li class="orgListUser fb">已有栏目</li>
|
||||
<li class="orgListStatus fb">状态</li>
|
||||
<li class="orgListStatus fb">类型</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser fb">已有栏目</li>
|
||||
<li class="orgListUser fb">状态</li>
|
||||
<li class="orgListStatus fb">类型</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser">动态</li>
|
||||
<li class="orgListUser">默认</li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser">项目</li>
|
||||
<li class="orgListUser">默认</li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser">课程</li>
|
||||
<li class="orgListUser">默认</li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% subfields.each do |field| %>
|
||||
<% default_fields.each do |field| %>
|
||||
<% name = get_default_name(field) %>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser"><div id="subfield_show_<%= field.id %>"><%= field.name %></div><div id="subfield_edit_<%= field.id %>" style="display:none;">
|
||||
<input type="text" name="name" onblur="update_subfield('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>','<%= field.id %>',$(this).val());" value="<%= field.name %>" style="width:70px;" /></div></li>
|
||||
<li class="orgListUser">新增</li>
|
||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子":"资源" %></li>
|
||||
<%= link_to "删除",org_subfield_path(field), :method => 'delete',:remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr5" %>
|
||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
|
||||
<div class="cl"></div>
|
||||
<li class="orgListUser"><%= name %></li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
function edit(show_id, edit_id){
|
||||
<% subfields.each do |field| %>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser">
|
||||
<div id="subfield_show_<%= field.id %>"><%= field.name %></div>
|
||||
<div id="subfield_edit_<%= field.id %>" style="display:none;">
|
||||
<input type="text" name="name" onblur="update_subfield('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>','<%= field.id %>',$(this).val());" value="<%= field.name %>" style="width:70px;"/>
|
||||
</div>
|
||||
</li>
|
||||
<li class="orgListStatus">新增</li>
|
||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
||||
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
|
||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
||||
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
|
||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
function edit(show_id, edit_id) {
|
||||
$(show_id).toggle();
|
||||
$(edit_id).toggle();
|
||||
$(edit_id).find('input').focus();
|
||||
$(edit_id).find('input').on('keypress',function(e){
|
||||
if(e.keyCode == 13){
|
||||
$(edit_id).find('input').on('keypress', function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
this.blur();
|
||||
}
|
||||
})
|
||||
|
@ -50,12 +50,25 @@
|
|||
if ($(show_id).html().trim() != input_value.trim()) {
|
||||
if (confirm('确定修改为' + input_value + "?"))
|
||||
$.ajax({
|
||||
url :"/org_subfields/" + field_id + "?name=" + input_value,
|
||||
type :'put'
|
||||
url: "/org_subfields/" + field_id + "?name=" + input_value,
|
||||
type: 'put'
|
||||
});
|
||||
}
|
||||
$(show_id).show();
|
||||
$(edit_id).hide();
|
||||
// $(edit_id).focus();
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
||||
function hide(content, id){
|
||||
if (content.text() == '设为隐藏')
|
||||
$.ajax({
|
||||
url: "/organizations/hide_org_subfield?org_subfield_id=" + id,
|
||||
type: "post"
|
||||
});
|
||||
else
|
||||
$.ajax({
|
||||
url: "/organizations/show_org_subfield?org_subfield_id=" + id,
|
||||
type: "post"
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
$("#hide_<%= @org_subfield.id %>").text("设为可见");
|
||||
$("#org_subfield_<%= @org_subfield.id %>").css("display", "none");
|
|
@ -0,0 +1,2 @@
|
|||
$(".columnContent").html('<%= escape_javascript( render :partial => 'users/org_resources_subfield',:locals => {:subfield=>@subfield})%>')
|
||||
$(".orgDirection").text('目标地址:'+'<%= @org.name.html_safe%>')
|
|
@ -0,0 +1,16 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
$("#message_subject").focus();
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
编辑帖子
|
||||
</div>
|
||||
</div>
|
||||
<%= render :partial => 'boards/course_new',
|
||||
:locals => {:f => f, :edit_mode => edit_mode, :topic => topic, :course => course} %>
|
||||
</div>
|
|
@ -107,7 +107,8 @@
|
|||
</div>
|
||||
<div class="undis ml15 mr15" id="orgContent_3">
|
||||
<div class="orgMemberList" id="org_subfield_list">
|
||||
<%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields } %>
|
||||
<%= render :partial => 'organizations/subfield_list', :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||||
:subfields => @organization.org_subfields.where("field_type != 'default'") } %>
|
||||
</div>
|
||||
<div class="fr orgMemContainer">
|
||||
<div class="orgMemberAdd">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
</style>
|
||||
<% if params[:show_homepage].nil? %>
|
||||
<% if params[:show_homepage].nil? and User.current.logged? %>
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName"><%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %></div>
|
||||
<% if params[:org_subfield_id].nil? %>
|
||||
|
@ -69,10 +69,10 @@
|
|||
<% end %>
|
||||
<% if @org_activities %>
|
||||
<%= render :partial => 'organizations/org_activities',
|
||||
:locals => {:org_activities =>@org_activities,
|
||||
:page=>@page,
|
||||
:org => @organization,
|
||||
:org_act_count=>@org_activities.count}%>
|
||||
:locals => {:org_activities => @org_activities,
|
||||
:page=> @page,
|
||||
:org => @organization,
|
||||
:org_act_count=> @org_activities.count} %>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#hide_<%= @org_subfield.id %>").text("设为隐藏");
|
||||
$("#org_subfield_<%= @org_subfield.id %>").css("display", "block");
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
<!--message -->
|
||||
<% when "Message" %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id} %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<!--new 新闻-->
|
||||
<% when "News" %>
|
||||
<% if !activity.forge_act.nil? and activity.forge_act.project %>
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
<ul class="hworkUl">
|
||||
<li class="hworkList340 hworkH30 width505">
|
||||
<span class="HomeworkNameTitle f14 fb fl">作品名称</span>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
|
||||
<span class="HomeworkStuTitle f14 fb fl">学号</span>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<span class="HomeworkStuTitle f14 fb fl">关联项目</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="hworkList130 hworkH30 fb ml10">
|
||||
时间
|
||||
</li>
|
||||
|
||||
<li class="hworkList50 hworkH30 fb mr10 ml10">
|
||||
我的评分
|
||||
</li>
|
||||
<ul class="hworkUl">
|
||||
<li class="hworkList340 hworkH30 w455">
|
||||
<span class="HomeworkNameTitle f14 fb fl w235">作品名称</span>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
|
||||
<span class="HomeworkStuTitle f14 fb fl">学号</span>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<span class="HomeworkStuTitle f14 fb fl">关联项目</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="hworkList130 hworkH30 fb ml10">
|
||||
时间
|
||||
</li>
|
||||
|
||||
<% if @homework.homework_type == 2%>
|
||||
<li class="hworkList50 hworkH30 fb">
|
||||
系统
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<li class="hworkList50 hworkH30 fb mr10 ml10" style="float: right;">
|
||||
我的评分
|
||||
</li>
|
||||
</ul>
|
|
@ -6,16 +6,16 @@
|
|||
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% is_my_work = pro && pro.student_work_id == student_work.id%>
|
||||
<% end %>
|
||||
<li class="hworkList340 width525">
|
||||
<li class="hworkList340 w465">
|
||||
<ul>
|
||||
<% if is_my_work%>
|
||||
<li class="hworkPortrait mt15 mr10">
|
||||
<%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %>
|
||||
</li>
|
||||
<li class="hworkName mt15 mr15 width255 student_work_<%= student_work.id%>">
|
||||
<li class="hworkName mt15 mr15 w230 student_work_<%= student_work.id%>">
|
||||
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
|
||||
<div>
|
||||
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
|
||||
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w230"%>
|
||||
</div>
|
||||
</li>
|
||||
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
|
||||
|
@ -40,9 +40,9 @@
|
|||
<li class="hworkPortrait mt15 mr10">
|
||||
<%= image_tag(url_to_avatar(""),width:"40", height: "40") %>
|
||||
</li>
|
||||
<li class="hworkName mt15 mr15 width255 student_work_<%= student_work.id%>">
|
||||
<li class="hworkName mt15 mr15 w230 student_work_<%= student_work.id%>">
|
||||
<div>
|
||||
<%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
|
||||
<%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w230"%>
|
||||
</div>
|
||||
</li>
|
||||
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
|
||||
|
@ -75,8 +75,15 @@
|
|||
</li>
|
||||
|
||||
<!-- 成绩 -->
|
||||
<% if @homework.homework_type == 2%>
|
||||
<!-- 系统评分 -->
|
||||
<li class="hworkList50 <%= score_color student_work.system_score%>">
|
||||
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<% my_score = student_work_score(student_work,User.current) %>
|
||||
<li class="hworkList50 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score)%> mr10">
|
||||
<li class="hworkList50 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score)%> mr10 ml10" style="float:right; ">
|
||||
<%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
|
||||
</li>
|
||||
<li class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></li>
|
||||
|
|
|
@ -25,7 +25,7 @@ else{
|
|||
indentUnit: 2,
|
||||
matchBrackets: true,
|
||||
readOnly: true,
|
||||
value: document.getElementById("work-src").innerText
|
||||
value: $("#work-src").text()
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" onmouseover="$('#message_setting_<%= user_activity_id%>').show();" onmouseout="$('#message_setting_<%= user_activity_id%>').hide();">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
|
||||
|
@ -43,17 +43,38 @@
|
|||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
|
||||
|
||||
|
||||
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:class => 'postOptionLink'
|
||||
) if activity.course_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.course_destroyable_by?(User.current) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -120,7 +141,7 @@
|
|||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= 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|%>
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>
|
||||
<% unless subfield.nil? || subfield.empty? %>
|
||||
<% subfield.each do |field| %>
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="subfield" onclick="subfield_click();" value="<%= field.id %>" class="mt3 fl mr5" />
|
||||
<span><%= field.name %></span></label>
|
||||
</li>
|
||||
<%end %>
|
||||
<%end %>
|
|
@ -1,4 +1,4 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" onmouseover="$('#message_setting_<%= user_activity_id%>').show();" onmouseout="$('#message_setting_<%= user_activity_id%>').hide();">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
|
@ -44,6 +44,36 @@
|
|||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:class => 'postOptionLink'
|
||||
) if activity.editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.destroyable_by?(User.current) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<div >
|
||||
<div class="relateText fl mb10 mr5">发送到</div>
|
||||
<div class="resourcesSendTo mr15">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2">项目</option>
|
||||
<option value="3" selected>组织</option>
|
||||
</select>
|
||||
</div>
|
||||
<%= form_tag search_user_org_user_path(user),:method => 'get',
|
||||
:remote=>true,:id=>'search_user_org_form' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<input type="text" name="serach" id="search_org_input" value="<%=@search %>" placeholder="输入名称搜索" class="orgSendSearch mt15" />
|
||||
<script>
|
||||
observeSearchfieldOnInput('search_org_input','<%= search_user_org_user_path(user)%>','<%= send_id %>','<%= send_ids%>')
|
||||
</script>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<div class="sectionWrap fl mr15">
|
||||
<ul class="fontGrey3 sectionContent">
|
||||
<% unless @orgs.empty? %>
|
||||
<% @orgs.each do |org|%>
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id)%>')" class="mt3 fl mr5" />
|
||||
<span><%= org.name%></span></label>
|
||||
</li>
|
||||
<%end%>
|
||||
<%end%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="columnWrap">
|
||||
<ul class="columnContent">
|
||||
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
|
||||
<!--<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>-->
|
||||
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
|
||||
<!--<li>-->
|
||||
<!--<label>-->
|
||||
<!--<input type="radio" name="sendColumn" class="mt3 fl mr5" />-->
|
||||
<!--<span>动态</span></label>-->
|
||||
<!--</li>-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
|
||||
<div class="courseSendSubmit mr15">
|
||||
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
|
||||
</div>
|
||||
<div class="courseSendCancel">
|
||||
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%end %>
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
<div class="boxContainer">
|
||||
<div>
|
||||
<div class="sendText fl">将资源发送至</div>
|
||||
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
||||
<div class="resourcesSendTo">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2" selected>项目</option>
|
||||
<option value="3">组织</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -47,7 +48,7 @@
|
|||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="closePopUp();">取消</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
<div class="boxContainer">
|
||||
<div>
|
||||
<div class="sendText fl">将资源发送至</div>
|
||||
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
||||
<div class="resourcesSendTo">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2">项目</option>
|
||||
<option value="3">组织</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -47,7 +48,7 @@
|
|||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="closePopUp();">取消</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<% attachments.each do |attach| %>
|
||||
<ul class="resourcesList" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
|
||||
<li class="resourcesListCheckbox fl">
|
||||
<input name="checkbox1[]" type="checkbox" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
||||
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
||||
</li>
|
||||
<li class="resourcesListName fl">
|
||||
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<% when 'News' %>
|
||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||
<% when 'Course'%>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<% when 'Issue' %>
|
||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
||||
<% when 'ProjectCreateInfo'%>
|
||||
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% end %>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
if($.trim($("#anonymous_comment").val()) == 1) {
|
||||
$("#anonymous_comment").attr('checked',false);
|
||||
} else {
|
||||
$("#anonymous_comment").attr('checked',true);
|
||||
} else {
|
||||
$("#anonymous_comment").attr('checked',false);
|
||||
}
|
||||
$("#BluePopupBox a.BlueCirBtn").click();
|
||||
<% if edit_mode && homework.is_group_homework? %>
|
||||
|
@ -16,9 +16,9 @@
|
|||
});
|
||||
function checked_val() {
|
||||
if ($("#anonymous_comment").is(":checked")) {
|
||||
$("#anonymous_comment").val(0);
|
||||
} else {
|
||||
$("#anonymous_comment").val(1);
|
||||
} else {
|
||||
$("#anonymous_comment").val(0);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -53,8 +53,8 @@
|
|||
</div>
|
||||
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
|
||||
<div class="fl f14 ml10" style="margin-top: 4px;">
|
||||
<input type="checkbox" name="homework_common[anonymous_comment]" checked="checked" value="<%=edit_mode ? homework.anonymous_comment : 0 %>" id="anonymous_comment"/>
|
||||
<span class="f14 c_grey mr10">启用匿评</span>
|
||||
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 0 %>" id="anonymous_comment"/>
|
||||
<span class="f14 c_grey mr10">禁用匿评</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
|
|||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
closePopUp();
|
||||
hideModal();
|
||||
alert("发送成功")
|
||||
<% else%>
|
||||
<% end %>
|
|
@ -0,0 +1,10 @@
|
|||
<% if @flag == true%>
|
||||
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
|
||||
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
hideModal();
|
||||
alert("发送成功")
|
||||
<% else%>
|
||||
<% end %>
|
|
@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
|
|||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
closePopUp();
|
||||
hideModal();
|
||||
alert("发送成功")
|
||||
<% else%>
|
||||
<% end %>
|
|
@ -9,10 +9,10 @@
|
|||
//$("#upload_box").css('left','').css('top','');
|
||||
//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
//$("#upload_box").css('display','block');
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closePopUp();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox").addClass("shareDP");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
var val = $("#search_org_input").val();
|
||||
$("#search_org_input").val("").focus().val(val);
|
|
@ -8,7 +8,7 @@
|
|||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closePopUp();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox")
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
|
|
@ -41,6 +41,20 @@
|
|||
function submit_files(){
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
|
||||
function check_des(event){
|
||||
if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址组织不能为空')
|
||||
return false;
|
||||
}else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址栏目不能为空')
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">资源库</div>
|
||||
|
@ -294,10 +308,15 @@
|
|||
//批量删除
|
||||
function batch_delete(){
|
||||
var data = $("#resources_list_form").serialize();
|
||||
if($("input[type=checkbox][data-has-history=Y]:checked").length != 0){
|
||||
alert("您只能删除没有历史记录的资源,请重新选择后再删除。");
|
||||
return;
|
||||
}
|
||||
if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){
|
||||
alert("您只能删除自己上传的资源,请重新选择后再删除。");
|
||||
return;
|
||||
}
|
||||
|
||||
if(data != "" && confirm('确认要删除这些资源吗?')) {
|
||||
$.post(
|
||||
'<%= user_resource_delete_user_path(@user)%>',
|
||||
|
@ -441,6 +460,10 @@
|
|||
line.children().css("background-color", 'white');
|
||||
id = line.children().last().html();
|
||||
user_id = line.children().eq(5).html();
|
||||
if(line.children().first().children().data('hasHistory') == 'Y'){
|
||||
alert('该资源存在历史版本,不能删除');
|
||||
return;
|
||||
}
|
||||
if(user_id === '<%= User.current.id%>') {
|
||||
if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) {
|
||||
$.ajax({
|
||||
|
@ -467,11 +490,17 @@
|
|||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id
|
||||
});
|
||||
} else {
|
||||
} else if(sendType === '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if(sendType ==='3')
|
||||
{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}
|
||||
}else{//如果是多个发送
|
||||
if (sendType === '1'){
|
||||
|
@ -479,11 +508,16 @@
|
|||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize()
|
||||
});
|
||||
}else{
|
||||
}else if(sendType === '2'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize()
|
||||
});
|
||||
}else if(sendType === '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -521,5 +555,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
function subfield_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
var sendColumn = $("input[name='subfield']:checked").next().text();
|
||||
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ en:
|
|||
label_homework: Task
|
||||
label_course_news: 课程通知
|
||||
label_main_teacher: 主讲教师
|
||||
label_course_term: 开课学期
|
||||
label_course_term: 开始学期
|
||||
|
||||
label_join_course: 加入
|
||||
label_exit_course: exit course
|
||||
|
|
|
@ -19,7 +19,7 @@ zh:
|
|||
label_course_news: 课程通知
|
||||
label_course_mail_news_reply: 课程通知回复
|
||||
label_main_teacher: 主讲教师
|
||||
label_course_term: 开课学期
|
||||
label_course_term: 开始学期
|
||||
label_isuue_mail_status: 更新了issue状态!
|
||||
|
||||
label_join_course: 加入
|
||||
|
|
|
@ -1728,6 +1728,7 @@ zh:
|
|||
label_hot_project: '热门项目'
|
||||
label_borad_project: 项目讨论区
|
||||
label_borad_course: 课程讨论区
|
||||
label_borad_org_subfield: 资源栏目讨论区
|
||||
view_borad_course: 课程讨论
|
||||
label_memo_create_succ: 发布成功
|
||||
label_memo_create_fail: 发布失败
|
||||
|
|
|
@ -47,10 +47,13 @@ RedmineApp::Application.routes.draw do
|
|||
post 'join_project_menu'
|
||||
post 'join_projects'
|
||||
post 'logout'
|
||||
get 'org_resources_subfield'
|
||||
end
|
||||
collection do
|
||||
get 'check_uniq'
|
||||
get 'autocomplete_search'
|
||||
post 'hide_org_subfield'
|
||||
post 'show_org_subfield'
|
||||
end
|
||||
resources :org_document_comments do
|
||||
member do
|
||||
|
@ -62,6 +65,9 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'}
|
||||
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}
|
||||
|
||||
resources :org_member do
|
||||
member do
|
||||
|
||||
|
@ -84,6 +90,7 @@ RedmineApp::Application.routes.draw do
|
|||
match "quote_resource_show_org_subfield", :via => [:get]
|
||||
end
|
||||
end
|
||||
resource :boards
|
||||
end
|
||||
|
||||
resources :org_document_comments do
|
||||
|
@ -409,12 +416,12 @@ RedmineApp::Application.routes.draw do
|
|||
match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields'
|
||||
get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
|
||||
match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
|
||||
get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
|
||||
get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit',:as=>'edit_board_message'
|
||||
|
||||
post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message'
|
||||
post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
|
||||
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
|
||||
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
|
||||
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy',:as=>'delete_board_message'
|
||||
match 'messages/join_org_subfield', :to => 'messages#join_org_subfield'
|
||||
match 'messages/get_subfield_on_click_org', :to => 'messages#get_subfield_on_click_org'
|
||||
match 'messages/join_org_subfields', :to => 'messages#join_org_subfields'
|
||||
|
@ -506,6 +513,7 @@ RedmineApp::Application.routes.draw do
|
|||
get "search_user_course"
|
||||
post "add_exist_file_to_course"
|
||||
post "add_exist_file_to_project"
|
||||
post 'add_exist_file_to_org'
|
||||
get 'resource_preview'
|
||||
get 'rename_resource'
|
||||
get 'search_user_project'
|
||||
|
@ -516,6 +524,8 @@ RedmineApp::Application.routes.draw do
|
|||
get 'store_selected_resource'
|
||||
get 'user_organizations'
|
||||
get 'search_user_orgs'
|
||||
get 'search_user_org' #for send resource
|
||||
|
||||
# end
|
||||
end
|
||||
#resources :blogs
|
||||
|
@ -807,6 +817,8 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
# additional routes for having the file name at the end of url
|
||||
get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'
|
||||
get 'attachments/attachment_versions/:id',:to=>'attachments#attachment_versions',:as=>'attachments_versions'
|
||||
post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version'
|
||||
get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
|
||||
get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
|
||||
get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddQuotesToMessages < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :messages, :quotes, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
class CreateAttachmentHistories < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :attachment_histories do |t|
|
||||
t.integer :container_id
|
||||
t.string :container_type
|
||||
t.string :filename , :default => ""
|
||||
t.string :disk_filename, :default => ""
|
||||
t.integer :filesize, :default => 0
|
||||
t.string :content_type, :default => ""
|
||||
t.string :digest , :default => "",:limit=>40
|
||||
t.integer :downloads, :default => 0
|
||||
t.integer :author_id
|
||||
t.datetime :created_on
|
||||
t.string :description
|
||||
t.string :disk_directory
|
||||
t.integer :attachtype
|
||||
t.integer :is_public
|
||||
t.integer :copy_from
|
||||
t.integer :quotes
|
||||
t.integer :version
|
||||
t.integer :version_id
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddOrgSubfieldIdToBoards < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :boards, :org_subfield_id, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
# encoding: utf-8
|
||||
class SetBoardForOrgSubfields < ActiveRecord::Migration
|
||||
def up
|
||||
OrgSubfield.where("field_type='Post'").each do |field|
|
||||
Board.create(:org_subfield_id => field.id, :name => "资源栏目讨论区", :project_id => -1, :description => field.name)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class RenameAttachmentHistoriesColumnVersionIdToAttachmentId < ActiveRecord::Migration
|
||||
def up
|
||||
rename_column :attachment_histories,:version_id,:attachment_id
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
class AddLastTermToCourse < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :courses, :end_time, :integer
|
||||
add_column :courses, :end_term, :string
|
||||
|
||||
count = Course.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do
|
||||
Course.page(i).per(30).each do |course|
|
||||
course.end_time = course.time
|
||||
course.end_term = course.term
|
||||
course.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddHideToOrgSubfields < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_subfields, :hide, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddRecordsToOrgSubfields < ActiveRecord::Migration
|
||||
def change
|
||||
Organization.all.each do |org|
|
||||
OrgSubfield.create(:organization_id => org.id, :name => 'activity', :field_type => 'default')
|
||||
OrgSubfield.create(:organization_id => org.id, :name => 'course', :field_type => 'default')
|
||||
OrgSubfield.create(:organization_id => org.id, :name => 'project', :field_type => 'default')
|
||||
end
|
||||
end
|
||||
end
|
3936
db/schema.rb
3936
db/schema.rb
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
|
@ -978,6 +978,15 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
|
||||
//点击发送资源弹出框中的组织,要更改选择栏目中的内容
|
||||
//@dom 选中的radio,值为org_id
|
||||
function change_org_subfield(url){
|
||||
$.ajax({
|
||||
type:'get',
|
||||
url:url
|
||||
})
|
||||
}
|
||||
|
||||
//点击图片即显示大图
|
||||
function showNormalImage(id) {
|
||||
var description_images=$('div#'+id).find("img");
|
||||
|
@ -1001,4 +1010,4 @@ $(function(){
|
|||
var userId = $(this).attr('data-user-id');
|
||||
$(window.location).attr('href', '/users/'+userId);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue