Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-12-11 19:34:29 +08:00
commit 7c114e1a13
80 changed files with 1138 additions and 267 deletions

View File

@ -418,6 +418,8 @@ class ApplicationController < ActionController::Base
@project = Project.find(params[:project_id])
elsif params[:course_id]
@course = Course.find(params[:course_id])
elsif params[:org_subfield_id]
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
end
rescue ActiveRecord::RecordNotFound
render_404

View File

@ -240,6 +240,8 @@ class AttachmentsController < ApplicationController
format.html { redirect_to_referer_or respond_path(@attachment.container) }
elsif !@attachment.container.nil? && @attachment.container.is_a?(PhoneAppVersion)
format.html { redirect_to_referer_or mobile_version_path }
elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgSubfield)
format.html {redirect_to_referer_or org_subfield_files_path(@attachment.container)}
else
if @project.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }

View File

@ -25,6 +25,7 @@ class CoursesController < ApplicationController
before_filter :authorize_course, :only => [:show, :settings, :update, :course]
before_filter :authorize_course_global, :only => [:new,:create]
before_filter :toggleCourse, :only => [:finishcourse, :restartcourse]
before_filter :is_deleted, :only => [:show, :settings]
before_filter :require_login, :only => [:join, :unjoin]
#before_filter :allow_join, :only => [:join]
@ -55,11 +56,11 @@ class CoursesController < ApplicationController
def join
if User.current.logged?
cs = CoursesService.new
@user = User.current
join = cs.join_course params,@user
@state = join[:state]
@course = join[:course]
cs = CoursesService.new
@user = User.current
join = cs.join_course params,@user
@state = join[:state]
@course = join[:course]
# else
# @course = Course.find_by_id params[:object_id]
# CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest')
@ -70,7 +71,7 @@ class CoursesController < ApplicationController
end
@object_id = params[:object_id]
respond_to do |format|
format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} }
format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} }
end
end
@ -85,7 +86,7 @@ class CoursesController < ApplicationController
end
end
def join_private_courses
respond_to do |format|
format.js
@ -98,14 +99,14 @@ class CoursesController < ApplicationController
c = cs.edit_course params,@course,User.current
@course = c[:course]
if @course.errors.full_messages.count <= 0
respond_to do |format|
format.html {
# render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_update)
redirect_to settings_course_url(@course)
}
format.api { render_api_ok }
end
respond_to do |format|
format.html {
# render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_update)
redirect_to settings_course_url(@course)
}
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
@ -134,8 +135,8 @@ class CoursesController < ApplicationController
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc")
@courses = paginateHelper courses,10
end
@name = params[:name]
@type = 'courses'
@name = params[:name]
@type = 'courses'
respond_to do |format|
format.html {
render :layout => 'course_base'
@ -277,7 +278,7 @@ class CoursesController < ApplicationController
def member
## 有角色参数的才是课程,没有的就是项目
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
@render_file = 'new_member_list'
@score_sort_by = "desc"
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
@ -312,7 +313,7 @@ class CoursesController < ApplicationController
def export_course_member_excel
@all_members = student_homework_score(0,0,0,"desc")
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
respond_to do |format|
format.xls {
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
@ -427,7 +428,7 @@ class CoursesController < ApplicationController
end
def course
@school_id = params[:school_id]
@school_id = params[:school_id]
per_page_option = 10
if @school_id == "0" or @school_id.nil?
@courses_all = Course.active.visible.
@ -515,8 +516,8 @@ class CoursesController < ApplicationController
def index
if !User.current.admin?
render_404
return
render_404
return
end
@course_type = params[:course_type]
@school_id = params[:school_id]
@ -565,7 +566,7 @@ class CoursesController < ApplicationController
respond_to do |format|
format.html {
render :layout => 'base'
render :layout => 'base'
}
format.atom {
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
@ -581,6 +582,13 @@ class CoursesController < ApplicationController
end
end
def is_deleted
if @course.is_delete == 1 and !User.current.admin?
render_404
return
end
end
def get_courses
@user = User.current
membership = @user.coursememberships.all
@ -634,6 +642,11 @@ class CoursesController < ApplicationController
end
def show
# 被删除的课程只有超级管理员才能看到is_delete为1的时候标记课程被删除
# if @course.is_delete == 1 && !User.current.admin?
# render_403
# return
# end
#更新创建课程消息状态
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
create_course_messages.update_all(:viewed => true)
@ -684,10 +697,10 @@ class CoursesController < ApplicationController
end
def feedback
@course.journals_for_messages.each do |messages|
query = messages.course_messages.where("user_id = ?", User.current.id)
query.update_all(:viewed => true);
end
@course.journals_for_messages.each do |messages|
query = messages.course_messages.where("user_id = ?", User.current.id)
query.update_all(:viewed => true);
end
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
page = params[:page]
@ -738,20 +751,20 @@ class CoursesController < ApplicationController
#从课程创建的老师那里选择课程大纲
def course_outline
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles
@is_in_show_outline_page = params[:is_in_show_outline_page]
respond_to do |format|
format.js
end
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles
@is_in_show_outline_page = params[:is_in_show_outline_page]
respond_to do |format|
format.js
end
end
#根据关键字搜索,查找方法一样的,但返回内容不一样
def search_course_outline
@article_title = params[:title]
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles.like(@article_title)
render :json=>@blog_articles.to_json
@article_title = params[:title]
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles.like(@article_title)
render :json=>@blog_articles.to_json
end
#设置或者更改课程的大纲
@ -771,10 +784,23 @@ class CoursesController < ApplicationController
format.html {render :layout => 'base_courses'}
end
end
#删除课程
#删除课程只是将课程的is_delete状态改为falseis_delete为false状态的课程只有管理员可以看到
def destroy
#删除课程
#删除课程只是将课程的is_deleted状态改为falseis_deleted为false状态的课程只有管理员可以看到
def destroy
@course.update_attributes(:is_delete => true)
@course = nil
redirect_to user_url(User.current)
end
# 恢复已删除的课程
def renew
if User.current.admin?
@course.update_attributes(:is_delete => false)
redirect_to course_path(@course)
else
return 404
end
end
private
@ -797,7 +823,7 @@ class CoursesController < ApplicationController
def can_show_course
@first_page = FirstPage.find_by_page_type('project')
if @first_page.try(:show_course) == 2
render_404
render_404
end
end

View File

@ -186,7 +186,7 @@ class FilesController < ApplicationController
@order = ""
@is_remote = false
if params[:project_id]
@isproject = true
@container_type = 0
if params[:sort]
params[:sort].split(",").each do |sort_type|
@ -246,7 +246,7 @@ class FilesController < ApplicationController
format.js
end
elsif params[:course_id]
@isproject = false
@container_type = 1
if params[:sort]
params[:sort].split(",").each do |sort_type|
@ -297,6 +297,13 @@ class FilesController < ApplicationController
@tag_list = attachment_tag_list @all_attachments
render :layout => 'base_courses'
elsif params[:org_subfield_id]
@container_type = 2
@organization = Organization.find(params[:organization_id])
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
show_attachments @containers
render :layout => 'base_org'
# @subfield = params[:org_subfield_id]
end
end
@ -421,8 +428,39 @@ class FilesController < ApplicationController
redirect_to course_files_url(@course)
}
end
end
elsif @org_subfield
@addTag=false
# if params[:in_org_subfield_toolbar]
# @in_org_subfield_toolbar = params[:in_org_subfield_toolbar]
# end
attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type])
# if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
# Mailer.run.attachments_added(attachments[:files])
# end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
@containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] #modify by Long Jun
# @containers += @org_subfield.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
show_attachments @containers
@attachtype = 0
@contenttype = 0
respond_to do |format|
format.js
format.html {
redirect_to org_subfield_files_url(@org_subfield)
}
end
end
end
end

View File

@ -85,7 +85,7 @@ class MyController < ApplicationController
flash[:notice] = l(:notice_mail_notification_updated)
redirect_to my_account_url
else
redirect_to signin_url
redirect_to signin_url
end
end
@ -109,12 +109,23 @@ class MyController < ApplicationController
# Edit user's account
def account
@user = User.current
lg=@user.login
@pref = @user.pref
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
begin
if request.post?
# 修改邮箱的时候同步修改到gitlab
if @user.mail != params[:user][:mail]
g = Gitlab.client
begin
g.edit_user(@user.gid, :email => params[:user][:mail])
rescue
logger.error "sync user's email of gitlab failed!"
end
end
@user.safe_attributes = params[:user]
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
@ -212,7 +223,7 @@ class MyController < ApplicationController
end
flash.now[:error] = l(:notice_account_old_wrong_password)
end
render :template => 'my/account',:layout=>'base_users_new'
render :template => 'my/account',:layout=>'new_base_user'
end
# Create a new feeds key

View File

@ -11,10 +11,17 @@ class OrgDocumentCommentsController < ApplicationController
@org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id)
@org_document_comment.title = params[:org_document_comment][:title]
@org_document_comment.content = params[:org_document_comment][:content]
if params[:field_id]
@org_document_comment.org_subfield_id = params[:field_id].to_i
end
if @org_document_comment.save
flash.keep[:notice] = l(:notice_successful_create)
EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at)
redirect_to organization_org_document_comments_path(@organization)
if params[:field_id]
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
else
redirect_to organization_org_document_comments_path(@organization)
end
else
redirect_to new_org_document_comment_path(:organization_id => @organization.id)
end
@ -46,7 +53,7 @@ class OrgDocumentCommentsController < ApplicationController
if params[:flag].to_i == 1
redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
else
redirect_to organization_path(@org_document.organization.id)
redirect_to organization_path(@org_document.organization.id, :org_subfield_id => params[:org_subfield_id])
end
end
}

View File

@ -3,7 +3,7 @@ class OrgSubfieldsController < ApplicationController
@subfield = OrgSubfield.create(:name => params[:name])
@organization = Organization.find(params[:organization_id])
@organization.org_subfields << @subfield
@subfield.update_attributes(:priority => @subfield.id)
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
end
def destroy
@ -17,4 +17,8 @@ class OrgSubfieldsController < ApplicationController
@organization = Organization.find(@subfield.organization_id)
@subfield.update_attributes(:name => params[:name])
end
def show
end
end

View File

@ -68,29 +68,35 @@ class OrganizationsController < ApplicationController
def show
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@organization = Organization.find(params[:id])
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)
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(",")})").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|
@ -239,6 +245,13 @@ class OrganizationsController < ApplicationController
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 = '%%'

View File

@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project]
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
before_filter :file, :statistics #:watcherlist
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
# before_filter :memberAccess, only: :member
@ -697,7 +697,11 @@ class ProjectsController < ApplicationController
flash[:error] = l(:error_can_not_archive_project)
end
end
redirect_to admin_projects_url(:status => params[:status])
if params[:type] == "project"
redirect_to user_path(User.current)
else
redirect_to admin_projects_url(:status => params[:status])
end
end
def unarchive

View File

@ -75,6 +75,9 @@ class RepositoriesController < ApplicationController
redirect_to repository_url(@repository)
else
g = Gitlab.client
if User.current.gid.nil?
g.sync_user(User.current)
end
gproject = g.fork(@project.gpid, User.current.gid)
if gproject
copy_project(@project, gproject)
@ -346,27 +349,13 @@ update
# end
#add by hx
if g.commits(@project.gpid , :page=>25).count==0
count = count_commits(@project.gpid , 0 , 25)
elsif g.commits(@project.gpid , :page=>50).count ==0
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
elsif g.commits(@project.gpid , :page=>75).count ==0
count = count_commits(@project.gpid , 50 , 75)+ 50 * 20
elsif g.commits(@project.gpid , :page=>100).count== 0
count = count_commits(@project.gpid , 75 , 100) + 75 * 20
elsif g.commits(@project.gpid , :page=>125).count==0
count = count_commits(@project.gpid , 100 , 125) + 100 * 20
elsif g.commits(@project.gpid , :page=>150).count==0
count = count_commits(@project.gpid , 125 , 150) + 125 * 20
else
count = count_commits(@project.gpid , 150 ,200) + 150 * 20
end
@changesets = g.commits(@project.gpid)
@changesets = g.commits(@project.gpid, :ref_name => @rev)
# @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_all_count = count
@changesets_all_count = 0
@changesets_latest_coimmit = @changesets[0]
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@ -409,8 +398,28 @@ update
limit = 20
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
#add by hx
if g.commits(@project.gpid , :page=>200).count > 0
count = 4020
elsif g.commits(@project.gpid , :page=>25).count==0
count = count_commits(@project.gpid , 0 , 25)
elsif g.commits(@project.gpid , :page=>50).count ==0
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
elsif g.commits(@project.gpid , :page=>75).count ==0
count = count_commits(@project.gpid , 50 , 75)+ 50 * 20
elsif g.commits(@project.gpid , :page=>100).count== 0
count = count_commits(@project.gpid , 75 , 100) + 75 * 20
elsif g.commits(@project.gpid , :page=>125).count==0
count = count_commits(@project.gpid , 100 , 125) + 100 * 20
elsif g.commits(@project.gpid , :page=>150).count==0
count = count_commits(@project.gpid , 125 , 150) + 125 * 20
else
count = count_commits(@project.gpid , 150 ,200) + 150 * 20
end
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
@commits_count = params[:commit_count].to_i
@commits_count = count
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
@commit = g.commit(@project.gpid,@rev)

View File

@ -270,6 +270,9 @@ class StudentWorkController < ApplicationController
user_activity.updated_at = Time.now
user_activity.save
end
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
course_message.save
@student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
respond_to do |format|
format.js
@ -299,10 +302,11 @@ class StudentWorkController < ApplicationController
@submit_result = true
@work.name = params[:student_work][:name]
@work.description = params[:student_work][:description]
@work.project_id = params[:student_work][:project]
@work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@work)
if @work.save
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
course_message.save
=begin
respond_to do |format|
format.html {
@ -687,6 +691,7 @@ class StudentWorkController < ApplicationController
end
all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")"
all_students = User.where("id in #{all_student_ids}")
@commit_student_ids = @homework.student_work_projects.map{|student| student.user_id}
@users = searchstudent_by_name all_students,name
respond_to do |format|
format.js
@ -918,7 +923,7 @@ class StudentWorkController < ApplicationController
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
if homework.homework_type == 1 #匿评作业
if homework.homework_type != 2 #匿评作业
if homework.teacher_priority == 1 #教师优先
if student_work.teacher_score
student_work.final_score = student_work.teacher_score

View File

@ -2455,7 +2455,7 @@ module ApplicationHelper
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
else
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"

View File

@ -113,7 +113,8 @@ module FilesHelper
if attachment.is_public? ||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
attachment.author_id == User.current.id
attachment.author_id == User.current.id ||
attachment.container_type == "OrgSubfield"
result << attachment
end
end

View File

@ -22,6 +22,7 @@ class Attachment < ActiveRecord::Base
belongs_to :container, :polymorphic => true
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"

View File

@ -20,7 +20,7 @@ class Course < ActiveRecord::Base
end
end
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
@ -86,7 +86,8 @@ class Course < ActiveRecord::Base
'is_public',
'description',
'class_period',
'open_student'
'open_student',
'is_delete'
acts_as_customizable
@ -94,7 +95,7 @@ class Course < ActiveRecord::Base
scope :active, lambda { where(:status => STATUS_ACTIVE) }
scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
scope :all_public, lambda { where(:is_public => true) }
scope :visible, lambda {|*args| where(Course.visible_condition(args.shift || User.current, *args)) }
scope :visible, lambda {|*args| where(Course.where("is_delete =?", 0).visible_condition(args.shift || User.current, *args)) }
scope :allowed_to, lambda {|*args|
user = User.current
permission = nil
@ -114,7 +115,7 @@ class Course < ActiveRecord::Base
where(" LOWER(name) LIKE :p ", :p => pattern)
end
}
scope :indexable,lambda { where('is_public = 1') }
scope :indexable,lambda { where('is_public = 1 and is_delete = 0') }
def self.search(query)
__elasticsearch__.search(
{
@ -399,12 +400,12 @@ class Course < ActiveRecord::Base
# __elasticsearch__.delete_document
# end
def create_course_ealasticsearch_index
if self.is_public == 1
if self.is_public == 1 and self.is_delete == 0 #公开 和 没有被删除的课程才被索引
self.__elasticsearch__.index_document
end
end
def update_course_ealasticsearch_index
if self.is_public == 1 #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
begin
self.__elasticsearch__.update_document
rescue => e

View File

@ -1,5 +1,5 @@
class CourseMessage < ActiveRecord::Base
# status说明 status在课程不同的类型区分不同的功能
# status说明 status在课程不同的类型区分不同的功能 status = 9 作品的提交记录
# HomeworkCommonstatus
# nil发布了作业 1作业截止时间到了提醒2:开启匿评; 3关闭匿评 4匿评开始失败
attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status
@ -19,7 +19,7 @@ class CourseMessage < ActiveRecord::Base
def add_user_message
#unless self.course_message_type == 'JoinCourseRequest'
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? && self.status != 9
self.message_alls << MessageAll.new(:user_id => self.user_id)
end
#end

View File

@ -46,20 +46,24 @@ class ForgeActivity < ActiveRecord::Base
end
def add_org_activity
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
if org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
if org_activity
org_activity.created_at = self.created_at
org_activity.save
else
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
org_activity.created_at = self.created_at
org_activity.save
else
OrgActivity.create(:user_id => self.user_id,
:org_act_id => self.forge_act_id,
:org_act_type => self.forge_act_type,
:container_id => self.project_id,
:container_type => 'Project',
:created_at => self.created_at,
:updated_at => self.updated_at)
end
else
OrgActivity.create(:user_id => self.user_id,
:org_act_id => self.forge_act_id,
:org_act_type => self.forge_act_type,
:container_id => self.project_id,
:container_type => 'Project',
:created_at => self.created_at,
:updated_at => self.updated_at)
end
end

View File

@ -186,7 +186,7 @@ class Message < ActiveRecord::Base
# Description
def act_as_forge_activity
# 如果project为空那么就是课程相关的消息
if !self.board.project.nil?
if !self.board.project.nil? && self.parent_id.nil?
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.board.project.id)
end

View File

@ -1,3 +1,9 @@
class OrgSubfield < ActiveRecord::Base
belongs_to :organization, :foreign_key => :organization_id
has_many :org_document_comments, :dependent => :destroy
has_many :files
acts_as_attachable
def project
end
end

View File

@ -46,7 +46,7 @@ class StudentWork < ActiveRecord::Base
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
if homework.homework_type == 1 #匿评作业
if homework.homework_type != 2 #匿评作业
if homework.teacher_priority == 1 #教师优先
if student_work.teacher_score
student_work.final_score = student_work.teacher_score

View File

@ -227,7 +227,7 @@ class User < Principal
validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false
validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false
# Login must contain letters, numbers, underscores only
validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
validates_format_of :login, :with => /\A[a-z0-9_\-\.]*\z/i
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
validates_length_of :firstname, :maximum => 30
validates_length_of :lastname, :maximum => 30

View File

@ -228,13 +228,22 @@ class UsersService
end
course_list
end
#修改密码
def change_password params
@current_user = User.find(params[:current_user_id])
if @current_user.check_password?(params[:password])
@current_user.password, @current_user.password_confirmation = params[:new_password], params[:new_password_confirmation]
@current_user.save
# 修改密码同步gitlab密码修改
unless @current_user.gid.nil?
begin
g = Gitlab.client
g.edit_user(@current_user.gid, :password => params[:new_password])
rescue Exception => e
logger.error "change users password failed! ===> #{e}"
end
end
#raise @current_user.errors.full_message
#return @current_user
else

View File

@ -1,8 +1,7 @@
<% if @is_destroy%>
$("#attachment_<%= @attachment.id%>").remove();
if(document.getElementById("uploadReviseBox")) {
$("#uploadReviseBox").removeClass('disable_link');
$("#choose_revise_attach").attr("onclick","_file.click();");
if(document.getElementById("revise_attachment_div_<%= @attachment.id%>")) {
$("#revise_attachment_div_<%= @attachment.id%>").remove();
}
<%else%>
var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');

View File

@ -27,14 +27,14 @@
</div>
<% else %>
<div nhname='new_message_' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'},:method => "post") do |f|%>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_' name="new_form[course_message]"></textarea>
<p nhname='contentmsg_'></p>
<div nhname='toolbar_container_' style="float:left;padding-top:3px;margin-bottom: 15px;"></div>
<a id="new_message_cancel_btn_" href="javascript:void(0)" class="grey_btn fr mt10">取消</a>
<a id="new_message_submit_btn_" href="javascript:void(0)" class="blue_btn fr ml10 mt10">留言</a>
<% end%>
<a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="submit_feedback_course" >留言</a>
<% end %>
</div>
<% end %>
</div>
@ -50,7 +50,11 @@
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
$(function(){
$("#submit_feedback_course").one('click',function() {
$("#course_feedback_new").submit();
});
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
@ -83,4 +87,5 @@
});
});
});
</script>

View File

@ -1,6 +1,7 @@
<% @members.each do |member| %>
<li >
<%= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
<%#= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
<%= link_to "#{member.principal}#{member.principal.show_name}", user_path(member.principal), :class => "w150 linkBlue fl" %>
<span class="w150 fl">
<%= zh_course_role(h member.roles.sort.collect(&:to_s).join(', ')) %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),

View File

@ -12,3 +12,4 @@
<%= render :partial => 'course_teacher', :locals => {:members => @members} %>
<% end%>

View File

@ -88,6 +88,15 @@
</li>
<% end %>
</ul>
<% if @course.is_delete == 1 %>
<div class="mt30"><%=link_to "恢复该课程", renew_course_path(@course) %></div>
<% else %>
<div class="mt30">
<img src="/images/pic_del.gif" class="mr5"><%=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %>
<span>(友情提示:删除该课程后如果您想恢复该课程,请联系系统管理员!)</span>
</div>
<% end %>
</div>
<div class="hwork_undis" id="tbc_02">

View File

@ -33,6 +33,19 @@
}).mouseleave(function(){
$("#work_click_<%= exercise.id%>").hide();
});
$(function(){
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$("#show_student_result_div").on('click',show_result);
<% else %>
$("#show_student_result_div").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_name_id").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_id_id").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_class_id").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
});
function show_result() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';
}
</script>
<ul class="hworkListRow" id="student_work_<%= exercise.id%>">
<li class="hworkList340 width530">
@ -40,22 +53,16 @@
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
</li>
<div onclick="" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<div id="show_student_result_div" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<li>
<ul class="mt10 fl">
<li class="hworkStName mr15 mt16" title="姓名">
<% name = exercise.user.show_name %>
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
<%= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>
<% else %>
<span title="截止日期未到,暂不能查看学生答题结果。"><%=name%></span>
<%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %>
<% end %>
<li class="hworkStName mr15 mt16" title="姓名" id="student_name_id">
<%=exercise.user.show_name %>
</li>
<li class="hworkStID mr10 mt16" title="学号">
<li class="hworkStID mr10 mt16" title="学号" id="student_id_id">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
</li>
<li class="hworkStID mt16" title="班级">
<li class="hworkStID mt16" title="班级" id="student_class_id">
--
</li>
</ul>
@ -63,7 +70,7 @@
</div>
</ul>
</li>
<li class="hworkList130 c_grey student_work_<%= exercise.id%>" onclick="" style="cursor: pointer;">
<li class="hworkList130 c_grey student_work_<%= exercise.id%>">
<% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% end %>

View File

@ -20,6 +20,25 @@
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<% elsif @project %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => ie8? ? '':'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
: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'),
: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)
} %>
<% else %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',

View File

@ -0,0 +1,56 @@
<% delete_allowed = User.current.admin? %>
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if order == "asc" %>
按&nbsp;<%= 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"} %>&nbsp;/&nbsp;
<%= 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"} %>&nbsp;/&nbsp;
<%= 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"} %>&nbsp;排序
<% else %>
按&nbsp;<%= 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"} %>&nbsp;/&nbsp;
<%= 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"} %>&nbsp; /&nbsp;
<%= 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"} %>&nbsp;排序
<% 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">
<% org_subfield_attachments.each do |file| %>
<% if 1 %>
<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? %>
<%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %>
<% 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 == @org_subfield.id && file.container_type == "OrgSubfield"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div>
<div class="cl"></div>
<!--<div class="tag_h">-->
<!--&lt;!&ndash; container_type = 1 代表是课程里的资源 &ndash;&gt;-->
<!--<%#= 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-->
<% 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>

View File

@ -0,0 +1,97 @@
<%= stylesheet_link_tag 'courses' %>
<script>
function searchone4reload(fileid){
var url = "<%= searchone4reload_org_subfield_files_path(@org_subfield)%>";
var data = {};data.fileid=fileid;
$.ajax({
url:url,dataType:'text',data:data,success:function(text){
var container_file_div = $("#container_files_"+fileid);
container_file_div.after(text);
container_file_div.remove();
}
});
}
function show_upload(obj)
{
switch(obj)
{
case 1:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>');
break;
case 2:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>');
break;
case 3:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 3}) %>');
break;
case 4:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>');
break;
case 6:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>');
break;
default:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 5}) %>');
}
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function presscss(id)
{
if(id == "inorg_subfield")
{
$('#inorg_subfield').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function buttoncss()
{
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</script>
<div class="container">
<div class="resources"><!--资源库内容开始--->
<div class="re_top" style="width:710px;">
<%= form_tag( search_org_subfield_files_path(@org_subfield), 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 => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> <!-- 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>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
</p>
<%# end %>
</div><!---re_top end-->
<div class="cl"></div>
<div class="re_con" id="org_subfield_list">
<%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
</div><!---re_con end-->
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -0,0 +1,55 @@
<% delete_allowed = User.current.admin? %>
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if order == "asc" %>
按&nbsp;<%= 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"} %>&nbsp;/&nbsp;
<%= 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"} %>&nbsp;/&nbsp;
<%= 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"} %>&nbsp;排序
<% else %>
按&nbsp;<%= 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"} %>&nbsp;/&nbsp;
<%= 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"} %>&nbsp; /&nbsp;
<%= 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"} %>&nbsp;排序
<% 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.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" %>
</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 == @org_subfield.id && file.container_type == "OrgSubfield"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= 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-->
<% 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>

View File

@ -0,0 +1,31 @@
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(org_subfield_files_path(org_subfield), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
<!--<input type="hidden" name="in_org_subfield_toolbar" value="Y">-->
<input type="hidden" name="org_subfield_attachment_type" value="<%= org_subfield_attachment_type%>">
<%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %>
<div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<% end %>
</div>
</div>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>
<script>
function submit_resource()
{
$('#submit_resource').parent().submit();
}
</script>

View File

@ -52,6 +52,17 @@ $('#upload_file_div').slideToggle('slow');
setTimeout( function(){div.remove();},3000)
<% end %>
<%end%>
<% elsif @org_subfield %>
hideModal();
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
// $("#courses_files_count_info").html("<%#= @all_attachments.count%>");
// $("#courses_files_count_nav").html("(<%#= @all_attachments.count%>)")
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#org_subfield_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %>
<% end %>
$(document).ready(img_thumbnails);

View File

@ -1,8 +1,10 @@
<div id="resource_list">
<% if @isproject %>
<% if @container_type == 0 %>
<%= render :partial => 'project_file_new', locals: {project: @project} %>
<% else %>
<% elsif @container_type == 1 %>
<%= render :partial => 'course_file', locals: {course: @course} %>
<% elsif @container_type == 2 %>
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
<% end %>
</div>

View File

@ -46,12 +46,13 @@
<li class="navOrgMenu fr" id="orgSwitch" style="cursor:pointer;">
<span class="orgMenuArrow" id="orgArrow">
<ul class="org_login_list" style="display:none;">
<li> <%= link_to "个人主页",user_path(User.current), :class => "linkGrey8" %></li>
<li><%= link_to "退出",signout_path, :class =>"linkGrey8", :method => 'post', :rel => "nofollow" %></li>
<li> <%= link_to "个人主页",user_path(User.current), :class => "linkGrey8", :target => "_blank" %></li>
<li><%= link_to "退出",logout_organization_path(@organization), :class =>"linkGrey8", :method => 'post', :rel => "nofollow" %></li>
<!--<li><%#= link_to "退出",signout_path, :class =>"linkGrey8", :method => 'post', :rel => "nofollow" %></li>-->
</ul>
</span>
</li>
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;"><%=link_to User.current, user_path(User.current), :class => "linkGrey8 f14", :id => "orgUserName" %></li>
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;"><a href="javascript:void(0);" class="linkGrey8 f14" id="orgUserName"><%= User.current %></a></li>
<!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>-->
<% else %>
<li class="navOrgMenu fr"><a href="<%= signin_path(:login=>true) %>" class="linkGrey8 f14">登录</a></li>

View File

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','courses','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
@ -103,17 +103,17 @@
<!--邀请加入-->
<div class="subNavBox">
<% if User.current.member_of?(@project) %>
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit" data-val="expand">
<%= l(:label_invite)%>
</div>
<ul class="navContent " style="display:block" id="navContent_invit">
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
<!--<%# if User.current.allowed_to?(:manage_members, @project) %>-->
<%# if User.current.member_of?(@project) %>
<!--<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit" data-val="expand">-->
<!--<%#= l(:label_invite)%>-->
<!--</div>-->
<!--<ul class="navContent " style="display:block" id="navContent_invit">-->
<!--<li><%#= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>-->
<!--&lt;!&ndash;<%# if User.current.allowed_to?(:manage_members, @project) %>&ndash;&gt;-->
<!--<li><%#= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>-->
<!--<%# end %>-->
</ul>
<% end %><!--end-->
<!--</ul>-->
<%# end %><!--end-->
<!--menu 左侧工具栏 -->
<%#--project_new_type: 1为开发组2为科研组3为朋友圈子--%>

View File

@ -147,7 +147,7 @@
<% end%>
<% end%>
</div>
<% courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>

View File

@ -170,7 +170,7 @@
</ul>
<ul class="setting_right ">
<li><input id="password" name="password" class="w210" type="password" required="true" nh_required="1"></li>
<li><input id="new_password" name="new_password" class="w210" type="password" required="true" nh_required="1"><span class="c_red ml5">请输入6-12个字符</span></li>
<li><input id="new_password" name="new_password" class="w210" type="password" required="true" nh_required="1"><span class="c_red ml5">请输入8-12个字符</span></li>
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true" nh_required="1"></li>
<li class="ml2">
<a href="javascript:;" id="my_password_form_link" class="blue_btn fl">确认</a>

View File

@ -1,2 +1,6 @@
//location.reload();
window.location.href = '<%= organization_org_document_comments_path(:organization_id => @org_document_comment.root.organization_id)%>'
<% if params[:detail_page] %>
window.location.href = '<%= organization_org_document_comments_path(:organization_id => @org_document_comment.root.organization_id)%>';
<% else %>
window.location.reload();
<% end %>

View File

@ -17,7 +17,7 @@
</div>
<div class="cl"></div>
<div>
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag),:method => 'put', :id => 'new_org_document_form' do |f| %>
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %>
<div class="resources">
<div>
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" />

View File

@ -1,24 +1,37 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
<script>
function check_org_title(title)
{
if($("#document_title").val().trim() == "")
{
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
}
else
{
$("#doc_title_hint").hide();
}
}
function check_org_title()
{
if($("#document_title").val().trim() == "")
{
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
return false;
}
else
{
$("#doc_title_hint").hide();
return true;
}
}
function create_org_document()
{
if(check_org_title() == true)
{
org_document_description_editor.sync();
$('#new_org_document_form').submit();
}
}
function cancel_create_org_document(){
location.href = document.referrer;
}
</script>
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %>
<div class="resources">
<div>
<textarea class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" placeholder="请输入文章标题"></textarea>
<textarea class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题"></textarea>
</div>
<div id="doc_title_hint"></div>
<div id="org_document_editor" class="mt15" style="display: none">
<div id="org_document_editor" class="mt15" >
<div class="mt10">
<%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
</div>
@ -29,9 +42,9 @@
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="org_document_description_editor.sync();$('#new_org_document_form').submit();">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="create_org_document();">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" onclick="$('#org_document_editor').hide(); $('#doc_title_hint').hide();" class="fr mr10 mt3">取消</a>
<a href="javascript:void(0);" onclick="cancel_create_org_document();" class="fr mr10 mt3">取消</a>
<div class="cl"></div>
</div>

View File

@ -46,7 +46,7 @@
<%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
</li>
<li>
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :method => 'delete',
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete',
:data => {:confirm => l(:text_are_you_sure)},
:remote => true, :class => 'postOptionLink' %>
</li>

View File

@ -0,0 +1,96 @@
<script>
function searchone4reload(fileid){
var url = "<%= searchone4reload_course_files_path(@course)%>";
var data = {};data.fileid=fileid;
$.ajax({
url:url,dataType:'text',data:data,success:function(text){
var container_file_div = $("#container_files_"+fileid);
container_file_div.after(text);
container_file_div.remove();
}
});
}
function show_upload(obj)
{
switch(obj)
{
case 1:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 1}) %>');
break;
case 2:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 2}) %>');
break;
case 3:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 3}) %>');
break;
case 4:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 4}) %>');
break;
case 6:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 6}) %>');
break;
default:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 5}) %>');
}
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function presscss(id)
{
if(id == "incourse")
{
$('#incourse').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function buttoncss()
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</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()" %>
<% 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>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
</p>
<% end %>
</div><!---re_top end-->
<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>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -1,4 +1,5 @@
$("#org_subfield_list").html("");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#subfield_name").val("");

View File

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

View File

@ -25,8 +25,13 @@
</div>
<% organization.org_subfields.each do |field| %>
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses_#{field.id}').slideToggle();"><%= field.name %></a>
<%=link_to "", :title => "关联#{field.name}"%>
<% 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 => "发布帖子"%>
<% else %>
<%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %>
<a href="javascript:void(0);" class="homepageMenuText"><%= field.name %></a>
<% end %>
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">
</div>

View File

@ -11,14 +11,10 @@
<ul style="text-align: left;" >
<%= radio_button_tag 'org_member[role_ids][]', role.id, member.roles.include?(role) %>
<!--编辑时候显示成员,中英文切换后面需从数据库的角度优化-->
<% if User.current.language == "zh" %>
<% if role.id == 11 %>
<label >管理人员</label>
<% elsif role.id == 12 %>
<label >组织成员</label>
<% end %>
<% else %>
<label ><%= h role %></label>
<% if role.id == 11 %>
<label >管理人员</label>
<% elsif role.id == 12 %>
<label >组织成员</label>
<% end %>
</ul>
<!--<br/>-->

View File

@ -8,7 +8,7 @@
<%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %>
TO&nbsp;&nbsp;<%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
|
<span style="color:#269ac9;">组织文章</span>
<span style="color:#269ac9;"><%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %></span>
</div>
<div class="homepagePostTitle postGrey"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></div>
<div class="homepagePostDate">
@ -27,12 +27,12 @@
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %>
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id, :show_homepage => 1}, :method => "put", :remote => true) do |f| %>
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
<% end %>
</li>
<li>
<%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag), :class => "postOptionLink" %>
<%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag, :org_subfield_id => params[:org_subfield_id] ), :class => "postOptionLink" %>
</li>
<li>
<%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',

View File

@ -1,27 +1,26 @@
<ul class="orgListRow">
<li class="orgListUser fb">已有栏目</li>
<li class="orgListRole fb">状态</li>
<div class="cl"></div>
</ul>
<ul class="orgListRow">
<li class="orgListUser">组织首页</li>
<li class="orgListUser">默认</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| %>
@ -29,6 +28,7 @@
<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>

View File

@ -1,2 +1,2 @@
//location.reload();
window.location.href ='<%= organization_path(@org)%>'
window.location.href ='<%= organization_path(@org, :show_homepage => 1)%>';

View File

@ -114,7 +114,18 @@
<p class="fontBlue fb mb5">新增栏目</p>
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb20" />
<div class="cl"></div>
<ul class="orgAddRole">
<li class="fontGrey3 fb mb10">栏目类型</li>
<li>
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
<label for="orgMng">帖子</label>
</li>
<li>
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
<label for="orgMeb">资源</label>
</li>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
<% end %>
</div>

View File

@ -14,45 +14,47 @@
</style>
<% if params[:show_homepage].nil? %>
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
<div class="NewsBannerName"><%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %></div>
<% if params[:org_subfield_id].nil? %>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<% end %>
</div>
<% end %>
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %>
<script>
$(function() {
init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?",@organization.home_id).first.id %>, null, "87%");

View File

@ -29,7 +29,8 @@
<p nhname="contentmsg"></p>
<div class="fl mt10" style="padding-top:5px;" nhname="toolbar_container"></div>
<%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %>
<%= link_to l(:button_leave_meassge), "javascript:void(0)", :onclick => 'submitProjectFeedback();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fr mt10 mb10' %>
<a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="submit_feedback_project" >留言</a>
<%#= link_to l(:button_leave_meassge), "javascript:void(0)", :onclick => 'submitProjectFeedback();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fr mt10 mb10' %>
<% end %>
<% end %>
@ -43,6 +44,9 @@
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
$("#submit_feedback_project").one('click',function() {
$("#project_feedback_form").submit();
});
function init_editor(params){
params.textarea.removeAttr('placeholder');

View File

@ -26,4 +26,13 @@
</ul>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="submit_edit_project(<%= @project.id %>);" >保存</a>
<% end %>
<% if User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %>
<div class="mt30">
<img src="/images/pic_del.gif" class="mr5">
<%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" },
:data => {:confirm => l(:text_are_you_sure)}, :method => :post) unless @project.archived? %>
<%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %>
<span>(友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!)</span>
</div>
<% end %>
<div class="cl"></div>

View File

@ -25,8 +25,8 @@
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%=@repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
<!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span>Fork</a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>-->
<% unless User.current.id == @project.user_id %>
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
<% if User.current.id != @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span>
</div>
@ -52,10 +52,9 @@
</span>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev,:page=>1 ,
:commit_count =>"#{@changesets_all_count}"} %></font> 提交
<%=link_to"全部提交次数", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
</span>
</div>
<% end %>

View File

@ -1,6 +1,6 @@
<ul class="hworkUl">
<li class="hworkList340 hworkH30 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr140 ml50'%>">作品名称</span>
<span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr150 ml50'%>">作品名称</span>
<% if @homework.homework_type != 3 %>
<span class="c_dark f14 fb fl mr50">姓名</span>
<span class="c_dark f14 fb fl">学号</span>

View File

@ -12,7 +12,7 @@
<li class="hworkPortrait mt15 mr10">
<%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %>
</li>
<li class="hworkName mt15 mr15 width285 student_work_<%= student_work.id%>">
<li class="hworkName mt15 mr15 width255 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"%>
@ -40,7 +40,7 @@
<li class="hworkPortrait mt15 mr10">
<%= image_tag(url_to_avatar(""),width:"40", height: "40") %>
</li>
<li class="hworkName mt15 mr15 width285 student_work_<%= student_work.id%>">
<li class="hworkName mt15 mr15 width255 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"%>
</div>

View File

@ -25,8 +25,8 @@
<li >
<span class="tit_fb ">编程代码:</span>
<div class="showHworkP break_word">
<%= text_format(work.description) if work.description%>
<div class="showHworkP break_word"><pre class="fontGrey2 font_cus"><%= text_format(work.description) if work.description%>
</pre>
</div>
<div class="cl"></div>
</li>

View File

@ -4,7 +4,7 @@
<div class="resubAtt mb15">
<span class="resubTitle">追加修订附件</span>
</div>
<div class="mb10">
<div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>">
<span class="tit_fb"> 追加附件:</span>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %>
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>&nbsp;&nbsp;(<%=revise_attachment_status @homework,revise_attachment %>)
@ -15,7 +15,7 @@
<span class="resubTitle">追加修订附件</span>
</div>
<% if revise_attachment %>
<div class="mb10">
<div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>">
<span class="tit_fb"> 追加附件:</span>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %>
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>

View File

@ -18,7 +18,7 @@ $("#all_students_list").empty();
}
}
}
<% if user.id.to_i != User.current.id.to_i %>
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'";
@ -29,5 +29,9 @@ $("#all_students_list").empty();
$("#choose_students_list").append(li);
});
}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
}
<% end %>
<% end %>

View File

@ -55,7 +55,7 @@
<% end %>
<div class="cl"></div>
<span class="fl fontGrey2" id="relate_project_show">
<% if @homework %>
<% if @homework && @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %>
<% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %>
关联项目:<%=project.name %>

View File

@ -22,6 +22,7 @@
<% end %>
<!--被管理员拉入项目-->
<% if ma.forge_message_type == "JoinProject" %>
<% unless ma.project.nil? %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.forge_message_id)), :width => "30", :height => "30"), user_path(ma.forge_message_id) %></a>
@ -52,9 +53,11 @@
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
<!-被管理员移出项目-->
<!--被管理员移出项目-->
<% if ma.forge_message_type == "RemoveFromProject" %>
<% unless ma.project.nil? %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.forge_message_id)), :width => "30", :height => "30"), user_path(ma.forge_message_id) %></a>
@ -85,6 +88,7 @@
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
<!--邀请加入项目-->
<% if ma.forge_message_type == "ProjectInvite" %>

View File

@ -19,12 +19,12 @@
<div class="message_box mb10" id="users_setting">
<div nhname='new_message' style="display:none;">
<%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%>
<%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
<p nhname='contentmsg'></p>
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>
<a id="new_message_submit_btn" href="javascript:void(0)" class="blue_n_btn fr mr5 " style="margin-top:6px;">留言</a>
<a href="javascript:void(0);" class="blue_n_btn fr mr5" id="submit_feedback_user" style="margin-top:6px;" >留言</a>
<% end%>
</div>
<div class="cl"></div>
@ -43,4 +43,13 @@
</div>
<div class="cl"></div>
</div><!--message_box end-->
</div>
</div>
<script type="text/javascript">
$(function(){
$("#submit_feedback_user").one('click',function() {
$("#submit_feedback_user").submit();
});
});
</script>

View File

@ -52,7 +52,7 @@ zh:
label_mail_attention: "qq邮箱可能收不到此邮件其他邮箱如果没有收到可能在垃圾邮件中"
label_mail_attention1: "其中gmail与教育网邮箱的激活邮件有时比较慢请耐心等待。"
# register中js判断密码设置是否合法提示信息
setting_password_min_length_limit: "密码长度至少大于 %{count} 个字符。"
setting_password_min_length_limit: "密码长度至少大于等于 %{count} 个字符。"
setting_password_error: "密码长度不够或密码不一致"
setting_password_success: "密码设置成功"
# account_controller中register方法判断注册成功的提示信息

View File

@ -921,6 +921,7 @@ zh:
button_rollback: 恢复到这个版本
button_reply: 回复
button_archive: 存档
button_delete_project: 删除项目
button_unarchive: 取消存档
button_reset: 重置
button_rename: 重命名/重定向

View File

@ -46,6 +46,7 @@ RedmineApp::Application.routes.draw do
get 'search_projects'
post 'join_project_menu'
post 'join_projects'
post 'logout'
end
collection do
get 'check_uniq'
@ -71,7 +72,17 @@ RedmineApp::Application.routes.draw do
end
resources :org_subfields do
resources :files, :only => [:index, :new, :create] do
collection do
match "getattachtype", :via => [:get, :post]
match "search",:via => [:post,:get]
match "searchone4reload",:via => [:post,:get]
match "search_tag_attachment", :via => [:post,:get]
end
member do
match "quote_resource_show", :via => [:get]
end
end
end
resources :org_document_comments do
@ -894,6 +905,7 @@ RedmineApp::Application.routes.draw do
get 'member_score', :to => 'courses#member_score'
post 'finishcourse'
post 'restartcourse'
match "renew", :to => 'courses#renew', :via => [:post, :get], :as =>'renew'
match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get]
match "searchgroupmembers", :via => [:post, :get]
match 'member_score_sort', :via => [:get]

View File

@ -0,0 +1,5 @@
class AddIsDeleteToCourses < ActiveRecord::Migration
def change
add_column :courses, :is_delete, :integer, :default => 0
end
end

View File

@ -0,0 +1,5 @@
class AddSubfieldToDocument < ActiveRecord::Migration
def change
add_column :org_document_comments, :org_subfield_id, :integer
end
end

View File

@ -0,0 +1,5 @@
class AddTypeToOrgSubfields < ActiveRecord::Migration
def change
add_column :org_subfields, :field_type, :string
end
end

View File

@ -0,0 +1,10 @@
class SetTypeForOrgSubfields < ActiveRecord::Migration
def up
OrgSubfield.all.each do |field|
field.update_attribute(:field_type, "Post")
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151208032013) do
ActiveRecord::Schema.define(:version => 20151209085942) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -459,6 +459,7 @@ ActiveRecord::Schema.define(:version => 20151208032013) do
t.integer "open_student", :default => 0
t.integer "outline", :default => 0
t.integer "publish_resource", :default => 0
t.integer "is_delete", :default => 0
end
create_table "custom_fields", :force => true do |t|
@ -1160,6 +1161,7 @@ ActiveRecord::Schema.define(:version => 20151208032013) do
t.datetime "updated_at", :null => false
t.boolean "locked", :default => false
t.integer "sticky", :default => 0
t.integer "org_subfield_id"
end
create_table "org_member_roles", :force => true do |t|
@ -1186,6 +1188,7 @@ ActiveRecord::Schema.define(:version => 20151208032013) do
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "field_type"
end
create_table "organizations", :force => true do |t|

View File

@ -0,0 +1,25 @@
require 'trustie/gitlab/sync'
namespace :gitlab do
namespace :check_members do
desc "check up projects' members "
task :projects => :environment do
s = Trustie::Gitlab::Sync.new
g = Gitlab.client
Project.all.each do |project|
unless project.gpid.nil?
begin
gmembers = g.team_members(project.gpid)
if gmembers.count != project.members.count
puts "gitlab' projects count #{gmembers.count}"
puts "project ID is #{project.id}"
s.only_members(project)
end
rescue
p "This project is wrong #{project.id}"
end
end
end
end
end
end

View File

@ -6,32 +6,55 @@ namespace :gitlab do
users = User.find_by_sql("select * from users where gid is null")
s = Trustie::Gitlab::Sync.new
g = Gitlab.client
logger = Logger.new('./log/add_gid.log', 'daily') #按天生成
logger_i = Logger.new('./log/task_add_gid.log', 'daily')
logger_e = Logger.new('./log/task_add_gid_error.log', 'daily')
NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze
MAIL_REGEX_STR ='^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$'.freeze
error_cnt=0
success_cnt=0
p "同步Gitlab用户开始..."
users.each do |user|
info="userid=#{user.id},mail=#{user.mail},login(username)=#{user.login},name=#{user.show_name}"
# username不能有特殊字符,不能有保留字符,邮箱特殊字符(比如‘>)导致search失败的name不能为空串
if !(user.login =~ /\A#{NAMESPACE_REGEX_STR}\Z/.freeze)
logger_e.error("#{info}error=校验失败username特殊字符")
error_cnt+=1
next
elsif !(user.mail.downcase =~ /#{MAIL_REGEX_STR}/)
logger_e.error("#{info}error=校验失败:邮箱特殊字符")
error_cnt+=1
next
elsif user.show_name.lstrip.rstrip.blank?
logger_e.error("#{info}error=校验失败name不正常")
error_cnt+=1
next
end
begin
us = g.get("/users?search=#{user.mail}")
puts user.mail
if us.blank?
puts "55555555555555555"
s.sync_user(user)
logger_i.info("sync_remote_user:id=#{user.id},mail=#{user.mail}")
success_cnt+=1
else
# 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com
puts "66666666666666666666"
puts user.id
if Array === us
us.each do |u|
if u.email == user.mail
user.gid = u.id
user.save
# !爆炸方法抛出异常
user.save!
logger_i.info("sync_local_user:#{info}")
success_cnt+=1
end
end
end
end
rescue => e
logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}")
logger_e.error("#{info},error=#{e}")
puts e
end
end
p "同步Gitlab用户结束..."
p "同步成功#{success_cnt},未完成#{error_cnt}"
end
task :sync_members => :environment do

View File

@ -4186,6 +4186,7 @@ _extend(KUploadButton, {
(options.form ? '</div>' : '</form>'),
'</div>'].join('');
var div = K(html, button.doc);
$(div).hide()// 如果 以后要用根据 http://kindeditor.net/docs/uploadbutton.html#k-uploadbutton-options来使用uploadButton,那么这里的button会 是隐藏的
button.hide();
button.before(div);
self.div = div;

View File

@ -1380,4 +1380,11 @@ $(function(){
});
personalized_init();
});
});
function submit_course_feedback() {
var flag = false;
if(flag == false){
$("#course_feedback_new").submit();
var flag = true
}
}

View File

@ -83,6 +83,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re
.width180{width: 180px;}
.width525{width: 525px;}
.width285{width: 285px;}
.width255{width: 255px;}
.width530{width: 530px;}
.mr95{margin-right: 95px;}
.mr140 {margin-right: 140px;}
@ -1224,4 +1225,8 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.uploadKeyword {margin-bottom:10px; outline:none; border:1px solid #e6e6e6; height:30px; width:280px;}
.mb10 {margin-bottom: 10px}
.mb15 {margin-bottom: 15px}
div.disable_link {background-color: #c1c1c1 !important;}
div.disable_link {background-color: #c1c1c1 !important;}
/*新课程资源库*/
.reCon{ margin:5px; width:710px;}
.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;}

View File

@ -68,4 +68,19 @@ a.linkGrey8:hover {color:#585858;}
.orgMenuArrow {background:url(../images/nav_icon.png) -10px -165px no-repeat; position:relative; display:inline-block; width:20px; height:30px;}
.orgMenuArrow2 {background:url(../images/nav_icon.png) -10px -132px no-repeat; position:relative; display:inline-block; width:20px; height:30px;}
.org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;}
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
.orgListStatus {width:55px; float:left;}
.reCon{ margin:5px; width:710px;}
.retop{width:710px; height:40px; background:#eaeaea; padding:5px;}
.resources {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd;float: right}
.re_search{ margin-top:7px; margin-left:5px;}
.re_search{ margin-top:7px; margin-left:5px;}
.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9; color:#666666;}
.re_schbtn{ width:60px; height:26px; color:#fff; margin-right:5px; border:none; margin-left:0px;padding-left: 0px;}
.b_lblue{ background:#64bdd9;}
.c_grey{ color:#888888;}
.re_con{ margin:5px; width:665px;}
.re_con_top{color:#494949; }
.re_con_top span{ color:#999999; font-weight:bold;}
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }

View File

@ -907,3 +907,162 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
border: 1px solid #e4e4e4;
}
/*项目动态新样式*/
.homepageRight {
width: 750px;
float: left;
margin-top: 15px;
margin-bottom: 10px;
}
.homepageRightBanner {
width: 718px;
margin: 0px auto;
float: right;
background-color: #FFF;
padding: 10px 15px;
border: 1px solid #DDD;
}
.resources {
width: 718px;
background-color: #FFF;
padding: 15px;
border: 1px solid #DDD;
float: right;
}
.homepagePostBrief {
width: 720px;
margin: 0px auto;
position: relative;
}
.homepagePostPortrait {
float: left;
width: 50px;
}
.homepagePostDes {
float: left;
width: 655px;
margin-left: 15px;
}
.homepagePostTo {
font-size: 14px;
color: #484848;
margin-bottom: 5px;
}
.m_w600 {
max-width: 600px;
}
.hidden {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.homepagePostTitle {
font-size: 14px;
color: #484848;
margin-bottom: 5px;
font-weight: bold;
}
.maxh360 {
max-height: 360px;
}
.lh18 {
line-height: 18px;
}
.homepagePostIntro {
font-size: 14px;
color: #484848;
overflow: hidden;
}
.homepagePostReply {
width: 710px;
margin: 10px auto 0px;
background-color: #F1F1F1;
}
.topBorder {
border-top: 1px solid #E4E4E4;
}
.homepagePostReplyBanner {
width: 708px;
height: 33px;
border: 1px solid #E4E4E4;
line-height: 33px;
vertical-align: middle;
font-size: 12px;
color: #888;
}
.homepagePostReplyBannerCount {
width: 255px;
display: inline-block;
margin-left: 15px;
}
.homepagePostReplyBannerTime {
width: 85px;
display: inline-block;
}
.homepagePostReplyContainer {
border-bottom: 1px solid #E3E3E3;
width: 680px;
margin: 15px auto 0px;
min-height: 60px;
}
.borderBottomNone {
border-bottom: medium none !important;
}
.homepagePostReplyPortrait {
float: left;
width: 33px;
}
.homepagePostReplyInputContainer {
width: 630px;
float: left;
}
.homepagePostType {
width: 90px;
background-color: #FFF;
float: left;
list-style: outside none none;
position: absolute;
border: 1px solid #EAEAEA;
border-radius: 5px;
top: 15px;
padding: 5px 10px;
left: -80px;
font-size: 12px;
color: #4B4B4B;
line-height: 2;
z-index: 9999;
display: none;
}
.homepagePostTypeHomework {
width: 90px;
}
a.homepagePostTypeAll {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -189px -308px;
padding-left: 23px;
}
a.homepagePostTypeAssignment {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -93px -318px;
padding-left: 23px;
}
a.homepagePostTypeNotice {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -87px -280px;
padding-left: 23px;
}
a.homepagePostTypeResource {
background: transparent url("images/homepage_icon.png") no-repeat scroll -86px -517px;
padding-left: 23px;
}
a.homepagePostTypeForum {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -10px -310px;
padding-left: 23px;
}
a.homepagePostTypeMessage {
background: transparent url("images/homepage_icon.png") no-repeat scroll -3px -518px;
padding-left: 23px;
}
a.homepagePostTypeQuiz {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -90px -124px;
padding-left: 23px;
}
.loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;}

1
tag1.txt Normal file
View File

@ -0,0 +1 @@
just test