Merge branch 'szzh' into memcached_alan

Conflicts:
	Gemfile
	app/views/issues/index.html.erb
	db/schema.rb

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2015-05-20 17:42:26 +08:00
commit 799f561d77
294 changed files with 11858 additions and 6867 deletions

2
.rspec
View File

@ -1,2 +1,2 @@
--format documentation
--color --color
--require spec_helper

39
Gemfile
View File

@ -23,41 +23,26 @@ gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1' gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet' gem 'spreadsheet'
gem 'ruby-ole' gem 'ruby-ole'
gem 'redis'
gem 'redis-store'
gem 'rails_kindeditor',path:'lib/rails_kindeditor' gem 'rails_kindeditor',path:'lib/rails_kindeditor'
#gem "rmagick", ">= 2.0.0"
group :development do group :development do
gem 'grape-swagger' gem 'grape-swagger'
#gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
gem 'puma' if RbConfig::CONFIG['host_os'] =~ /linux/
gem 'pry-rails'
if RUBY_VERSION >= '2.0.0'
gem 'pry-byebug'
else
# gem 'pry-debugger'
end
gem 'pry-stack_explorer'
gem 'better_errors', '~> 1.1.0' gem 'better_errors', '~> 1.1.0'
gem 'rack-mini-profiler', '~> 0.9.3' gem 'rack-mini-profiler', '~> 0.9.3'
end end
group :test do group :development, :test do
gem "shoulda", "~> 3.5.0" unless RUBY_PLATFORM =~ /w32/
gem "mocha", "~> 1.1.0" gem 'pry-rails'
gem 'capybara', '~> 2.4.1' if RUBY_VERSION >= '2.0.0'
gem 'nokogiri', '~> 1.6.3' gem 'pry-byebug'
gem 'factory_girl', '~> 4.4.0' end
gem 'selenium-webdriver', '~> 2.42.0' gem 'pry-stack_explorer'
end
gem "faker" gem 'rspec-rails', '~> 3.0'
# platforms :mri, :mingw do gem 'factory_girl_rails'
# group :rmagick do
# # RMagick 2 supports ruby 1.9
# # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# # different requirements for the same gem on different platforms
# gem "rmagick", ">= 2.0.0"
# end
#end
end end
# Gems used only for assets and not required # Gems used only for assets and not required

View File

@ -168,6 +168,30 @@ module Mobile
present :status, 0 present :status, 0
end end
desc "设置教辅"
params do
requires :token,type:String
requires :user_id,type:Integer,desc: '用户id'
requires :course_id,type:Integer,desc:'课程id'
end
get 'set_user_as_assitant' do
cs = CoursesService.new
cs.set_as_assitant_teacher params
present :status, 0
end
desc "删除教辅"
params do
requires :token,type:String
requires :user_id,type:Integer,desc: '用户id'
requires :course_id,type:Integer,desc:'课程id'
end
get 'del_user_as_assitant' do
cs = CoursesService.new
cs.del_assitant_teacher params
present :status, 0
end
desc "返回单个课程" desc "返回单个课程"
params do params do
requires :id, type: Integer requires :id, type: Integer
@ -179,7 +203,7 @@ module Mobile
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user)) course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
#course = Course.find(params[:id]) #course = Course.find(params[:id])
present :data, course, with: Mobile::Entities::Course present :data, course, with: Mobile::Entities::Course
present :status, 0 { status: 0}
end end
end end
@ -232,14 +256,61 @@ module Mobile
params do params do
requires :token, type: String requires :token, type: String
requires :course_id,type: Integer,desc: '课程id' requires :course_id,type: Integer,desc: '课程id'
optional :name,type:String,desc:'课件名称可能包含的字符'
end end
get ":course_id/attachments" do post ":course_id/attachments" do
cs = CoursesService.new cs = CoursesService.new
count = cs.course_attachments params count = cs.course_attachments params
present :data, count, with: Mobile::Entities::Attachment present :data, count, with: Mobile::Entities::Attachment
present :status, 0 present :status, 0
end end
desc '课程学生'
params do
requires :token,type:String
requires :course_id,type:Integer,desc: '课程id'
optional :name,type:String,desc:'学生的姓名或者昵称或者学号可能包含的字符'
end
get ":course_id/members" do
cs = CoursesService.new
count = cs.course_members params
# 我如果在学生当中,那么我将放在第一位
count.each do |m|
if m.user.id == current_user.id
count.delete m
count.unshift m
end
end
present :data, count, with: Mobile::Entities::Member
present :status, 0
end
desc '查看用户历次作业成绩'
params do
requires :token,type:String
requires :member_id,type:Integer,desc:'课程member_id'
optional :homeworkName,type:String,desc:'作业名称以及作业名称可能包含的字符'
end
get '/show_member_score/:member_id' do
cs = CoursesService.new
homeworkscore = cs.show_member_score params
present :data,homeworkscore,with: Mobile::Entities::Homeworkscore
present :status,0
end
desc '发布课程通知'
params do
requires :token,type:String
requires :course_id,type:Integer,desc:'课程id'
requires :title,type:String,desc:'通知标题'
requires :desc,type:String,desc:'通知描述'
end
post ':course_id/create_course_notice' do
cs = CoursesService.new
news = cs.create_course_notice params,current_user
present :data,news,with:Mobile::Entities::News
present :status,0
end
end end
end end
end end

View File

@ -96,6 +96,21 @@ module Mobile
present :status, 0 present :status, 0
end end
desc '创建作业'
params do
requires :token,type:String
requires :work_name,type:String,desc:'作业名称'
requires :work_desc,type:String,desc:'作业描述'
requires :work_deadline,type:String,desc:'截止日期'
requires :is_blind_appr,type:Integer,desc:'是否匿评'
requires :blind_appr_num,type:Integer,desc:'匿评分配数'
requires :course_id,type:Integer,desc: '课程id'
end
post 'create_home_work' do
Homeworks.get_service.create_home_work params,current_user
present :status, 0
end
end end
end end

View File

@ -83,6 +83,9 @@ module Mobile
params do params do
requires :name, type: String, desc: '用户名关键字' requires :name, type: String, desc: '用户名关键字'
requires :search_by, type: String,desc: '搜索依据0 昵称1 用户名2 邮箱,3 昵称和姓名' requires :search_by, type: String,desc: '搜索依据0 昵称1 用户名2 邮箱,3 昵称和姓名'
optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教'
optional :course_id,type:Integer,desc: '课程id搜索注册用户不为该课程教师的其他用户'
optional :user_id,type:Integer,desc:'用户id'
end end
get 'search/search_user' do get 'search/search_user' do
us = UsersService.new us = UsersService.new
@ -91,6 +94,31 @@ module Mobile
present :status, 0 present :status, 0
end end
desc "用户留言"
params do
requires :token, type: String
requires :user_id, type: Integer,desc: '被留言的用户id'
end
get ':user_id/messages' do
us = UsersService.new
jours = us.get_all_messages params
present :data,jours,with:Mobile::Entities::Jours
present :status,0
end
desc "给用户留言或回复用户留言"
params do
requires :token, type: String
requires :user_id, type: Integer,desc: '被留言的用户id'
requires :content,type:String,desc:'留言内容'
optional :refer_user_id,type:Integer,desc:'被回复的用户id'
end
post ':user_id/leave_message' do
us = UsersService.new
jours = us.leave_messages params,current_user
present :status,0
end
end end
end end
end end

View File

@ -46,6 +46,7 @@ module Mobile
course_expose :term course_expose :term
course_expose :time course_expose :time
course_expose :updated_at course_expose :updated_at
course_expose :course_student_num
expose :teacher, using: Mobile::Entities::User do |c, opt| expose :teacher, using: Mobile::Entities::User do |c, opt|
if c.is_a? ::Course if c.is_a? ::Course
c.teacher c.teacher

View File

@ -37,7 +37,6 @@ module Mobile
f.send(:attachments) f.send(:attachments)
end end
end end
#homework_attach_expose :user
end end
end end
end end

View File

@ -0,0 +1,18 @@
module Mobile
module Entities
class Homeworkscore < Grape::Entity
include Redmine::I18n
include ApplicationHelper
def self.homeworkscore_expose(field)
expose field do |f,opt|
if f.is_a?(Hash) && f.key?(field)
f[field]
end
end
end
homeworkscore_expose :name
homeworkscore_expose :score
end
end
end

View File

@ -0,0 +1,34 @@
module Mobile
module Entities
class Member < Grape::Entity
include ApplicationHelper
include ApiHelper
def self.member_expose(f)
expose f do |u,opt|
if u.is_a?(Hash) && u.key?(f)
u[f]
elsif u.is_a?(::Member)
if u.respond_to?(f)
u.send(f)
else
case f
when :student_id
u.user.user_extensions.student_id
end
end
end
end
end
expose :user, using: Mobile::Entities::User do |c, opt|
if c.is_a?(::Member)
c.user
end
end
member_expose :student_id
member_expose :score
member_expose :id
end
end
end

View File

@ -9,7 +9,7 @@ module Mobile
u[f] u[f]
elsif u.is_a?(::User) elsif u.is_a?(::User)
if u.respond_to?(f) if u.respond_to?(f)
u.send(f) u.send(f) unless u.user_extensions.nil?
else else
case f case f
when :img_url when :img_url
@ -17,9 +17,9 @@ module Mobile
when :gender when :gender
u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender
when :work_unit when :work_unit
get_user_work_unit u get_user_work_unit u unless u.user_extensions.nil?
when :location when :location
get_user_location u get_user_location u unless u.user_extensions.nil?
when :brief_introduction when :brief_introduction
u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.brief_introduction u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.brief_introduction
end end

View File

@ -31,9 +31,6 @@ class AccountController < ApplicationController
else else
authenticate_user authenticate_user
end end
rescue AuthSourceException => e
logger.error "An error occured when authenticating #{params[:username]}: #{e.message}"
render_error :message => e.message
end end
# Log out current user and redirect to welcome page # Log out current user and redirect to welcome page
@ -47,6 +44,10 @@ class AccountController < ApplicationController
# display the logout form # display the logout form
end end
def heartbeat
render :json => session[:user_id]
end
# Lets user choose a new password # Lets user choose a new password
def lost_password def lost_password
(redirect_to(home_url); return) unless Setting.lost_password? (redirect_to(home_url); return) unless Setting.lost_password?
@ -314,7 +315,7 @@ class AccountController < ApplicationController
#根据home_url生产正则表达式 #根据home_url生产正则表达式
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != '' if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''
redirect_to user_activities_path(user) redirect_to user_activities_path(user,host: Setting.host_user)
else else
if last_login_on == '' if last_login_on == ''
redirect_to my_account_url redirect_to my_account_url
@ -329,10 +330,10 @@ class AccountController < ApplicationController
end end
def set_autologin_cookie(user) def set_autologin_cookie(user)
token = Token.create(:user => user, :action => 'autologin') token = Token.get_or_create_permanent_login_token(user)
cookie_options = { cookie_options = {
:value => token.value, :value => token.value,
:expires => 7.days.from_now, :expires => 1.month.from_now,
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'), :path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
:httponly => true :httponly => true

View File

@ -156,16 +156,16 @@ class ApplicationController < ActionController::Base
user user
end end
end end
def try_to_autologin1 def try_to_autologin1
user = User.try_to_autologin(params[:token])
# auto-login feature starts a new session if user
user = User.try_to_autologin(params[:token]) logout_user if User.current.id != user.id
if user start_user_session(user)
start_user_session(user) end
end user
user
end end
# Sets the logged in user # Sets the logged in user
def logged_user=(user) def logged_user=(user)
reset_session reset_session
@ -200,7 +200,7 @@ class ApplicationController < ActionController::Base
def logout_user def logout_user
if User.current.logged? if User.current.logged?
cookies.delete(autologin_cookie_name) cookies.delete(autologin_cookie_name)
Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil self.logged_user = nil
end end
end end

View File

@ -8,23 +8,26 @@ class AvatarController < ApplicationController
# Make sure that API users get used to set this content type # Make sure that API users get used to set this content type
# as it won't trigger Rails' automatic parsing of the request body for parameters # as it won't trigger Rails' automatic parsing of the request body for parameters
unless request.content_type == 'application/octet-stream' unless request.content_type == 'application/octet-stream'
render :nothing => true, :status => 406 @source_type = params[:source_type]
return
end
unless request.raw_post.nil?
@source_type = params[:source_type]
@source_id = params[:source_id] @source_id = params[:source_id]
@temp_file = request.raw_post @temp_file = params[:avatar][:image]
if @temp_file.size > 0 @image_file = @temp_file.original_filename
if @temp_file.respond_to?(:original_filename) else
@image_file = @temp_file.original_filename unless request.raw_post.nil?
#image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding) @source_type = params[:source_type]
else @source_id = params[:source_id]
@image_file=params[:filename] @temp_file = request.raw_post
end if @temp_file.size > 0
if @temp_file.respond_to?(:original_filename)
@image_file = @temp_file.original_filename
#image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding)
else
@image_file=params[:filename]
end
end
end end
end end
if @temp_file && (@temp_file.size > 0) if @temp_file && (@temp_file.size > 0)
diskfile=disk_filename(@source_type,@source_id) diskfile=disk_filename(@source_type,@source_id)
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
@ -56,27 +59,15 @@ class AvatarController < ApplicationController
# self.digest = md5.hexdigest # self.digest = md5.hexdigest
end end
@temp_file = nil @temp_file = nil
# @avatar = Avatar.new(:receive_file => request.raw_post)
# @avatar.source_id = User.current.id
# @avatar.image_file = params[:filename].presence || Redmine::Utils.random_hex(16)
# saved = @avatar.save
begin
f = Magick::ImageList.new(diskfile)
# gif格式不再做大小处理
if f.format != 'GIF'
width = 300.0
proportion = (width/f[0].columns)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height)
f.write(diskfile)
end
rescue Exception => e
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
end
image = Trustie::Utils::Image.new(diskfile,true)
image.compress(300)
respond_to do |format| respond_to do |format|
format.json{
render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html'
return
}
format.js format.js
format.api { format.api {
if saved if saved

View File

@ -490,7 +490,7 @@ class BidsController < ApplicationController
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1 FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
WHERE table1.t_score IS NULL OR table1.t_score = 0") WHERE table1.t_score IS NULL")
@not_batch_homework = true @not_batch_homework = true
@cur_type = 1 @cur_type = 1
else else

View File

@ -27,18 +27,22 @@ class BoardsController < ApplicationController
include SortHelper include SortHelper
helper :watchers helper :watchers
helper :project_score helper :project_score
helper :attachments
def index def index
#modify by nwb #modify by nwb
@flag = params[:flag] || false @flag = params[:flag] || false
if @project if @project
@boards = @project.boards.includes(:last_message => :author).all if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
@boards = [] << @boards[0] if @boards.any? render_403
if @boards.size == 1 else
@board = @boards.first @boards = @project.boards.includes(:last_message => :author).all
show and return @boards = [] << @boards[0] if @boards.any?
if @boards.size == 1
@board = @boards.first
show and return
end
render :layout => false if request.xhr?
end end
render :layout => false if request.xhr?
elsif @course elsif @course
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
@boards = @course.boards.includes(:last_message => :author).all @boards = @course.boards.includes(:last_message => :author).all
@ -80,7 +84,7 @@ class BoardsController < ApplicationController
includes(:last_reply). includes(:last_reply).
limit(@topic_pages.per_page). limit(@topic_pages.per_page).
offset(@topic_pages.offset). offset(@topic_pages.offset).
order(sort_clause). order("last_replies_messages.created_on desc").
preload(:author, {:last_reply => :author}). preload(:author, {:last_reply => :author}).
all all
elsif @course elsif @course
@ -88,7 +92,7 @@ class BoardsController < ApplicationController
includes(:last_reply). includes(:last_reply).
# limit(@topic_pages.per_page). # limit(@topic_pages.per_page).
# offset(@topic_pages.offset). # offset(@topic_pages.offset).
order(sort_clause). order("last_replies_messages.created_on desc").
preload(:author, {:last_reply => :author}). preload(:author, {:last_reply => :author}).
all : [] all : []
@topics = paginateHelper board_topics,10 @topics = paginateHelper board_topics,10

View File

@ -5,6 +5,7 @@ class CoursesController < ApplicationController
helper :activities helper :activities
helper :members helper :members
helper :words helper :words
helper :attachments
before_filter :auth_login1, :only => [:show, :feedback] before_filter :auth_login1, :only => [:show, :feedback]
menu_item :overview menu_item :overview
@ -341,10 +342,15 @@ class CoursesController < ApplicationController
def export_course_member_excel def export_course_member_excel
@all_members = student_homework_score(0,0,0,"desc") @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)}";
# 如果是ie11 需要转码
if(/rv\:11\.0/.match(request.env["HTTP_USER_AGENT"]) != nil)
filename= URI::encode(filename)
end
respond_to do |format| respond_to do |format|
format.xls { format.xls {
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}.xls") :filename => "#{filename}.xls")
} }
end end
end end
@ -851,7 +857,7 @@ class CoursesController < ApplicationController
#验证是否显示课程 #验证是否显示课程
def can_show_course def can_show_course
@first_page = FirstPage.find_by_page_type('project') @first_page = FirstPage.find_by_page_type('project')
if @first_page.show_course == 2 if @first_page.try(:show_course) == 2
render_404 render_404
end end
end end

View File

@ -23,7 +23,7 @@ class FilesController < ApplicationController
before_filter :auth_login1, :only => [:index] before_filter :auth_login1, :only => [:index]
before_filter :logged_user_by_apptoken,:only => [:index] before_filter :logged_user_by_apptoken,:only => [:index]
before_filter :find_project_by_project_id#, :except => [:getattachtype] before_filter :find_project_by_project_id#, :except => [:getattachtype]
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:search_project,:quote_resource_show_project,:search_tag_attachment] before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment]
helper :sort helper :sort
include SortHelper include SortHelper
@ -46,6 +46,13 @@ class FilesController < ApplicationController
@obj_attachments = paginateHelper @all_attachments,10 @obj_attachments = paginateHelper @all_attachments,10
end end
def searchone4reload
attachment = Attachment.find_by_id(params[:fileid]);
respond_to do |format|
format.html{render :layout => nil,:locals=>{:file=>attachment,:course=>@course}}
end
end
def search def search
sort = "" sort = ""
@sort = "" @sort = ""

View File

@ -51,7 +51,7 @@ class HomeworkAttachController < ApplicationController
order_by = "created_at #{direction}" order_by = "created_at #{direction}"
end end
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}) AS table1 ORDER BY #{order_by}) AS table1
@ -445,7 +445,8 @@ class HomeworkAttachController < ApplicationController
is_teacher = @is_teacher ? 1 : 0 is_teacher = @is_teacher ? 1 : 0
#保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0)) #保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0))
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言 @is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
if @m_score && (@is_teacher || @is_anonymous_comments) if @is_teacher || @is_anonymous_comments
@m_score ||= 0
rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first
if rate if rate
rate.stars = @m_score rate.stars = @m_score
@ -502,7 +503,7 @@ class HomeworkAttachController < ApplicationController
get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id
elsif @cur_type == "2" #老师已批列表 elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.find_by_sql("SELECT homework_attaches.*, @result_homework = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE id = #{@homework.id}").first FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "3" #全部作业列表 elsif @cur_type == "3" #全部作业列表
@ -629,7 +630,7 @@ class HomeworkAttachController < ApplicationController
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{bid_id} FROM homework_attaches WHERE bid_id = #{bid_id}
ORDER BY #{order_by}) AS table1 ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NULL OR table1.t_score = 0 ") WHERE table1.t_score IS NULL ")
@all_homework_list = search_homework_member(@all_homework_list,@search_name.to_s.downcase) if @search_name @all_homework_list = search_homework_member(@all_homework_list,@search_name.to_s.downcase) if @search_name
# @homework_list = paginateHelper @all_homework_list,10 # @homework_list = paginateHelper @all_homework_list,10
@homework_list = @all_homework_list @homework_list = @all_homework_list

View File

@ -58,7 +58,7 @@ class IssuesController < ApplicationController
def index def index
retrieve_query retrieve_query
sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns) sort_update(@query.sortable_columns)
@query.sort_criteria = sort_criteria.to_a @query.sort_criteria = sort_criteria.to_a
@ -75,20 +75,19 @@ class IssuesController < ApplicationController
else else
@limit = 10#per_page_option @limit = 10#per_page_option
end end
@assign_to_id = params[:assigned_to_id]
@author_id = params[:author_id]
@priority_id = params[:priority_id]
@status_id = params[:status_id]
@subject = params[:subject]
@issue_count = @query.issue_count @issue_count = @query.issue_count
@issue_pages = Paginator.new @issue_count, @limit, params['page'] @issue_pages = Paginator.new @issue_count, @limit, params['page']
@offset ||= @issue_pages.offset @offset ||= @issue_pages.offset
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
:order => sort_clause, :order => sort_clause,
:offset => @offset, :offset => @offset,
:limit => @limit) :limit => @limit)
@issue_count_by_group = @query.issue_count_by_group @issue_count_by_group = @query.issue_count_by_group
respond_to do |format| respond_to do |format|
format.js format.js
format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
@ -383,7 +382,7 @@ class IssuesController < ApplicationController
def retrieve_previous_and_next_issue_ids def retrieve_previous_and_next_issue_ids
retrieve_query_from_session retrieve_query_from_session
if @query if @query
sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns, 'issues_index_sort') sort_update(@query.sortable_columns, 'issues_index_sort')
limit = 500 limit = 500
issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version]) issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])

View File

@ -93,10 +93,27 @@ class MessagesController < ApplicationController
end end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message) render_attachment_warning_if_needed(@message)
redirect_to board_message_url(@board, @message) if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @message)
end
else else
layout_file = @project ? 'base_projects' : 'base_courses' if params[:is_board]
render :action => 'new', :layout => layout_file if @project
redirect_to project_boards_path(@project, :flag => true)
elsif @course
redirect_to course_boards_path(@course, :flag => true)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
end end
else else
respond_to do |format| respond_to do |format|
@ -111,7 +128,15 @@ class MessagesController < ApplicationController
# Reply to a topic # Reply to a topic
def reply def reply
if params[:reply][:content] == "" if params[:reply][:content] == ""
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return) if params[:is_board]
if @project
(redirect_to project_boards_path(@project), :notice => l(:label_reply_empty);return)
elsif @course
(redirect_to course_boards_path(@course), :notice => l(:label_reply_empty);return)
end
else
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
end end
@quote = params[:quote][:quote] @quote = params[:quote][:quote]
@reply = Message.new @reply = Message.new
@ -123,16 +148,24 @@ class MessagesController < ApplicationController
#@topic.update_attribute(:updated_on, Time.now) #@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record? if !@reply.new_record?
if params[:asset_id] if params[:asset_id]
ids = params[:asset_id].split(',') ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
end end
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments]) attachments = Attachment.attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply) render_attachment_warning_if_needed(@reply)
else else
#render file: 'messages#show', layout: 'base_courses' #render file: 'messages#show', layout: 'base_courses'
end end
redirect_to board_message_url(@board, @topic, :r => @reply) if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @topic, :r => @reply)
end
end end
@ -144,19 +177,36 @@ class MessagesController < ApplicationController
else else
(render_403; return false) unless @message.course_editable_by?(User.current) (render_403; return false) unless @message.course_editable_by?(User.current)
end end
@message.safe_attributes = params[:message] @message.safe_attributes = params[:message]
if request.post? && @message.save if request.post? && @message.save
attachments = Attachment.attach_files(@message, params[:attachments]) attachments = Attachment.attach_files(@message, params[:attachments])
render_attachment_warning_if_needed(@message) render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
@message.reload @message.reload
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
end
elsif request.get? elsif request.get?
respond_to do |format| if params[:is_board]
format.html { if @project
layout_file = @project ? 'base_projects' : 'base_courses' redirect_to project_boards_path(@project)
render :layout => layout_file elsif @course
} redirect_to course_boards_path(@course)
end
else
respond_to do |format|
format.html {
layout_file = @project ? 'base_projects' : 'base_courses'
render :layout => layout_file
}
end
end end
end end
end end
@ -172,16 +222,20 @@ class MessagesController < ApplicationController
@message.destroy @message.destroy
# modify by nwb # modify by nwb
if @project if @project
if @message.parent if params[:is_board]
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to project_boards_url(@project) redirect_to project_boards_url(@project)
else
redirect_to board_message_url(@board, @topic, :r => @reply)
end end
elsif @course elsif @course
if @message.parent if params[:is_board]
redirect_to board_message_url(@board, @message.parent, :r => r) redirect_to course_boards_url(@course)
else else
redirect_to course_board_url(@course, @board) if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to course_board_url(@course, @board)
end
end end
end end
end end
@ -202,7 +256,7 @@ class MessagesController < ApplicationController
render :partial => 'common/preview' render :partial => 'common/preview'
end end
private private
def find_message def find_message
return unless find_board return unless find_board
@message = @board.messages.find(params[:id], :include => :parent) @message = @board.messages.find(params[:id], :include => :parent)

View File

@ -95,76 +95,46 @@ class MyController < ApplicationController
@pref = @user.pref @pref = @user.pref
diskfile = disk_filename('User', @user.id) diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp' diskfile1 = diskfile + 'temp'
if request.post? begin
@user.safe_attributes = params[:user] if request.post?
@user.pref.attributes = params[:pref] @user.safe_attributes = params[:user]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1') @user.pref.attributes = params[:pref]
@user.login = params[:login] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
unless @user.user_extensions.nil? @user.login = params[:login]
if @user.user_extensions.identity == 2 unless @user.user_extensions.nil?
@user.firstname = params[:enterprise_name] if @user.user_extensions.identity == 2
end @user.firstname = params[:enterprise_name]
end
@se = @user.extensions
if params[:occupation].to_i.to_s == params[:occupation]
@se.school_id = params[:occupation]
else
@se.occupation = params[:occupation]
end
@se.gender = params[:gender]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@se.identity = params[:identity].to_i if params[:identity]
@se.technical_title = params[:technical_title] if params[:technical_title]
@se.student_id = params[:no] if params[:no]
if @user.save && @se.save
# 头像保存
if File.exist?(diskfile1)
if File.exist?(diskfile)
File.delete(diskfile)
end
File.open(diskfile1, "rb") do |f|
buffer = f.read(10)
if buffer != "DELETE"
File.open(diskfile1, "rb") do |f1|
File.open(diskfile, "wb") do |f|
buffer = ""
while (buffer = f1.read(8192))
f.write(buffer)
end
end
end
# File.rename(diskfile + 'temp',diskfile);
end
end end
end end
# 确保文件被删除 @se = @user.extensions
if File.exist?(diskfile1) if params[:occupation].to_i.to_s == params[:occupation]
File.delete(diskfile1) @se.school_id = params[:occupation]
else
@se.occupation = params[:occupation]
end end
@se.gender = params[:gender]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@se.identity = params[:identity].to_i if params[:identity]
@se.technical_title = params[:technical_title] if params[:technical_title]
@se.student_id = params[:no] if params[:no]
@user.pref.save if @user.save && @se.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) # 头像保存
set_language_if_valid @user.language FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1
flash[:notice] = l(:notice_account_updated) @user.pref.save
redirect_to user_url(@user) @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
return set_language_if_valid @user.language
else flash[:notice] = l(:notice_account_updated)
# 确保文件被删除 redirect_to user_url(@user)
if File.exist?(diskfile1) return
File.delete(diskfile1) else
@user.login = lg
end end
@user.login = lg
end
else
# 确保文件被删除
if File.exist?(diskfile1)
File.delete(diskfile1)
end end
ensure
File.delete(diskfile1) if File.exist?(diskfile1)
end end
end end
@ -200,31 +170,20 @@ class MyController < ApplicationController
@user = us.change_password params.merge(:current_user_id => @user.id) @user = us.change_password params.merge(:current_user_id => @user.id)
if @user.errors.full_messages.count <= 0 if @user.errors.full_messages.count <= 0
flash.now[:notice] = l(:notice_account_password_updated) flash.now[:notice] = l(:notice_account_password_updated)
redirect_to my_account_url # 修改完密码让其重新登录并更新Token
Token.delete_user_all_tokens(@user)
logout_user
redirect_to signin_url(back_url: my_account_path)
else
flash.now[:error] = l(:notice_account_wrong_password)
end end
end end
rescue Exception => e rescue Exception => e
if e.message == 'wrong password' if e.message == 'wrong password'
flash.now[:error] = l(:notice_account_wrong_password) flash.now[:error] = l(:notice_account_wrong_password)
else
flash.now[:error] = e.message
end end
# @user = User.current
# unless @user.change_password_allowed?
# flash.now[:error] = l(:notice_can_t_change_password)
# redirect_to my_account_url
# return
# end
# if request.post?
# if @user.check_password?(params[:password])
# @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
#
# if @user.save
# flash.now[:notice] = l(:notice_account_password_updated)
# redirect_to my_account_url
# end
# else
# flash.now[:error] = l(:notice_account_wrong_password)
# end
# end
end end
# Create a new feeds key # Create a new feeds key

View File

@ -31,7 +31,7 @@ class ProjectsController < ApplicationController
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] 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 :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :file, :statistics, :watcherlist before_filter :file, :statistics #:watcherlist
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member before_filter :memberAccess, only: :member
@ -417,10 +417,14 @@ class ProjectsController < ApplicationController
@members = @project.member_principals.includes(:roles, :principal).all.sort @members = @project.member_principals.includes(:roles, :principal).all.sort
end end
else else
roles = Role.find_all_givable if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
@subPage_title = l :label_member_list render_403
@members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all else
@applied_members = appied_project_members(@project, @members) roles = Role.find_all_givable
@subPage_title = l :label_member_list
@members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all
@applied_members = appied_project_members(@project, @members)
end
end end
@members = paginateHelper @members @members = paginateHelper @members
render :layout => 'base_courses' if @project.project_type == 1 render :layout => 'base_courses' if @project.project_type == 1
@ -676,11 +680,13 @@ class ProjectsController < ApplicationController
true true
end end
# added by huang
def watcherlist def watcherlist
if @watched unless @project.nil?
@users -= watched.watcher_users if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403
else
@users -= watched.watcher_users if @watched
end
end end
end end

View File

@ -244,12 +244,12 @@ update
def show def show
## TODO: the below will move to filter, done. ## TODO: the below will move to filter, done.
# if !User.current.member_of?(@project) if !User.current.member_of?(@project)
# if @project.hidden_repo if @project.hidden_repo
# render_403 render_403
# return -1 return -1
# end end
# end end
#if( !User.current.member_of?(@project) || @project.hidden_repo) #if( !User.current.member_of?(@project) || @project.hidden_repo)
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?

View File

@ -38,12 +38,13 @@ class TrackersController < ApplicationController
@tracker ||= Tracker.new(params[:tracker]) @tracker ||= Tracker.new(params[:tracker])
@trackers = Tracker.sorted.all @trackers = Tracker.sorted.all
@projects = Project.where("project_type = #{Project::ProjectType_project}").all @projects = Project.where("project_type = #{Project::ProjectType_project}").all
@courses = Course.all # 去掉原因,这块代码已经没有用到
@course_activity_count=Hash.new # @courses = Course.all
@courses.each do |course| # @course_activity_count=Hash.new
@course_activity_count[course.id]=0 # @courses.each do |course|
end # @course_activity_count[course.id]=0
@course_activity_count=get_course_activity @courses,@course_activity_count # end
# @course_activity_count=get_course_activity @courses,@course_activity_count
end end
def create def create

View File

@ -383,6 +383,8 @@ class UsersController < ApplicationController
# scope = User.logged.status(@status) # scope = User.logged.status(@status)
# @search_by = params[:search_by] ? params[:search_by][:id] : 0 # @search_by = params[:search_by] ? params[:search_by][:id] : 0
# scope = scope.like(params[:name],@search_by) if params[:name].present? # scope = scope.like(params[:name],@search_by) if params[:name].present?
@search_by = params[:search_by] ? params[:search_by] : 0
us = UsersService.new us = UsersService.new
scope = us.search_user params scope = us.search_user params
@user_count = scope.count @user_count = scope.count

View File

@ -58,12 +58,18 @@ class WelcomeController < ApplicationController
else else
case @first_page.sort_type case @first_page.sort_type
when 0 when 0
@my_projects = find_my_projects
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
@projects = find_miracle_project(10, 3,"created_on desc") @projects = find_miracle_project(10, 3,"created_on desc")
#@projects = @projects_all.order("created_on desc") #@projects = @projects_all.order("created_on desc")
when 1 when 1
@my_projects = find_my_projects
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
@projects = find_miracle_project(10, 3,"score desc") @projects = find_miracle_project(10, 3,"score desc")
#@projects = @projects_all.order("grade desc") #@projects = @projects_all.order("grade desc")
when 2 when 2
@my_projects = find_my_projects
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
@projects = find_miracle_project(10, 3,"watchers_count desc") @projects = find_miracle_project(10, 3,"watchers_count desc")
#@projects = @projects_all.order("watchers_count desc") #@projects = @projects_all.order("watchers_count desc")

View File

@ -85,6 +85,9 @@ class WordsController < ApplicationController
elsif @journal_destroyed.jour_type == "Course" elsif @journal_destroyed.jour_type == "Course"
@course = Course.find @journal_destroyed.jour_id @course = Course.find @journal_destroyed.jour_id
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count @jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
elsif @journal_destroyed.jour_type == "Principal"
@user = User.find(@journal_destroyed.jour_id)
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
end end
respond_to do |format| respond_to do |format|
format.js format.js

View File

@ -118,11 +118,11 @@ module ApplicationHelper
end end
#if user.active? || (User.current.admin? && user.logged?) #if user.active? || (User.current.admin? && user.logged?)
# link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes # link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes
#else #else
# name # name
#end #end
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes
else else
h(user.to_s) h(user.to_s)
end end
@ -131,7 +131,7 @@ module ApplicationHelper
def link_to_isuue_user(user, options={}) def link_to_isuue_user(user, options={})
if user.is_a?(User) if user.is_a?(User)
name = h(user.name(options[:format])) name = h(user.name(options[:format]))
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "pro_info_p" link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p"
else else
h(user.to_s) h(user.to_s)
end end
@ -140,7 +140,7 @@ module ApplicationHelper
def link_to_settings_user(user, options={}) def link_to_settings_user(user, options={})
if user.is_a?(User) if user.is_a?(User)
name = h(user.name(options[:format])) name = h(user.name(options[:format]))
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "w90 c_orange fl" link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "w90 c_orange fl"
else else
h(user.to_s) h(user.to_s)
end end
@ -155,7 +155,7 @@ module ApplicationHelper
else else
name = user.login name = user.login
end end
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => options[:class] link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => options[:class]
else else
h(user.to_s) h(user.to_s)
end end
@ -593,6 +593,42 @@ module ApplicationHelper
Project.project_tree(projects, &block) Project.project_tree(projects, &block)
end end
# 项目版本库可见权限判断
# 条件1、modules中设置不可见或项目没有版本库2、如果项目是私有或者项目版本库隐藏则必须是项目成员才可见
def visible_repository?(project)
@result = false
unless project.enabled_modules.where("name = 'repository'").empty? || project.repositories.count == 0
if (project.hidden_repo || !project.is_public?)
if User.current.member_of?(project)
@result = true
end
else
@result = true
end
end
return @result
end
# 判断当前用户是否为项目管理员
def is_project_manager?(user_id, project_id)
@result = false
mem = Member.where("user_id = ? and project_id = ?",user_id, project_id)
unless mem.blank?
@result = mem.first.roles.to_s.include?("Manager") ? true : false
end
return @result
end
# 公开项目资源可以引用admin和管理员和资源上传者拥有设置公开私有权限
def authority_pubilic_for_files(project, file)
@result = false
if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id || User.current.admin) &&
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
@result = true
end
return @result
end
def principals_check_box_tags(name, principals) def principals_check_box_tags(name, principals)
s = '' s = ''
principals.each do |principal| principals.each do |principal|
@ -1770,8 +1806,7 @@ module ApplicationHelper
def get_memo def get_memo
@new_memo = Memo.new @new_memo = Memo.new
#@new_memo.subject = "有什么想说的,尽管来咆哮吧~~" @public_forum = Forum.find(1) rescue ActiveRecord::RecordNotFound
@public_forum = Forum.find(1)
end end
#获取用户未过期的课程 #获取用户未过期的课程
@ -2066,21 +2101,21 @@ module ApplicationHelper
hidden_non_project = Setting.find_by_name("hidden_non_project") hidden_non_project = Setting.find_by_name("hidden_non_project")
visiable = !(hidden_non_project && hidden_non_project.value == "0") visiable = !(hidden_non_project && hidden_non_project.value == "0")
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain} main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.host_course}
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain} main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.host_name}
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain} main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.host_contest}
# course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'} # course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain} course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.host_course}
# courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'} # courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'}
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain} #users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.host_user}
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'} # contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'} bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"} forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'} stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'} school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.project_domain} project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.host_name}
# project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain} # project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
#@nav_dispaly_project_label #@nav_dispaly_project_label
nav_list = Array.new nav_list = Array.new

View File

@ -797,4 +797,17 @@ module CoursesHelper
end end
result result
end end
def zh_course_role role
if role == "TeachingAsistant"
result = l(:label_TA)
elsif role == "Teacher"
result = l(:label_teacher)
elsif role == "Student"
result = l(:label_student)
elsif role == "Manager"
result = l(:field_admin)
end
result
end
end end

View File

@ -11,7 +11,7 @@ module GitlabHelper
PROJECT_PATH_CUT = 40 PROJECT_PATH_CUT = 40
# gitlab版本库所在服务器 # gitlab版本库所在服务器
# 注意REPO_IP_ADDRESS必须以http://开头暂时只支持HTTP协议未支持SSH # 注意REPO_IP_ADDRESS必须以http://开头暂时只支持HTTP协议未支持SSH
#REPO_IP_ADDRESS = "http://" + Setting.repository_domain #REPO_IP_ADDRESS = "http://" + Setting.host_repository
REPO_IP_ADDRESS = "http://192.168.137.100" REPO_IP_ADDRESS = "http://192.168.137.100"
GITLAB_API = "/api/v3" GITLAB_API = "/api/v3"

View File

@ -67,29 +67,33 @@ module IssuesHelper
s.html_safe s.html_safe
end end
#获取跟踪类型 #获取跟踪类型及样式
#REDO:时间紧需要优化,两个方法可以综合成一个 #REDO:时间紧可以优化.
def get_issue_type(value) def get_issue_type(value)
issuetype = []
if value == "缺陷" || value == 1 if value == "缺陷" || value == 1
class_type = "red_btn_cir ml10" issuetype << "red_btn_cir ml10"
issuetype << "缺陷"
elsif value == "功能" || value == 2 elsif value == "功能" || value == 2
class_type = "blue_btn_cir ml10" issuetype << "blue_btn_cir ml10"
issuetype << "功能"
elsif value == "支持" || value == 3 elsif value == "支持" || value == 3
class_type = "green_btn_cir ml10" issuetype << "green_btn_cir ml10"
issuetype << "支持"
elsif value == "任务" || value == 4
issuetype << "orange_btn_cir ml10"
issuetype << "任务"
else else
class_type = "orange_btn_cir ml10" issuetype << "bgreen_btn_cir ml10"
issuetype << "周报"
end end
end end
def get_issue_typevalue(value) def principals_options_for_isuue_list(project)
if value == "缺陷" || value == 1 if User.current.member_of?(project)
assign = "缺陷" project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
elsif value == "功能" || value == 2
assign = "功能"
elsif value == "支持" || value == 3
assign = "支持"
else else
assign = "任务" project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
end end
end end

View File

@ -243,15 +243,15 @@ module QueriesHelper
# Retrieve query from session or build a new query # Retrieve query from session or build a new query
def retrieve_query def retrieve_query
if !params[:query_id].blank? # if !params[:query_id].blank?
cond = "project_id IS NULL" # cond = "project_id IS NULL"
cond << " OR project_id = #{@project.id}" if @project # cond << " OR project_id = #{@project.id}" if @project
@query = IssueQuery.find(params[:query_id], :conditions => cond) # @query = IssueQuery.find(params[:query_id], :conditions => cond)
raise ::Unauthorized unless @query.visible? # raise ::Unauthorized unless @query.visible?
@query.project = @project # @query.project = @project
session[:query] = {:id => @query.id, :project_id => @query.project_id} # session[:query] = {:id => @query.id, :project_id => @query.project_id}
sort_clear # sort_clear
elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) # elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
# Give it a name, required to be valid # Give it a name, required to be valid
@query = IssueQuery.new(:name => "_") @query = IssueQuery.new(:name => "_")
@query.project = @project @query.project = @project
@ -268,12 +268,12 @@ module QueriesHelper
'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil? 'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil?
@query.build_from_params(params) @query.build_from_params(params)
#session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names} #session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
else # else
# retrieve from session # # retrieve from session
@query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id] # @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id]
@query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) # @query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
@query.project = @project # @query.project = @project
end # end
end end
def retrieve_query_from_session def retrieve_query_from_session

View File

@ -24,7 +24,7 @@ module RepositoriesHelper
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/" ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
end end
PROJECT_PATH_CUT = 40 PROJECT_PATH_CUT = 40
REPO_IP_ADDRESS = Setting.repository_domain REPO_IP_ADDRESS = Setting.host_repository
def format_revision(revision) def format_revision(revision)
if revision.respond_to? :format_identifier if revision.respond_to? :format_identifier
@ -232,6 +232,18 @@ module RepositoriesHelper
:label => l(:label_git_report_last_commit) :label => l(:label_git_report_last_commit)
)) ))
end end
# 判断项目是否有主版本库
def judge_main_repository(pro)
if pro.repositories.blank?
return false
else
pro.repositories.sort.each do |rep|
rep.is_default?
return true
end
end
end
# def cvs_field_tags(form, repository) # def cvs_field_tags(form, repository)
# content_tag('p', form.text_field( # content_tag('p', form.text_field(
# :root_url, # :root_url,

View File

@ -443,6 +443,10 @@ module WelcomeHelper
resultSet.take(limit) resultSet.take(limit)
end end
def find_my_projects
my_projects = User.current.memberships.all(conditions: "projects.project_type = 0")
end
def sort_project_by_hot_rails project_type=0, order_by='score DESC', limit=15 def sort_project_by_hot_rails project_type=0, order_by='score DESC', limit=15
# Project.find_by_sql(" # Project.find_by_sql("
# SELECT p.id, p.name, p.description, p.identifier, t.project_id # SELECT p.id, p.name, p.description, p.identifier, t.project_id

View File

@ -1,3 +1,4 @@
#coding=utf-8
# Redmine - project management software # Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2006-2013 Jean-Philippe Lang
# #
@ -14,7 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
class Token < ActiveRecord::Base class Token < ActiveRecord::Base
belongs_to :user belongs_to :user
validates_uniqueness_of :value validates_uniqueness_of :value
@ -27,6 +28,16 @@ class Token < ActiveRecord::Base
self.value = Token.generate_token_value self.value = Token.generate_token_value
end end
def self.get_or_create_permanent_login_token(user)
token = Token.get_token_from_user(user, 'autologin')
unless token
token = Token.create(:user => user, :action => 'autologin')
else
token.update_attribute(:created_on, Time.now)
end
token
end
def self.get_token_from_user(user, action) def self.get_token_from_user(user, action)
token = Token.where(:action => action, :user_id => user).first token = Token.where(:action => action, :user_id => user).first
unless token unless token
@ -42,7 +53,7 @@ class Token < ActiveRecord::Base
# Delete all expired tokens # Delete all expired tokens
def self.destroy_expired def self.destroy_expired
Token.delete_all ["action NOT IN (?) AND created_on < ?", ['feeds', 'api'], Time.now - @@validity_time] Token.delete_all ["action NOT IN (?) AND created_on < ?", ['feeds', 'api', 'autologin'], Time.now - @@validity_time]
end end
# Returns the active user who owns the key for the given action # Returns the active user who owns the key for the given action
@ -80,6 +91,10 @@ class Token < ActiveRecord::Base
Redmine::Utils.random_hex(20) Redmine::Utils.random_hex(20)
end end
def self.delete_user_all_tokens(user)
Token.delete_all(user_id: user.id)
end
private private
# Removes obsolete tokens (same user and action) # Removes obsolete tokens (same user and action)

View File

@ -86,7 +86,7 @@ class CoursesService
gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender
work_unit = get_user_work_unit m.user work_unit = get_user_work_unit m.user
location = get_user_location m.user location = get_user_location m.user
users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, :brief_introduction => m.user.user_extensions.brief_introduction} users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, :brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname}
end end
users users
end end
@ -169,7 +169,7 @@ class CoursesService
unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
raise '403' raise '403'
end end
{:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course)} {:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
end end
#创建课程 #创建课程
@ -433,13 +433,104 @@ class CoursesService
result = [] result = []
@course = Course.find(params[:course_id]) @course = Course.find(params[:course_id])
@attachments = @course.attachments.order("created_on desc") @attachments = @course.attachments.order("created_on desc")
@attachments.each do |atta| if !params[:name].nil? && params[:name] != ""
result << {:filename => atta.filename,:description => atta.description,:downloads => atta.downloads,:quotes => atta.quotes.nil? ? 0 :atta.quotes } @attachments.each do |atta|
result << {:filename => atta.filename,
:description => atta.description,
:downloads => atta.downloads,
:quotes => atta.quotes.nil? ? 0 :atta.quotes } if atta.filename.include?(params[:name])
end
else
@attachments.each do |atta|
result << {:filename => atta.filename,
:description => atta.description,
:downloads => atta.downloads,
:quotes => atta.quotes.nil? ? 0 :atta.quotes }
end
end end
result result
end end
# 课程学生列表
def course_members params
@all_members = searchmember_by_name(student_homework_score(0,params[:course_id], 10,"desc"),params[:name])
end
def show_member_score params
@member_score = Member.find(params[:member_id]) if params[:member_id]
atta = @member_score.student_homework_score[0]
result = []
atta.each do |t|
if !params[:homeworkName].nil? && params[:homeworkName] != ""
result << {:name=>t[:name],:score=>t[:score]} if t[:name].include?(params[:homeworkName])
else
result << {:name=>t[:name],:score=>t[:score]}
end
end
result
end
# 设置人员为课程教辅
def set_as_assitant_teacher params
members = []
#找到课程
course = Course.find(params[:course_id])
#新建课程人员
member = Member.new(:role_ids =>[7], :user_id => params[:user_id],:course_id=>params[:course_id])
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
joined.each do |join|
join.delete
end
member.course_group_id = 0
members << member
course.members << members
#将课程人员设置为教辅
end
def del_assitant_teacher params
member = Member.where("user_id = ? and course_id = ?",params[:user_id],params[:course_id])
member.each do |m|
m.destroy
end
user_admin = CourseInfos.where("user_id = ? and course_id = ?",params[:user_id], params[:course_id])
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id])
joined.each do |join|
join.delete
end
end
def create_course_notice params ,current_user
n = News.new(:course_id =>params[:course_id], :author_id => current_user.id,:title =>params[:title],:description=> params[:desc])
n.save
{:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count}
end
private private
def searchmember_by_name members, name
#searchPeopleByRoles(project, StudentRoles)
mems = []
if name != ""
name = name.to_s.downcase
members.each do |m|
username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase
if(m.user[:login].to_s.downcase.include?(name) || m.user.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name))
mems << m
end
end
else
mems = members
end
mems
end
def show_homework_info course,bid,current_user,is_course_teacher def show_homework_info course,bid,current_user,is_course_teacher
author_real_name = bid.author.lastname + bid.author.firstname author_real_name = bid.author.lastname + bid.author.firstname
many_times = course.homeworks.index(bid) + 1 many_times = course.homeworks.index(bid) + 1
@ -476,5 +567,56 @@ class CoursesService
end end
def student_homework_score(groupid,course_id, nums, score_sort_by)
#teachers = find_course_teachers(@course)
#start_from = start_from * nums
sql_select = ""
if groupid == 0
if nums == 0
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id} AND
students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
else
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id} AND
students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by} " #limit #{start_from}, #{nums}"
end
else
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id
and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id})
GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id}
and members.course_group_id = #{groupid} AND
students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
end
sql = ActiveRecord::Base.connection()
homework_scores = Member.find_by_sql(sql_select)
sql.close()
homework_scores
end
end end

View File

@ -231,6 +231,29 @@ class HomeworkService
anonymous_repy(jour) anonymous_repy(jour)
end end
end end
# 发布作业
def create_home_work params,current_user
@bid = Bid.new
@bid.name = params[:work_name]
@bid.description = params[:work_desc]
# @bid.is_evaluation = params[:is_blind_appr]
@bid.evaluation_num = params[:blind_appr_num]
@bid.open_anonymous_evaluation = params[:is_blind_appr]
@bid.reward_type = 3
@bid.deadline = params[:work_deadline]
@bid.budget = 0
@bid.author_id = current_user.id
@bid.commit = 0
@bid.homework_type = 1
# @bid.
if @bid.save
HomeworkForCourse.create(:course_id => params[:course_id], :bid_id => @bid.id)
unless @bid.watched_by?(current_user)
@bid.add_watcher(current_user)
end
end
end
# 学生匿评列表 # 学生匿评列表
def student_jour_list params def student_jour_list params

View File

@ -4,6 +4,7 @@ class UsersService
include AvatarHelper include AvatarHelper
include CoursesHelper include CoursesHelper
include ApiHelper include ApiHelper
include WordsHelper
#将用户注册的功能函数写这里 #将用户注册的功能函数写这里
#参数约定 #参数约定
#成功返回注册后的User实例失败直接抛异常 #成功返回注册后的User实例失败直接抛异常
@ -154,6 +155,25 @@ class UsersService
@user @user
end end
# 获取某个用户的所有留言信息
def get_all_messages params
user = User.find(params[:user_id])
jours = user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
jours.update_all(:is_readed => true, :status => false)
jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
end
jours
end
# 给某个用户留言
def leave_messages params,current_user
user = User.find(params[:user_id])
user.add_jour(current_user, params[:content], params[:refer_user_id] ||= 0)
unless params[:refer_user_id].nil? || params[:refer_user_id] == 0 || params[:refer_user_id] == User.current.id
User.find(params[:refer_user_id]).add_jour(current_user, params[:content], params[:refer_user_id])
end
end
@ -205,10 +225,23 @@ class UsersService
"show_changesets" => true "show_changesets" => true
} }
scope = User.logged.status(status) scope = User.logged.status(status)
watcher = User.watched_by(params[:user_id]) if params[:is_search_assitant].nil?
watcher.push(params[:user_id]) #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件(bug:#2270) start
search_by = params[:search_by] ? params[:search_by] : "0" #say by yutao: params[:user_id]这个是指谁发起的搜索么? 如果是 这个值貌似应该从session获取 怪怪的赶脚-_-!
scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present? search_by = params[:search_by] ? params[:search_by] : "0"
if params[:name].present?
if !params[:user_id].nil?
watcher = User.watched_by(params[:user_id])
watcher.push(params[:user_id])
scope = scope.where("id not in (?)",watcher)
end
scope = scope.like(params[:name],search_by)
end
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
else
teachers = searchTeacherAndAssistant(Course.find(params[:course_id]))
scope = scope.where("id not in (?)",teachers.map{|t| t.user_id}).like(params[:name],search_by) if params[:name].present?
end
scope scope
end end

View File

@ -17,6 +17,7 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>
<div class="cl"></div>
<% end %> <% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %> <% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment"> <span id="attachments_p<%= i %>" class="attachment">
@ -34,10 +35,12 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>
<div class="cl"></div>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
<% project = project %> <% project = project %>
<div class="cl"></div>
<span class="add_attachment" style="font-weight:normal;"> <span class="add_attachment" style="font-weight:normal;">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%--> <!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->

View File

@ -1,27 +1,31 @@
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html"> <span id="attachments_fields<%= container.id %>" class="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %> <% if defined?(container) && container && container.saved_attachments %>
<% if isReply %> <% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %> <% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment"> <span id="attachments_p<%= i %>" class="sub_btn">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span> <span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%> <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<% container.attachments.each_with_index do |attachment, i| %> <% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment"> <span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> <span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%> <%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
@ -38,12 +42,12 @@
<span class="add_attachment"> <span class="add_attachment">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%--> <!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"_file.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> <%= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"file#{container.id}.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]', <%= file_field_tag 'attachments[dummy][file]',
:id => '_file', :id => "file#{container.id}",
:class => 'file_selector', :class => 'file_selector',
:multiple => true, :multiple => true,
:onchange => 'addInputFiles(this);', :onchange => "addInputFiles_board(this, '#{container.id}');",
:style => 'display:none', :style => 'display:none',
:data => { :data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
@ -56,7 +60,9 @@
:file_count => l(:label_file_count), :file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all) :delete_all_files => l(:text_are_you_sure_all)
} %> } %>
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span> <% if container.nil? %>
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
<% end %>
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span> </span>

View File

@ -1,4 +1,73 @@
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html"> <% if defined?(container) %>
<span id="attachments_fields<%= container.id %>" class="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="sub_btn">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% else %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), 'data-containerid'=>"#{container.id}",:method => 'delete', :remote => true, :class => 'remove-upload') %>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
<% end %>
</span>
<script type='text/javascript'>
// function CompatibleSend()
// {
// var obj=document.getElementById("_file");
// var file= $(obj).clone();
// file.click();
// }
</script>
<span class="add_attachment" data-containerid="<%= container.id %>">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file#{container.id}.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file#{container.id}",
:class => 'file_selector',
:multiple => true,
:onchange => "addInputFiles_board(this, '#{container.id}');",
:style => '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),
:delete_all_files => l(:text_are_you_sure_all),
:containerid => "#{container.id}"
} %>
<span id="upload_file_count<%=container.id %>" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span>
<% else %>
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %> <% if defined?(container) && container && container.saved_attachments %>
<% if isReply %> <% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %> <% container.saved_attachments.each_with_index do |attachment, i| %>
@ -27,39 +96,42 @@
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
<script type='text/javascript'> <script type='text/javascript'>
// function CompatibleSend() // function CompatibleSend()
// { // {
// var obj=document.getElementById("_file"); // var obj=document.getElementById("_file");
// var file= $(obj).clone(); // var file= $(obj).clone();
// file.click(); // file.click();
// } // }
</script> </script>
<span class="add_attachment"> <span class="add_attachment">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%--> <!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]', <%= file_field_tag 'attachments[dummy][file]',
:id => '_file', :id => '_file',
:class => 'file_selector', :class => 'file_selector',
:multiple => true, :multiple => true,
:onchange => 'addInputFiles(this);', :onchange => 'addInputFiles(this);',
:style => 'display:none', :style => 'display:none',
:data => { :data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes, :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_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, :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js'), :upload_path => uploads_path(:format => 'js'),
:description_placeholder => l(:label_optional_description), :description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public), :field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure), :are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count), :file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all) :delete_all_files => l(:text_are_you_sure_all)
} %> } %>
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span> <% if defined?(container) %>
<span id="upload_file_count" class="c_grey"><%= l(:label_no_file_uploaded)%></span>
<% end %>
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span> </span>
<% end %>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %> <%= javascript_include_tag 'attachments' %>
<% end %> <% end %>

View File

@ -13,6 +13,6 @@
:target => "_blank"%> :target => "_blank"%>
</div> </div>
<% end %> <% end %>
<br> <div class="cl"></div>
<% end %> <% end %>
</div> </div>

View File

@ -28,7 +28,8 @@
<div class="attachments" style="font-weight:normal;"> <div class="attachments" style="font-weight:normal;">
<% is_float ||= false %> <% is_float ||= false %>
<% for attachment in attachments %> <% for attachment in attachments %>
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <div style="float:left;">
<p style="height:14px;line-height:10px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%if is_float%> <%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;"> <div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%> <% end%>
@ -50,9 +51,10 @@
:id => attachment, :id => attachment,
:filename => attachment.filename%> :filename => attachment.filename%>
<% end %> <% end %>
<span title="<%= attachment.description%>"> </div>
<%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %> <div style="float:left;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="<%= attachment.description%>">
</span> <%= h(" - #{attachment.description}") unless attachment.description.blank? %>
</div>
<span class="size">( <span class="size">(
<%= number_to_human_size attachment.filesize %>) <%= number_to_human_size attachment.filesize %>)
</span> </span>

View File

@ -4,4 +4,5 @@
$("#error_show").html("<%= @message.html_safe %>"); $("#error_show").html("<%= @message.html_safe %>");
<% else %> <% else %>
closeModal(); closeModal();
searchone4reload('<%=params[:file_id]%>');
<% end %> <% end %>

View File

@ -1,8 +1,26 @@
$('#attachments_<%= j params[:attachment_id] %>').remove(); var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
var count=$('#attachments_fields>span').length; //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
if(count<=0){ var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
$("#upload_file_count").text(<%= l(:label_no_file_uploaded)%>); if(containerid==undefined){
$(".remove_all").remove(); $('#attachments_<%= j params[:attachment_id] %>').remove();
var count=$('#attachments_fields>span').length;
if(count<=0){
$("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
$(".remove_all").remove();
}else{
$("#upload_file_count").html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
}
}else{ }else{
$("#upload_file_count").html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件"); $('#attachments_<%= j params[:attachment_id] %>').remove();
} var count=$('#attachments_fields'+containerid+'>span').length;
if(count<=0){
$('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
var remove_all_html_obj = $(".remove_all").filter(function(index){
return $(this).data('containerid')==containerid;
});
remove_all_html_obj.remove();
}else{
$('#upload_file_count'+containerid).html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
}
}
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end

View File

@ -3,14 +3,15 @@ var fileSpan = $('#attachments_<%= j params[:attachment_id] %>');
fileSpan.hide(); fileSpan.hide();
alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>");
<% else %> <% else %>
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
fileSpan.find('a.remove-upload') fileSpan.find('a.remove-upload')
.attr({ .attr({
"data-remote": true, "data-remote": true,
"data-method": 'delete', "data-method": 'delete',
"href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
}) })
.off('click'); .off('click');
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
//var divattach = fileSpan.find('div.div_attachments'); //var divattach = fileSpan.find('div.div_attachments');
//divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>'); //divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>');
<% end %> <% end %>

View File

@ -43,7 +43,7 @@
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div> <div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
</div> </div>
</span> </span>
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %> <%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;"> <a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span> <span><%= l(:button_upload_photo) %></span>
</a> </a>
@ -73,4 +73,7 @@
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= javascript_include_tag 'avatars' %> <%= javascript_include_tag 'avatars' %>
<% end %> <% end %>
</div> </div>

View File

@ -7,11 +7,10 @@
:id => nil, :id => nil,
:class => 'upload_file', :class => 'upload_file',
:size => "1", :size => "1",
:multiple => false, :multiple => true,
:onchange => 'addInputAvatar(this);',
:data => { :data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size => Setting.upload_avatar_max_size,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), :max_file_size_message => l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s, :file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type), :type_support_message => l(:error_pic_type),
@ -22,6 +21,6 @@
} %> } %>
<!--</span>--> <!--</span>-->
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= javascript_include_tag 'avatars' %> <%= javascript_include_tag 'jq-upload/jquery.ui.widget', 'jq-upload/jquery.iframe-transport', 'jq-upload/jquery.fileupload', 'jq-upload/upload' %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,4 +1,4 @@
var imgSpan = $('#avatar_image'); var imgSpan = jQuery('#avatar_image');
imgSpan.attr({"src":'<%= @urlfile.to_s << "?" << Time.now.to_s%>'}); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});

View File

@ -59,6 +59,55 @@
} }
); );
} }
// $(window).scroll(function(){
// //获取窗口的滚动条的垂直位置
// var s = $(window).scrollTop();
// //当窗口的滚动条的垂直位置大于页面的最小高度时,让返回顶部元素渐现,否则渐隐
// if( s > 600){
// $("#gotoTop").fadeIn(100);
// }else{
// $("#gotoTop").fadeOut(200);
// };
// });
$(function(){goTopEx();});
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
function goTopEx() {
var obj = document.getElementById("goTopBtn");
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
function getScrollTop() {
var xsun = document.documentElement.scrollTop;
if (Sys.chrome) {
xsun=document.body.scrollTop;
}
return xsun;
}
function setScrollTop(value) {
if (Sys.chrome) {
document.body.scrollTop = value;
}
else {
document.documentElement.scrollTop = value;
}
}
window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
obj.onclick = function () {
var goTop = setInterval(scrollMove, 10);
function scrollMove() {
setScrollTop(getScrollTop() / 1.1);
if (getScrollTop() < 1) clearInterval(goTop);
}
}
}
</script> </script>
</div> </div>
<div id='bidding_project_list'> <div id='bidding_project_list'>

View File

@ -35,7 +35,7 @@
</li> </li>
<li class="ml9" id="bid_evaluation_num_li" style="display: <%= bid.open_anonymous_evaluation == 1 ? 'block' : 'none'%>;"> <li class="ml9" id="bid_evaluation_num_li" style="display: <%= bid.open_anonymous_evaluation == 1 ? 'block' : 'none'%>;">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_evaluation_num)%>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:field_evaluation_num)%>&nbsp;&nbsp;</label>
<input type="text" name="bid[evaluation_num]" id="bid_evaluation_num" class="hwork_input02" onkeyup="regex_evaluation_num();" value="<%= bid.evaluation_num%>"> <input type="text" name="bid[evaluation_num]" id="bid_evaluation_num" class="hwork_input02" onkeyup="regex_evaluation_num();" value="<%= bid.evaluation_num%>" maxlength="3">
<span><%= l(:label_evaluation_description)%></span> <span><%= l(:label_evaluation_description)%></span>
<p id="bid_evaluation_num_span" class="c_red" style="padding-left: 90px;"></p> <p id="bid_evaluation_num_span" class="c_red" style="padding-left: 90px;"></p>
</li> </li>

View File

@ -0,0 +1,9 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
<li>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="#" onclick="submitProjectsBoard('<%= @message.id %>')" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>
<% end %>

View File

@ -1,28 +1,26 @@
<div id="add-message" class="add_frame" style="display:none;">
<% if User.current.logged? %>
<h3>
<%= link_to h(@board.name), course_board_path(@course, @board) %>
<%= l(:label_message_new) %>
</h3>
<div class="add_frame_header" >
<%= l(:label_message_new) %>
</div>
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form_course', :locals => {:f => f} %>
<p>
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
</p>
<% end %>
<div id="preview" class="wiki"></div>
<% end %>
</div>
<!--display the board--> <!--display the board-->
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= l(:label_board_plural) %></h2> <h2 class="project_h2 fl">
</div> <% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
<div class="cl"></div>
</div>
<!-- 发布新帖部分 -->
<div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;" >
<ul>
<%= render :partial => 'course_new' %>
</ul>
</div><!--talknew end-->
<% if !User.current.logged?%> <% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;"> <div style="font-size: 14px;margin:20px;">
@ -31,38 +29,160 @@
<hr/> <hr/>
</div> </div>
<% end %> <% end %>
<div class="talk_top ml15"> <p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<p class="fl">
<%= l(:label_totle) %>
<span><%= @topic_count %></span>
<%= l(:label_course_momes_count) %>
</p>
<%= link_to l(:label_message_new),
new_board_message_path(@board),
:class => 'problem_new_btn fl c_dorange' if User.current.logged? %>
<div class="cl"></div>
</div>
<% if @topics.any? %> <% if @topics.any? %>
<% @topics.each do |topic| %> <% @topics.each do |topic| %>
<div class="problem_main"> <div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %> <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talk_txt fl"> <div class="talkmain_txt fl mt5">
<%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %> <% author = topic.author.to_s + "" %>
<% if topic.sticky? %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<a href="javascript:void(0)" class="talk_up fr c_red">置顶</a>
<% end %>
<br/>
<p>由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %></p>
</div>
<%=link_to (l(:label_reply) + topic.replies_count.to_s), board_message_path(@board, topic),:class => "talk_btn fr c_white" %>
<div class="cl"></div> <p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p>
</div><!--讨论主类容 end--> <% if topic.course_editable_by?(User.current) %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: right;
margin-right: 10px;"><%= l(:button_edit) %></a>
<% end %>
<%= link_to(
l(:button_delete),
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;'
) if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
<div class="cl"></div>
<script>
$(function(){if($("#contentmessage<%=topic.id %>").height()>55){$("#project_show_<%= topic.id%>").show();}});
</script>
<div class="project_board_content break_word" id="content_<%=topic.id%>">
<div id="contentmessage<%=topic.id %>" class="upload_img">
<%= topic.content.html_safe %>
</div>
</div>
<p style="display: none" id="project_show_<%= topic.id%>">
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="display: none" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<% replies_all = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").offset(2).
all %>
<% replies_show = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").limit(2).
all %>
<% unless replies_show.empty? %>
<% reply_count = 0 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul>
<% replies_all.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<%if replies_all.first %>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
<% end %>
</div>
<% end %> <% end %>
<% else %> <% else %>
<p class="nodata"> <p class="nodata"><%= l(:label_no_data) %></p>
<%= l(:label_no_data) %>
</p>
<% end %> <% end %>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>

View File

@ -0,0 +1,43 @@
<% if topic.project %>
<%#= board_breadcrumb(@message) %>
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
<div class="talk_new ml15" name='containerxxoo'>
<ul>
<%= form_for topic, { :as => :message,
:url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id},
:html => {:multipart => true, :name=>'message-form',
:id => 'message-form' + topic.id.to_s,
:method => :post}
} do |f| %>
<%= render :partial => 'form_project',
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="javascript:void(0)" name='submitbtn' class="blue_btn fl c_white" ><%= l(:button_submit)%></a>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" class="blue_btn grey_btn fl c_white"><%= l(:button_cancel) %></a>
<%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
</ul>
</div>
<% end %>
<% elsif topic.course %>
<%#= course_board_breadcrumb(@message) %>
<div class="talk_new ml15">
<ul>
<%= form_for topic, {
:as => :message,
:url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id},
:html => {:multipart => true,
:id => 'message-form' + topic.id.to_s,
:method => :post}
} do |f| %>
<%= render :partial => 'form_course',
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="javascript:void(0)" onclick="submitProjectsBoard('<%= topic.id%>');"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" class="blue_btn grey_btn fl c_white"><%= l(:button_cancel) %></a>
<% end %>
</ul>
</div>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -0,0 +1,60 @@
<%= error_messages_for 'message' %>
<% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
<% if replying %>
<li style="display: none">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span<%= topic.id%>" class="ml55"></p>
</li>
<% else %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span<%= f.object.id%>" class="ml55"></p>
</li>
<% end %>
<li class="ml60 mb5">
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<% if @message.safe_attribute? 'locked' %>
<%= f.check_box :locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<% end %>
<div class="cl"></div>
</li>
<li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %>
<%= text_area :quote,:quote,:style => 'display:none' %>
<% if replying%>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %>
<% else %>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<% end %>
<div class="cl"></div>
<p id="message_content_span<%= f.object.id%>" class="ml55"></p>
</li>
<div class="cl"></div>
<li>
<% unless replying %>
<div class="fl ml3" style="padding-left: 52px;">
<%= render :partial => 'attachments/form_course', :locals => {:container => topic,:isReply => @isReply} %>
</div>
<% end %>
</li>
<li >
<div class="cl"></div>
</li>

View File

@ -0,0 +1,96 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<style>
.comment{
position: relative;
width: 330px;
padding: 10px;
}
.comment .ke-toolbar{
position: absolute;
bottom: -18px;
}
</style>
<%= error_messages_for 'message' %>
<% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
<% if replying %>
<li style="display: none">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span<%= f.object.id%>" class="ml55"></p>
</li>
<% else %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span<%= f.object.id%>" class="ml55"></p>
</li>
<% end %>
<li class="ml60 mb5">
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<% if @message.safe_attribute? 'locked' %>
<%= f.check_box :locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<% end %>
<div class="cl"></div>
</li>
<li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %>
<%= f.text_area :quote,:quote,:style => 'display:none' %>
<div class="content">
<% if replying%>
<%= f.text_area :content,
:width => '89%',
:height => 300,
:id => "message_content#{f.object.id}",
:name => 'content',
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %>
<% else %>
<%= f.text_area :content,
:width => '90%',
:height => 300,
:class => 'talk_text fl',
:editor_id => "message_content#{f.object.id}_edit",
:id => "message_content#{f.object.id}",
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
:name => 'content',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %>
<% end %>
</div>
<div class="cl"></div>
<p id="message_content_span<%= f.object.id%>" class="ml55"></p>
</li>
<div class="cl"></div>
<li>
<% unless replying %>
<div class="fl ml3" style="padding-left: 52px;">
<%= render :partial => 'attachments/form_project', :locals => {:container => topic,:isReply => @isReply} %>
</div>
<% end %>
</li>
<li >
<div class="cl"></div>
</li>

View File

@ -0,0 +1,10 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
<li>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="javascript:;" name="submitbtn" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>
<% end %>

View File

@ -1,11 +1,14 @@
<div class="project_r_h"> <div class="project_r_h" xmlns="http://www.w3.org/1999/html">
<h2 class="project_h2"> <h2 class="project_h2 fl">
<% if User.current.language == "zh"%> <% if User.current.language == "zh"%>
<%= h @board.name %> <%= h @board.name %>
<% else %> <% else %>
<%= l(:project_module_boards) %> <%= l(:project_module_boards) %>
<% end %> <% end %>
</h2> </h2>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
<div class="cl"></div>
</div> </div>
<!--display the board--> <!--display the board-->
@ -16,34 +19,193 @@
</div> </div>
<% end %> <% end %>
<!-- 内容显示部分 --> <!-- 发布新帖部分 -->
<div class="talk_top"> <div class="cl"></div>
<div class="fl"><span><%= l(:label_project_board_count , :count => @topic_count)%></span></div> <div class=" talklist_box" >
<% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %> <div class="talk_new ml15 mb10" name="containerxxoo" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
<span><%= link_to l(:project_module_boards_post), new_board_message_path(@board), <ul>
:class => 'problem_new_btn fl c_dorange', <%= render :partial => 'project_new_topic' %>
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %></span> </ul>
<% end %> </div><!--talknew end-->
<div class="cl"></div>
</div>
<!-- 帖子内容显示 --> <!-- 帖子内容显示 -->
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %> <% if @topics.any? %>
<% @topics.each do |topic| %> <% @topics.each do |topic| %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %> <div class="talkmain_box" id="topic<%= topic.id %>" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<div class="talk_txt fl"> <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %> <div class="talkmain_txt fl mt5">
<% if topic.sticky? %> <% author = topic.author.to_s + "" %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<% end %>
<br/> <p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<%= l(:label_post_by)%><%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %> <% if topic.editable_by?(User.current) %>
&nbsp;<%= l(:label_post_by_time)%><%= format_time topic.created_on %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: right;
margin-right: 10px;"><%= l(:button_edit) %></a>
<% end %>
<%= link_to(
l(:button_delete),
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;'
) if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
<div class="cl"></div>
<script>
$(function(){if($("#contentmessage<%=topic.id %>").height()>55){$("#project_show_<%= topic.id%>").show();}});
</script>
<div class="project_board_content break_word" id="content_<%=topic.id%>">
<div id="contentmessage<%=topic.id %>" class="upload_img">
<%= topic.content %>
</div>
</div>
<p style="display: none" id="project_show_<%= topic.id%>">
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div> </div>
<%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %> <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %>
<div class="cl"></div> <div class="cl"></div>
</div><!--讨论主类容 end--> </div><!--讨论主类容 end-->
<% end %>
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="display: none" name="containerxxoo" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %>
<a href="javascript:(0)" name="submitbtn" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<% replies_all = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.id asc").offset(2).
all %>
<% replies_show = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.id asc").limit(2).
all %>
<% unless replies_show.empty? %>
<% reply_count = 0 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_quote),
{:controller => 'messages', :action => 'quote', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:class => ' c_dblue fr',
:style => 'margin-right: 10px;',
:remote => true,
:method => 'get',
:onclick => "$('#reply#{topic.id}').slideToggle(); return false;",
:focus => "about_newtalk#{topic.id}",
:title => l(:button_quote)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul>
<% replies_all.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_quote),
{:controller => 'messages', :action => 'quote', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:remote => true,
:method => 'get',
:focus => "about_newtalk#{topic.id}",
:class => ' c_dblue fr',
:style => 'margin-right: 10px;',
:title => l(:button_quote)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<%if replies_all.first %>
<div class="talkWrapMsg"><a class=" c_blue ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
<% end %>
</div>
<% end %>
<% else %> <% else %>
<p class="nodata"><%= l(:label_no_data) %></p> <p class="nodata"><%= l(:label_no_data) %></p>
<% end %> <% end %>
@ -61,3 +223,48 @@
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
<% end %> <% end %>
</div>
<script type="text/javascript">
// var flag = false;
// jQuery(document).ready(function($) {
// transpotUrl('#content');
// });
function submit_message_replay()
{
if(flag)
{
$("#message_form").submit();
}
}
</script>
<script type="text/javascript">
//submitProjectsBoard()
KindEditor.ready(function(K){
$("div[name='containerxxoo']").each(function(){
var container=$(this);
var textarea= $("textarea[name='content']",container);
var editor = K.create(textarea, {
resizeType : 1,
allowPreviewEmoticons : false,
allowImageUpload : false,
width:"89%",
items : ['emoticons']
});
$("a[name='submitbtn']",container).click(function(){
textarea[0].value = editor.html();
var id = textarea[0].id.toString().substr(15);
if(this.parentNode.name == 'message-form') {
this.parentNode.submit();
}
else
this.parentNode.parentNode.submit();
});
});
});
</script>

View File

@ -1,4 +1,72 @@
<script type="text/javascript">
//头部导航
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.display="block"
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none"
}
}
}
}
if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)
</script>
<script type="text/javascript">//侧导航
window.onload = function () {
var topic_id = getParam('topic_id');
document.getElementById(topic_id).focus();
}
var getParam = function(name){
var search = document.location.search;
var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
var matcher = pattern.exec(search);
var items = null;
if(null != matcher){
try{
items = decodeURIComponent(decodeURIComponent(matcher[1]));
}catch(e){
try{
items = decodeURIComponent(matcher[1]);
}catch(e){
items = matcher[1];
}
}
}
return items;
};
function show_newtalk()
{
$("#about_newtalk").toggle();
}
function show_newtalk1(id)
{
$(id).toggle();
}
</script>
<% if @project %> <% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %> <%= render :partial => 'project_show', locals: {project: @project} %>
<% elsif @course %> <% elsif @course %>

View File

@ -33,20 +33,21 @@
%> %>
</p> </p>
<p style="margin-left:-10px;padding-right: 20px;"> <p>
<%= f.text_area :description, <%= f.text_area :description,
:rows => 5, :size => 60,
:class => 'wiki-edit', :rows => 4,
:style => "font-size:small;width:490px;margin-left:10px;", :style => "width:490px;",
:maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT,
:placeholder => "#{l(:label_contest_description)}" :placeholder => "#{l(:label_contest_description)}"
%> %>
</p> </p>
<p style="margin-left:-10px;"> <p>
<%= f.text_field :password, <%= f.text_field :password,
:size => 60, :size => 60,
:style => "width:488px;margin-left: 10px;" :rows => 4,
:style => "width:490px;"
%> %>
</p> </p>

View File

@ -187,7 +187,7 @@
<!-- modified by longjun --> <!-- modified by longjun -->
<%= link_to l(:label_create_new_projects), <%= link_to l(:label_create_new_projects),
new_project_path(:course => 0, :project_type => 0, :host => Setting.project_domain), new_project_path(:course => 0, :project_type => 0, :host => Setting.host_name),
:target => '_blank' :target => '_blank'
%> %>
<!-- end longjun --> <!-- end longjun -->

View File

@ -56,16 +56,16 @@
</p> </p>
<p class="stats"> <p class="stats">
<%= content_tag('span', "#{garble @course.members.count}", :class => "info") %> <%= content_tag('span', "#{garble @course.members.count}", :class => "info") %>
<%= content_tag('span', l(:label_x_member, :count => memberCount(@course))) %> <%= content_tag('span', l(:label_x_member, :count => @course.members.count)) %>
</p> </p>
<!--gcm--> <!--gcm-->
<p class="stats"> <p class="stats">
<%= content_tag('span', link_to("#{@course_activity_count[@course.id]}", course_path(@course)), :class => "info") %> <%= content_tag('span', link_to("#{@course_activity_count[@course.id]}", course_path(@course)), :class => "info") %>
<%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %> <%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %>
</p> </p>
<!--gcm--> <!--gcm-->
<div class="buttons_for_course" style="margin-top:30px;margin-left:144px"> <div class="buttons_for_course" style="margin-top:30px;margin-left:144px">
<span class="info"></span> <span class="info"></span>
<% if(course_endTime_timeout? @course) %> <% if(course_endTime_timeout? @course) %>

View File

@ -21,7 +21,7 @@
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %> <%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
<div class="member_search"> <div class="member_search">
<input hidden="hidden" value="true" name="flag"> <input hidden="hidden" value="true" name="flag">
<input id="principal_search" class="member_search_input fl" type="text" placeholder="请输入用户名称来搜索好友"> <input id="principal_search" class="member_search_input fl" type="text" placeholder="<%= l(:label_invite_trustie_user_tips)%>">
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js',:flag => true) }')" %> <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js',:flag => true) }')" %>
<div class="cl"></div> <div class="cl"></div>
@ -37,7 +37,7 @@
<% @roles.each do |role| %> <% @roles.each do |role| %>
<li> <li>
<%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "学生" || role.name == "Student" %> <%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "学生" || role.name == "Student" %>
<label ><%= h role %></label> <label ><%= zh_course_role(h role) %></label>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -1,6 +1,7 @@
<div class="st_list"> <div class="st_list">
<div class="st_box"> <div class="st_box">
<a href="javascript:void(0)" class="fr fb mb5" >加入时间</a> <a href="javascript:void(0)" class="fr fb mb5" >加入时间</a>
<a href="javascript:void(0)" class="fr fb mb5 mr70" >角色</a>
<div class="cl"></div><!--st_box_top end--> <div class="cl"></div><!--st_box_top end-->
<% members.each do |member| %> <% members.each do |member| %>
@ -9,8 +10,9 @@
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
</a> </a>
<span class="fl ml10 c_grey"><%= l(:label_username)%></span> <span class="fl ml10 c_grey"><%= l(:label_username)%></span>
<%= link_to(member.user.name, user_path(member.user),:class => "ml10 c_blue02") %> <%= link_to(member.user.show_name, user_path(member.user),:class => "ml10 c_blue02") %>
<span class="fr c_grey"><%= format_date(member.created_on)%></span> <span class="fr c_grey"><%= format_date(member.created_on)%></span>
<span class="fr c_grey mr30 w45"><%= zh_course_role(h member.roles.sort.collect(&:to_s).first)%></span>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% end%> <% end%>

View File

@ -15,7 +15,7 @@
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;", <%= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%> :placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%>
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10">取&nbsp;&nbsp;消</a> <a href="javascript:void(0)" class="grey_btn fr ml10 mt10" onclick="KindEditor.instances[0].html('');">取&nbsp;&nbsp;消</a>
<a href="javascript:void(0)" onclick='leave_message_editor.sync();$("#leave_message_form").submit();' class="blue_btn fr mt10"> <a href="javascript:void(0)" onclick='leave_message_editor.sync();$("#leave_message_form").submit();' class="blue_btn fr mt10">
<%= l(:button_leave_meassge)%> <%= l(:button_leave_meassge)%>
</a> </a>

View File

@ -2,21 +2,21 @@
<li > <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" %>
<span class="w150 fl"> <span class="w150 fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %> <%= zh_course_role(h member.roles.sort.collect(&:to_s).join(', ')) %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put, :method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}} :html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
) do |f| %> ) do |f| %>
<% @roles.each do |role| %> <% @roles.each do |role| %>
<ul style="text-align: left;" class="ml20"> <ul style="text-align: left;" class="ml45">
<%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role), <%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> :disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<label ><%= h role %></label> <label ><%= zh_course_role(h role) %></label>
</ul> </ul>
<!--<br/>--> <!--<br/>-->
<% end %> <% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %> <%= hidden_field_tag 'membership[role_ids][]', '' %>
<div class="ml20"> <div class="ml45">
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;"> <a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
<%= l(:button_change)%> <%= l(:button_change)%>
</a> </a>

View File

@ -23,6 +23,7 @@
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>"> <input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span> <span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
<input type="password" style="top: -100000px;position: fixed;">
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ml45"> <li class="ml45">

View File

@ -15,12 +15,13 @@
<span class="fl"> &nbsp;</span> <span class="fl"> &nbsp;</span>
<span class="fl"> <%= l(:label_new_activity) %></span> <span class="fl"> <%= l(:label_new_activity) %></span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) : e.event_url),:class => "problem_tit c_dblue fl fb"%> (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") || e.event_type.eql?("reply") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>
<br /> <br />
<p class="mt5 break_word"><%= e.event_description.html_safe %> <p class="mt5 break_word"><%= e.event_description.html_safe %>
<br /> <br />
<%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %> <%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p> </p>
<%= link_to_attachments_course(e) if e.is_a?(News) %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--课程动态 end--> </div><!--课程动态 end-->
@ -49,4 +50,4 @@
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,4 +1,15 @@
<script> <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) function show_upload(obj)
{ {
switch(obj) switch(obj)

View File

@ -1,66 +1,66 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %> <% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
<div class="re_con_top"> <div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p> <p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080"> <p class="f_r" style="color: #808080">
<% if order == "asc" %> <% if order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp; 按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: '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: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp; <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: '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: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序 <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% else %> <% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp; 按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: '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: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp; <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: '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: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序 <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% end %> <% end %>
</p> </p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="files_tag" id="files_tag"> <div class="files_tag" id="files_tag">
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%> <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="for_img_thumbnails"> <div class="for_img_thumbnails">
<% curse_attachments.each do |file| %> <% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.member_of_course?(course) %> <% if file.is_public? || User.current.member_of_course?(course) %>
<div class="re_con_box"> <div class="re_con_box" id="container_files_<%= file.id %>">
<div class=""> <div class="">
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %> <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %>
<% if User.current.logged? %> <% if User.current.logged? %>
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
<span id="is_public_<%= file.id %>"> <span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
</span> </span>
<% else %> <% else %>
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> --> <!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %> <% end %>
<% else %> <% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% end %> <% end %>
<% else %> <% else %>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class=""> <div class="">
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p> <p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file), <%= 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 && file.container_id == @course.id && file.container_type == "Course"%> :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p> <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>
<div class="cl"></div> <div class="cl"></div>
<div class="tag_h"> <div class="tag_h">
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> <%= 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} %> <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!---re_con_box end--> </div><!---re_con_box end-->
<% else %> <% else %>
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div> <div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
<% end %>
<% end %> <% end %>
<% end %>
</div> </div>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>

View File

@ -21,19 +21,15 @@
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :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" %> <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %> <% if User.current.logged? %>
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %> <% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% if manage_allowed && file.container_id == project.id && file.container_type == "Project" %>
<span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
</span>
<% else %>
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %>
<% else %> <% else %>
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% end %> <% end %>
<% else %> <% if authority_pubilic_for_files(project, file) %>
<span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
</span>
<% end %>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -27,6 +27,8 @@ $('#upload_file_div').slideToggle('slow');
<%elsif @course%> <%elsif @course%>
closeModal(); closeModal();
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
$("#courses_files_count_info").html("<%= @all_attachments.count%>");
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
<% end %> <% end %>
<% end %> <% end %>
$(document).ready(img_thumbnails); $(document).ready(img_thumbnails);

View File

@ -0,0 +1,39 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
<% if file.is_public? || User.current.member_of_course?(course) %>
<div class="re_con_box" id="container_files_<%= file.id %>">
<div class="">
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %>
<% if User.current.logged? %>
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
<span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
</span>
<% else %>
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %>
<% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% end %>
<% else %>
<% end %>
</div>
<div class="cl"></div>
<div class="">
<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 && file.container_id == @course.id && file.container_type == "Course"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&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">
<%= 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 %>

View File

@ -48,8 +48,8 @@
</table> </table>
</div> </div>
</div> </div>
<% end %> <% end %>
<div class="pagination"> <div class="pagination" style="margin-top: 10px;">
<%= pagination_links_full @forums_pages, @forums_count %> <%= pagination_links_full @forums_pages, @forums_count %>
</div> </div>
<% else %> <% else %>

View File

@ -1,5 +1,4 @@
<!-- added by fq --> <script>$(function(){$("img").removeAttr("alt");});</script>
<!--display the board-->
<div class="borad-topic-count">共有 <%=link_to @forum.memos.count %> 个贴子</div> <div class="borad-topic-count">共有 <%=link_to @forum.memos.count %> 个贴子</div>
<div style="padding-top: 10px"> <div style="padding-top: 10px">
<% if memos.any? %> <% if memos.any? %>

View File

@ -21,7 +21,9 @@
function submit_jours(is_teacher) function submit_jours(is_teacher)
{ {
if(!is_teacher&&$("#stars_value").val() == "0"){alert("您还没有打分");return;} // if(("#stars_value").val() == "0"){
// if(confirm('是否确定评分为0分?')){}else{return;}
// }
if(!is_teacher&&$("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;} if(!is_teacher&&$("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;}
$('#new_form_user_message').parent().submit(); $('#new_form_user_message').parent().submit();
} }
@ -57,7 +59,7 @@
<strong style="float: left;"> <strong style="float: left;">
文件: 文件:
</strong> </strong>
<div id="homework_attach_jour_attachment"> <div id="homework_attach_jour_attachment" style="padding-left: 40px;">
<%= render :partial => 'attachments/form' %> <%= render :partial => 'attachments/form' %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -32,7 +32,7 @@
<% unless is_student_batch_homework %> <% unless is_student_batch_homework %>
<%= l(:label_teacher_score)%>: <%= l(:label_teacher_score)%>:
<span class="c_red"> <span class="c_red">
<%= (homework.t_score.nil? || (homework.t_score && homework.t_score.to_i == 0)) ? l(:label_without_score) : format("%.2f",homework.t_score)%> <%= (homework.t_score.nil?) ? l(:label_without_score) : format("%.2f",homework.t_score)%>
</span> </span>
&nbsp;&nbsp; &nbsp;&nbsp;
<% end %> <% end %>

View File

@ -34,7 +34,11 @@
</span> </span>
</div> </div>
<% end %> <% end %>
<div class="cl"></div>
<div class="to_top" id="goTopBtn" style="display: none;">
返<br/>回<br/>顶<br/>部
</div>
<div class="cl"></div> <div class="cl"></div>
<% unless homeworks.nil? %> <% unless homeworks.nil? %>

View File

@ -22,11 +22,11 @@
</span> </span>
<% end %> <% end %>
</span> </span>
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;"> <span style="color:#a6a6a6; margin-right:20px; margin-left:10px;">
<%= format_time(review.created_at) %> <%= format_time(review.created_at) %>
</span> </span>
<span style="font-weight:bold; color:#a6a6a6; float: right;"> <span style="font-weight:bold; color:#a6a6a6; float: right;">
<% if review.stars && review.stars.to_i > 0%> <% if review.stars%>
<span style="float:left"> <span style="float:left">
<%= l(:label_work_rating) %> <%= l(:label_work_rating) %>
</span> </span>

View File

@ -11,6 +11,14 @@
for (var i = num; i >= 0; i--) {$("#star0" + i).css("background-position","-24px 0px");} for (var i = num; i >= 0; i--) {$("#star0" + i).css("background-position","-24px 0px");}
$("#stars_value").val(num); $("#stars_value").val(num);
} }
// function ChoseZero()
// {
// if(confirm('是否确定评分为0分?'))
// {
// ChoseStars(0);
// }
// }
</script> </script>
<div id="popbox"> <div id="popbox">
<div class="ping_con"> <div class="ping_con">

View File

@ -1,3 +1,4 @@
<a style="float: right;padding-left: 10px;font-weight: normal;cursor: pointer;color: red;" onclick="ChoseStars(0);">零分</a>
<span><a href="javascript:" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span> <span><a href="javascript:" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span> <span><a href="javascript:" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span> <span><a href="javascript:" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>

View File

@ -42,7 +42,7 @@
<div id="tb_" class="tb_"> <div id="tb_" class="tb_">
<ul> <ul>
<li id="tb_1" class="hovertab" onclick="switchTab(1);this.blur();return false;" style="width: auto; padding:5px 10px 0;"> <li id="tb_1" class="hovertab" onclick="switchTab(1);this.blur();return false;" style="width: auto; padding:5px 10px 0;">
修改作 修改作
</li> </li>
<li id="tb_2" class="normaltab" onclick="switchTab(2);this.blur();return false;"> <li id="tb_2" class="normaltab" onclick="switchTab(2);this.blur();return false;">
成员 成员
@ -75,16 +75,32 @@
<%= f.text_area :description, :rows => 8, :name => "homework_description", :class => "w620", <%= f.text_area :description, :rows => 8, :name => "homework_description", :class => "w620",
:maxlength => 3000, :placeholder => "最多3000个汉字" %> :maxlength => 3000, :placeholder => "最多3000个汉字" %>
</p> </p>
<p> <!--<div class="cl"></div>-->
<label style="float: left;"> <!--<p>-->
<!--<label style="float: left;">-->
<!--&nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp;-->
<!--</label>-->
<!--<div style="float: left;padding-bottom: 15px;">-->
<!--<%#= render :partial => 'attachments/form', :locals => {:container => @homework}%>-->
<!--</div>-->
<!--</p>-->
<!--<div class="cl"></div>-->
<div class="cl"></div>
<label style="float: left;padding-left: 15px;">
&nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp;
</label> </label>
<div style="float: left;padding-bottom: 15px;"> <!--<div style="float: left;margin-left: 5px;">-->
<%= render :partial => 'attachments/form', :locals => {:container => @homework}%> <!--<%#= render :partial => 'attachments/form',locals: {:container => @homework}%>-->
<!--</div>-->
<div style="float: left;">
<%= render :partial => 'attachments/form', :locals => {:container => @homework} %>
</div> </div>
</p>
<div class="cl"></div> <div class="cl"></div>
<p>
<p style="padding-top: 10px;">
<label>&nbsp;&nbsp;&nbsp;开发项目 <label>&nbsp;&nbsp;&nbsp;开发项目
<img src="/images/bid/pic_question.png" width="16" height="16" <img src="/images/bid/pic_question.png" width="16" height="16"
title="项目是一种由用户创建的基于网络的协作空间,能够为个人或小组提供分布式的协同交流和资料管理等方面的支持。 title="项目是一种由用户创建的基于网络的协作空间,能够为个人或小组提供分布式的协同交流和资料管理等方面的支持。
@ -101,7 +117,7 @@
<span style="float: left;"> <span style="float: left;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span> </span>
<a href="javascript:" class="tijiao" onclick="submit_homework_form();"> <a href="javascript:void(0)" class="tijiao" onclick="submit_homework_form();">
<%= l(:label_button_ok) %> <%= l(:label_button_ok) %>
</a> </a>
<a href="javascript:history.back()" class="tijiao">取&nbsp;&nbsp;消</a> <a href="javascript:history.back()" class="tijiao">取&nbsp;&nbsp;消</a>

View File

@ -3,7 +3,7 @@ showModal('ajax-modal', '513px');
$('#ajax-modal').css('height','569px'); $('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_homework_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:void(0)' onclick='hidden_homework_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");

View File

@ -12,7 +12,7 @@
<%= link_to issue.author.name, user_path(issue.author), :class => "problem_name c_orange fl" %> <%= link_to issue.author.name, user_path(issue.author), :class => "problem_name c_orange fl" %>
<span class="fl"><%= l(:label_post_on_issue) %>(<%= "#{raw column_content[2]}" %>)</span> <span class="fl"><%= l(:label_post_on_issue) %>(<%= "#{raw column_content[2]}" %>)</span>
<div class="problem_tit_div fl"> <div class="problem_tit_div fl">
<%=link_to "#{column_content[4]}<span class = '#{get_issue_type(column_content[1])}'>#{get_issue_typevalue(column_content[1])}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word" %> <%=link_to "#{column_content[4]}<span class = '#{get_issue_type(column_content[1])[0]}'>#{get_issue_type(column_content[1])[1]}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<p> <p>
@ -31,5 +31,5 @@
</div> </div>
<% end -%> <% end -%>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => false, :flag => true %> <%= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => true, :flag => true %>
</ul> </ul>

View File

@ -34,31 +34,31 @@
<%#= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> <%#= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %> <%= hidden_field_tag 'set_filter', '1' %>
<div class="problem_search" > <div class="problem_search" >
<input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="" onkeypress="EnterPress(event)" onkeydown="EnterPress()"> <input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="<%= @subject ? @subject : ""%>" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a> <a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
</div><!--problem_search end--> </div><!--problem_search end-->
<div id="filter_form" class="fr" > <div id="filter_form" class="fr" >
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给",0]), <%= select( :issue, :user_id, principals_options_for_isuue_list(@project),
{ :include_blank => false,:selected=>0 { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0
}, },
{:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"v[assigned_to_id]",:class=>"w90"} {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"v[assigned_to_id]",:class=>"w90"}
) )
%> %>
<%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]),
{ :include_blank => false,:selected=>0 { :include_blank => false,:selected=>@priority_id ? @priority_id : 0
}, },
{:onchange=>"remote_function();",:id=>"priority_id",:name=>"v[priority_id]",:class=>"w90"} {:onchange=>"remote_function();",:id=>"priority_id",:name=>"v[priority_id]",:class=>"w90"}
) )
%> %>
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
{ :include_blank => false,:selected=>0 { :include_blank => false,:selected=>@status_id ? @status_id : 0
}, },
{:onchange=>"remote_function();",:id=>"status_id",:name=>"v[status_id]",:class=>"w90"} {:onchange=>"remote_function();",:id=>"status_id",:name=>"v[status_id]",:class=>"w90"}
) )
%> %>
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]),
{ :include_blank => false,:selected=>0 { :include_blank => false,:selected=>@author_id ? @author_id : 0
}, },
{:onchange=>"remote_function();",:id=>"author_id",:name=>"v[author_id]",:class=>"w90"} {:onchange=>"remote_function();",:id=>"author_id",:name=>"v[author_id]",:class=>"w90"}
) )
@ -66,8 +66,8 @@
</div><!--filter_form end--> </div><!--filter_form end-->
<div class="cl"></div> <div class="cl"></div>
<%# end %> <%# end %>
<p class="problem_p fl" ><%= l(:label_issues_sum) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.count %></a> <p class="problem_p fl" ><%= l(:label_issues_sum) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.visible.all.count %></a>
<%= l(:lable_issues_undo) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').count %> </a> <%= l(:lable_issues_undo) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> </a>
</p> </p>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1 +1,3 @@
$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>"); $("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>");
$("#v_subject").focus();
$("#v_subject").blur();

View File

@ -2,7 +2,6 @@
<h2 class="project_h2"><%= l(:label_issue_new) %></h2> <h2 class="project_h2"><%= l(:label_issue_new) %></h2>
</div> </div>
<%= call_hook(:view_issues_new_top, {:issue => @issue}) %> <%= call_hook(:view_issues_new_top, {:issue => @issue}) %>
<%= labelled_form_for @issue, :url => project_issues_path(@project), <%= labelled_form_for @issue, :url => project_issues_path(@project),
:html => {:id => 'issue-form', :multipart => true} do |f| %> :html => {:id => 'issue-form', :multipart => true} do |f| %>
<%= error_messages_for 'issue' %> <%= error_messages_for 'issue' %>
@ -16,7 +15,6 @@
</a> </a>
<%#= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %> <%#= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %>
<% end %> <% end %>
<div id="preview" class="wiki"></div> <div id="preview" class="wiki"></div>
<% content_for :header_tags do %> <% content_for :header_tags do %>

View File

@ -14,7 +14,7 @@
<div class="talk_txt fl"> <div class="talk_txt fl">
<p class="pro_page_tit" style="word-break:break-all;"> <p class="pro_page_tit" style="word-break:break-all;">
<%= @issue.subject %> <%= @issue.subject %>
<span class='<%= "#{get_issue_type(@issue.tracker_id)}" %>'><%= get_issue_typevalue(@issue.tracker_id) %></span> <span class='<%= "#{get_issue_type(@issue.tracker_id)[0]}" %>'><%= get_issue_type(@issue.tracker_id)[1] %></span>
</p><br/> </p><br/>
<div class="cl"></div> <div class="cl"></div>
@ -46,59 +46,52 @@
<!--属性--> <!--属性-->
<div class="pro_info_box mb10"> <div class="pro_info_box mb10">
<%= issue_fields_rows do |rows| %> <%= issue_fields_rows do |rows| %>
<ul class="fl"> <ul class="fl" >
<li><p class="label03" >&nbsp;状态&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= @issue.status.name %></p>
<li><p class="label"><span class="c_red f12">*</span>&nbsp;状态&nbsp;&nbsp;:&nbsp;</p> </li>
<div class="cl"></div>
<p class="pro_info_p"><%= @issue.status.name %></p>
</li>
<div class="cl"></div>
<li><p class="label"><span class="c_red f12">*</span>&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p"><%= @issue.priority.name %></span>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('assigned_to_id') %> <% unless @issue.disabled_core_fields.include?('assigned_to_id') %>
<li><p class="label">&nbsp;指派给&nbsp;&nbsp;:&nbsp;</p> <li><p class="label03" >&nbsp;指派给&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %></span>
<span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "-" %></span> </li>
</li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %> </ul>
<li><p class="label">&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p> <ul class="fl" >
<span class="pro_info_p"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "-") %></span> <li><p class="label03" >&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.priority.name %></span>
</li> </li>
<% end %> <div class="cl"></div>
<div class="cl"></div>
</ul>
<ul class="fl ml90">
<% unless @issue.disabled_core_fields.include?('start_date') %>
<li><p class="label02">&nbsp;开始日期&nbsp;&nbsp;:&nbsp;</p>
<p class="pro_info_p"><%= format_date(@issue.start_date) %></p></li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('due_date') %>
<li><p class="label02">&nbsp;计划完成日期&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p"><%= format_date(@issue.due_date) %></span>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
<li><p class="label02">&nbsp;预期时间&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('done_ratio') %> <% unless @issue.disabled_core_fields.include?('done_ratio') %>
<li><p class="label02">&nbsp;% 完成&nbsp;&nbsp;:&nbsp;</p> <li><p class="label03" >&nbsp;% 完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.done_ratio %>%</span>
<span class="pro_info_p"><%= @issue.done_ratio %>%</span> </li>
</li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<% end %>
<ul class="fl " >
<% unless @issue.disabled_core_fields.include?('start_date') %>
<li><p class="label03" style="width:50px;" >&nbsp;开始&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= format_date(@issue.start_date) %></p>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
<li><p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl " >
<% unless @issue.disabled_core_fields.include?('due_date') %>
<li><p class="label03" >&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= format_date(@issue.due_date)? format_date(@issue.due_date) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %>
<li><p class="label03" >&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %><!--pro_info_box end-->
<%#= render_custom_fields_rows(@issue) %> <%#= render_custom_fields_rows(@issue) %>
<%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> <%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
</div> </div>

View File

@ -1,52 +0,0 @@
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
<% end %>
</div>
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<div class="subNav">
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
<% unless @project.issues.count == 0 %>
<a class="subnav_num">(<%= @project.issues.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
<% end %>
</div>
<% end %>
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<div class="subNav">
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
<% unless @project.boards.first.topics.count == 0 %>
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
<div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %>
<a class="subnav_num">(<%= attaments_num %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_files), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
<% end %>
</div>
<% end%>
<% unless @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %>
<div class="subNav">
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
</div>
<% end %><!--meny end -->
<!-- more -->
<div class="subNav subNav_jiantou" onclick="expand_tools_expand();" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent">
<%= render 'projects/tools_expand' %>
</ul>

View File

@ -169,6 +169,7 @@ function cookieget(n)
<div class="side_center"> <div class="side_center">
<div class="custom_service"> <div class="custom_service">
<% get_memo %> <% get_memo %>
<% if @public_forum %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
@ -176,6 +177,7 @@ function cookieget(n)
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label> <label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a> <a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a>
<% end %> <% end %>
<% end %>
</div> </div>
<div class="msgserver"> <div class="msgserver">
<a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a> <a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a>

View File

@ -1,29 +0,0 @@
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
<% end %>
</div>
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<div class="subNav">
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
<% unless @project.boards.first.topics.count == 0 %>
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
<div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %>
<a class="subnav_num">(<%= attaments_num %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_files), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
<% end %>
</div>
<% end %>

View File

@ -27,13 +27,13 @@
<% end %> <% end %>
<%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %> <%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%> <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
</li> </li>
</ul> </ul>
</li> </li>
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;"> <li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', <%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user },
{:class => 'my-message'} if User.current.logged?%> {:class => 'my-message'} if User.current.logged?%>
</li> </li>
</ul> </ul>

View File

@ -1,40 +0,0 @@
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
<% end %>
</div>
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<div class="subNav">
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
<% unless @project.issues.count == 0 %>
<a class="subnav_num">(<%= @project.issues.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
<% end %>
</div>
<% end %>
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<div class="subNav">
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
<% unless @project.boards.first.topics.count == 0 %>
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
<div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %>
<a class="subnav_num">(<%= attaments_num %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_files), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
<% end %>
</div>
<% end%>

View File

@ -67,17 +67,17 @@ end
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=User.current%> <b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=User.current%> <b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, {:class => 'my-message'} if User.current.logged? -%> <%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user }, {:class => 'my-message'} if User.current.logged? -%>
</li> </li>
<li> <li>
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %> <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.host_course} %>
</li> </li>
<li> <li>
<%=link_to l(:label_my_projects),{:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> <%=link_to l(:label_my_projects),{:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
</li> </li>
<li class="divider"></li> <li class="divider"></li>
<li> <li>
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%> <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -20,5 +20,4 @@
!Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %> !Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %>
<%= exit_project_link(@project) %> <%= exit_project_link(@project) %>
<% end %> <% end %>
</div> </div>

View File

@ -18,15 +18,15 @@
<% if User.current.logged? -%> <% if User.current.logged? -%>
<li id="current_user_li"> <li id="current_user_li">
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.user_domain}, :class => "uses_name"%> <%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, :class => "uses_name"%>
<ul id="user_sub_menu" style="right: 0px;display: none;"> <ul id="user_sub_menu" style="right: 0px;display: none;">
<% unless User.current.projects.empty? %> <% unless User.current.projects.empty? %>
<li id="my_projects_li"> <li id="my_projects_li">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain}, :class => "parent" %> <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name}, :class => "parent" %>
<ul id="my_projects_ul"> <ul id="my_projects_ul">
<% User.current.projects.each do |project| %> <% User.current.projects.each do |project| %>
<li title="<%=project.name%>"> <li title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %> <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
</li> </li>
<% end %> <% end %>
</ul> </ul>
@ -49,7 +49,7 @@
<% end %> <% end %>
<% end %> <% end %>
<li> <li>
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%> <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -3,7 +3,6 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>升级浏览器</title> <title>升级浏览器</title>
<script src="jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js" type="text/javascript"></script>
<style type="text/css"> <style type="text/css">
body{ font-size:12px; font-family:"微软雅黑","宋体"; background: #F2F2F2; font-style:normal;} body{ font-size:12px; font-family:"微软雅黑","宋体"; background: #F2F2F2; font-style:normal;}
.update{ border-bottom:1px solid #d7d7d7; color:#fea254; text-align:center; width:100%; font-size:10px; height:30px; background:#fdffd9; padding:2px 0;z-index:1000;} .update{ border-bottom:1px solid #d7d7d7; color:#fea254; text-align:center; width:100%; font-size:10px; height:30px; background:#fdffd9; padding:2px 0;z-index:1000;}

View File

@ -1,10 +1,10 @@
<% if User.current.projects.count>0 %> <% if User.current.projects.count>0 %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;"> <ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
<% User.current.projects.each do |project| %> <% User.current.projects.each do |project| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>"> <li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %> <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -52,7 +52,7 @@
<a href="javascript:void(0)" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" > <a href="javascript:void(0)" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
<%= l(:label_search)%> <%= l(:label_search)%>
</a> </a>
<br /> <div class="cl"></div>
<span id="project_name_span" style="float: left"></span> <span id="project_name_span" style="float: left"></span>
<% end %> <% end %>
</div> </div>
@ -95,7 +95,7 @@
<span>|&nbsp;</span> <span>|&nbsp;</span>
<%= l(:label_account_identity_student)%><%= course_student_link student_num %> <%= l(:label_account_identity_student)%><%= course_student_link student_num %>
<span>|&nbsp;</span> <span>|&nbsp;</span>
<%= l(:project_module_attachments)%><%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue' %></div> <%= l(:project_module_attachments)%><%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %></div>
<div class="cl"></div> <div class="cl"></div>
</div><!--课程信息 end--> </div><!--课程信息 end-->
<div class="info_box"> <div class="info_box">
@ -127,13 +127,13 @@
</div> </div>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange" %> <%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
<%= link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white') if is_teacher %> <%= link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white') if is_teacher %>
</div> </div>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.boards.first ? @course.boards.first.topics.count : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %> <%= link_to "(#{@course.boards.first ? @course.boards.first.topics.count : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
<%= link_to( "+#{l(:label_message_new)}", new_board_message_path(@course.boards.first), :class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %> <%= link_to( "+#{l(:label_message_new)}",course_boards_path(@course, :flag => true),:class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %>
</div> </div>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>

View File

@ -35,43 +35,6 @@
<tr> <tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td> <td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td> <td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#project_search_form").submit();}
}
</script>
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span" style="float: left"></span>
<% end %>
</div>
</td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/forums", forums_path %></a></td> <td style="padding-left: 8px"><a><%= link_to request.host()+"/forums", forums_path %></a></td>

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