Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
6d46c265c1
4
Gemfile
4
Gemfile
|
@ -6,6 +6,10 @@ unless RUBY_PLATFORM =~ /w32/
|
|||
gem 'iconv'
|
||||
end
|
||||
|
||||
source 'http://rubygems.oneapm.com' do
|
||||
gem 'oneapm_rpm'
|
||||
end
|
||||
|
||||
gem "mysql2", "= 0.3.18"
|
||||
gem 'redis-rails'
|
||||
gem 'rubyzip'
|
||||
|
|
|
@ -99,6 +99,19 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc '留言详情'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :comment_parent_id,type:Integer,desc:'留言id'
|
||||
optional :course_id,type:Integer,desc:'课程id'
|
||||
end
|
||||
get ':comment_parent_id/comment_details' do
|
||||
cs = CommentService.new
|
||||
jour = cs.comment_detail params,current_user
|
||||
present :data, jour, with: Mobile::Entities::Jours
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -98,6 +98,7 @@ module Mobile
|
|||
params do
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer,desc: '被留言的用户id'
|
||||
requires :page,type:Integer,desc:'请求数据的页码'
|
||||
end
|
||||
get ':user_id/messages' do
|
||||
us = UsersService.new
|
||||
|
@ -106,19 +107,46 @@ module Mobile
|
|||
present :status,0
|
||||
end
|
||||
|
||||
desc "给用户留言或回复用户留言"
|
||||
desc "回复用户留言"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer,desc: '被留言的用户id'
|
||||
requires :content,type:String,desc:'留言内容'
|
||||
optional :refer_user_id,type:Integer,desc:'被回复的用户id'
|
||||
requires :ref_user_id,type:Integer,desc:'被回复的用户id'
|
||||
requires :parent_id,type:Integer,desc:'留言父id'
|
||||
requires :ref_message_id,type:Integer,desc:'引用消息id'
|
||||
optional :type,type:Integer,desc:'回复类型'
|
||||
optional :course_id,type:Integer,desc:'课程id'
|
||||
end
|
||||
post ':user_id/leave_message' do
|
||||
post ':user_id/reply_message' do
|
||||
us = UsersService.new
|
||||
jours = us.leave_messages params,current_user
|
||||
jours = us.reply_user_messages params,current_user
|
||||
present :status,0
|
||||
end
|
||||
|
||||
desc "给用户留言"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer,desc:'被留言的用户id'
|
||||
requires :content, type: String,desc:'留言内容'
|
||||
end
|
||||
post ':user_id/leave_message' do
|
||||
us = UsersService.new
|
||||
us.leave_message params,current_user
|
||||
present :data,0
|
||||
end
|
||||
|
||||
desc "与我相关"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :page,type:Integer,desc:'页码'
|
||||
end
|
||||
get ':user_id/all_my_dynamic' do
|
||||
us = UsersService.new
|
||||
my_jours = us.reply_my_messages params,current_user
|
||||
present :data,my_jours,with:Mobile::Entities::Jours
|
||||
present :status,0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,6 +14,11 @@ module Mobile
|
|||
else
|
||||
f.send(field)
|
||||
end
|
||||
else
|
||||
case f
|
||||
when :course_name
|
||||
f[:jour_type] == "Course" ? f.course.name : ""
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -27,6 +32,11 @@ module Mobile
|
|||
jours_expose :notes
|
||||
jours_expose :m_reply_id
|
||||
jours_expose :m_parent_id
|
||||
expose :course,using:Mobile::Entities::Course do |f,opt|
|
||||
if f.is_a?(::JournalsForMessage) && f[:jour_type] == "Course"
|
||||
f.course
|
||||
end
|
||||
end
|
||||
expose :reply_user,using: Mobile::Entities::User do |f, opt|
|
||||
f.at_user
|
||||
end
|
||||
|
|
|
@ -336,6 +336,7 @@ class AccountController < ApplicationController
|
|||
:expires => 1.month.from_now,
|
||||
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
||||
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
||||
:domain => Redmine::Configuration['cookie_domain'],
|
||||
:httponly => true
|
||||
}
|
||||
cookies[autologin_cookie_name] = cookie_options
|
||||
|
|
|
@ -199,7 +199,7 @@ class ApplicationController < ActionController::Base
|
|||
# Logs out current user
|
||||
def logout_user
|
||||
if User.current.logged?
|
||||
cookies.delete(autologin_cookie_name)
|
||||
cookies.delete(autologin_cookie_name, domain: :all)
|
||||
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
|
||||
self.logged_user = nil
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class AvatarController < ApplicationController
|
||||
|
||||
|
||||
|
||||
include ActionView::Helpers::NumberHelper
|
||||
#before_filter :set_cache_buster
|
||||
include AvatarHelper
|
||||
|
||||
|
||||
def upload
|
||||
# Make sure that API users get used to set this content type
|
||||
# as it won't trigger Rails' automatic parsing of the request body for parameters
|
||||
|
@ -24,48 +24,58 @@ class AvatarController < ApplicationController
|
|||
else
|
||||
@image_file=params[:filename]
|
||||
end
|
||||
@temp_file = StringIO.new(@temp_file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @temp_file && (@temp_file.size > 0)
|
||||
diskfile=disk_filename(@source_type,@source_id)
|
||||
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
||||
if @temp_file.size > Setting.upload_avatar_max_size.to_i
|
||||
@status = 1
|
||||
@msg = l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i))
|
||||
elsif Trustie::Utils::Image.new(@temp_file).image?
|
||||
diskfile=disk_filename(@source_type,@source_id)
|
||||
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
||||
|
||||
# 用户头像上传时进行特别处理
|
||||
if @source_type == 'User'
|
||||
# 用户头像上传时进行特别处理
|
||||
if @source_type == 'User'
|
||||
diskfile += "temp"
|
||||
@urlfile += "temp"
|
||||
end
|
||||
|
||||
logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)")
|
||||
path = File.dirname(diskfile)
|
||||
unless File.directory?(path)
|
||||
FileUtils.mkdir_p(path)
|
||||
end
|
||||
md5 = Digest::MD5.new
|
||||
File.open(diskfile, "wb") do |f|
|
||||
if @temp_file.respond_to?(:read)
|
||||
buffer = ""
|
||||
while (buffer = @temp_file.read(8192))
|
||||
f.write(buffer)
|
||||
md5.update(buffer)
|
||||
end
|
||||
else
|
||||
f.write(@temp_file)
|
||||
md5.update(@temp_file)
|
||||
end
|
||||
|
||||
logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)")
|
||||
path = File.dirname(diskfile)
|
||||
unless File.directory?(path)
|
||||
FileUtils.mkdir_p(path)
|
||||
end
|
||||
md5 = Digest::MD5.new
|
||||
File.open(diskfile, "wb") do |f|
|
||||
if @temp_file.respond_to?(:read)
|
||||
@temp_file.rewind
|
||||
buffer = ""
|
||||
while (buffer = @temp_file.read(8192))
|
||||
f.write(buffer)
|
||||
md5.update(buffer)
|
||||
end
|
||||
else
|
||||
f.write(@temp_file)
|
||||
md5.update(@temp_file)
|
||||
end
|
||||
end
|
||||
|
||||
Trustie::Utils::Image.new(diskfile,true).compress(300)
|
||||
@status = 0
|
||||
@msg = ''
|
||||
else
|
||||
@status = 2
|
||||
@msg = l(:not_valid_image_file)
|
||||
end
|
||||
# self.digest = md5.hexdigest
|
||||
end
|
||||
@temp_file = nil
|
||||
|
||||
image = Trustie::Utils::Image.new(diskfile,true)
|
||||
image.compress(300)
|
||||
|
||||
respond_to do |format|
|
||||
format.json{
|
||||
render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html'
|
||||
render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html'
|
||||
return
|
||||
}
|
||||
format.js
|
||||
|
|
|
@ -675,11 +675,12 @@ class BidsController < ApplicationController
|
|||
#删除作业
|
||||
#by xianbo
|
||||
def homework_destroy
|
||||
@bid_to_destroy = Bid.find params[:course_id]
|
||||
@bid_to_destroy = Bid.find params[:id]
|
||||
course_url = course_homework_path(@bid_to_destroy.courses.first)
|
||||
(render_403; return false) unless User.current.admin?||User.current.id==@bid_to_destroy.author_id
|
||||
@bid_to_destroy.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.html { redirect_to course_url }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
|
|
|
@ -67,9 +67,7 @@ class FilesController < ApplicationController
|
|||
end
|
||||
sort = "#{@sort} #{@order}"
|
||||
end
|
||||
|
||||
# show_attachments [@course]
|
||||
|
||||
begin
|
||||
q = "%#{params[:name].strip}%"
|
||||
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||
|
@ -108,14 +106,18 @@ class FilesController < ApplicationController
|
|||
end
|
||||
sort = "#{@sort} #{@order}"
|
||||
end
|
||||
|
||||
begin
|
||||
q = "%#{params[:name].strip}%"
|
||||
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||
if params[:insite]
|
||||
@result = find_public_attache q,sort
|
||||
@result = visable_attachemnts_insite @result,@project
|
||||
@searched_attach = paginateHelper @result,10
|
||||
if q == "%%"
|
||||
@result = []
|
||||
@searched_attach = paginateHelper @result,10
|
||||
else
|
||||
@result = find_public_attache q,sort
|
||||
@result = visable_attachemnts_insite @result,@project
|
||||
@searched_attach = paginateHelper @result,10
|
||||
end
|
||||
else
|
||||
@result = find_project_attache q,@project,sort
|
||||
@result = visable_attachemnts @result
|
||||
|
|
|
@ -126,11 +126,11 @@ class IssuesController < ApplicationController
|
|||
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
||||
@priorities = IssuePriority.active
|
||||
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
|
||||
|
||||
|
||||
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
|
||||
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
respond_to do |format|``
|
||||
format.html {
|
||||
retrieve_previous_and_next_issue_ids
|
||||
render :template => 'issues/show', :layout => @project_base_tag#by young
|
||||
|
@ -169,7 +169,7 @@ class IssuesController < ApplicationController
|
|||
attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
|
||||
redirect_to new_project_issue_url(@issue.project, :issue => attrs)
|
||||
else
|
||||
redirect_to issue_url(@issue)
|
||||
redirect_to issue_url(@issue.id)
|
||||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
|
||||
|
@ -239,7 +239,8 @@ class IssuesController < ApplicationController
|
|||
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default issue_path(@issue) }
|
||||
|
||||
format.html { redirect_to issue_url(@issue.id) }
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
|
|
|
@ -247,9 +247,9 @@ class ProjectsController < ApplicationController
|
|||
# 1、自动注册
|
||||
# 2、加入项目、创建角色
|
||||
# 3、用户得分
|
||||
if params[:email]
|
||||
user = User.find_by_mail(params[:email].to_s)
|
||||
Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id)
|
||||
if params[:mail]
|
||||
Member.create(:role_ids => [4], :user_id => params[:user],:project_id => params[:id])
|
||||
UserGrade.create(:user_id =>params[:user], :project_id => params[:id])
|
||||
end
|
||||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||
return
|
||||
|
@ -348,7 +348,7 @@ class ProjectsController < ApplicationController
|
|||
if !params[:mail].blank? && User.find_by_mail(params[:mail].to_s).nil?
|
||||
email = params[:mail]
|
||||
Mailer.run.send_invite_in_project(email, @project, User.current)
|
||||
@is_zhuce =false
|
||||
@is_zhuce = false
|
||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||
elsif !User.find_by_mail(params[:mail].to_s).nil?
|
||||
user = User.find_by_mail(params[:mail].to_s)
|
||||
|
|
|
@ -9,10 +9,14 @@ class ZipdownController < ApplicationController
|
|||
|
||||
#统一下载功能
|
||||
def download
|
||||
begin
|
||||
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => params[:filename], :type => detect_content_type(params[:file])
|
||||
rescue => e
|
||||
render file: 'public/no_file_found.html'
|
||||
if User.current.logged?
|
||||
begin
|
||||
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => params[:filename], :type => detect_content_type(params[:file])
|
||||
rescue => e
|
||||
render file: 'public/no_file_found.html'
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -47,6 +47,18 @@ module AccountHelper
|
|||
user
|
||||
end
|
||||
|
||||
# 自动创建一个新用户,但是初始状态是锁定的
|
||||
def automatically_register_lock(user, &block)
|
||||
user.lock
|
||||
user.last_login_on = Time.now
|
||||
if user.save
|
||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||
else
|
||||
yield if block_given?
|
||||
end
|
||||
user
|
||||
end
|
||||
|
||||
def administrator_manually__register(user, &block)
|
||||
if user.save
|
||||
UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0)
|
||||
|
|
|
@ -622,8 +622,8 @@ module ApplicationHelper
|
|||
# 公开项目资源可以引用,admin和管理员和资源上传者拥有设置公开私有权限
|
||||
def authority_pubilic_for_files(project, file)
|
||||
@result = false
|
||||
if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id || User.current.admin) &&
|
||||
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
|
||||
if (is_project_manager?(User.current.id, @project.id) && User.current.allowed_to?(:manage_files, project)) || file.author_id == User.current.id || User.current.admin &&
|
||||
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
|
||||
@result = true
|
||||
end
|
||||
return @result
|
||||
|
|
|
@ -65,6 +65,16 @@ module ProjectsHelper
|
|||
content_tag('div', content, :class => "tabs")
|
||||
end
|
||||
|
||||
# 判断我的项目中是否有重名项目
|
||||
def judge_same_projectname(user, project_name)
|
||||
result = false
|
||||
my_projects = user.projects
|
||||
my_projects.each do |mp|
|
||||
result = true if mp.name == project_name
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
# Added by young
|
||||
def course_settings_tabs
|
||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
||||
|
|
|
@ -255,7 +255,7 @@ module QueriesHelper
|
|||
# Give it a name, required to be valid
|
||||
@query = IssueQuery.new(:name => "_")
|
||||
@query.project = @project
|
||||
params[:f] = %w(subject status_id priority_id author_id assigned_to_id) unless params[:status_id].nil?
|
||||
params[:f] = %w(subject status_id priority_id author_id assigned_to_id created_on) unless params[:status_id].nil?
|
||||
params[:op] = {'subject' => "~" ,
|
||||
'status_id' => ( params[:status_id] == '0' ? "!":"=" ),
|
||||
'priority_id' => ( params[:priority_id] == '0' ? "!":"=" ),
|
||||
|
@ -266,6 +266,22 @@ module QueriesHelper
|
|||
'priority_id' => [params[:priority_id]],
|
||||
'author_id' => [params[:author_id]],
|
||||
'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil?
|
||||
if(params[:status_id] != nil)
|
||||
if( params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='' &&
|
||||
params[:issue_create_date_end]!=nil && params[:issue_create_date_end]!='' )
|
||||
params[:op][:created_on]='><'
|
||||
params[:v][:created_on]=[params[:issue_create_date_start],params[:issue_create_date_end]]
|
||||
elsif(params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='')
|
||||
params[:op][:created_on]='>='
|
||||
params[:v][:created_on]=[params[:issue_create_date_start]]
|
||||
elsif(params[:issue_create_date_end]!=nil && params[:issue_create_date_end]!='')
|
||||
params[:op][:created_on]='<='
|
||||
params[:v][:created_on]=[params[:issue_create_date_end]]
|
||||
else
|
||||
params[:op][:created_on]='!'
|
||||
params[:v][:created_on]=''
|
||||
end
|
||||
end
|
||||
@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}
|
||||
# else
|
||||
|
|
|
@ -58,14 +58,10 @@ class Mailer < ActionMailer::Base
|
|||
us = UsersService.new
|
||||
# 自动激活用户
|
||||
user = us.register_auto(login, @email, @password)
|
||||
|
||||
Member.create(:role_ids => [4], :user_id => user.id,:project_id => project.id)
|
||||
UserGrade.create(:user_id => user.id, :project_id => project.id)
|
||||
User.current = user unless User.current.nil?
|
||||
@user = user
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,:user => user, :token => @token.value
|
||||
)
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value)
|
||||
mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
|
@ -77,7 +73,7 @@ class Mailer < ActionMailer::Base
|
|||
@project_name = "#{project.name}"
|
||||
@user = user
|
||||
@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.id, :mail => true, :token => @token.value)
|
||||
mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class Project < ActiveRecord::Base
|
|||
|
||||
validates_presence_of :name, :identifier
|
||||
validates_uniqueness_of :identifier
|
||||
validates_uniqueness_of :name
|
||||
# validates_uniqueness_of :name
|
||||
validates_associated :wiki#, :repository
|
||||
# validates_length_of :description, :maximum => 255
|
||||
validates_length_of :name, :maximum => 255
|
||||
|
|
|
@ -101,4 +101,17 @@ class CommentService
|
|||
@jours
|
||||
end
|
||||
|
||||
def comment_detail params,current_user
|
||||
if !params[:course_id].nil? && params[:course_id] != 0
|
||||
course = Course.find(params[:course_id])
|
||||
jour = course.journals_for_messages.where("id = ? ",params[:comment_parent_id])
|
||||
jour
|
||||
else
|
||||
jour1 = JournalsForMessage.where("id = ? ",params[:comment_parent_id])
|
||||
jour1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
|
@ -364,19 +364,20 @@ class CoursesService
|
|||
latest_course_dynamics = []
|
||||
latest_news = course.news.order("created_on desc").first
|
||||
unless latest_news.nil?
|
||||
latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => l(:label_recently_updated_notification,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 1,:time => latest_news.created_on,
|
||||
:message =>latest_news.author.realname<< l(:label_recently_updated_notification,:locale => get_user_language(current_user))<<":"<< latest_news.title }
|
||||
end
|
||||
latest_message = course.journals_for_messages.order("created_on desc").first
|
||||
unless latest_message.nil?
|
||||
latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message =>latest_message.user.realname << l(:label_recently_updated_message,:locale => get_user_language(current_user))<<":"<<latest_message.notes}
|
||||
end
|
||||
latest_attachment = course.attachments.order("created_on desc").first
|
||||
unless latest_attachment.nil?
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message => l(:label_recently_updated_courseware,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message =>latest_attachment.author.realname<< l(:label_recently_updated_courseware,:locale => get_user_language(current_user))<<":"<<latest_attachment.filename}
|
||||
end
|
||||
latest_bid = course.homeworks.order('updated_on DESC').first
|
||||
unless latest_bid.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => latest_bid.author.realname<<l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<":"<<latest_bid.name}
|
||||
end
|
||||
|
||||
# Time 2015-04-07 14:58:30
|
||||
|
@ -416,7 +417,7 @@ class CoursesService
|
|||
end
|
||||
latest_homework_attach = homeworks.first
|
||||
unless latest_homework_attach.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message =>latest_homework_attach.user.realname<< l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<":"<<(latest_homework_attach.name.nil? ? latest_homework_attach.description : latest_homework_attach.name)}
|
||||
end
|
||||
latest_course_dynamics.sort!{|order,newer| newer[:time] <=> order[:time]}
|
||||
latest_course_dynamic = latest_course_dynamics.first
|
||||
|
|
|
@ -158,7 +158,7 @@ class UsersService
|
|||
# 获取某个用户的所有留言信息
|
||||
def get_all_messages params
|
||||
user = User.find(params[:user_id])
|
||||
jours = user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
jours = user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC').page(params[:page] || 1).per(10)
|
||||
jours.update_all(:is_readed => true, :status => false)
|
||||
jours.each do |journal|
|
||||
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
|
@ -166,16 +166,36 @@ class UsersService
|
|||
jours
|
||||
end
|
||||
|
||||
# 给某个用户留言
|
||||
def leave_messages params,current_user
|
||||
# 回复用户
|
||||
def reply_user_messages params,current_user
|
||||
user = User.find(params[:user_id])
|
||||
user.add_jour(current_user, params[:content], params[:refer_user_id] ||= 0)
|
||||
unless params[:refer_user_id].nil? || params[:refer_user_id] == 0 || params[:refer_user_id] == User.current.id
|
||||
User.find(params[:refer_user_id]).add_jour(current_user, params[:content], params[:refer_user_id])
|
||||
|
||||
m_parent_id = params[:parent_id]
|
||||
author_id = current_user.id
|
||||
reply_id = params[:ref_user_id]
|
||||
ref_message_id = params[:ref_message_id]
|
||||
content = params[:content]
|
||||
options = {:user_id => author_id, # 作者id
|
||||
:status => true,
|
||||
:m_parent_id => m_parent_id,# 父留言id
|
||||
:m_reply_id => ref_message_id, # 子留言 id
|
||||
:reply_id => reply_id, # 被留言用户id
|
||||
:notes => content,
|
||||
:is_readed => false}
|
||||
if(params[:type] == 1)
|
||||
user.add_jour(nil, nil,nil,options)
|
||||
elsif(params[:type] == 2)
|
||||
Course.find(params[:course_id]).journals_for_messages.build(options).save! unless params[:course_id].nil?
|
||||
else
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
# 给用户留言
|
||||
def leave_message params,current_user
|
||||
obj = User.find(params[:user_id]).add_jour(current_user, params[:content], 0)
|
||||
obj
|
||||
end
|
||||
|
||||
|
||||
#关注列表
|
||||
|
@ -245,4 +265,41 @@ class UsersService
|
|||
scope
|
||||
end
|
||||
|
||||
# 课程留言中与我相关的回复
|
||||
def my_course_messages params,current_user
|
||||
#找到我所有的课程
|
||||
@user = current_user
|
||||
if !current_user.admin? && !@user.active?
|
||||
raise '404'
|
||||
return
|
||||
end
|
||||
if current_user == @user || current_user.admin?
|
||||
membership = @user.coursememberships.all
|
||||
end
|
||||
# membership.sort! {|older, newer| newer.created_on <=> older.created_on }
|
||||
message_list = []
|
||||
membership.each do |mp|
|
||||
#课程轮询找到与我相关的回复
|
||||
message_list << mp.course.journals_for_messages.where("reply_id = ?",current_user.id)
|
||||
end
|
||||
message_list
|
||||
end
|
||||
|
||||
# 获取与我相关的留言:我的留言,回复我的留言
|
||||
def my_personal_messages params,current_user
|
||||
jours = current_user.journals_for_messages.where('m_parent_id is null or reply_id = ?',current_user.id)
|
||||
jours.update_all(:is_readed => true, :status => false)
|
||||
jours
|
||||
end
|
||||
|
||||
def reply_my_messages params,current_user
|
||||
jours = my_personal_messages params,current_user
|
||||
jours1 = my_course_messages params,current_user
|
||||
my_jours = []
|
||||
my_jours << jours << jours1
|
||||
my_jours.flatten!.sort! {|older, newer| newer.created_on <=> older.created_on }
|
||||
my_jours_arr = Kaminari.paginate_array(my_jours, total_count: my_jours.count).page(params[:page] || 1).per(10)
|
||||
my_jours_arr
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
<label class="fl" > <%= l(:field_quote)%> :</label>
|
||||
<!--<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"></textarea>-->
|
||||
<% if edit_mode %>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID %>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0 %>
|
||||
<% else %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor' %>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0 %>
|
||||
<% end %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -46,9 +46,7 @@
|
|||
<%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName1();', :width => "125px" %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
||||
<br />
|
||||
<span id="contest_name_span_head"></span>
|
||||
</div>
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
</p>
|
||||
<p>
|
||||
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
|
||||
<%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
|
||||
</p>
|
||||
<%= content_tag "div", course.short_description, :class => "brief_introduction",:style=>'float:left;', :title => course.short_description %>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
<p class="fl "><%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )</p>
|
||||
<% if @is_teacher%>
|
||||
<%= bid_anonymous_comment(bid)%>
|
||||
<% if bid.homeworks.empty? %>
|
||||
<%= link_to(l(:button_delete),bids_homework_path(:id => bid.id), :method => :delete, :confirm => l(:label_delete_confirm), :class => "fr mr10 work_edit") %>
|
||||
<% end %>
|
||||
<%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %>
|
||||
<% elsif @is_student%>
|
||||
<%= student_anonymous_comment bid %>
|
||||
|
@ -59,4 +62,4 @@
|
|||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, project) %>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
|
@ -22,13 +22,13 @@
|
|||
<% if User.current.logged? %>
|
||||
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
|
||||
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% end %>
|
||||
<% if authority_pubilic_for_files(project, file) %>
|
||||
<% if authority_pubilic_for_files(project, file) && delete_allowed %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<!--added by huang-->
|
||||
<%#= watcher_link_issue(@issue, User.current) %>
|
||||
<%#= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %>
|
||||
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %>
|
||||
<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %>
|
||||
|
||||
|
||||
<%= link_to l(:button_edit), edit_issue_path(@issue), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %>
|
||||
<%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %>
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
<li>
|
||||
<% if @issue.safe_attribute? 'tracker_id' %>
|
||||
<label class="label"><span class="c_red f12">*</span> 类型 : </label>
|
||||
<%= f.select :tracker_id,
|
||||
@issue.project.trackers.collect { |t| [t.name, t.id] },
|
||||
{:required => true, :no_label => true},
|
||||
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
|
||||
:class => "w90"
|
||||
%>
|
||||
<%= f.select :tracker_id, @issue.project.trackers.collect { |t| [t.name, t.id] },
|
||||
{:required => true, :no_label => true},
|
||||
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
|
||||
:class => "w90" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -31,11 +29,10 @@
|
|||
<% if @issue.safe_attribute? 'subject' %>
|
||||
<label class="label"><span class="c_red f12">*</span> 主题 : </label>
|
||||
<%= f.text_field :subject,
|
||||
:class => "w583",
|
||||
:maxlength => 255,
|
||||
:style => "font-size:small",
|
||||
:no_label => true
|
||||
%>
|
||||
:class => "w576",
|
||||
:maxlength => 255,
|
||||
:style => "font-size:small",
|
||||
:no_label => true %>
|
||||
<!--Added by young-->
|
||||
<%= javascript_tag do %>
|
||||
observeAutocompleteField('issue_subject',
|
||||
|
@ -54,16 +51,17 @@
|
|||
<% if @issue.safe_attribute? 'description' %>
|
||||
<label class="label"> 描述 : </label>
|
||||
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
|
||||
<%= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
|
||||
<%= content_tag 'span', :id => "issue_description_and_toolbar", :style => (@issue.new_record? ? nil : 'display:none') do %>
|
||||
<%= f.text_area :description,
|
||||
:rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
|
||||
:accesskey => accesskey(:edit),
|
||||
:class => "w583",
|
||||
:no_label => true %>
|
||||
<% end %>
|
||||
|
||||
<%= wikitoolbar_for 'issue_description' %>
|
||||
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
|
||||
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
|
||||
<%= f.kindeditor :description,:editor_id => "issue_desc_editor",
|
||||
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
|
||||
# :accesskey => accesskey(:edit),
|
||||
# :class => "w583",
|
||||
:width=>'87%',
|
||||
:resizeType => 0,
|
||||
:no_label => true %>
|
||||
<%# end %>
|
||||
<%#= wikitoolbar_for 'issue_description' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
|
@ -96,20 +94,20 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--<div class="newpro_box02 ">-->
|
||||
<!--<label class="label"> <%#= l(:label_issue_watchers) %>:</label>-->
|
||||
<!--<input id="" name="" size="22" class="fl mb10 h26" type="text" placeholder="搜索添加跟踪者">-->
|
||||
<!--<span class="search_for_watchers">-->
|
||||
<%#= link_to "",
|
||||
<!--<label class="label"> <%#= l(:label_issue_watchers) %>:</label>-->
|
||||
<!--<input id="" name="" size="22" class="fl mb10 h26" type="text" placeholder="搜索添加跟踪者">-->
|
||||
<!--<span class="search_for_watchers">-->
|
||||
<%#= link_to "",
|
||||
# {:controller => 'watchers', :action => 'new', :project_id => @issue.project},
|
||||
# :remote => true,
|
||||
# :method => 'get',
|
||||
:class => "pic_sch mt5 ml5" %>
|
||||
<!--</span>-->
|
||||
<!--</span>-->
|
||||
<%#= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript watchers_autocomplete_for_user_path(:user => @available_watchers, :format => 'js', :flag => 'ture') }')" %>
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--<span id="watchers_inputs">-->
|
||||
<!--<%#= watchers_checkboxes(@issue, @available_watchers) %>-->
|
||||
<!--</span>-->
|
||||
<!--<span id="watchers_inputs">-->
|
||||
<!--<%#= watchers_checkboxes(@issue, @available_watchers) %>-->
|
||||
<!--</span>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %>
|
||||
|
|
|
@ -1,19 +1,32 @@
|
|||
<script>
|
||||
function remote_function() {
|
||||
$.ajax({
|
||||
url:'<%= project_issues_path(@project)%>',
|
||||
data:{
|
||||
subject:$("#v_subject").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, ""),
|
||||
priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||
author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
|
||||
},
|
||||
success: function(data){
|
||||
},
|
||||
error: function(data){
|
||||
}
|
||||
$(function(){
|
||||
$("input[nhname='date_show']").change(function(){
|
||||
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
|
||||
$("input[nhname='date_val']",$(this).parent('div')).val($(this).val());
|
||||
remote_function();
|
||||
});
|
||||
});
|
||||
function remote_function() {
|
||||
$("#issue_query_form").submit();
|
||||
// $.ajax({
|
||||
// url:'<%#= project_issues_path(@project)%>',
|
||||
// data:{
|
||||
// subject:$("#v_subject").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, ""),
|
||||
// priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||
// author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
|
||||
// },
|
||||
// success: function(data){
|
||||
// },
|
||||
// error: function(data){
|
||||
// }
|
||||
// });
|
||||
}
|
||||
function nh_reset_form() {
|
||||
$("#issue_query_form")[0].reset();
|
||||
$("input[nhname='date_val']").val('');//涛哥的火狐reset 清不掉这个值 我擦
|
||||
remote_function();
|
||||
}
|
||||
|
||||
function EnterPress(e){
|
||||
|
@ -31,44 +44,62 @@
|
|||
</div>
|
||||
<div class="problem_top">
|
||||
<% 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},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
|
||||
<%= hidden_field_tag 'set_filter', '1' %>
|
||||
<div class="problem_search" >
|
||||
<input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="<%= @subject ? @subject : ""%>" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
|
||||
<input class="problem_search_input fl" id="v_subject" type="text" name="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="grey_btn fl ml10" onclick="nh_reset_form();" >清空</a>
|
||||
</div><!--problem_search end-->
|
||||
<%= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %>
|
||||
<p class="problem_p fr" ><%= l(:label_issues_sum) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.visible.all.count %></a>
|
||||
<%= l(:lable_issues_undo) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> </a>
|
||||
</p>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div id="filter_form" class="fl">
|
||||
|
||||
<div id="filter_form" class="fr" >
|
||||
<%= select( :issue, :user_id, principals_options_for_isuue_list(@project),
|
||||
{ :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=>"assigned_to_id",:class=>"w90"}
|
||||
)
|
||||
%>
|
||||
<%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",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=>"priority_id",:class=>"w90"}
|
||||
)
|
||||
%>
|
||||
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",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=>"status_id",:class=>"w90"}
|
||||
)
|
||||
%>
|
||||
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",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=>"author_id",:class=>"w90"}
|
||||
)
|
||||
%>
|
||||
</div><!--filter_form end-->
|
||||
<div>
|
||||
<div class="fl"> </div>
|
||||
<div>
|
||||
<input name="issue_create_date_start" nhname="date_val" type="hidden"/>
|
||||
<%= text_field_tag 'issue_create_date_start_show', '创建日期起始',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= calendar_for('issue_create_date_start_show') %>
|
||||
</div>
|
||||
<div style="float:left;"> - </div>
|
||||
<div>
|
||||
<input name="issue_create_date_end" nhname="date_val" type="hidden"/>
|
||||
<%= text_field_tag 'issue_create_date_end_show', '创建日期结束',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= calendar_for('issue_create_date_end_show') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%# end %>
|
||||
<p class="problem_p fl" ><%= l(:label_issues_sum) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.visible.all.count %></a>
|
||||
<%= l(:lable_issues_undo) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> </a>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
|
||||
<h2 class="project_h2"><%= l(:label_issue_new) %></h2>
|
||||
</div>
|
||||
|
@ -10,7 +11,7 @@
|
|||
<%= render :partial => 'issues/form', :locals => {:f => f} %>
|
||||
</div>
|
||||
<!--<%= javascript_tag "$('#issue_subject').focus();" %>-->
|
||||
<a href="#" class="blue_btn fl ml80" onclick="$('#issue-form').submit();">
|
||||
<a href="#" class="blue_btn fl ml80" onclick="issue_desc_editor.sync();$('#issue-form').submit();">
|
||||
<%= l(:button_create) %>
|
||||
</a>
|
||||
<%#= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_issue_edit) %></h2>
|
||||
</div>
|
||||
|
@ -19,11 +20,11 @@
|
|||
|
||||
<div class="cl"></div>
|
||||
<p>由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a>
|
||||
<% if @issue.created_on != @issue.updated_on %>
|
||||
更新于 <%= format_time(@issue.created_on).html_safe %>
|
||||
<% else %>
|
||||
添加于 <%= format_time(@issue.updated_on).html_safe %>
|
||||
<% end %>
|
||||
<%# if @issue.created_on != @issue.updated_on %>
|
||||
添加于 <%= format_time(@issue.created_on).html_safe %>
|
||||
<%# else %>
|
||||
<%#= format_time(@issue.updated_on).html_safe %>
|
||||
<%# end %>
|
||||
</div>
|
||||
<!--talk_txt end-->
|
||||
<a href="javascript:void(0)" class="talk_edit fr"<%= render :partial => 'action_menu' %></a>
|
||||
|
@ -32,7 +33,7 @@
|
|||
<% if @issue.description? || @issue.attachments.any? -%>
|
||||
<% if @issue.description? %>
|
||||
<%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
|
||||
<%= textilizable @issue, :description, :attachments => @issue.attachments %>
|
||||
<%= textAreailizable @issue, :description, :attachments => @issue.attachments %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pro_pic_box mb10">
|
||||
|
@ -102,13 +103,13 @@
|
|||
</div>
|
||||
<!--problem_main end-->
|
||||
<div style="clear: both;"></div>
|
||||
<!--留言-->
|
||||
<% if @issue.editable? %>
|
||||
<div id="update">
|
||||
<%= render :partial => 'edit' %>
|
||||
</div>
|
||||
<!--留言-->
|
||||
<p style="padding-top: 5px"></p>
|
||||
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="$('#issue-form').submit();">
|
||||
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="issue_desc_editor.sync();$('#issue-form').submit();">
|
||||
<%= l(:button_submit) %>
|
||||
</a>
|
||||
<% end %>
|
||||
|
@ -123,18 +124,12 @@
|
|||
<%= render :partial => 'changesets', :locals => {:changesets => @changesets} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<!--留言-- end>
|
||||
<!--<div style="clear: both;"></div>-->
|
||||
<!--<%#= render :partial => 'action_menu' %>-->
|
||||
|
||||
|
||||
<div class="cl"></div>
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<%= f.link_to 'PDF' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'issues/sidebar' %>
|
||||
<br>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
.close_btn span { display:none;}
|
||||
.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 a { background:url(/images/sidebar_bg.png) no-repeat -119px -115px; padding-left:22px;}
|
||||
.msgserver a { padding-left:4px;}
|
||||
.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:hover{background: #0fa9bb; }
|
||||
|
@ -180,7 +180,9 @@ function cookieget(n)
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="msgserver">
|
||||
<a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白 羽</a>
|
||||
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
|
||||
<%= l(:label_technical_support) %>白 羽</a>
|
||||
<iframe name="hiddentab" style="display: none"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side_bottom"></div>
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="msgserver">
|
||||
<a href="http://user.trustie.net/users/34/user_newfeedback" target="_blank">
|
||||
<%= l(:label_technical_support) %>
|
||||
白 羽
|
||||
</a>
|
||||
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
|
||||
<%= l(:label_technical_support) %>白 羽</a>
|
||||
<iframe name="hiddentab" style="display: none"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side_bottom"></div>
|
||||
|
|
|
@ -18,54 +18,7 @@
|
|||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
||||
<!--项目的三种类型-->
|
||||
<script type="text/javascript">
|
||||
function click_ok(url)
|
||||
{
|
||||
$('#light').css('display','none');
|
||||
$('#fade').css('display','none');
|
||||
//ajax处理请求
|
||||
var project_type;
|
||||
if($("#development_group").attr("checked") == "checked"){
|
||||
project_type = 1;
|
||||
}
|
||||
else if($("#research_group").attr("checked") == "checked"){
|
||||
project_type = 2;
|
||||
|
||||
}
|
||||
else if($("#friend_organization").attr("checked") == "checked"){
|
||||
project_type = 3;
|
||||
}
|
||||
$.get(
|
||||
url,
|
||||
{ project_type: project_type},
|
||||
function (data) {
|
||||
if(data == 1)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group')) %>');
|
||||
$("#close_light").attr("onClick","close_window('development_group');");
|
||||
}
|
||||
else if(data == 2)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team')) %>');
|
||||
$("#close_light").attr("onClick","close_window('research_group');");
|
||||
}
|
||||
else if(data == 3)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group')) %>');
|
||||
$("#close_light").attr("onClick","close_window('friend_organization');");
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("服务器异常,请与管理员联系");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<!--add by huang-->
|
||||
<body>
|
||||
|
@ -83,13 +36,7 @@
|
|||
</h2>
|
||||
<p class="hidden">
|
||||
<%= l(:label_user_location) %> :
|
||||
<%= link_to l(:field_homepage), home_path %>
|
||||
>
|
||||
<a href="http://<%= Setting.host_name %>">
|
||||
<%=l(:label_project_hosting_platform) %>
|
||||
</a>
|
||||
>
|
||||
<%= link_to @project.name, project_path(@project.id) %>
|
||||
<%= link_to l(:field_homepage), home_path %> > <a href="http://<%= Setting.host_name %>"><%=l(:label_project_hosting_platform) %> </a>><%= link_to @project.name, project_path(@project.id) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="search fl">
|
||||
|
@ -144,10 +91,13 @@
|
|||
<%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>)
|
||||
<span>| </span>
|
||||
<%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>)
|
||||
<span>| </span>
|
||||
<%= l(:project_module_attachments) %>(
|
||||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %></span>)
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<span>| </span>
|
||||
<%= l(:project_module_attachments) %>(
|
||||
<% attaments_num %>
|
||||
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %></span>)
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--参数 end-->
|
||||
|
@ -164,14 +114,14 @@
|
|||
</ul>
|
||||
<% end %><!--end-->
|
||||
<!--menu 左侧工具栏 -->
|
||||
<!--project_new_type: 1为开发组;2为科研组;3为朋友圈子-->
|
||||
<%#--project_new_type: 1为开发组;2为科研组;3为朋友圈子--%>
|
||||
<div id="project_memu_list">
|
||||
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
|
||||
<%= render :partial => 'projects/development_group', :locals => {:project => @project}%>
|
||||
<%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<% elsif @project.project_new_type == 2 %>
|
||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project}%>
|
||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<% else %>
|
||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project}%>
|
||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
@ -230,8 +180,55 @@
|
|||
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14"> 圈子模式:<span class="f12 ml5 c_grey">为朋友圈提供简洁的交流和分享工具。</span></label></li>
|
||||
</ul>
|
||||
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>
|
||||
|
||||
</div>
|
||||
<!--项目的三种类型-->
|
||||
<script type="text/javascript">
|
||||
function click_ok(url)
|
||||
{
|
||||
$('#light').css('display','none');
|
||||
$('#fade').css('display','none');
|
||||
//ajax处理请求
|
||||
var project_type;
|
||||
if($("#development_group").attr("checked") == "checked"){
|
||||
project_type = 1;
|
||||
}
|
||||
else if($("#research_group").attr("checked") == "checked"){
|
||||
project_type = 2;
|
||||
|
||||
}
|
||||
else if($("#friend_organization").attr("checked") == "checked"){
|
||||
project_type = 3;
|
||||
}
|
||||
$.get(
|
||||
url,
|
||||
{ project_type: project_type},
|
||||
function (data) {
|
||||
if(data == 1)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||
$("#close_light").attr("onClick","close_window('development_group');");
|
||||
}
|
||||
else if(data == 2)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||
$("#close_light").attr("onClick","close_window('research_group');");
|
||||
}
|
||||
else if(data == 3)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||
$("#close_light").attr("onClick","close_window('friend_organization');");
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("服务器异常,请与管理员联系");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<div id="fade" class="black_overlay">123</div>
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% elsif @user.user_extensions.identity == 3 && @user.user_extensions.occupation.empty? %>
|
||||
<% elsif @user.user_extensions.identity == 3 && @user.user_extensions.occupation %>
|
||||
<tr>
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:field_occupation) %>:</span>
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
<% @nav_dispaly_project_label = 1
|
||||
@nav_dispaly_forum_label = 1 %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%=h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%=h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main" class="nosidebar">
|
||||
<div id="content_">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
<%=render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +1,5 @@
|
|||
//ckeditor.setData("<%= raw escape_javascript(@content) %>");
|
||||
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
$('#quote').val("<%= raw escape_javascript(@content) %>");
|
||||
showAndScrollTo("new_memo", "cke_editor01");
|
||||
showAndScrollTo("new_memo", "cke_editor01");
|
||||
$("img").removeAttr("align");
|
|
@ -182,4 +182,5 @@
|
|||
}
|
||||
});
|
||||
};
|
||||
$("img").removeAttr("align");
|
||||
</script>
|
|
@ -36,9 +36,9 @@
|
|||
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
|
||||
<br />
|
||||
<div class="cl mb5"></div>
|
||||
<p id="news_description_<%= news.id %>" class="news_description mt5">
|
||||
<div id="news_description_<%= news.id %>" class="news_description mt5">
|
||||
<%= news.description.html_safe %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="news_foot c_red" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
|
||||
<%= l(:button_more)%>...
|
||||
<span class="g-arr-down"></span>
|
||||
|
|
|
@ -1,26 +1,35 @@
|
|||
<li class="ml45">
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<li>
|
||||
<label><span class="c_red">*</span> <%= l(:field_title) %> :</label>
|
||||
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
|
||||
<input type="text" name="news[title]" class="hwork_input_news" id="news_title" width="576px" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
|
||||
<p id="title_notice_span" class="ml55"></p>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<textarea id="news_description" name="news[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl" onkeyup="regexDescription();" maxlength="6000"><%= is_new ? '' : @news.description %></textarea>
|
||||
<p id="description_notice_span" class="ml55"></p>
|
||||
<li class="mb10">
|
||||
<% if is_new %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id=>'project_news_description_editor' %>
|
||||
<p id="description_notice_span" class="ml55"></p>
|
||||
<% else %>
|
||||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<%= f.kindeditor :description,:width=>'91%', :editor_id=>'project_news_description_editor', :owner_id => @news.id, :owner_type => OwnerTypeHelper::NEWS %>
|
||||
<p id="description_notice_span" class="ml55"></p>
|
||||
<% end %>
|
||||
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label class="fl"> <%= l(:label_attachment_plural) %> :</label>
|
||||
<li>
|
||||
<label class="fl mt5"> <%= l(:label_attachment_plural) %> :</label>
|
||||
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
<li class="ml40" >
|
||||
<% if is_new %>
|
||||
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
|
||||
<%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
|
||||
<%= link_to l(:button_cancel), project_news_index_path(@project), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
|
||||
<% else %>
|
||||
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %>
|
||||
<%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
|
||||
<%= link_to l(:button_cancel), news_path(@news), :class => 'blue_btn grey_btn fl c_white' %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
|
||||
<span class="fl"> <%= l(:label_add_news) %>:</span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
|
||||
<div class="cl mb5"></div>
|
||||
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%= news.description %><br /> </p>
|
||||
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%=textAreailizable news.description %><br /> </p>
|
||||
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
|
||||
<span class="f1"><%= l(:label_create_time) %> :<%= format_time(news.created_on) %></span>
|
||||
</div>
|
||||
|
|
|
@ -82,8 +82,9 @@
|
|||
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %>
|
||||
<%= delete_link news_path(@news),:class => 'talk_edit fr' if User.current.allowed_to?(:manage_news, @project) %>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5" style="word-break:break-all;"><%= textAreailizable(@news, :description) %><br /> <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %></div>
|
||||
<%= link_to_attachments_course @news %>
|
||||
<div class="mb5" style="word-break:break-all;"><%= textAreailizable(@news, :description) %> </div>
|
||||
<%= link_to_attachments_course @news %><br />
|
||||
<%= l(:label_create_time) %> : <%= format_time(@news.created_on) %>
|
||||
<!--<a href="#" class=" link_file">附件:爱覅俄方if.zip(27.5kB)</a> -->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
|
@ -8,9 +7,10 @@
|
|||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.issues.visible.all.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.issues.visible.all.count %>)</a>
|
||||
<% if (issue_count = @project.issues.count) > 0 %>
|
||||
<a class="subnav_num">(<%= issue_count %>)</a>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
|
||||
<% end %>
|
||||
|
@ -49,4 +49,4 @@
|
|||
<div class="subNav subNav_jiantou" id="expand_tools_expand" nhtype="toggle4cookie" data-id="expand_tool_more" data-target="#navContent" data-val="retract"><%= l(:label_project_more) %></div>
|
||||
<ul class="navContent" id="navContent">
|
||||
<%= render 'projects/tools_expand' %>
|
||||
</ul>
|
||||
</ul>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
|
@ -8,8 +7,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.issues.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.issues.visible.all.count %>)</a>
|
||||
<% if (issue_count = @project.issues.count) > 0 %>
|
||||
<a class="subnav_num">(<%= issue_count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
|
||||
|
@ -37,4 +36,4 @@
|
|||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
||||
<% end%>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_invite_join) %></h2>
|
||||
</div>
|
||||
|
@ -68,5 +67,37 @@
|
|||
var text=$(label).text();
|
||||
$(label).attr("title",text);
|
||||
}
|
||||
|
||||
function nh_show_err_message(msg){
|
||||
$("#RSide>.flash").remove();
|
||||
$("#RSide").prepend('<div class="flash error" id="flash_error">'+msg+'</div>');
|
||||
}
|
||||
$('#new_membership').submit(function(){
|
||||
var user_ischeck=false;
|
||||
$("input[name='membership[user_ids][]']").each(function(){
|
||||
if($(this).prop('checked')){
|
||||
user_ischeck=true;
|
||||
}
|
||||
});
|
||||
var role_ischeck=false;
|
||||
$("input[name='membership[role_ids][]']").each(function(){
|
||||
if($(this).prop('checked')){
|
||||
role_ischeck=true;
|
||||
}
|
||||
});
|
||||
if(user_ischeck==false && role_ischeck==false){
|
||||
nh_show_err_message('请选择用户和角色!');
|
||||
return false;
|
||||
}
|
||||
if(user_ischeck==false){
|
||||
nh_show_err_message('请选择用户!');
|
||||
return false;
|
||||
}
|
||||
if(role_ischeck==false){
|
||||
nh_show_err_message('请选择角色!');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -51,7 +51,7 @@
|
|||
<%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.project_issues_index}: #{act.issue.subject}"),
|
||||
{:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"}, :class => "problem_tit fl fb" %>
|
||||
</a><br />
|
||||
<p class="mt5 break_word"><%= textAreailizable act,:notes %><br />
|
||||
<p class="mt5 break_word"><%= textilizable act,:notes %><br />
|
||||
<%= l :label_activity_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
<p style="padding-left: 180px;"><%= setting_text_field :activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p>
|
||||
|
||||
<p style="padding-left: 180px;"><%= setting_text_field :host_name, :size => 60 %>
|
||||
<p style="padding-left: 180px;"><%= setting_text_field :host_course, :size => 60 %>
|
||||
<p style="padding-left: 180px;"><%= setting_text_field :host_contest, :size => 60 %>
|
||||
<p style="padding-left: 180px;"><%= setting_text_field :host_user, :size => 60 %>
|
||||
<p style="padding-left: 180px;"><%= setting_text_field :host_repository, :size => 60 %>
|
||||
|
||||
<em class="info"><%= l(:label_example) %>: <%= @guessed_host_and_path %></em></p>
|
||||
|
||||
<p style="padding-left: 180px;"><%= setting_select :protocol, [['HTTP', 'http'], ['HTTPS', 'https']] %></p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- added by fq -->
|
||||
<!-- added by fq -->u
|
||||
<!--huang-->
|
||||
<% if @user.user_extensions.identity == 0 %>
|
||||
<%= render :partial => 'my_create_homework' %>
|
||||
|
|
|
@ -90,6 +90,7 @@ default:
|
|||
user_name: "huang.jingquan@163.com"
|
||||
password: 'xinhu1ji2qu366'
|
||||
|
||||
cookie_domain: ".trustie.net"
|
||||
# Absolute path to the directory where attachments are stored.
|
||||
# The default is the 'files' directory in your Redmine instance.
|
||||
# Your Redmine instance needs to have write permission on this
|
||||
|
|
|
@ -113,6 +113,7 @@ en:
|
|||
one: "1 error prohibited this %{model} from being saved"
|
||||
other: "%{count} errors prohibited this %{model} from being saved"
|
||||
messages:
|
||||
record_invalid: "validate error: %{errors}"
|
||||
inclusion: "is not included in the list"
|
||||
exclusion: "is reserved"
|
||||
invalid: "is invalid"
|
||||
|
@ -428,4 +429,4 @@ en:
|
|||
previous: "« Previous"
|
||||
next: "Next »"
|
||||
truncate: "..."
|
||||
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ zh:
|
|||
one: "由于发生了一个错误 %{model} 无法保存"
|
||||
other: "%{count} 个错误使得 %{model} 无法保存"
|
||||
messages:
|
||||
record_invalid: "校验失败: %{errors}"
|
||||
inclusion: "不包含于列表中"
|
||||
exclusion: "是保留关键字"
|
||||
invalid: "是无效的"
|
||||
|
@ -352,7 +353,7 @@ zh:
|
|||
#
|
||||
label_feedback: 意见反馈
|
||||
label_feedback_tips: "欢迎反馈网站问题,课程中遇到的问题请反馈给相关老师!"
|
||||
label_technical_support: "技术支持:"
|
||||
label_technical_support: "QQ 在线支持:"
|
||||
label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!"
|
||||
label_feedback_value: "该帖来自用户反馈:)"
|
||||
|
||||
|
@ -435,4 +436,4 @@ zh:
|
|||
last: "末页 »"
|
||||
previous: "« 上一页"
|
||||
next: "下一页 »"
|
||||
truncate: "..."
|
||||
truncate: "..."
|
||||
|
|
|
@ -183,6 +183,10 @@ en:
|
|||
setting_bcc_recipients: Blind carbon copy recipients (bcc)
|
||||
setting_plain_text_mail: Plain text mail (no HTML)
|
||||
setting_host_name: Host name and path
|
||||
setting_host_course: Host course and path
|
||||
setting_host_contest: Host contest and path
|
||||
setting_host_user: Host user and path
|
||||
setting_host_repository: Host repository and path
|
||||
setting_text_formatting: Text formatting
|
||||
setting_wiki_compression: Wiki history compression
|
||||
setting_feeds_limit: Maximum number of items in Atom feeds
|
||||
|
@ -755,6 +759,7 @@ en:
|
|||
button_create_and_continue: Create and continue
|
||||
button_test: Test
|
||||
button_edit: Edit
|
||||
button_delete: Delete
|
||||
button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
|
||||
button_add: Add
|
||||
button_change: Change
|
||||
|
@ -1521,4 +1526,5 @@ en:
|
|||
label_commit_failed: commit failed
|
||||
#api end
|
||||
error_upload_avatar_to_large: "too big (%{max_size})"
|
||||
not_valid_image_file: not a valid image file
|
||||
|
||||
|
|
|
@ -190,6 +190,10 @@ zh:
|
|||
setting_bcc_recipients: 使用密件抄送 (bcc)
|
||||
setting_plain_text_mail: 纯文本(无HTML)
|
||||
setting_host_name: 主机名称
|
||||
setting_host_course: 课程域名
|
||||
setting_host_contest: 竞赛域名
|
||||
setting_host_user: 用户域名
|
||||
setting_host_repository: 仓库域名
|
||||
setting_text_formatting: 文本格式
|
||||
setting_wiki_compression: 压缩Wiki历史文档
|
||||
setting_feeds_limit: RSS Feed内容条数限制
|
||||
|
@ -845,6 +849,7 @@ zh:
|
|||
button_create_and_continue: 创建并继续
|
||||
button_test: 测试
|
||||
button_edit: 编辑
|
||||
button_delete: 删除
|
||||
button_edit_associated_wikipage: "编辑相关wiki页面: %{page_title}"
|
||||
button_add: 新增
|
||||
button_change: 修改
|
||||
|
@ -1985,3 +1990,4 @@ zh:
|
|||
label_code: 代码
|
||||
|
||||
error_upload_avatar_to_large: "超过大小限制 (%{max_size})"
|
||||
not_valid_image_file: 不是有效的图片文件
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
#
|
||||
# OneApm RubyAgent Configuration
|
||||
#
|
||||
|
||||
# Here are the settings that are common to all environments
|
||||
common: &default_settings
|
||||
# ============================== LICENSE KEY ===============================
|
||||
|
||||
#
|
||||
# Get your license key from oneapm.com
|
||||
#
|
||||
license_key: 'BAQMBw8FUwR2542UFFpDXFgVVk66e2dZWB4EBlQHSf846wgBGwICFQoD0498BAEfBgNIAlQ='
|
||||
|
||||
# Agent Enabled (Ruby/Rails Only)
|
||||
# Valid values are true, false and auto.
|
||||
#
|
||||
# agent_enabled: auto
|
||||
|
||||
# This app_name will be the application name in oneapm.com in your account.
|
||||
#
|
||||
# Caution: If you change this name, a new application will appear in the OneApm
|
||||
# user interface with the new name, and data will stop reporting to the
|
||||
# app with the old name.
|
||||
#
|
||||
app_name: trusite
|
||||
|
||||
# When "true", the agent collects performance data about your
|
||||
# application and reports this data to the OneApm service at
|
||||
# oneapm.com. This global switch is normally overridden for each
|
||||
# environment below. (formerly called 'enabled')
|
||||
monitor_mode: true
|
||||
|
||||
# Specify its log level here.
|
||||
log_level: info
|
||||
|
||||
# log_file_path: 'log'
|
||||
# log_file_name: 'oneapm_agent.log'
|
||||
|
||||
# The oneapm agent communicates with the service via https by default.
|
||||
# ssl: true
|
||||
|
||||
# ======================== Browser Monitoring =============================
|
||||
browser_monitoring:
|
||||
# By default the agent automatically injects the monitoring JavaScript
|
||||
# into web pages. Set this attribute to false to turn off this behavior.
|
||||
auto_instrument: true
|
||||
|
||||
# Proxy settings for connecting to the OneApm server.
|
||||
#
|
||||
# proxy_host: hostname
|
||||
# proxy_port: 8080
|
||||
# proxy_user:
|
||||
# proxy_pass:
|
||||
|
||||
# Tells transaction tracer and error collector (when enabled)
|
||||
# whether or not to capture HTTP params. When true, frameworks can
|
||||
# exclude HTTP parameters from being captured.
|
||||
# Rails: the RoR filter_parameter_logging excludes parameters
|
||||
capture_params: false
|
||||
|
||||
# Transaction tracer captures deep information about slow
|
||||
# transactions and sends this to the OneApm service once a
|
||||
# minute. Included in the transaction is the exact call sequence of
|
||||
# the transactions including any SQL statements issued.
|
||||
transaction_tracer:
|
||||
|
||||
# Transaction tracer is enabled by default.
|
||||
enabled: true
|
||||
|
||||
# Threshold in seconds for when to collect a transaction
|
||||
# trace. When the response time of a controller action exceeds
|
||||
# this threshold, a transaction trace will be recorded and sent to
|
||||
# OneApm. Valid values are any float value, or (default) "apdex_f",
|
||||
# which will use the threshold for an dissatisfying Apdex
|
||||
# controller action - four times the Apdex T value.
|
||||
transaction_threshold: apdex_f
|
||||
|
||||
# When transaction tracer is on, SQL statements can optionally be
|
||||
# recorded. The recorder has three modes, "off" which sends no
|
||||
# SQL, "raw" which sends the SQL statement in its original form,
|
||||
# and "obfuscated", which strips out numeric and string literals.
|
||||
record_sql: obfuscated
|
||||
|
||||
# Threshold in seconds for when to collect stack trace for a SQL
|
||||
# call. In other words, when SQL statements exceed this threshold,
|
||||
# then capture and send to OneApm the current stack trace. This is
|
||||
# helpful for pinpointing where long SQL calls originate from.
|
||||
stack_trace_threshold: 0.500
|
||||
|
||||
# Determines whether the agent will capture query plans for slow
|
||||
# SQL queries. Only supported in mysql and postgres. Should be
|
||||
# set to false when using other adapters.
|
||||
# explain_enabled: true
|
||||
|
||||
# Threshold for query execution time below which query plans will
|
||||
# not be captured. Relevant only when `explain_enabled` is true.
|
||||
# explain_threshold: 0.5
|
||||
|
||||
# Error collector captures information about uncaught exceptions and
|
||||
# sends them to OneApm for viewing
|
||||
error_collector:
|
||||
|
||||
# Error collector is enabled by default.
|
||||
enabled: true
|
||||
|
||||
# Ignore the following errors, add your own.
|
||||
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
|
||||
|
||||
# ===================== Application Environments ========================
|
||||
# Environment-specific settings are in this section.
|
||||
# For Rails applications, RAILS_ENV is used to determine the environment.
|
||||
|
||||
# NOTE if your application has other named environments, you should
|
||||
# provide oneapm configuration settings for these environments here.
|
||||
|
||||
development:
|
||||
<<: *default_settings
|
||||
# Turn on communication to OneApm service in development mode
|
||||
monitor_mode: true
|
||||
app_name: My Application (Development)
|
||||
|
||||
test:
|
||||
<<: *default_settings
|
||||
monitor_mode: false
|
||||
|
||||
# Turn on the agent in production for 24x7 monitoring.
|
||||
production:
|
||||
<<: *default_settings
|
||||
monitor_mode: true
|
||||
|
||||
# Staging environment which behaves identically to production.
|
||||
staging:
|
||||
<<: *default_settings
|
||||
monitor_mode: true
|
||||
app_name: My Application (Staging)
|
|
@ -251,7 +251,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
|
||||
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
|
||||
# boards end
|
||||
post 'bids/homework_destroy', :to => 'bids#homework_destroy'
|
||||
delete 'bids/homework', :to => 'bids#homework_destroy'
|
||||
|
||||
# Misc issue routes. TODO: move into resources
|
||||
match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
|
||||
|
|
10
db/schema.rb
10
db/schema.rb
|
@ -659,6 +659,16 @@ ActiveRecord::Schema.define(:version => 20150514133640) do
|
|||
|
||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_details_copy", :force => true do |t|
|
||||
t.integer "journal_id", :default => 0, :null => false
|
||||
t.string "property", :limit => 30, :default => "", :null => false
|
||||
t.string "prop_key", :limit => 30, :default => "", :null => false
|
||||
t.text "old_value"
|
||||
t.text "value"
|
||||
end
|
||||
|
||||
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_replies", :id => false, :force => true do |t|
|
||||
t.integer "journal_id"
|
||||
t.integer "user_id"
|
||||
|
|
|
@ -4,6 +4,7 @@ module RailsKindeditor
|
|||
def kindeditor_tag(name, content = nil, options = {})
|
||||
id = sanitize_to_id(name)
|
||||
input_html = { :id => id }.merge(options.delete(:input_html) || {})
|
||||
input_html = input_html.merge(style: 'display:none')
|
||||
output = ActiveSupport::SafeBuffer.new
|
||||
output << text_area_tag(name, content, input_html)
|
||||
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true')))
|
||||
|
@ -12,6 +13,7 @@ module RailsKindeditor
|
|||
def kindeditor(name, method, options = {})
|
||||
# TODO: Refactory options: 1. kindeditor_option 2. html_option
|
||||
input_html = (options.delete(:input_html) || {}).stringify_keys
|
||||
input_html = input_html.merge(style: 'display:none')
|
||||
output_buffer = ActiveSupport::SafeBuffer.new
|
||||
output_buffer << build_text_area_tag(name, method, self, options, input_html)
|
||||
output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true')))
|
||||
|
|
|
@ -3,11 +3,36 @@
|
|||
module Trustie
|
||||
module Utils
|
||||
class Image
|
||||
def initialize(file, bak)
|
||||
def initialize(file, bak=false)
|
||||
@file = file
|
||||
@bak = bak
|
||||
end
|
||||
|
||||
def bitmap?(data)
|
||||
data[0,2]==77.chr + 66.chr
|
||||
end
|
||||
|
||||
def gif?(data)
|
||||
data[0,4]==71.chr + 73.chr + 70.chr + 56.chr
|
||||
end
|
||||
|
||||
def jpeg?(data)
|
||||
data[0,3]== 0xff.chr + 0xd8.chr + 0xff.chr
|
||||
end
|
||||
def png?(data)
|
||||
data[0,2]==0x89.chr + 80.chr
|
||||
end
|
||||
|
||||
def image?
|
||||
data = ''
|
||||
if @file.respond_to?(:read)
|
||||
data = @file.read(9)
|
||||
@file.rewind
|
||||
end
|
||||
return false if data.size < 9
|
||||
bitmap?(data) || gif?(data) || jpeg?(data) || png?(data)
|
||||
end
|
||||
|
||||
def compress(size=300)
|
||||
backup if @bak
|
||||
begin
|
||||
|
|
|
@ -1,182 +1,158 @@
|
|||
//配置课程信息
|
||||
function course_setting(id)
|
||||
{
|
||||
function course_setting(id) {
|
||||
//alert(id);
|
||||
$('#tb_'+id).removeClass().addClass("hwork_hovertab");
|
||||
$('#tbc_0'+id).removeClass().addClass("dis");
|
||||
$('#tb_'+(3-id)).removeClass().addClass("hwork_normaltab");
|
||||
$('#tbc_0'+(3-id)).removeClass().addClass("undis");
|
||||
$('#tb_' + id).removeClass().addClass("hwork_hovertab");
|
||||
$('#tbc_0' + id).removeClass().addClass("dis");
|
||||
$('#tb_' + (3 - id)).removeClass().addClass("hwork_normaltab");
|
||||
$('#tbc_0' + (3 - id)).removeClass().addClass("undis");
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$("img").removeAttr("align");
|
||||
$(function() {
|
||||
$("img").removeAttr("align");
|
||||
});
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//添加分班
|
||||
function add_group(url,course_id) {
|
||||
var group_name = $('#group_name').val();
|
||||
$.get(
|
||||
url,
|
||||
{ valid: "name",
|
||||
value: group_name,
|
||||
course_id: course_id },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$("#add_group_name").submit();
|
||||
function add_group(url, course_id) {
|
||||
var group_name = $('#group_name').val();
|
||||
$.get(
|
||||
url, {
|
||||
valid: "name",
|
||||
value: group_name,
|
||||
course_id: course_id
|
||||
},
|
||||
function(data) {
|
||||
if (data.valid) {
|
||||
$("#add_group_name").submit();
|
||||
} else {
|
||||
alert(data.message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(data.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
//修改分班:修改分班时得考虑什么都不改但是点击确定的情况
|
||||
function edit_group(id,url,course_id,group_id)
|
||||
{
|
||||
var group_name = $('#'+id).val();
|
||||
);
|
||||
}
|
||||
//修改分班:修改分班时得考虑什么都不改但是点击确定的情况
|
||||
|
||||
function edit_group(id, url, course_id, group_id) {
|
||||
var group_name = $('#' + id).val();
|
||||
$.get(
|
||||
url,
|
||||
{
|
||||
url, {
|
||||
valid: "name",
|
||||
value: group_name,
|
||||
course_id: course_id,
|
||||
group_id: group_id
|
||||
},
|
||||
function (data) {
|
||||
function(data) {
|
||||
if (data.valid) {
|
||||
$("#update_group_"+group_id).submit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#update_group_" + group_id).submit();
|
||||
} else {
|
||||
alert(data.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function hidden_homework_score_form()
|
||||
{
|
||||
hideModal($("#user_score"));
|
||||
}
|
||||
///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////新建课程相关
|
||||
//验证课程名称
|
||||
function regex_course_name()
|
||||
{
|
||||
var name = $.trim($("#course_name").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#course_name_notice").show();
|
||||
return false;
|
||||
function hidden_homework_score_form() {
|
||||
hideModal($("#user_score"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_name_notice").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//验证课程学时
|
||||
function regex_course_class_period()
|
||||
{
|
||||
var class_period = $.trim($("#class_period").val());
|
||||
var regex = /^\d*$/;
|
||||
if(class_period.length == 0)
|
||||
{
|
||||
$("#course_class_period_notice").html("学时总数不能为空");
|
||||
$("#course_class_period_notice").show();
|
||||
return false;
|
||||
}
|
||||
else if (regex.test(class_period)) {
|
||||
if(parseInt(class_period) > 0)
|
||||
{
|
||||
$("#course_class_period_notice").html("");
|
||||
$("#course_class_period_notice").hide();
|
||||
///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////新建课程相关
|
||||
//验证课程名称
|
||||
|
||||
function regex_course_name() {
|
||||
var name = $.trim($("#course_name").val());
|
||||
if (name.length == 0) {
|
||||
$("#course_name_notice").show();
|
||||
return false;
|
||||
} else {
|
||||
$("#course_name_notice").hide();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_class_period_notice").html("学时总数必须大于0");
|
||||
}
|
||||
//验证课程学时
|
||||
|
||||
function regex_course_class_period() {
|
||||
var class_period = $.trim($("#class_period").val());
|
||||
var regex = /^\d*$/;
|
||||
if (class_period.length == 0) {
|
||||
$("#course_class_period_notice").html("学时总数不能为空");
|
||||
$("#course_class_period_notice").show();
|
||||
return false;
|
||||
} else if (regex.test(class_period)) {
|
||||
if (parseInt(class_period) > 0) {
|
||||
$("#course_class_period_notice").html("");
|
||||
$("#course_class_period_notice").hide();
|
||||
return true;
|
||||
} else {
|
||||
$("#course_class_period_notice").html("学时总数必须大于0");
|
||||
$("#course_class_period_notice").show();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$("#course_class_period_notice").html("学时总数必须为数字");
|
||||
$("#course_class_period_notice").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_class_period_notice").html("学时总数必须为数字");
|
||||
$("#course_class_period_notice").show();
|
||||
return false;
|
||||
//验证密码
|
||||
|
||||
function regex_course_password() {
|
||||
var class_period = $.trim($("#course_course_password").val());
|
||||
var regex = /^\w+$/;
|
||||
if (class_period.length == 0) {
|
||||
$("#course_course_password_notice").html("课程密码不能为空");
|
||||
$("#course_course_password_notice").show();
|
||||
return false;
|
||||
} else if (regex.test(class_period)) {
|
||||
$("#course_course_password_notice").html("");
|
||||
$("#course_course_password_notice").hide();
|
||||
return true;
|
||||
} else {
|
||||
$("#course_course_password_notice").html("课程密码有非法字符");
|
||||
$("#course_course_password_notice").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//验证密码
|
||||
function regex_course_password()
|
||||
{
|
||||
var class_period = $.trim($("#course_course_password").val());
|
||||
var regex = /^\w+$/;
|
||||
if(class_period.length == 0)
|
||||
{
|
||||
$("#course_course_password_notice").html("课程密码不能为空");
|
||||
$("#course_course_password_notice").show();
|
||||
return false;
|
||||
}
|
||||
else if (regex.test(class_period)) {
|
||||
$("#course_course_password_notice").html("");
|
||||
$("#course_course_password_notice").hide();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_course_password_notice").html("课程密码有非法字符");
|
||||
$("#course_course_password_notice").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//提交新建课程
|
||||
function submit_new_course()
|
||||
{
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_course_password())
|
||||
{
|
||||
//提交新建课程
|
||||
|
||||
function submit_new_course() {
|
||||
if (regex_course_name() && regex_course_class_period() && regex_course_password()) {
|
||||
$("#new_course").submit();
|
||||
}
|
||||
}
|
||||
|
||||
function submit_edit_course(id)
|
||||
{
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_course_password())
|
||||
{
|
||||
$("#edit_course_"+id).submit();
|
||||
function submit_edit_course(id) {
|
||||
if (regex_course_name() && regex_course_class_period() && regex_course_password()) {
|
||||
$("#edit_course_" + id).submit();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////课程讨论区
|
||||
function regexSubject(id) {
|
||||
var subjectid = "#message_subject" + id ;
|
||||
var subjectid = "#message_subject" + id;
|
||||
var content = $.trim($(subjectid).val());
|
||||
var message = "#subject_span" + id;
|
||||
if (content.length == 0) {
|
||||
$(message).text("主题不能为空");
|
||||
$(message).css('color', '#ff0000');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
} else {
|
||||
$(message).text("填写正确");
|
||||
$(message).css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function regexContent(id) {
|
||||
var contentid = "#message_content" + id;
|
||||
var message = "#message_content_span"+ id;
|
||||
var message = "#message_content_span" + id;
|
||||
var content = $.trim($(contentid).val());
|
||||
if (content.length == 0) {
|
||||
$(message).text("描述不能为空");
|
||||
$(message).css('color', '#ff0000');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
} else {
|
||||
$(message).text("填写正确");
|
||||
$(message).css('color', '#008000');
|
||||
return true;
|
||||
|
@ -195,297 +171,242 @@ function submitProjectsBoard(id) {
|
|||
|
||||
///////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////// 课程通知
|
||||
function regexTitle()
|
||||
{
|
||||
function regexTitle() {
|
||||
var name = $("#news_title").val();
|
||||
if(name.length ==0)
|
||||
{
|
||||
if (name.length == 0) {
|
||||
$("#title_notice_span").text("标题不能为空");
|
||||
$("#title_notice_span").css('color','#ff0000');
|
||||
$("#title_notice_span").css('color', '#ff0000');
|
||||
$("#news_title").focus();
|
||||
return false;
|
||||
}
|
||||
else if(name.length <= 60)
|
||||
{
|
||||
} else if (name.length <= 60) {
|
||||
$("#title_notice_span").text("填写正确");
|
||||
$("#title_notice_span").css('color','#008000');
|
||||
$("#title_notice_span").css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$("#title_notice_span").text("标题超过60个字符");
|
||||
$("#title_notice_span").css('color','#ff0000');
|
||||
$("#title_notice_span").css('color', '#ff0000');
|
||||
$("#news_title").focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function regexDescription()
|
||||
{
|
||||
function regexDescription() {
|
||||
var name = news_description_editor.html();
|
||||
if(name.length ==0)
|
||||
{
|
||||
if (name.length == 0) {
|
||||
$("#description_notice_span").text("描述不能为空");
|
||||
$("#description_notice_span").css('color','#ff0000');
|
||||
$("#description_notice_span").css('color', '#ff0000');
|
||||
$("#description_notice_span").focus();
|
||||
return false;
|
||||
}
|
||||
else if(name.length >=6000){
|
||||
} else if (name.length >= 6000) {
|
||||
$("#description_notice_span").text("描述最多3000个汉字(或6000个英文字符)");
|
||||
$("#description_notice_span").css('color','#ff0000');
|
||||
$("#description_notice_span").css('color', '#ff0000');
|
||||
$("#description_notice_span").focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$("#description_notice_span").text("填写正确");
|
||||
$("#description_notice_span").css('color','#008000');
|
||||
$("#description_notice_span").css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function submitNews()
|
||||
{
|
||||
if(regexTitle() && regexDescription())
|
||||
{
|
||||
function submitNews() {
|
||||
if (regexTitle() && regexDescription()) {
|
||||
news_description_editor.sync();
|
||||
$("#news-form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
function submitFocus(obj)
|
||||
{
|
||||
function submitFocus(obj) {
|
||||
$(obj).focus();
|
||||
}
|
||||
|
||||
function submitComment()
|
||||
{
|
||||
function submitComment() {
|
||||
comment_editor.sync();
|
||||
$("#add_comment_form").submit();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////课程讨论区
|
||||
function course_board_submit_message_replay()
|
||||
{
|
||||
if(MessageReplayVevify())
|
||||
{
|
||||
message_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
||||
function course_board_submit_message_replay() {
|
||||
if (MessageReplayVevify()) {
|
||||
message_content_editor.sync(); //提交内容之前要sync,不然服务器端取不到值
|
||||
$("#message_form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
function course_board_canel_message_replay()
|
||||
{
|
||||
function course_board_canel_message_replay() {
|
||||
$("#reply").hide(200);
|
||||
$("#message_quote").html("");
|
||||
}
|
||||
|
||||
function MessageReplayVevify() {
|
||||
var content = message_content_editor.html();//$.trim($("#message_content").val());
|
||||
if (content.length == 0) {
|
||||
$("#message_content_span").text("回复不能为空");
|
||||
$("#message_content_span").css('color', '#ff0000');
|
||||
return false;
|
||||
var content = message_content_editor.html(); //$.trim($("#message_content").val());
|
||||
if (content.length == 0) {
|
||||
$("#message_content_span").text("回复不能为空");
|
||||
$("#message_content_span").css('color', '#ff0000');
|
||||
return false;
|
||||
} else {
|
||||
$("#message_content_span").text("填写正确");
|
||||
$("#message_content_span").css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#message_content_span").text("填写正确");
|
||||
$("#message_content_span").css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////
|
||||
//验证搜索时输入名字
|
||||
function regexName(content)
|
||||
{
|
||||
var name = $.trim($("#name").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#project_name_span").text(content);
|
||||
$("#project_name_span").css('color','#ff0000');
|
||||
$("#project_name_span").focus();
|
||||
return false;
|
||||
function regexName(content) {
|
||||
var name = $.trim($("#name").val());
|
||||
if (name.length == 0) {
|
||||
$("#project_name_span").text(content);
|
||||
$("#project_name_span").css('color', '#ff0000');
|
||||
$("#project_name_span").focus();
|
||||
return false;
|
||||
} else {
|
||||
$("#project_name_span").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_name_span").text("");
|
||||
return true;
|
||||
//提交搜索
|
||||
|
||||
function submitSerch(content) {
|
||||
if (regexName(content)) {
|
||||
$("#course_search_form").submit();
|
||||
}
|
||||
}
|
||||
//提交搜索
|
||||
function submitSerch(content)
|
||||
{
|
||||
if(regexName(content)){$("#course_search_form").submit();}
|
||||
}
|
||||
|
||||
//验证搜索时输入名字
|
||||
function regexQ(content)
|
||||
{
|
||||
var name = $.trim($("#q").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#course_member_name_span").text(content);
|
||||
$("#course_member_name_span").css('color','#ff0000');
|
||||
$("#course_member_name_span").focus();
|
||||
return false;
|
||||
function regexQ(content) {
|
||||
var name = $.trim($("#q").val());
|
||||
if (name.length == 0) {
|
||||
$("#course_member_name_span").text(content);
|
||||
$("#course_member_name_span").css('color', '#ff0000');
|
||||
$("#course_member_name_span").focus();
|
||||
return false;
|
||||
} else {
|
||||
$("#course_member_name_span").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#course_member_name_span").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//提交课程成员搜索
|
||||
function submitMemberSerch(content)
|
||||
{
|
||||
//提交课程成员搜索
|
||||
|
||||
function submitMemberSerch(content) {
|
||||
//if(regexQ(content)){$("#course_member_search_form").submit();}
|
||||
$("#course_member_search_form").submit();
|
||||
}
|
||||
|
||||
//课程描述显示更多信息
|
||||
function show_more_msg()
|
||||
{
|
||||
$("#course_description").toggleClass("course_description_none");
|
||||
function show_more_msg() {
|
||||
$("#course_description").toggleClass("course_description_none");
|
||||
}
|
||||
//作业描述显示更多信息
|
||||
|
||||
function news_show_more_des(id) {
|
||||
$('#news_description_' + id).toggleClass("news_description_none");
|
||||
}
|
||||
//作业描述显示更多信息
|
||||
function news_show_more_des(id)
|
||||
{
|
||||
$('#news_description_' + id).toggleClass("news_description_none");
|
||||
}
|
||||
function bid_show_more_des(id)
|
||||
{
|
||||
|
||||
function bid_show_more_des(id) {
|
||||
$("#bid_description_" + id).toggleClass("news_description_none");
|
||||
}
|
||||
|
||||
//课程作业结束时间倒计时
|
||||
function show_bid_dead_line(year,month,day,divname)
|
||||
{
|
||||
var now = new Date();
|
||||
var endDate = new Date(year, month-1, day);
|
||||
var leftTime=endDate.getTime()-now.getTime();
|
||||
var leftsecond = parseInt(leftTime/1000);
|
||||
var day1=Math.floor(leftsecond/(60*60*24));
|
||||
var hour=Math.floor((leftsecond-day1*24*60*60)/3600);
|
||||
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);
|
||||
$("#"+divname).html("<form name='formnow' class='fr'>"
|
||||
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+day1+"' > 天"
|
||||
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+hour+"' > 小时"
|
||||
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+minute+"' > 分"
|
||||
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+second+"' > 秒"
|
||||
+ "</form>"
|
||||
+ "<p class='fr'>作品提交还剩:</p>");
|
||||
}
|
||||
//验证新建作业的名字
|
||||
function regex_bid_name()
|
||||
{
|
||||
function show_bid_dead_line(year, month, day, divname) {
|
||||
var now = new Date();
|
||||
var endDate = new Date(year, month - 1, day);
|
||||
var leftTime = endDate.getTime() - now.getTime();
|
||||
var leftsecond = parseInt(leftTime / 1000);
|
||||
var day1 = Math.floor(leftsecond / (60 * 60 * 24));
|
||||
var hour = Math.floor((leftsecond - day1 * 24 * 60 * 60) / 3600);
|
||||
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);
|
||||
$("#" + divname).html("<form name='formnow' class='fr'>" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + day1 + "' > 天" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + hour + "' > 小时" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + minute + "' > 分" + "<input class='c_orange' type='text' style='border:0;' size='1' value='" + second + "' > 秒" + "</form>" + "<p class='fr'>作品提交还剩:</p>");
|
||||
}
|
||||
//验证新建作业的名字
|
||||
|
||||
function regex_bid_name() {
|
||||
var name = $.trim($("#bid_name").val());
|
||||
|
||||
if(name=="")
|
||||
{
|
||||
if (name == "") {
|
||||
$("#bid_name_span").text("名称不能为空");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$("#bid_name_span").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//验证匿评数量
|
||||
function regex_evaluation_num()
|
||||
{
|
||||
function regex_evaluation_num() {
|
||||
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
||||
var regex = /^\d+$/;
|
||||
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||
{
|
||||
if(evaluation_num=="")
|
||||
{
|
||||
if ($("#bid_open_anonymous_evaluation").attr("checked") == "checked") {
|
||||
if (evaluation_num == "") {
|
||||
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
||||
return false;
|
||||
}
|
||||
else if(regex.test(evaluation_num))
|
||||
{
|
||||
if(evaluation_num > 0)
|
||||
{
|
||||
} else if (regex.test(evaluation_num)) {
|
||||
if (evaluation_num > 0) {
|
||||
$("#bid_evaluation_num_span").text("");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//点击是否开启匿评单选框效果
|
||||
$(function(){
|
||||
$("#bid_open_anonymous_evaluation").click(function(){
|
||||
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||
{
|
||||
$(function() {
|
||||
$("#bid_open_anonymous_evaluation").click(function() {
|
||||
if ($("#bid_open_anonymous_evaluation").attr("checked") == "checked") {
|
||||
$("#bid_evaluation_num_li").slideDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$("#bid_evaluation_num_li").slideUp();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//老师提交新建作业
|
||||
function submit_new_bid(id)
|
||||
{
|
||||
if(regex_bid_name()&®ex_evaluation_num())
|
||||
{
|
||||
function submit_new_bid(id) {
|
||||
if (regex_bid_name() && regex_evaluation_num()) {
|
||||
bid_description_editor.sync();
|
||||
$("#"+id).submit();
|
||||
$("#" + id).submit();
|
||||
}
|
||||
}
|
||||
|
||||
function show_window (id1,id2,top,left) {
|
||||
$('#'+ id1).css('top',top);
|
||||
$('#'+ id1).css('left',left);
|
||||
$('#'+ id1).css('display','block');
|
||||
$('#' + id2).css('display','block');
|
||||
function show_window(id1, id2, top, left) {
|
||||
$('#' + id1).css('top', top);
|
||||
$('#' + id1).css('left', left);
|
||||
$('#' + id1).css('display', 'block');
|
||||
$('#' + id2).css('display', 'block');
|
||||
}
|
||||
|
||||
function close_window(id1,id2){
|
||||
$('#' + id1).css('display','none');
|
||||
$('#' + id2).css('display','none');
|
||||
function close_window(id1, id2) {
|
||||
$('#' + id1).css('display', 'none');
|
||||
$('#' + id2).css('display', 'none');
|
||||
}
|
||||
|
||||
//隐藏提示狂
|
||||
function hidden_atert_form(cur_page,cur_type)
|
||||
{
|
||||
function hidden_atert_form(cur_page, cur_type) {
|
||||
hideModal($("#popbox"));
|
||||
}
|
||||
|
||||
//当课程描述长度小于112px时,不显示更多按钮
|
||||
$(function(){
|
||||
if($("#course_description_content").height()>112)
|
||||
{
|
||||
$(function() {
|
||||
if ($("#course_description_content").height() > 112) {
|
||||
$("#lg-foot").show();
|
||||
}
|
||||
});
|
||||
|
||||
//将右侧的最小高度设置成左侧高度,美化界面
|
||||
// firefox pre标签换行
|
||||
$(document).ready(function () {
|
||||
$("#RSide").css("min-height",$("#LSide").height()-30);
|
||||
$(document).ready(function() {
|
||||
$("#RSide").css("min-height", $("#LSide").height() - 30);
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
var browser = {
|
||||
version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1],
|
||||
|
@ -494,50 +415,55 @@ $(document).ready(function () {
|
|||
msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
|
||||
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
|
||||
};
|
||||
if (browser.mozilla || browser.opera){
|
||||
if (browser.mozilla || browser.opera) {
|
||||
$("pre").addClass("break_word_firefox");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$("pre").addClass("break_word");
|
||||
}
|
||||
});
|
||||
|
||||
// 日历选择日期后关闭
|
||||
function regexDeadLine()
|
||||
{
|
||||
function regexDeadLine() {
|
||||
('#ui-datepicker-div').hide;
|
||||
}
|
||||
|
||||
//新建、修改课程明码显示
|
||||
$(function(){
|
||||
$(function() {
|
||||
$("#psw_btn").click(function() {
|
||||
alert("密码: "+$("#course_course_password").val());
|
||||
alert("密码: " + $("#course_course_password").val());
|
||||
});
|
||||
});
|
||||
|
||||
//课程通知更多按钮显示
|
||||
$(function(){
|
||||
$('.news_description').each(function () {
|
||||
if($(this).height() >= 38)
|
||||
{
|
||||
$('#news_foot_'+$(this).attr('id').replace('news_description_','')).css("display","block");
|
||||
}
|
||||
$(function() {
|
||||
$('.news_description').each(function() {
|
||||
if ($(this).height() >= 38) {
|
||||
$('#news_foot_' + $(this).attr('id').replace('news_description_', '')).css("display", "block");
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
$(".news_description img").one('load', function() {
|
||||
var node = $(this).parents('.news_description');
|
||||
if (node && node.height() >= 38) {
|
||||
$('#news_foot_' + node.attr('id').replace('news_description_', '')).css("display", "block");
|
||||
}
|
||||
}).each(function() {
|
||||
if (this.complete) {
|
||||
$(this).load();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//查找TAG资源
|
||||
function search_tag_attachment(url,tag_name,q,course_id,sort)
|
||||
{
|
||||
function search_tag_attachment(url, tag_name, q, course_id, sort) {
|
||||
//alert("111");
|
||||
$.get(
|
||||
url,
|
||||
{
|
||||
url, {
|
||||
tag_name: tag_name,
|
||||
q: q,
|
||||
course_id:course_id
|
||||
course_id: course_id
|
||||
},
|
||||
function (data) {
|
||||
function(data) {
|
||||
|
||||
}
|
||||
);
|
||||
|
@ -546,27 +472,22 @@ function search_tag_attachment(url,tag_name,q,course_id,sort)
|
|||
// 课程讨论区
|
||||
function showhelpAndScrollToMessage(id, id1, count) {
|
||||
$('#' + id).toggle();
|
||||
if(cookieget("repositories_visiable") == "true")
|
||||
{
|
||||
cookiesave("repositories_visiable", false,'','','');
|
||||
}
|
||||
else
|
||||
{
|
||||
cookiesave("repositories_visiable", true,'','','');
|
||||
if (cookieget("repositories_visiable") == "true") {
|
||||
cookiesave("repositories_visiable", false, '', '', '');
|
||||
} else {
|
||||
cookiesave("repositories_visiable", true, '', '', '');
|
||||
}
|
||||
var information = $(id1);
|
||||
var val = information.attr("value");
|
||||
if(val=="show_help")
|
||||
{
|
||||
$(id1).text("收起回复(" + count + ")" );
|
||||
if (val == "show_help") {
|
||||
$(id1).text("收起回复(" + count + ")");
|
||||
information.attr("value", "hide_help");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$(id1).text("展开回复(" + count + ")");
|
||||
information.attr("value", "show_help");
|
||||
}
|
||||
}
|
||||
|
||||
function show_more_reply(contentid, id2, id3) {
|
||||
$(contentid).toggleClass("course_description_none");
|
||||
var information = $(id2);
|
||||
|
@ -576,10 +497,9 @@ function show_more_reply(contentid, id2, id3) {
|
|||
$(id2).text("[收起]");
|
||||
information.attr("value", "hide_more");
|
||||
arrow.attr("src", "/images/jiantouup.jpg")
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$(id2).text("[展开]");
|
||||
information.attr("value", "show_more");
|
||||
arrow.attr("src", "/images/jiantou.jpg")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,9 +44,18 @@ $(function() {
|
|||
},
|
||||
done: function(e, data) {
|
||||
var imgSpan = jQuery('#avatar_image');
|
||||
imgSpan.attr({
|
||||
"src": data.result.text ? data.result.text() : data.result
|
||||
});
|
||||
var result = data.result.text ? data.result.text() : data.result;
|
||||
if(result){
|
||||
var o = JSON.parse(result);
|
||||
if(o.status == 0){
|
||||
imgSpan.attr({
|
||||
"src": o.url
|
||||
});
|
||||
} else {
|
||||
alert(o.message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -219,6 +219,7 @@ function regexTitle() {
|
|||
}
|
||||
|
||||
function regexDescription() {
|
||||
project_news_description_editor.sync();
|
||||
var name = $("#news_description").val();
|
||||
if (name.length == 0) {
|
||||
$("#description_notice_span").text("描述不能为空");
|
||||
|
@ -426,10 +427,41 @@ $(function(){
|
|||
cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
|
||||
target.toggle(timeout);
|
||||
}
|
||||
$("*[nhtype='toggle4cookie']").click(function(){
|
||||
$("*[nhtype='toggle4cookie']").live('click',function(){
|
||||
personalized_click($(this),500);
|
||||
});
|
||||
|
||||
personalized_init();
|
||||
});
|
||||
//cookie记忆html区块 显示/隐藏 的代码 end
|
||||
//cookie记忆html区块 显示/隐藏 的代码 end
|
||||
|
||||
// 新建项目的时候判断是否与我已有的项目重复
|
||||
function judgeprojectname(){
|
||||
$('#new_project').validate({
|
||||
errorPlacement: function(error, element){
|
||||
alert('error')
|
||||
},
|
||||
success: function(label){
|
||||
alert('ok')
|
||||
},
|
||||
onkeyup: false,
|
||||
rules : {
|
||||
name:{required : true,
|
||||
remote : {
|
||||
url : 'projects/judge_same_projectname',
|
||||
type:'get',
|
||||
dataType:'text',
|
||||
data:{
|
||||
name : function(){ return $.trim( $("#name").val() ); }
|
||||
},
|
||||
dataFilter:function( data ){
|
||||
if( data=='true')return false; else return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
messages : {
|
||||
name:{required : "请填写项目名称!",remote:'您已新建过同名项目,请修改项目名称!'}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2794,3 +2794,4 @@ div.repos_explain{
|
|||
padding-bottom: 20px;
|
||||
}
|
||||
.upload_img img{max-width: 100%;}
|
||||
#activity .upload_img img{width: 580px;}
|
||||
|
|
|
@ -330,6 +330,7 @@ a:hover.st_add{ color:#ff8e15;}
|
|||
.hwork_new{ color:#4c4c4c;}
|
||||
.c_red{ color:#F00;}
|
||||
.hwork_input{ border:1px solid #64bdd9; height:22px; width:555px; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_input_news{ border:1px solid #64bdd9; height:22px; width:594px; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_input02{ border:1px solid #64bdd9; height:15px; width:120px; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
|
||||
.hwork_new ul li{ }
|
||||
|
|
|
@ -93,6 +93,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.w520{ width:520px;}
|
||||
.w543{ width:543px;}
|
||||
.w557{ width:557px;}
|
||||
.w576{ width:576px;}
|
||||
.w583{ width:583px;}
|
||||
.w350{ width:350px;}
|
||||
.w610{ width:610px;}
|
||||
|
@ -286,7 +287,8 @@ html{ overflow-x:hidden;}
|
|||
.close_btn span { display:none;}
|
||||
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
|
||||
.msgserver { margin-top:5px;}
|
||||
.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }
|
||||
/*.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }*/
|
||||
.msgserver a { padding-left:4px; height:21px; display:block; }
|
||||
.opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;}
|
||||
a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
|
||||
a:hover.opnionButton{background: #0fa9bb; }
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#coding=utf-8
|
||||
#
|
||||
FactoryGirl.define do
|
||||
factory :attachment do
|
||||
filename "11.gif"
|
||||
filesize 296833
|
||||
digest "8a74e086d7716f89bc4fbac0606589c7"
|
||||
disk_directory "2015/05"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
#coding=utf-8
|
||||
#
|
||||
#:author_id, :budget, :deadline, :name, :description, :homework_type, :password
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :homework, class: Bid do
|
||||
name "test homework"
|
||||
budget 0
|
||||
deadline {(Time.now+1.days).strftime('%Y-%m-%d')}
|
||||
description "description"
|
||||
homework_type 3
|
||||
reward_type 3
|
||||
end
|
||||
|
||||
factory :homework_attach, class: HomeworkAttach do
|
||||
end
|
||||
end
|
|
@ -6,4 +6,12 @@ FactoryGirl.define do
|
|||
password "foobar111"
|
||||
password_confirmation "foobar111"
|
||||
end
|
||||
|
||||
factory :student, class: User do
|
||||
login "student"
|
||||
mail "student@example.com"
|
||||
password "foobar111"
|
||||
password_confirmation "foobar111"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ForumObserver do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe MemoObserver do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "avatar request", type: :request do
|
||||
describe "上传头像" do
|
||||
let(:user){FactoryGirl.create(:user)}
|
||||
|
||||
it "参数正确,可以成功上传头像" do
|
||||
data = File.open("#{Rails.root}/spec/fixtures/test.jpg").read
|
||||
binding.pry
|
||||
post upload_avatar_path(source_type: 'User', source_id: user.id, filename: 'test.jpg')
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include(/\/images\/avatars\/User\//)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -35,13 +35,53 @@ RSpec.describe "课程", :type => :request do
|
|||
context "修改课程图片" do
|
||||
include Rack::Test::Methods
|
||||
let(:avatar) {Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/test.jpg",'image/jpg')}
|
||||
|
||||
context "正常图片上传成功" do
|
||||
subject(:resp) {post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: avatar}}
|
||||
it{ expect(subject).to be_ok }
|
||||
it{ expect(subject.body).not_to be_empty }
|
||||
it "状态要为0" do
|
||||
o = ActiveSupport::JSON.decode(subject.body)
|
||||
expect(o["status"]).to eq(0)
|
||||
end
|
||||
it "要回传图片地址" do
|
||||
o = ActiveSupport::JSON.decode(subject.body)
|
||||
expect(o["url"]).not_to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context "不是图片,上传失败" do
|
||||
let(:invalid_avatar) {Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/hah.txt",'text/plain')}
|
||||
before do
|
||||
resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: invalid_avatar}
|
||||
@o = ActiveSupport::JSON.decode(resp.body)
|
||||
end
|
||||
it "状态不为0" do
|
||||
expect(@o["status"]).not_to eq(0)
|
||||
end
|
||||
it "要回传错误信息" do
|
||||
expect(@o["message"]).to be_include("图片")
|
||||
end
|
||||
end
|
||||
|
||||
context "文件过大,上传失败" do
|
||||
before do
|
||||
big_file = Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/test.jpg",'image/jpg')
|
||||
allow(ActionDispatch::Http::UploadedFile).to receive(:new).and_return(double('BigFile',size: 10*1024*1024, original_filename: 'rais.jpg', tempfile: nil))
|
||||
# trace = TracePoint.new(:call) do |tp|
|
||||
# p [tp.lineno, tp.defined_class, tp.method_id, tp.event] if tp.method_id == :post
|
||||
# end
|
||||
resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),'avatar[image]'=> big_file
|
||||
@o = ActiveSupport::JSON.decode(resp.body)
|
||||
end
|
||||
it "状态不为0" do
|
||||
expect(@o["status"]).not_to eq(0)
|
||||
end
|
||||
it "要回传错误信息" do
|
||||
expect(@o["message"]).to be_include("大")
|
||||
end
|
||||
end
|
||||
|
||||
it "不是图片,上传失败"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
require 'rails_helper'
|
||||
require 'shared_account_spec'
|
||||
|
||||
RSpec.describe "homework", type: :request do
|
||||
include_context "create user"
|
||||
let(:course) {FactoryGirl.create(:course, teacher: current_user)}
|
||||
let(:homework){FactoryGirl.attributes_for(:homework)}
|
||||
|
||||
before {
|
||||
shared_register
|
||||
}
|
||||
describe "创建作业" do
|
||||
before do
|
||||
post calls_create_homework_path(course_id: course.id), {
|
||||
bid: homework
|
||||
}
|
||||
@homework = assigns(:bid)
|
||||
end
|
||||
it "参数正确,可以成功创建作业" do
|
||||
expect(response).to redirect_to(course_homework_url(course.id))
|
||||
end
|
||||
it {expect(course.homeworks).to_not be_empty}
|
||||
it {expect(@homework.acts).to_not be_empty}
|
||||
it {expect(@homework.watchers).to_not be_empty}
|
||||
it {expect(@homework.attachments).to_not be_empty}
|
||||
end
|
||||
|
||||
describe "删除作业" do
|
||||
before do
|
||||
shared_login
|
||||
post calls_create_homework_path(course_id: course.id), {
|
||||
bid: homework
|
||||
}
|
||||
@homework = assigns(:bid)
|
||||
delete bids_homework_path(id: @homework.id)
|
||||
end
|
||||
it{expect(response).to redirect_to(course_homework_path(course.id))}
|
||||
it "homework_for_courses应删除" do
|
||||
expect(course.homeworks).to be_empty
|
||||
end
|
||||
it "相关活动也删除" do
|
||||
expect(@homework.acts).to be_empty
|
||||
end
|
||||
it "watches 删除" do
|
||||
expect(@homework.watchers).to be_empty
|
||||
end
|
||||
it "附件 删除" do
|
||||
expect(@homework.attachments).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,6 +1,40 @@
|
|||
require 'rails_helper'
|
||||
require 'shared_account_spec'
|
||||
|
||||
# "attachments"=>{"1"=>{"filename"=>"11.gif", "description"=>"", "is_public_checkbox"=>"1", "token"=>"33731.8a74e086d7716f89bc4fbac0606589c7"}}
|
||||
RSpec.describe "作业打包下载", :type => :request do
|
||||
let(:student){FactoryGirl.create(:student)}
|
||||
describe "单独下载某学生作业" do
|
||||
include_context "create user"
|
||||
before {
|
||||
FactoryGirl.create(:user)
|
||||
shared_login
|
||||
@homework = FactoryGirl.create(:homework, author_id: current_user.id)
|
||||
|
||||
@attch = HomeworkAttach.new
|
||||
@attch.bid_id = @homework.id
|
||||
@attch.user_id = student.id
|
||||
@attachment = Attachment.new(:file => File.open(File.join(Rails.root, "spec/fixtures/test.jpg")))
|
||||
@attachment.author = User.current
|
||||
@attachment.container_type = 'HomeworkAttach'
|
||||
@attachment.container_id = @attch.id
|
||||
@attachment.filename = "test.jpg"
|
||||
@attachment.save
|
||||
params = {"1"=>{"filename" => "test.jpg", "description" =>"",
|
||||
"is_public_checkbox"=>"1",
|
||||
"token" => "#{@attachment.id}.#{@attachment.digest}" }
|
||||
}
|
||||
@attch.save_attachments(params)
|
||||
@attch.name = "test.jpg"
|
||||
@attch.save!
|
||||
}
|
||||
it "正常下载" do
|
||||
uu = current_user
|
||||
allow(uu).to receive(:admin?).and_return(true)
|
||||
allow(User).to receive(:current).and_return(uu)
|
||||
get zipdown_download_user_homework_path, {homework:@attch.id}
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.content_type).to eq(Mime::Type.new("applcation/zip",:zip))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue