Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-05-08 15:46:03 +08:00
commit e4e683d59b
112 changed files with 3887 additions and 2734 deletions

60
.gitignore vendored
View File

@ -1,30 +1,30 @@
*.swp *.swp
/.project /.project
/.idea /.idea
/.bundle /.bundle
*.swp *.swp
/config/database.yml /config/database.yml
/config/configuration.yml /config/configuration.yml
/config/additional_environment.rb /config/additional_environment.rb
/files/* /files/*
/log/* /log/*
/public/tmp/* /public/tmp/*
/tmp/* /tmp/*
/public/cache/* /public/cache/*
.gitignore .gitignore
/config/newrelic.yml /config/newrelic.yml
/public/images/avatars/* /public/images/avatars/*
/Gemfile /Gemfile
/Gemfile.lock /Gemfile.lock
/db/schema.rb /db/schema.rb
/Gemfile.lock /Gemfile.lock
/lib/plugins/acts_as_versioned/test/debug.log /lib/plugins/acts_as_versioned/test/debug.log
.rbenv-gemsets .rbenv-gemsets
.DS_Store .DS_Store
public/api_doc/ public/api_doc/
/.metadata /.metadata
vendor/cache vendor/cache
/files /files
/public/images/avatars /public/images/avatars
/public/files /public/files
/tags /tags

10
Gemfile
View File

@ -24,6 +24,8 @@ gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet' gem 'spreadsheet'
gem 'ruby-ole' gem 'ruby-ole'
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 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
@ -48,14 +50,6 @@ group :test do
gem 'selenium-webdriver', '~> 2.42.0' gem 'selenium-webdriver', '~> 2.42.0'
gem "faker" gem "faker"
# platforms :mri, :mingw do
# 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

@ -232,6 +232,7 @@ 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 get ":course_id/attachments" do
cs = CoursesService.new cs = CoursesService.new
@ -240,6 +241,19 @@ module Mobile
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
present :data, count, with: Mobile::Entities::Member
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

@ -0,0 +1,33 @@
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
end
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.user_domain)
else else
if last_login_on == '' if last_login_on == ''
redirect_to my_account_url redirect_to my_account_url
@ -329,7 +330,7 @@ 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 => 7.days.from_now,

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

@ -56,25 +56,9 @@ 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.js format.js

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

@ -0,0 +1,42 @@
class DiscussDemosController < ApplicationController
def index
@discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10)
end
def new
@discuss_demo = DiscussDemo.create
@discuss_demo.save!
@discuss_demo
end
def create
end
def update
@discuss_demo = DiscussDemo.find(params[:id])
@discuss_demo.update_attributes(:title => params[:discuss_demo][:title],:body => params[:discuss_demo][:body])
redirect_to :controller=> 'discuss_demos',:action => 'show',:id => params[:id]
end
def delete
end
def destroy
asset = Kindeditor::Asset.find_by_owner_id(params[:id])
if !asset.nil?
filepath = File.join(Rails.root,"public","files","uploads",
asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s,
asset[:asset].to_s)
File.delete(filepath) if File.exist?filepath
end
DiscussDemo.destroy(params[:id])
redirect_to :controller=> 'discuss_demos',:action => 'index'
end
def show
@discuss_demo = DiscussDemo.find(params[:id])
end
end

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

@ -75,7 +75,11 @@ 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

View File

@ -123,13 +123,13 @@ 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) redirect_to board_message_url(@board, @topic, :r => @reply)
@ -202,7 +202,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
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

@ -247,10 +247,9 @@ class ProjectsController < ApplicationController
# 1、自动注册 # 1、自动注册
# 2、加入项目、创建角色 # 2、加入项目、创建角色
# 3、用户得分 # 3、用户得分
if params[:login] if params[:email]
# 自动激活用户 user = User.find_by_mail(params[:email].to_s)
user.status = 1 Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id)
user.save
end end
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return return

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

@ -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

@ -329,12 +329,12 @@ module ApplicationHelper
imagesize = attachment.thumbnail(:size => "200*200") imagesize = attachment.thumbnail(:size => "200*200")
imagepath = named_attachment_path(attachment, attachment.filename) imagepath = named_attachment_path(attachment, attachment.filename)
if imagesize if imagesize
link_to image_tag(thumbnail_path(attachment), height: '73', width: '100', name: 'issue_attachment_picture'), link_to image_tag(thumbnail_path(attachment), height: '73', width: '100', class: 'issue_attachment_picture'),
imagepath, imagepath,
:title => attachment.filename :title => attachment.filename
else else
link_to image_tag(imagepath , height: '73', width: '100', name: 'issue_attachment_picture'), link_to image_tag(imagepath , height: '73', width: '100', class: 'issue_attachment_picture'),
imagepath, imagepath,
:title => attachment.filename :title => attachment.filename
end end

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

@ -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

@ -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

@ -71,14 +71,14 @@ class Mailer < ActionMailer::Base
# 邀请已注册的用户加入项目 # 邀请已注册的用户加入项目
def request_member_to_project(email, project, invitor) def request_member_to_project(email, project, invitor)
@subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
user = User.find_by_mail(email.to_s) user = User.find_by_mail(email.to_s)
Member.create(:role_ids => [4], :user_id => user.id,:project_id => project.id) @invitor_name = "#{invitor.name}"
@invitor_name = "#{invitor.name}" @project_name = "#{project.name}"
@project_name = "#{project.name}" @user = user
@user = user @token = Token.get_token_from_user(user, 'autologin')
@token = Token.get_token_from_user(user, 'autologin') @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :email => email, :token => @token.value)
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,:user => user, :token => @token.value) mail :to => email, :subject => @subject
mail :to => email, :invitor_name => "#{@invitor_name}", :project_name => "#{@project_name}"
end end
# author: alan # author: alan

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,14 @@ 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')
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 +51,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 +89,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

@ -1,86 +1,86 @@
# encoding: utf-8 # encoding: utf-8
=begin =begin
identity字段含义 identity字段含义
0 0
1 1
2 2
3 3
=end =end
class UserExtensions < ActiveRecord::Base class UserExtensions < ActiveRecord::Base
validate :school, presence: true validate :school, presence: true
belongs_to :user belongs_to :user
belongs_to :school, :class_name => 'School', :foreign_key => :school_id belongs_to :school, :class_name => 'School', :foreign_key => :school_id
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id
TEACHER = 0 TEACHER = 0
STUDENT = 1 STUDENT = 1
ENTERPRISE = 2 ENTERPRISE = 2
DEVELOPER = 3 DEVELOPER = 3
#this method was used to update the table user_extensions #this method was used to update the table user_extensions
def update_user_extensions(birthday=nil,brief_introduction=nil, def update_user_extensions(birthday=nil,brief_introduction=nil,
gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil) gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil)
self.birthday = birthday self.birthday = birthday
self.brief_introduction = brief_introduction self.brief_introduction = brief_introduction
self.gender = gender self.gender = gender
self.location = location self.location = location
self.occupation = occupation self.occupation = occupation
self.work_experience = work_experience self.work_experience = work_experience
self.zip_code = zip_code self.zip_code = zip_code
self.save self.save
end end
def get_brief_introduction def get_brief_introduction
return self.brief_introduction return self.brief_introduction
end end
# added by meng # added by meng
def show_identity def show_identity
if User.current.language == 'zh'||User.current.language == '' if User.current.language == 'zh'||User.current.language == ''
case self.identity case self.identity
when 0 when 0
user_identity = l(:label_account_identity_teacher) user_identity = l(:label_account_identity_teacher)
when 1 when 1
user_identity = l(:label_account_identity_student) user_identity = l(:label_account_identity_student)
when 2 when 2
user_identity = l(:label_account_identity_enterprise) user_identity = l(:label_account_identity_enterprise)
when 3 when 3
user_identity = l(:label_account_identity_developer) user_identity = l(:label_account_identity_developer)
else else
user_identity = '' user_identity = ''
end end
else else
case self.identity case self.identity
when 0 when 0
user_identity = l(:label_account_identity_teacher) user_identity = l(:label_account_identity_teacher)
when 1 when 1
user_identity = l(:label_account_identity_student) user_identity = l(:label_account_identity_student)
when 2 when 2
user_identity = l(:label_account_identity_enterprise) user_identity = l(:label_account_identity_enterprise)
when 3 when 3
user_identity = l(:label_account_identity_developer) user_identity = l(:label_account_identity_developer)
else else
user_identity = '' user_identity = ''
end end
end end
return user_identity return user_identity
end end
# end # end
def self.introduction(user, message) def self.introduction(user, message)
unless user.user_extensions.nil? unless user.user_extensions.nil?
info = user.user_extensions info = user.user_extensions
info.brief_introduction = message info.brief_introduction = message
info.save info.save
else else
info = UserExtensions.new info = UserExtensions.new
info.user_id = user.id info.user_id = user.id
info.brief_introduction = message info.brief_introduction = message
info.save info.save
end end
end end
end end

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,48 @@ 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
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 +511,52 @@ 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

@ -1,62 +1,28 @@
<script type="text/javascript"> <script type="text/javascript">
document.addEventListener('DOMContentLoaded',function(){
var img = document.getElementsByName('issue_attachment_picture');
function getImgNaturalStyle(img, callback) {
var nWidth, nHeight;
if (typeof img.naturalWidth == "undefined"|| img.naturalWidth == 0) {
var image = new Image();
image.src = img.src;
if (image.complete) {
callback(image);
} else {
image.onload = function () {
callback(image);
image.onload = null;
};
};
jQuery(window).load(function () {
jQuery(".issue_attachment_picture").each(function () {
DrawImage(this, 100, 73);
});
});
function DrawImage(ImgD, FitWidth, FitHeight) {
var image = new Image();
image.src = ImgD.src;
if (image.width > 100 || image.height > 73)
{
rateWidth = image.width / 100;
rateHeight = image.height / 73;
if (rateWidth > rateHeight) {
ImgD.width = 100;
ImgD.height = Math.round(image.height/rateWidth);
} }
else else
{ {
if (img.complete) { ImgD.width = Math.round(image.width/rateHeight);
nWidth = img.naturalWidth; ImgD.height = 73;
nHeight = img.naturalHeight;
} else {
img.onload = function () {
nWidth = img.naturalWidth;
nHeight = img.naturalHeight;
image.onload = null;
};
};
}
return [nWidth, nHeight];
}
function UpdateImageInformation(image) {
return [image.width,image.height];
}
for(i=0;i<img.length;i++)
{
imgNatural = getImgNaturalStyle(img[i],UpdateImageInformation);
var width = imgNatural[0];
var height = imgNatural[1];
if (width<100)
{
img[i].width = width;
}
if (height<73) {
img[i].height = height;
} }
} }
}); }
</script> </script>
<div class="attachments" style="font-weight:normal;"> <div class="attachments" style="font-weight:normal;">

View File

@ -1,8 +1,8 @@
$('#attachments_<%= j params[:attachment_id] %>').remove(); $('#attachments_<%= j params[:attachment_id] %>').remove();
var count=$('#attachments_fields>span').length; var count=$('#attachments_fields>span').length;
if(count<=0){ if(count<=0){
$("#upload_file_count").text(<%= l(:label_no_file_uploaded)%>); $("#upload_file_count").text(<%= l(:label_no_file_uploaded)%>);
$(".remove_all").remove(); $(".remove_all").remove();
}else{ }else{
$("#upload_file_count").html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件"); $("#upload_file_count").html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
} }

View File

@ -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

@ -0,0 +1,66 @@
<style type="text/css">
#preview{width:360px;height:360px;border:1px solid #000;overflow:hidden;}
#imghead {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);}
</style>
<script type="text/javascript">
function previewImage(file)
{
var MAXWIDTH = 360;
var MAXHEIGHT = 360;
var div = document.getElementById('preview');
if (file.files && file.files[0])
{
div.innerHTML = '<img id=imghead>';
var img = document.getElementById('imghead');
img.onload = function(){
var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
img.width = rect.width;
img.height = rect.height;
img.style.marginLeft = rect.left+'px';
img.style.marginTop = rect.top+'px';
}
var reader = new FileReader();
reader.onload = function(evt){img.src = evt.target.result;}
reader.readAsDataURL(file.files[0]);
}
else
{
var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
file.select();
var src = document.selection.createRange().text;
div.innerHTML = '<img id=imghead>';
var img = document.getElementById('imghead');
img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;margin-left:"+rect.left+"px;"+sFilter+src+"\"'></div>";
}
}
function clacImgZoomParam( maxWidth, maxHeight, width, height ){
var param = {top:0, left:0, width:width, height:height};
if( width>maxWidth || height>maxHeight )
{
rateWidth = width / maxWidth;
rateHeight = height / maxHeight;
if( rateWidth > rateHeight )
{
param.width = maxWidth;
param.height = Math.round(height / rateWidth);
}else
{
param.width = Math.round(width / rateHeight);
param.height = maxHeight;
}
}
param.left = Math.round((maxWidth - param.width) / 2);
param.top = Math.round((maxHeight - param.height) / 2);
return param;
}
</script>
<div id="preview">
<img id="imghead" width=100 height=100 border=0 src="file:///C:/Users/whimlex/Downloads/1.jpg">
</div>
<br/>
<input type="file" onchange="previewImage(this)" />

View File

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

View File

@ -1,201 +1,201 @@
<!--modified by huang--> <!--modified by huang-->
<script type="text/javascript"> <script type="text/javascript">
function ShowCountDown(year,month,day,divname) function ShowCountDown(year,month,day,divname)
{ {
var now = new Date(); var now = new Date();
var endDate = new Date(year, month-1, day); var endDate = new Date(year, month-1, day);
var leftTime=endDate.getTime()-now.getTime(); var leftTime=endDate.getTime()-now.getTime();
var leftsecond = parseInt(leftTime/1000); var leftsecond = parseInt(leftTime/1000);
var day1=Math.floor(leftsecond/(60*60*24)); var day1=Math.floor(leftsecond/(60*60*24));
var hour=Math.floor((leftsecond-day1*24*60*60)/3600); var hour=Math.floor((leftsecond-day1*24*60*60)/3600);
var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60); var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60);
var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60); var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60);
$("#"+divname).html("<span style='color: #acaeb1;'>作品提交还剩&nbsp;:</span>&nbsp;<span style='color: red;'>" $("#"+divname).html("<span style='color: #acaeb1;'>作品提交还剩&nbsp;:</span>&nbsp;<span style='color: red;'>"
+day1+"&nbsp;</span><span style='color: #acaeb1;'>天</span><span style='color: red;'>&nbsp;" +day1+"&nbsp;</span><span style='color: #acaeb1;'>天</span><span style='color: red;'>&nbsp;"
+hour+"&nbsp;</span><span style='color: #acaeb1;'>时</span><span style='color: red;'>&nbsp;" +hour+"&nbsp;</span><span style='color: #acaeb1;'>时</span><span style='color: red;'>&nbsp;"
+minute+"&nbsp;</span><span style='color: #acaeb1;'>分</span><span style='color: red;'>&nbsp;" +minute+"&nbsp;</span><span style='color: #acaeb1;'>分</span><span style='color: red;'>&nbsp;"
+second+"&nbsp;</span><span style='color: #acaeb1;'>秒</span>"); +second+"&nbsp;</span><span style='color: #acaeb1;'>秒</span>");
} }
</script> </script>
<style> <style>
.span_wping{} .span_wping{}
.span_wping a{ .span_wping a{
margin-top: 18px; margin-top: 18px;
margin-bottom: 3px; margin-bottom: 3px;
width: 43px; width: 43px;
height: 23px; height: 23px;
background: #15bccf; background: #15bccf;
color: #fff; color: #fff;
text-align: center; text-align: center;
padding: 5px !important; padding: 5px !important;
} }
.span_wping a:hover{ background-color:#03a1b3;} .span_wping a:hover{ background-color:#03a1b3;}
</style> </style>
<% if bids.blank? %> <% if bids.blank? %>
<%#= l(:label_uncommit_homework) %> <%#= l(:label_uncommit_homework) %>
暂无作业! 暂无作业!
<% else %> <% else %>
<% bids.each do |bid|%> <% bids.each do |bid|%>
<table class="content-text-list"> <table class="content-text-list">
<tr> <tr>
<td colspan="2" valign="top" width="50" > <td colspan="2" valign="top" width="50" >
<%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %> <%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %>
</td> </td>
<td> <td>
<table width="580px" border="0"> <table width="580px" border="0">
<tr> <tr>
<td valign="top"> <td valign="top">
<strong> <strong>
<%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %> <%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %>
</strong> </strong>
<span class="font_lighter"> <span class="font_lighter">
<%= l(:label_user_create_project_homework) %> <%= l(:label_user_create_project_homework) %>
</span> </span>
<span> <span>
<%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %> <%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %>
</span> </span>
</td> </td>
<td style="width: 150px;"> <td style="width: 150px;">
<span style="float: right"> <span style="float: right">
<% if User.current.logged? && is_cur_course_student(@course) %> <% if User.current.logged? && is_cur_course_student(@course) %>
<% cur_user_homework = cur_user_homework_for_bid(bid) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %>
<span class="span_wping"> <span class="span_wping">
<% if bid.open_anonymous_evaluation == 1 %> <% if bid.open_anonymous_evaluation == 1 %>
<% case bid.comment_status %> <% case bid.comment_status %>
<% when 0 %> <% when 0 %>
<a>未开启匿评</a> <a>未开启匿评</a>
<% when 1 %> <% when 1 %>
<a>&nbsp;&nbsp;匿评中..&nbsp;&nbsp;</a> <a>&nbsp;&nbsp;匿评中..&nbsp;&nbsp;</a>
<% when 2 %> <% when 2 %>
<a>&nbsp;&nbsp;匿评结束&nbsp;&nbsp;</a> <a>&nbsp;&nbsp;匿评结束&nbsp;&nbsp;</a>
<% end %> <% end %>
<% end%> <% end%>
</span> </span>
<% if cur_user_homework && cur_user_homework.empty? %> <% if cur_user_homework && cur_user_homework.empty? %>
<span class="span_wping"> <span class="span_wping">
<%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %> <%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %>
</span> </span>
<% else %> <% else %>
<span class="span_wping"> <span class="span_wping">
<a>已&nbsp;提&nbsp;交</a> <a>已&nbsp;提&nbsp;交</a>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
<% if (User.current.admin?||User.current.allowed_to?(:as_teacher,@course)) %> <% if (User.current.admin?||User.current.allowed_to?(:as_teacher,@course)) %>
<% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%> <% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%>
<span id="<%=bid.id %>_anonymous_comment" class="span_wping"> <span id="<%=bid.id %>_anonymous_comment" class="span_wping">
<% case bid.comment_status %> <% case bid.comment_status %>
<% when 0 %> <% when 0 %>
<%= link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...' %> <%= link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...' %>
<% when 1 %> <% when 1 %>
<%= link_to '关闭匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true %> <%= link_to '关闭匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true %>
<% when 2 %> <% when 2 %>
<a href="javascript:" style="background:#8e8e8e;">匿评结束</a> <a href="javascript:" style="background:#8e8e8e;">匿评结束</a>
<% end %> <% end %>
</span> </span>
<%end%> <%end%>
<span class="span_wping"> <span class="span_wping">
<%= link_to( <%= link_to(
l(:button_edit), l(:button_edit),
{:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id} {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id}
) %> ) %>
</span> </span>
<%#= link_to( <%#= link_to(
l(:button_delete), l(:button_delete),
{:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id}, {:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id},
:method => :post, :method => :post,
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del' :class => 'icon icon-del'
) %> ) %>
<% end %> <% end %>
</span> </span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<span class="font_lighter"> <span class="font_lighter">
<% bidding_project = bid.biding_projects.all <% bidding_project = bid.biding_projects.all
temp = [] temp = []
bidding_project.each do |pro| bidding_project.each do |pro|
if pro.project && pro.project.project_status if pro.project && pro.project.project_status
temp << pro temp << pro
end end
temp temp
end end
%> %>
<% if bid.homework_type == 1%> <% if bid.homework_type == 1%>
<%= l(:label_x_homework_project, :count => bid.homeworks.count) %> <%= l(:label_x_homework_project, :count => bid.homeworks.count) %>
( (
<strong> <strong>
<%= link_to bid.homeworks.count, course_for_bid_path(bid.id) %> <%= link_to bid.homeworks.count, course_for_bid_path(bid.id) %>
</strong>) </strong>)
<% else %> <% else %>
<%= l(:label_x_homework_project, :count => temp.count) %> <%= l(:label_x_homework_project, :count => temp.count) %>
( (
<strong> <strong>
<%= link_to temp.count, course_for_bid_path(bid.id) %> <%= link_to temp.count, course_for_bid_path(bid.id) %>
</strong>) </strong>)
<% end %> <% end %>
</span> </span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<% if bid.reward_type.nil? or bid.reward_type == 1 %> <% if bid.reward_type.nil? or bid.reward_type == 1 %>
<strong> <strong>
<%= l(:label_bids_reward_method) %> <%= l(:label_bids_reward_method) %>
<span style="color: #ed8924;font-family: 14px; font-family: '微软雅黑'"> <span style="color: #ed8924;font-family: 14px; font-family: '微软雅黑'">
<%= l(:label_call_bonus) %> <%= l(:label_call_bonus) %>
&nbsp; &nbsp;
<%= l(:label_RMB_sign) %> <%= l(:label_RMB_sign) %>
<%= bid.budget%> <%= bid.budget%>
</span> </span>
</strong> </strong>
<% elsif bid.reward_type == 2 %> <% elsif bid.reward_type == 2 %>
<strong> <strong>
<%= l(:label_bids_reward_method) %> <%= l(:label_bids_reward_method) %>
<span style="color: #15bccf;font-family: 14px; font-family:' 微软雅黑'"> <span style="color: #15bccf;font-family: 14px; font-family:' 微软雅黑'">
<%= bid.budget%> <%= bid.budget%>
</span> </span>
</strong> </strong>
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%#= l(:label_price) %><%#= l(:label_RMB_sign) %><%#= bid.budget%></strong></td> --> <% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%#= l(:label_price) %><%#= l(:label_RMB_sign) %><%#= bid.budget%></strong></td> -->
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580px" > <td colspan="2" width="580px" >
<span class="font_description"> <span class="font_description">
<%=h sanitize(bid.description.html_safe) %> <%=h sanitize(bid.description.html_safe) %>
</span> </span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="text-align: left" colspan="2"> <td style="text-align: left" colspan="2">
<span class="font_lighter"> <span class="font_lighter">
<%= l(:label_end_time) %> <%= l(:label_end_time) %>
:&nbsp; :&nbsp;
<%= bid.deadline %> <%= bid.deadline %>
</span> </span>
<span style="float: right"> <span style="float: right">
<% if betweentime(bid.deadline) < 0 %> <% if betweentime(bid.deadline) < 0 %>
<span style="color: red; float: right"> <span style="color: red; float: right">
<%= l(:label_commit_limit)%> <%= l(:label_commit_limit)%>
</span> </span>
<% else %> <% else %>
<script type="text/javascript"> <script type="text/javascript">
window.setInterval(function(){ShowCountDown(<%= bid.deadline.year%>,<%= bid.deadline.month%>,<%= bid.deadline.day + 1%>,"show_deadtime_span_<%= bid.id%>");},1000) window.setInterval(function(){ShowCountDown(<%= bid.deadline.year%>,<%= bid.deadline.month%>,<%= bid.deadline.day + 1%>,"show_deadtime_span_<%= bid.id%>");},1000)
</script> </script>
<span id="show_deadtime_span_<%= bid.id%>" style="float: right"> <span id="show_deadtime_span_<%= bid.id%>" style="float: right">
</span> </span>
<% end %> <% end %>
</span> </span>
</td> </td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
</table> </table>
<% end %> <% end %>
<% end %> <% end %>
<div class="pagination"> <div class="pagination">
<%= pagination_links_full bid_pages %> <%= pagination_links_full bid_pages %>
</div> </div>

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} %>
<li>
<%= link_to l(:button_cancel), course_boards_path(@course), :class => 'grey_btn fr ml10' %>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>
<% end %>

View File

@ -10,7 +10,7 @@
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %> <%= 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} %> <%= render :partial => 'messages/form_course', :locals => {:f => f} %>
<p> <p>
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a> <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' %> <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
</p> </p>
<% end %> <% end %>
@ -42,14 +42,14 @@
:class => 'problem_new_btn fl c_dorange' if User.current.logged? %> :class => 'problem_new_btn fl c_dorange' if User.current.logged? %>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<% if @topics.any? %> <% if @topics.any? %>
<% @topics.each do |topic| %> <% @topics.each do |topic| %>
<div class="problem_main"> <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' %> <%= 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="talk_txt fl"> <div class="talk_txt fl">
<%= 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" %> <%= link_to h(topic.subject), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %>
<% if topic.sticky? %> <% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red">置顶</a> <a href="javascript:void(0)" class="talk_up fr c_red">置顶</a>
<% end %> <% end %>
<br/> <br/>
<p>由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %></p> <p>由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %></p>
@ -58,17 +58,17 @@
<div class="cl"></div> <div class="cl"></div>
</div><!--讨论主类容 end--> </div><!--讨论主类容 end-->
<% end %> <% end %>
<% else %> <% else %>
<p class="nodata"> <p class="nodata">
<%= l(:label_no_data) %> <%= l(:label_no_data) %>
</p> </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%>
</ul> </ul>
<%# other_formats_links do |f| %> <%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %> <%# end %>
<% html_title @board.name %> <% html_title @board.name %>

View File

@ -0,0 +1,42 @@
<% 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">
<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_project',
:locals => {:f => f, :replying => !topic.parent.nil?} %>
<a href="#" onclick="$('#message-form<%= topic.id%>').submit();"class="blue_btn fl c_white" ><%= l(:button_submit)%></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?} %>
<a href="javascript:void(0)" onclick="$('#message-form<%= topic.id%>').submit();"class="blue_btn fl c_white"><%= l(:button_submit)%></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" %>
<% 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" 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", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" 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', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %>
<% else %>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<% end %>
<div class="cl"></div>
<p id="message_content_span" 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 => @message,:isReply => @isReply} %>
</div>
<% end %>
</li>
<li >
<div class="cl"></div>
</li>

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" 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", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" 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', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %>
<% else %>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<% end %>
<div class="cl"></div>
<p id="message_content_span" 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 => @message,:isReply => @isReply} %>
</div>
<% end %>
</li>
<li >
<div class="cl"></div>
</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_project', :locals => {:f => f} %>
<li>
<%= link_to l(:button_cancel), project_boards_path(@project), :class => 'grey_btn fr ml10' %>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>
<% end %>

View File

@ -11,49 +11,49 @@
<!--display the board--> <!--display the board-->
<% if !User.current.logged? %> <% if !User.current.logged? %>
<div class="c_grey f14"> <div class="c_grey f14">
<%= l(:label_user_login_project_board) %> <%= l(:label_user_login_project_board) %>
<%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %> <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
</div> </div>
<% end %> <% end %>
<!-- 内容显示部分 --> <!-- 内容显示部分 -->
<div class="talk_top"> <div class="talk_top">
<div class="fl"><span><%= l(:label_project_board_count , :count => @topic_count)%></span></div> <div class="fl"><span><%= l(:label_project_board_count , :count => @topic_count)%></span></div>
<% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %> <% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %>
<span><%= link_to l(:project_module_boards_post), new_board_message_path(@board), <span><%= link_to l(:project_module_boards_post), new_board_message_path(@board),
:class => 'problem_new_btn fl c_dorange', :class => 'problem_new_btn fl c_dorange',
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %></span> :onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %></span>
<% end %>
<div class="cl"></div>
</div>
<!-- 帖子内容显示 -->
<% if @topics.any? %>
<% @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="talk_txt fl">
<%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<% end %>
<br/>
<%= l(:label_post_by)%><%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %>
&nbsp;<%= l(:label_post_by_time)%><%= format_time topic.created_on %>
</div>
<%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %> <% end %>
<div class="cl"></div>
</div>
<!-- 帖子内容显示 -->
<% if @topics.any? %>
<% @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="talk_txt fl">
<%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<% end %>
<br/>
<%= l(:label_post_by)%><%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %>
&nbsp;<%= l(:label_post_by_time)%><%= format_time topic.created_on %>
</div>
<%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %> <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
</ul> </ul>
<!--讨论主类容 end--> <!--讨论主类容 end-->
<%# other_formats_links do |f| %> <%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %> <%# end %>
<% html_title @board.name %> <% html_title @board.name %>

View File

@ -1,4 +1,41 @@
<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">//侧导航
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

@ -58,14 +58,14 @@
<%= 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 => memberCount(@course))) %>
</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

@ -24,9 +24,9 @@
<%= 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" %> <% if manage_allowed && file.container_id == project.id && file.container_type == "Project" %>
<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",: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",: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 %>

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();
} }

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="ChoseZero();">零分</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

@ -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])}'>#{get_issue_typevalue(column_content[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>

View File

@ -1,151 +1,151 @@
<script> <script>
function remote_function() { function remote_function() {
$.ajax({ $.ajax({
url:'<%= project_issues_path(@project)%>', url:'<%= project_issues_path(@project)%>',
data:{ data:{
subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""), subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""), status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""), assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""), priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "") author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
}, },
success: function(data){ success: function(data){
}, },
error: function(data){ error: function(data){
} }
}); });
} }
function EnterPress(e){ function EnterPress(e){
var e = e || window.event; var e = e || window.event;
if(e.keyCode == 13){ if(e.keyCode == 13){
remote_function(); remote_function();
} }
} }
</script> </script>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= l(:label_issue_tracking) %></h2> <h2 class="project_h2"><%= l(:label_issue_tracking) %></h2>
</div> </div>
<div class="problem_top"> <div class="problem_top">
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<%#= 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, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给",0]),
{ :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"}
) )
%> %>
</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.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)').count %> </a>
</p> </p>
<div class="cl"></div> <div class="cl"></div>
<% end %> <% end %>
</div> </div>
<div class="contextual"> <div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %> <% if !@query.new_record? && @query.editable_by?(User.current) %>
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
<%= delete_link query_path(@query) %> <%= delete_link query_path(@query) %>
<% end %> <% end %>
</div> </div>
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
<div style="clear:right; "> <div style="clear:right; ">
</div> </div>
<%= error_messages_for 'query' %> <%= error_messages_for 'query' %>
<% if @query.valid? %> <% if @query.valid? %>
<% if @issues.empty? %> <% if @issues.empty? %>
<p class="nodata"> <p class="nodata">
<%= l(:label_no_data) %> <%= l(:label_no_data) %>
</p> </p>
<% else %> <% else %>
<div id="issue_list"> <div id="issue_list">
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %> <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %>
</div> </div>
<% end %> <% end %>
<div style="float: left; padding-top: 30px"> <div style="float: left; padding-top: 30px">
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
<%= f.link_to 'PDF', :url => params %> <%= f.link_to 'PDF', :url => params %>
<% end %> <% end %>
</div> </div>
<div id="csv-export-options" style="display:none;"> <div id="csv-export-options" style="display:none;">
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3> <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
<%= form_tag(params.merge({:format => 'csv', :page => nil}), :method => :get, :id => 'csv-export-form') do %> <%= form_tag(params.merge({:format => 'csv', :page => nil}), :method => :get, :id => 'csv-export-form') do %>
<p> <p>
<label> <label>
<%= radio_button_tag 'columns', 'all' %> <%= radio_button_tag 'columns', 'all' %>
<%= l(:description_all_columns) %> <%= l(:description_all_columns) %>
</label> </label>
</p> </p>
<p> <p>
<label> <label>
<%= check_box_tag 'description', '1', @query.has_column?(:description) %> <%= check_box_tag 'description', '1', @query.has_column?(:description) %>
<%= l(:field_description) %> <%= l(:field_description) %>
</label> </label>
</p> </p>
<p class="buttons"> <p class="buttons">
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %> <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %> <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
</p> </p>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> <%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %>
<% content_for :sidebar do %> <% content_for :sidebar do %>
<%= render :partial => 'issues/sidebar' %> <%= render :partial => 'issues/sidebar' %>
<% end %> <% end %>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, <%= auto_discovery_link_tag(:atom,
{:query_id => @query, :format => 'atom', {:query_id => @query, :format => 'atom',
:page => nil, :key => User.current.rss_key}, :page => nil, :key => User.current.rss_key},
:title => l(:label_issue_plural)) %> :title => l(:label_issue_plural)) %>
<%= auto_discovery_link_tag(:atom, <%= auto_discovery_link_tag(:atom,
{:controller => 'journals', :action => 'index', {:controller => 'journals', :action => 'index',
:query_id => @query, :format => 'atom', :query_id => @query, :format => 'atom',
:page => nil, :key => User.current.rss_key}, :page => nil, :key => User.current.rss_key},
:title => l(:label_changes_details)) %> :title => l(:label_changes_details)) %>
<% end %> <% end %>
<%= context_menu issues_context_menu_path %> <%= context_menu issues_context_menu_path %>

View File

@ -4,7 +4,7 @@
<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %> <% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %>
<div class="pro_page_box"> <div class="pro_page_box">
<div class="pro_page_top break_word"> <div class="pro_page_top break_word">
<a href="javascript:void(0)"><%= @issue.project.name %></a> > <%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %>
<a href="javascript:void(0)"><%= "#" + @issue.project_index %></a> <a href="javascript:void(0)"><%= "#" + @issue.project_index %></a>
</div> </div>
<div class="problem_main"> <div class="problem_main">

View File

@ -23,7 +23,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a> <a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% 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" %> <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %> <% end %>
</div> </div>
<% end%> <% end%>
@ -46,7 +46,7 @@
<% end %><!--meny end --> <% end %><!--meny end -->
<!-- more --> <!-- more -->
<div class="subNav subNav_jiantou" onclick="expand_tools_expand();" id="expand_tools_expand"><%= l(:label_project_more) %></div> <div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent"> <ul class="navContent" id="navContent">
<%= render 'projects/tools_expand' %> <%= render 'projects/tools_expand' %>
</ul> </ul>

View File

@ -1,189 +1,189 @@
<style type="text/css"> <style type="text/css">
html{ overflow-x:hidden;} html{ overflow-x:hidden;}
.scrollsidebar{ position:fixed;bottom:1px; right:1px; background:none; } .scrollsidebar{ position:fixed;bottom:1px; right:1px; background:none; }
.side_content{width:154px; height:auto; overflow:hidden; float:left; } .side_content{width:154px; height:auto; overflow:hidden; float:left; }
.side_content .side_list {width:154px;overflow:hidden;} .side_content .side_list {width:154px;overflow:hidden;}
.show_btn{ width:0; height:112px; overflow:hidden; float:left;margin-top: 200px; cursor:pointer;} .show_btn{ width:0; height:112px; overflow:hidden; float:left;margin-top: 200px; cursor:pointer;}
.show_btn span { display:none;} .show_btn span { display:none;}
.close_btn{width:24px;height:24px;cursor:pointer;} .close_btn{width:24px;height:24px;cursor:pointer;}
.side_title,.side_bottom,.close_btn,.show_btn {background:url(/images/sidebar_bg.png) no-repeat; } .side_title,.side_bottom,.close_btn,.show_btn {background:url(/images/sidebar_bg.png) no-repeat; }
.side_title {height:35px;} .side_title {height:35px;}
.side_bottom { height:8px;} .side_bottom { height:8px;}
.side_center {font-family:Verdana, Geneva, sans-serif; padding:0px 12px; font-size:12px;} .side_center {font-family:Verdana, Geneva, sans-serif; padding:0px 12px; font-size:12px;}
.close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;} .close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;}
.close_btn span { display:none;} .close_btn span { display:none;}
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} .side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
.msgserver { margin:2px 0px 0px 4px; padding-top: 0px} .msgserver { margin:2px 0px 0px 4px; padding-top: 0px}
.msgserver a { background:url(/images/sidebar_bg.png) no-repeat -119px -115px; padding-left:22px;} .msgserver a { background:url(/images/sidebar_bg.png) no-repeat -119px -115px; padding-left:22px;}
.opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;} .opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;}
.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} .opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
.opnionButton:hover{background: #0fa9bb; } .opnionButton:hover{background: #0fa9bb; }
/* blue skin as the default skin */ /* blue skin as the default skin */
.side_title {background-position:-195px 0;} .side_title {background-position:-195px 0;}
.side_center {background:url(/images/blue_line.png) repeat-y center;} .side_center {background:url(/images/blue_line.png) repeat-y center;}
.side_bottom {background-position:-195px -50px;} .side_bottom {background-position:-195px -50px;}
.close_btn {background-position:-44px 0;} .close_btn {background-position:-44px 0;}
.close_btn:hover {background-position:-66px 0;} .close_btn:hover {background-position:-66px 0;}
.show_btn {background-position:-119px 0;} .show_btn {background-position:-119px 0;}
.msgserver a {color:#15bccf; } .msgserver a {color:#15bccf; }
.msgserver a:hover { text-decoration:underline; } .msgserver a:hover { text-decoration:underline; }
</style> </style>
<head> <head>
<script> <script>
(function($){ (function($){
$.fn.fix = function(options){ $.fn.fix = function(options){
var defaults = { var defaults = {
float : 'right', float : 'right',
minStatue : true, minStatue : true,
skin : 'blue', skin : 'blue',
durationTime : 1000 durationTime : 1000
} }
var options = $.extend(defaults, options); var options = $.extend(defaults, options);
this.each(function(){ this.each(function(){
//??????? //???????
var thisBox = $(this), var thisBox = $(this),
closeBtn = thisBox.find('.close_btn' ), closeBtn = thisBox.find('.close_btn' ),
show_btn = thisBox.find('.show_btn' ), show_btn = thisBox.find('.show_btn' ),
sideContent = thisBox.find('.side_content'), sideContent = thisBox.find('.side_content'),
sideList = thisBox.find('.side_list') sideList = thisBox.find('.side_list')
; ;
var defaultTop = thisBox.offset().top; //????????top var defaultTop = thisBox.offset().top; //????????top
thisBox.css(options.float, 0); thisBox.css(options.float, 0);
if(options.minStatue == "true"){ if(options.minStatue == "true"){
$(".show_btn").css("float", options.float); $(".show_btn").css("float", options.float);
sideContent.css('width', 0); sideContent.css('width', 0);
show_btn.css('width', 25); show_btn.css('width', 25);
} }
//close //close
closeBtn.bind("click",function(){ closeBtn.bind("click",function(){
sideContent.animate({width: '0px'},"fast"); sideContent.animate({width: '0px'},"fast");
show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast"); show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast");
cookiesave('minStatue','true','','',''); cookiesave('minStatue','true','','','');
}); });
//show //show
show_btn.bind("click",function() { show_btn.bind("click",function() {
$(this).animate({width: '0px'},"fast"); $(this).animate({width: '0px'},"fast");
sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast"); sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast");
cookiesave('minStatue','false','','',''); cookiesave('minStatue','false','','','');
}); });
}); //end this.each }); //end this.each
}; };
})(jQuery); })(jQuery);
$(function(){ $(function(){
$("#button1").click(function(){ $("#button1").click(function(){
myTips("<%= l(:label_feedback_success) %>","success"); myTips("<%= l(:label_feedback_success) %>","success");
}); });
}); });
function f_submit() function f_submit()
{ {
// var subject = $("#memo_subject").val(); // var subject = $("#memo_subject").val();
// var content = $("#memo_content_1").val(); // var content = $("#memo_content_1").val();
// $("#memo_subject").val(subject+""+ content.substr(0,18)+"..."); // $("#memo_subject").val(subject+""+ content.substr(0,18)+"...");
$("#new_memo").submit(); $("#new_memo").submit();
} }
function cookiesave(n, v, mins, dn, path) function cookiesave(n, v, mins, dn, path)
{ {
if(n) if(n)
{ {
if(!mins) mins = 365 * 24 * 60; if(!mins) mins = 365 * 24 * 60;
if(!path) path = "/"; if(!path) path = "/";
var date = new Date(); var date = new Date();
date.setTime(date.getTime() + (mins * 60 * 1000)); date.setTime(date.getTime() + (mins * 60 * 1000));
var expires = "; expires=" + date.toGMTString(); var expires = "; expires=" + date.toGMTString();
if(dn) dn = "domain=" + dn + "; "; if(dn) dn = "domain=" + dn + "; ";
document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path; document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path;
} }
} }
function cookieget(n) function cookieget(n)
{ {
var name = n + "="; var name = n + "=";
var ca = document.cookie.split(';'); var ca = document.cookie.split(';');
for(var i=0;i<ca.length;i++) { for(var i=0;i<ca.length;i++) {
var c = ca[i]; var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length); while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(name) == 0){ if (c.indexOf(name) == 0){
return c.substring(name.length,c.length);} return c.substring(name.length,c.length);}
} }
return false; return false;
} }
</script> </script>
</head> </head>
<body> <body>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$("#scrollsidebar").fix({ $("#scrollsidebar").fix({
float : 'right', //default.left or right float : 'right', //default.left or right
minStatue : cookieget('minStatue'), minStatue : cookieget('minStatue'),
skin : 'green', //default.gray or blue skin : 'green', //default.gray or blue
durationTime : 600 durationTime : 600
}); });
}); });
$(document).ready(function(){ $(document).ready(function(){
$("#subject").keydown(function(){ $("#subject").keydown(function(){
var curLength=$("#subject").val().length; var curLength=$("#subject").val().length;
if(curLength>50){ if(curLength>50){
var num=$("#subject").val().substr(0,50); var num=$("#subject").val().substr(0,50);
$("#subject").val(num); $("#subject").val(num);
} }
else{ else{
$("#textCount").text(50-$("#subject").val().length) $("#textCount").text(50-$("#subject").val().length)
} }
}) })
$("#subject").keyup(function(){ $("#subject").keyup(function(){
var curLength=$("#subject").val().length; var curLength=$("#subject").val().length;
if(curLength>50){ if(curLength>50){
var num=$("#subject").val().substr(0,50); var num=$("#subject").val().substr(0,50);
$("#subject").val(num); $("#subject").val(num);
} }
else{ else{
$("#textCount").text(50-$("#subject").val().length) $("#textCount").text(50-$("#subject").val().length)
} }
}) })
}) })
</script> </script>
<div class="scrollsidebar" id="scrollsidebar" style="float: right"> <div class="scrollsidebar" id="scrollsidebar" style="float: right">
<div class="side_content"> <div class="side_content">
<div class="side_list"> <div class="side_list">
<div class="side_title"><a title="<%= l(:label_feedback) %>" class="close_btn"><span><%= l(:label_feedback) %></span></a></div> <div class="side_title"><a title="<%= l(:label_feedback) %>" class="close_btn"><span><%= l(:label_feedback) %></span></a></div>
<div class="side_center"> <div class="side_center">
<div class="custom_service"> <div class="custom_service">
<% get_memo %> <% get_memo %>
<%= 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) %>
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
<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 %>
</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>
</div> </div>
</div> </div>
<div class="side_bottom"></div> <div class="side_bottom"></div>
</div> </div>
</div> </div>
<div class="show_btn"><span><%= l(:label_submit)%></span></div> <div class="show_btn"><span><%= l(:label_submit)%></span></div>
</div> </div>
</body> </body>

View File

@ -23,7 +23,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a> <a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% 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" %> <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %> <% end %>
</div> </div>
<% end%> <% end%>

View File

@ -13,7 +13,7 @@
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %>
<%= javascript_include_tag 'project', 'header','select_list_move' %> <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
@ -89,7 +89,7 @@
<%=l(:label_project_hosting_platform) %> <%=l(:label_project_hosting_platform) %>
</a> </a>
> >
<%= link_to @project.name, nil %> <%= link_to @project.name, project_path(@project.id) %>
</p> </p>
</div> </div>
<div class="search fl"> <div class="search fl">
@ -122,13 +122,12 @@
<!-- 项目得分 --> <!-- 项目得分 -->
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<a class="pr_info_name fl c_dark fb break_word" href="javascript:void(0)" target="_blank" > <%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
<%= l(:label_project_name) %><%= @project.name %>
<% if @project.is_public? %> <% if @project.is_public? %>
<span class="img_private"><%= l(:label_public)%></span> <span class="img_private"><%= l(:label_public)%></span>
<% else %> <% else %>
<span class="img_private"><%= l(:label_private)%></span> <span class="img_private"><%= l(:label_private)%></span>
<% end %></a> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div> <div>
@ -158,8 +157,8 @@
<!--邀请加入--> <!--邀请加入-->
<div class="subNavBox"> <div class="subNavBox">
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="expand_tools_expand('invit');"><%= l(:label_invite)%></div> <div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="$('#navContent_invit').toggle(500);"><%= l(:label_invite)%></div>
<ul class="navContent " style="display:block"> <ul class="navContent " style="display:block" id="navContent_invit">
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li> <li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
<% if User.current.allowed_to?(:manage_members, @project) %> <% if User.current.allowed_to?(:manage_members, @project) %>
<li><%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li> <li><%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>

View File

@ -28,11 +28,6 @@
添加于<%= format_time(@topic.created_on) %> 添加于<%= format_time(@topic.created_on) %>
</p> </p>
</div> </div>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'talk_edit fr'
) if @message.course_editable_by?(User.current) %>
<%= link_to( <%= link_to(
l(:button_delete), l(:button_delete),
{:action => 'destroy', :id => @topic}, {:action => 'destroy', :id => @topic},
@ -40,6 +35,11 @@
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr' :class => 'talk_edit fr'
) if @message.course_destroyable_by?(User.current) %> ) if @message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'talk_edit fr'
) if @message.course_editable_by?(User.current) %>
<div class="cl"></div> <div class="cl"></div>
<div class="talk_info mb10 upload_img break_word"><%= @topic.content.html_safe %></div> <div class="talk_info mb10 upload_img break_word"><%= @topic.content.html_safe %></div>
<div class="talk_info mb10"><%= link_to_attachments_course @topic, :author => false %></div> <div class="talk_info mb10"><%= link_to_attachments_course @topic, :author => false %></div>
@ -105,6 +105,7 @@
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %> <%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_submit),"javascript:void(0)",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%> <%= link_to l(:button_submit),"javascript:void(0)",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fl c_white" %>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>

View File

@ -1,15 +1,16 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= error_messages_for 'message' %> <%= error_messages_for 'message' %>
<% replying ||= false %> <% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> <% extra_option = replying ? { hidden: "hidden"} : { maxlength: 200 } %>
<li> <li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label> <div style="display:<%= replying ? 'none' : 'block'%>;" class="fl"><label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label></div>
<% if replying %> <% if replying %>
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> <div style="display: none;"><%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585 fl" }.merge(extra_option) %></div>
<% else %> <% else %>
<%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
<% end %> <% end %>
<div class="cl"></div>
<p id="subject_span" class="ml55"></p> <p id="subject_span" class="ml55"></p>
</li> </li>
<li class="ml60 mb5"> <li class="ml60 mb5">
@ -26,7 +27,7 @@
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li> <li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div> <div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<label class="fl" > <label class="fl" >
<span class="c_red">*</span>&nbsp; <span class="c_red">*</span>&nbsp;
<%= l(:field_description) %>&nbsp;&nbsp; <%= l(:field_description) %>&nbsp;&nbsp;

View File

@ -10,7 +10,7 @@
<% end %> <% end %>
<p id="subject_span" class="ml55"></p> <p id="subject_span" class="ml55"></p>
</li> </li>
<li class="ml60 mb5"> <li class="ml55 mb5">
<% unless replying %> <% unless replying %>
<% if @message.safe_attribute? 'sticky' %> <% if @message.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %> <%= f.check_box :sticky %>
@ -25,7 +25,7 @@
</li> </li>
<li> <li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div> <div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<label class="fl ml3" >&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label> <label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<%= text_area :quote,:quote,:style => 'display:none' %> <%= text_area :quote,:quote,:style => 'display:none' %>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<div class="cl"></div> <div class="cl"></div>

View File

@ -5,7 +5,7 @@
<% if @message.project %> <% if @message.project %>
<%#= board_breadcrumb(@message) %> <%#= 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>--> <!--<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"> <div class="ml15">
<ul> <ul>
<%= form_for @message, { :as => :message, <%= form_for @message, { :as => :message,
:url => {:action => 'edit'}, :url => {:action => 'edit'},

View File

@ -5,3 +5,4 @@ $('#quote_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
showAndScrollTo("reply", "message_content"); showAndScrollTo("reply", "message_content");
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight; $('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;
$("img").removeAttr("align");

View File

@ -117,7 +117,7 @@
<div> <div>
<!-- 昵称 --> <!-- 昵称 -->
<p style="width:630px;padding-left: 40px;"> <p style="width:730px;padding-left: 40px;">
<%= f.text_field :login, :required => true, :size => 25, :name => "login", :style => 'border:1px solid #d3d3d3;'%> <%= f.text_field :login, :required => true, :size => 25, :name => "login", :style => 'border:1px solid #d3d3d3;'%>
<span class='font_lighter'><%= l(:label_max_number) %></span> <span class='font_lighter'><%= l(:label_max_number) %></span>
<br/> <br/>

View File

@ -1,9 +1,3 @@
<script>
function clearMessage()
{
$("#news_comment").html("<%= escape_javascript(hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none') %><%= escape_javascript(kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字")%>");
}
</script>
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_news) %></h2> <h2 class="project_h2"><%= l(:label_course_news) %></h2>
@ -39,7 +33,7 @@
<%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%> <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
</div> </div>
<p class="mt10"> <p class="mt10">
<a href="javascript:void(0)" class="grey_btn fr ml10" onclick="clearMessage();"> <a href="javascript:void(0)" class="grey_btn fr ml10" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %> <%= l(:label_cancel_with_space) %>
</a> </a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();"> <a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">

View File

@ -1,10 +1,10 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); $("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
showModal('ajax-modal', '250px'); showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','111px'); //$('#ajax-modal').css('height','111px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='close_alert_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("poll_alert_form"); $('#ajax-modal').parent().addClass("poll_alert_form");

View File

@ -1,10 +1,10 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); $("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
showModal('ajax-modal', '250px'); showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','80px'); //$('#ajax-modal').css('height','80px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='close_alert_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("poll_alert_form"); $('#ajax-modal').parent().addClass("poll_alert_form");

View File

@ -20,7 +20,7 @@
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@project), :remote => true, :method => :post}) do |f| %> <%= form_for(@member, {:as => :membership, :url => course_memberships_path(@project), :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(@project, :format => 'js',:flag => true) }')" %> <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@project, :format => 'js',:flag => true) }')" %>
<div class="cl"></div> <div class="cl"></div>

View File

@ -33,8 +33,18 @@
</li> </li>
<% roles.each do |role| %> <% roles.each do |role| %>
<li class="fl mr5"> <li class="fl mr5">
<%= check_box_tag 'membership[role_ids][]', role.id %> <%= check_box_tag 'membership[role_ids][]', role.id %>
<%= h role %> <% if User.current.language == "zh" %>
<% if role.id == 3 %>
<label >管理人员</label>
<% elsif role.id == 4 %>
<label >开发人员</label>
<% else %>
<label >报告人员</label>
<% end %>
<% else %>
<label ><%= h role %></label>
<% end %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -2,7 +2,12 @@
<% <%
roles = Role.givable.all roles = Role.givable.all
if @project.project_type == Project::ProjectType_course if @project.project_type == Project::ProjectType_course
roles = roles[3..5] if User.current.language == "zh"
roles = ["管理人员","开发者","报告人员"]
else
roles = ["管理人员","开发者","报告人员"]
# roles = roles[3..5]
end
else else
roles = roles[0..2] roles = roles[0..2]
end end
@ -18,7 +23,23 @@
<li > <li >
<%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %> <%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %>
<span class="w180_h fl"> <span class="w180_h fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %> <!--区分中英文角色显示的不同-->
<% if User.current.language == "zh" %>
<% zh_roles = [] %>
<% member.roles.each do |role| %>
<% if role.id == 3
zh_roles << "管理人员"
elsif role.id == 4
zh_roles << "开发人员"
else
zh_roles << "报告人员"
end
%>
<% end %>
<%= h zh_roles.sort.reverse.collect(&:to_s).join(', ') %>
<% else %>
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<% end %>
<%= 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'}}
@ -27,7 +48,18 @@
<ul style="text-align: left;" > <ul style="text-align: left;" >
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), <%= check_box_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> <!--编辑时候显示成员,中英文切换后面需从数据库的角度优化-->
<% if User.current.language == "zh" %>
<% if role.id == 3 %>
<label >管理人员</label>
<% elsif role.id == 4 %>
<label >开发人员</label>
<% else %>
<label >报告人员</label>
<% end %>
<% else %>
<label ><%= h role %></label>
<% end %>
</ul> </ul>
<!--<br/>--> <!--<br/>-->
<% end %> <% end %>
@ -91,7 +123,7 @@
<p class="c_blue fb mt10 mb5"><%= l(:label_member_new) %></p> <p class="c_blue fb mt10 mb5"><%= l(:label_member_new) %></p>
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<div class="member_search"> <div class="member_search">
<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_project_memberships_path(@project, :format => 'js') }')" %> <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
<div class="cl"></div> <div class="cl"></div>
@ -107,7 +139,17 @@
<% roles.each do |role| %> <% roles.each do |role| %>
<li> <li>
<%= check_box_tag 'membership[role_ids][]', role.id %> <%= check_box_tag 'membership[role_ids][]', role.id %>
<label ><%= h role %></label> <% if User.current.language == "zh" %>
<% if role.id == 3 %>
<label >管理人员</label>
<% elsif role.id == 4 %>
<label >开发人员</label>
<% else %>
<label >报告人员</label>
<% end %>
<% else %>
<label ><%= h role %></label>
<% end %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -1,8 +1,8 @@
<!-- new repository new by xianbo--> <!-- new repository new by xianbo-->
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= l(:label_repository_new_repos) %></h2> <h2 class="project_h2"><%= l(:label_repository_new_repos) %></h2>
</div> </div>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form'} do |f| %> <%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form'} do |f| %>
<%= render :partial => 'form_create', :locals => {:f => f} %> <%= render :partial => 'form_create', :locals => {:f => f} %>
<% end %> <% end %>

View File

@ -30,13 +30,13 @@
</p> </p>
</div> </div>
</div> </div>
<div class="repos_more"><a id="showgithelp" value="hide_help" onclick ="showhelpAndScrollTo('repos_git_more','repos_git_more'); return false;" class="c_dblue lh23">收起Git操作指南</a></div> <div class="repos_more"><a id="showgithelp" value="show_help" onclick ="showhelpAndScrollTo('repos_git_more'); " class="c_dblue lh23">展开Git操作指南</a></div>
<div id="repos_git_more"> <div id="repos_git_more">
<br> <br>
<div class=" c_dark f14"> <div class=" c_dark f14">
<p>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码</p> <p>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码</p>
<p>通过cmd命令提示符进入代码对应文件夹的根目录假设当前用户的登录名为user版本库名称为demo需要操作的版本库分支为branch。
<p>建立版本库文件夹,打开命令行执行如下</p> 如果是首次提交代码,执行如下命令</p>
</div> </div>
<div class="repos_explain"> <div class="repos_explain">
<p>git init</p> <p>git init</p>
@ -46,19 +46,19 @@
<p>git commit -m "first commit"</p> <p>git commit -m "first commit"</p>
<p>git remote add origin <p>git remote add origin
http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git http://user_demo@repository.trustie.net/user/demo.git
</p> </p>
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p> <p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u origin master:master</p> <p>git push -u origin branch:branch</p>
</div> </div>
<!--repos_explain end--> <!--repos_explain end-->
<div class="c_dark f14"> <div class="c_dark f14">
<p>已经有本地库,还没有配置远程地址,打开命令行执行如下:</p> <p>已经有本地库,还没有配置远程地址,打开命令行执行如下:</p>
</div> </div>
<div class="repos_explain"> <div class="repos_explain">
<p>git remote add origin http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git</p> <p>git remote add origin http://user_demo@repository.trustie.net/user/demo.git</p>
<p>git add .</p> <p>git add .</p>
@ -66,14 +66,14 @@
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p> <p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u origin master:master</p> <p>git push -u origin branch:branch</p>
</div> </div>
<!--repos_explain end--> <!--repos_explain end-->
<div class="c_dark f14"> <div class="c_dark f14">
<p>已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:</p> <p>已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:</p>
</div> </div>
<div class="repos_explain"> <div class="repos_explain">
<p>git clone http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git</p> <p>git clone http://user_demo@repository.trustie.net/user/demo.git</p>
<p>git push</p> <p>git push</p>
@ -87,7 +87,7 @@
</div> </div>
<div class="repos_explain"> <div class="repos_explain">
<p>git remote add trustie <p>git remote add trustie
http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git http://user_demo@repository.trustie.net/user/demo.git
</p> </p>
<p>git add .</p> <p>git add .</p>
@ -96,7 +96,7 @@
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p> <p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u trustie master:master</p> <p>git push -u trustie branch:branch</p>
<p><a href="/users/646" class="c_orange">李海</a>提供</p> <p><a href="/users/646" class="c_orange">李海</a>提供</p>
</div> </div>

View File

@ -1,110 +1,110 @@
<script type="text/javascript"> <script type="text/javascript">
// $(this).ready(function(){ // $(this).ready(function(){
// $('.tag_show').hover(function() { // $('.tag_show').hover(function() {
// $(this).children("span").show(); // $(this).children("span").show();
// }, function() { // }, function() {
// $(this).children("span").hide(); // $(this).children("span").hide();
// }); // });
// }) // })
</script> </script>
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 7代表竞赛 9代表课程--> <!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 7代表竞赛 9代表课程-->
<% @tags = obj.reload.tag_list %> <% @tags = obj.reload.tag_list %>
<% if non_list_all and (@tags.size > 0) %> <% if non_list_all and (@tags.size > 0) %>
<!-- 这里是显示的非主页的tag 所以当tag数量较多时 不必全部显示 用“更多”代替 --> <!-- 这里是显示的非主页的tag 所以当tag数量较多时 不必全部显示 用“更多”代替 -->
<% if @tags.size > Setting.show_tags_length.to_i then %> <% if @tags.size > Setting.show_tags_length.to_i then %>
<% i = 0 %> <% i = 0 %>
<% until i>Setting.show_tags_length.to_i do %> <% until i>Setting.show_tags_length.to_i do %>
<div id="tag"> <div id="tag">
<%= link_to @tags[i], :controller => "tags", :action => "index", :q => @tags[i], :object_flag => object_flag, :obj_id => obj.id %> <%= link_to @tags[i], :controller => "tags", :action => "index", :q => @tags[i], :object_flag => object_flag, :obj_id => obj.id %>
</div> </div>
<% i += 1 %> <% i += 1 %>
<% end %> <% end %>
<%= more_tags(obj.id,object_flag)%> <%= more_tags(obj.id,object_flag)%>
<% else %> <% else %>
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<div id="tag"> <div id="tag">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<% else %> <% else %>
<!-- 用来显示三大对象的主页中的tag 故是全部显示 --> <!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
<% if @tags.size > 0 %> <% if @tags.size > 0 %>
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<!--object_flag == '2'为项目 项目暂时单独出来,后面其它几个选项也需样式重构--> <!--object_flag == '2'为项目 项目暂时单独出来,后面其它几个选项也需样式重构-->
<% if object_flag == '2' %> <% if object_flag == '2' %>
<span class="re_tag f_l"> <span class="re_tag f_l">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
<% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %> <% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
<% end %> <% end %>
</span> </span>
<% else %> <% else %>
<div id="tag"> <div id="tag">
<span class="tag_show"> <span class="tag_show">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
<!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 --> <!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 -->
<% case object_flag %> <% case object_flag %>
<% when '1' %> <% when '1' %>
<% if User.current.eql?(obj) %> <% if User.current.eql?(obj) %>
<span class='del'> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %> <% end %>
<% when '3' %> <% when '3' %>
<% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %> <% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %>
<span class='del'> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %> <% end %>
<% when '4' %> <% when '4' %>
<% if obj.author_id == User.current.id %> <% if obj.author_id == User.current.id %>
<span class='del'> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %> <% end %>
<% when '5' %> <% when '5' %>
<% test = Forum.find(obj.id) %> <% test = Forum.find(obj.id) %>
<% if test && test.creator_id == User.current.id %> <% if test && test.creator_id == User.current.id %>
<span class='del'> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %> <% end %>
<% when '6' %> <% when '6' %>
<%# if (User.current.logged? && <%# if (User.current.logged? &&
User.current.admin? User.current.admin?
# && (@project && User.current.member_of?(@project)) # && (@project && User.current.member_of?(@project))
) )
%> %>
<% if obj.author_id == User.current.id || User.current.admin?%> <% if obj.author_id == User.current.id || User.current.admin?%>
<span class='del'> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %> <% end %>
<% when '7' %> <% when '7' %>
<% if obj.author_id == User.current.id %> <% if obj.author_id == User.current.id %>
<span class='del'> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %> <% end %>
<% when '9' %> <% when '9' %>
<% if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %> <% if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %>
<span class='del'> <span class='del'>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> :taggable_id => obj.id, :taggable_type => object_flag %>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -39,9 +39,9 @@
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
</table> </table>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -1,11 +1,11 @@
<% selector = ".#{watcher_css(watched)}" %> <% selector = ".#{watcher_css(watched)}" %>
<% id_selector = "#{watcher_css(watched)}" %> <% id_selector = "#{watcher_css(watched)}" %>
if($("<%= selector %>").get(0) == undefined) if($("<%= selector %>").get(0) == undefined)
{ {
$("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link_for_project(watched, user) %>")}); $("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link_for_project(watched, user) %>")});
} }
else else
{ {
$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")}); $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")});
} }

View File

@ -27,7 +27,7 @@
(<%= course.members.count %>人) (<%= course.members.count %>人)
<% files_count = course.attachments.count %> <% files_count = course.attachments.count %>
<% if files_count > 0%> <% if files_count > 0%>
(<%= link_to "#{files_count.to_s}份", course_files_path(course) %>资料) (<%= link_to "#{files_count.to_s}份", course_files_path(course) %>公开资料)
<% end %> <% end %>
</div> </div>
</li> </li>

View File

@ -1,25 +1,25 @@
<li style="overflow:hidden;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'> <li style="overflow:hidden;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;"> <div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %> <%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</div> </div>
<!-- 上左下右 --> <!-- 上左下右 -->
<div style="float: left; margin-left: 10px; width: 380px;"> <div style="float: left; margin-left: 10px; width: 380px;">
<% unless project.is_public %> <% unless project.is_public %>
<span class="private_project"> <span class="private_project">
<%= l(:label_private) %> <%= l(:label_private) %>
</span> </span>
<% end %> <% end %>
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to l(:label_project_member_amount, :count => projectCount(project)), project_member_path(project) ,:course =>'0' %>) (<%= link_to l(:label_project_member_amount, :count => projectCount(project)), project_member_path(project) ,:course =>'0' %>)
</div> </div>
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;min-height: 42px;"> <div style=" float: left;margin:5px; margin-left: 10px; width: 380px;min-height: 42px;">
<span class='font_lighter' title ='<%= project.short_description%>'> <%=project.description.truncate(90, omission: '...')%> </span> <span class='font_lighter' title ='<%= project.short_description%>'> <%=project.description.truncate(90, omission: '...')%> </span>
</div> </div>
<div > <div >
<%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s, <%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s,
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;", :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
:title => l(:label_project_score_tips), :title => l(:label_project_score_tips),
:class => "tooltip", :class => "tooltip",
:id => "tooltip-#{project.id}" %> :id => "tooltip-#{project.id}" %>
</div> </div>
</li> </li>

View File

@ -1 +1 @@
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 20.minutes, :key => '_trustie_session', :domain => :all Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 90.minutes, :key => '_trustie_session', :domain => :all

View File

@ -11,7 +11,7 @@ zh:
# #
# 公共变量 # 公共变量
# #
label_max_number: "登录名是在网站中显示的您的公开标识,只能为英文和数字。" label_max_number: "登录名是在网站中显示的您的公开标识,只能为下划线、@、.以及英文和数字。"
field_login: 登录名 field_login: 登录名
field_password: 密码 field_password: 密码

View File

@ -351,7 +351,7 @@ zh:
# 意见反馈 # 意见反馈
# #
label_feedback: 意见反馈 label_feedback: 意见反馈
label_feedback_tips: "有什么想说的,尽管来咆哮吧~~" label_feedback_tips: "欢迎反馈网站问题,课程中遇到的问题请反馈给相关老师!"
label_technical_support: "技术支持:" label_technical_support: "技术支持:"
label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!" label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!"
label_feedback_value: "该帖来自用户反馈:)" label_feedback_value: "该帖来自用户反馈:)"

View File

@ -15,8 +15,8 @@ zh:
label_forum_all: 公共贴吧 label_forum_all: 公共贴吧
label_school_all: 中国高校 label_school_all: 中国高校
label_contest_innovate: 创新竞赛 label_contest_innovate: 创新竞赛
#label_software_user: 软件创客 label_software_user: 软件创客
#label_requirement_enterprise: 软件众包 label_requirement_enterprise: 软件众包
label_stores_index: 资源搜索 label_stores_index: 资源搜索
label_login: 登录 label_login: 登录

View File

@ -338,7 +338,7 @@ zh:
label_input_email: 请输入邮箱地址 label_input_email: 请输入邮箱地址
label_invite_trustie_user: "邀请Trustie注册用户" label_invite_trustie_user: "邀请Trustie注册用户"
label_invite_trustie_user_tips: "请输入用户名称来搜索好友" label_invite_trustie_user_tips: "输入姓名、邮箱、昵称"
label_user_role_null: 用户和角色不能留空! label_user_role_null: 用户和角色不能留空!
label_invite_project: 邀请您加入项目 label_invite_project: 邀请您加入项目
label_invite_success: 邀请成功 label_invite_success: 邀请成功
@ -415,3 +415,4 @@ zh:
# #
field_sharing: 共享 field_sharing: 共享
label_title_code_review: 代码评审 label_title_code_review: 代码评审
label_home_non_project: 您还没有创建项目,您可以查看系统的其它项目!

View File

@ -227,6 +227,8 @@ RedmineApp::Application.routes.draw do
match '/projects/search', :via => [:get, :post] match '/projects/search', :via => [:get, :post]
match '/users/search', :via => [:get, :post] match '/users/search', :via => [:get, :post]
#end #end
match 'account/heartbeat', to: 'account#heartbeat', :via => :get
match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post] match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
match 'account/register', :via => [:get, :post], :as => 'register' match 'account/register', :via => [:get, :post], :as => 'register'

View File

@ -0,0 +1,5 @@
class AddIndexToHomeworkattachBidId < ActiveRecord::Migration
def change
add_index(:homework_attaches,:bid_id)
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToStudentforcourseStudentId < ActiveRecord::Migration
def change
add_index(:students_for_courses,:student_id)
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToStudentforcourseCourseId < ActiveRecord::Migration
def change
add_index(:students_for_courses,:course_id)
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToHomeworkforcourseCourseId < ActiveRecord::Migration
def change
add_index(:homework_for_courses,:course_id)
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToHomeworkforcourseBidId < ActiveRecord::Migration
def change
add_index(:homework_for_courses,:bid_id)
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,30 @@
#coding=utf-8 #coding=utf-8
#!/usr/bin/env python #!/usr/bin/env python
# 脚本用于刷新版本库由git hooks里进行调用传入参数为git仓库路径 # 脚本用于刷新版本库由git hooks里进行调用传入参数为git仓库路径
# 需要配置rails项目地址 # 需要配置rails项目地址
# 必须装此文件放在git的存放目录现在是 /home/pdl/redmine-2.3.2-0/apache2/htdocs # 必须装此文件放在git的存放目录现在是 /home/pdl/redmine-2.3.2-0/apache2/htdocs
import sys import sys
import os import os
import urllib import urllib
import urllib2 import urllib2
RAILS_URL = 'http://192.168.128.128:3000/' RAILS_URL = 'http://192.168.128.128:3000/'
def get_git_path(): def get_git_path():
return sys.argv[1] return sys.argv[1]
path=os.path.realpath(sys.argv[0]) path=os.path.realpath(sys.argv[0])
if os.path.isfile(path): if os.path.isfile(path):
path=os.path.dirname(os.path.dirname(path)) path=os.path.dirname(os.path.dirname(path))
return os.path.abspath(path) return os.path.abspath(path)
def post_http_data(url, data): def post_http_data(url, data):
data_urlencode = urllib.urlencode(data) data_urlencode = urllib.urlencode(data)
req = urllib2.Request(url = url,data =data_urlencode) req = urllib2.Request(url = url,data =data_urlencode)
res_data = urllib2.urlopen(req) res_data = urllib2.urlopen(req)
#res = res_data.read() #res = res_data.read()
#return res #return res
path = get_git_path() path = get_git_path()
post_http_data(RAILS_URL + 'git_callback/post_update', {'root_url': path}) post_http_data(RAILS_URL + 'git_callback/post_update', {'root_url': path})

View File

@ -55,7 +55,7 @@ module RailsKindeditor
}" }"
else else
"KindEditor.ready(function(K){ "KindEditor.ready(function(K){
#{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}); #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste');
});" });"
end end
end end
@ -101,4 +101,4 @@ module RailsKindeditor
@template.send("kindeditor", @object_name, method, objectify_options(options)) @template.send("kindeditor", @object_name, method, objectify_options(options))
end end
end end
end end

11
lib/tasks/avatar.rake Normal file
View File

@ -0,0 +1,11 @@
desc "compress and backup avatar"
task :compress_avatar => :environment do
path = File.join(Rails.root, "public/images/avatars/User")
Dir.foreach(path) do |f|
if f.to_s =~ /^\d+$/
puts f
image = Trustie::Utils::Image.new(File.join(path,f), true)
image.compress(300)
end
end
end

View File

@ -1 +1,2 @@
require 'trustie/utils' require 'trustie/utils'
require 'trustie/utils/image'

View File

@ -17,4 +17,4 @@ end
if __FILE__ == $0 if __FILE__ == $0
puts Trustie::Utils.digest('/Users/guange/Downloads/QQ_V4.0.2.dmg') puts Trustie::Utils.digest('/Users/guange/Downloads/QQ_V4.0.2.dmg')
end end

View File

@ -0,0 +1,35 @@
#coding=utf-8
module Trustie
module Utils
class Image
def initialize(file, bak)
@file = file
@bak = bak
end
def compress(size=300)
backup if @bak
begin
f = Magick::ImageList.new(@file)
if f.format != 'GIF'
width = size
if f[0].columns > width
proportion = (width/f[0].columns.to_f)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height.to_i)
f.write(@file)
end
end
rescue Exception => e
logger.error "[Error] compress : ===> #{e}"
end
end
def backup
FileUtils.cp @file, "#{@file}.bak"
end
end
end
end

View File

@ -1,6 +1,6 @@
source 'http://ruby.taobao.org' source 'http://ruby.taobao.org'
gem 'rich', '1.4.6' gem 'rich', '1.4.6'
gem 'kaminari' gem 'kaminari'
gem 'htmlentities' gem 'htmlentities'
gem 'paperclip', '~> 3.5.4' gem 'paperclip', '~> 3.5.4'

View File

@ -0,0 +1,37 @@
KindEditor.plugin('paste', function(K) {
var editor = this,
name = 'paste';
var contentWindow = document.getElementsByTagName('iframe')[0].contentWindow;
contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) {
// use event.originalEvent.clipboard for newer chrome versions
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
console.log(JSON.stringify(items)); // will give you the mime types
// find pasted image among pasted items
var blob = null;
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") === 0) {
blob = items[i].getAsFile();
}
}
// load image if there is a pasted image
if (blob !== null) {
var reader = new FileReader();
reader.onload = function(event) {
console.log(event.target.result); // data url!
var data = new FormData();
data.append("imgFile", blob, "imageFilename.png");
$.ajax({
url: '/kindeditor/upload?dir=image',
contentType: false,
type: 'POST',
data: data,
processData: false,
success: function(data) {
editor.exec('insertimage', JSON.parse(data).url);
}
});
};
reader.readAsDataURL(blob);
}
}
});

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