Merge branch 'szzh' into develop
This commit is contained in:
commit
47ce289bb6
|
@ -258,7 +258,7 @@ module Mobile
|
|||
requires :course_id,type: Integer,desc: '课程id'
|
||||
optional :name,type:String,desc:'课件名称可能包含的字符'
|
||||
end
|
||||
get ":course_id/attachments" do
|
||||
post ":course_id/attachments" do
|
||||
cs = CoursesService.new
|
||||
count = cs.course_attachments params
|
||||
present :data, count, with: Mobile::Entities::Attachment
|
||||
|
|
|
@ -94,6 +94,33 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc "用户留言"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer,desc: '被留言的用户id'
|
||||
end
|
||||
get ':user_id/messages' do
|
||||
us = UsersService.new
|
||||
jours = us.get_all_messages params
|
||||
present :data,jours,with:Mobile::Entities::Jours
|
||||
present :status,0
|
||||
end
|
||||
|
||||
desc "给用户留言或回复用户留言"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer,desc: '被留言的用户id'
|
||||
requires :content,type:String,desc:'留言内容'
|
||||
requires :ref_user_id,type:Integer,desc:'被回复的用户id'
|
||||
requires :parent_id,type:Integer,desc:'留言父id'
|
||||
requires :ref_message_id,type:Integer,desc:'引用消息id'
|
||||
end
|
||||
post ':user_id/leave_message' do
|
||||
us = UsersService.new
|
||||
jours = us.reply_user_messages params,current_user
|
||||
present :status,0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
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
|
||||
|
@ -29,43 +29,51 @@ class AvatarController < ApplicationController
|
|||
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.tempfile.path).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)
|
||||
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
|
||||
|
|
|
@ -32,13 +32,17 @@ class BoardsController < ApplicationController
|
|||
#modify by nwb
|
||||
@flag = params[:flag] || false
|
||||
if @project
|
||||
@boards = @project.boards.includes(:last_message => :author).all
|
||||
@boards = [] << @boards[0] if @boards.any?
|
||||
if @boards.size == 1
|
||||
@board = @boards.first
|
||||
show and return
|
||||
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
|
||||
render_403
|
||||
else
|
||||
@boards = @project.boards.includes(:last_message => :author).all
|
||||
@boards = [] << @boards[0] if @boards.any?
|
||||
if @boards.size == 1
|
||||
@board = @boards.first
|
||||
show and return
|
||||
end
|
||||
render :layout => false if request.xhr?
|
||||
end
|
||||
render :layout => false if request.xhr?
|
||||
elsif @course
|
||||
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||
@boards = @course.boards.includes(:last_message => :author).all
|
||||
|
|
|
@ -342,10 +342,15 @@ class CoursesController < ApplicationController
|
|||
|
||||
def export_course_member_excel
|
||||
@all_members = student_homework_score(0,0,0,"desc")
|
||||
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
|
||||
# 如果是ie11 需要转码
|
||||
if(/rv\:11\.0/.match(request.env["HTTP_USER_AGENT"]) != nil)
|
||||
filename= URI::encode(filename)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.xls {
|
||||
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
|
||||
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}.xls")
|
||||
:filename => "#{filename}.xls")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ class FilesController < ApplicationController
|
|||
before_filter :auth_login1, :only => [:index]
|
||||
before_filter :logged_user_by_apptoken,:only => [:index]
|
||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:search_project,:quote_resource_show_project,:search_tag_attachment]
|
||||
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment]
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
|
@ -46,6 +46,13 @@ class FilesController < ApplicationController
|
|||
@obj_attachments = paginateHelper @all_attachments,10
|
||||
end
|
||||
|
||||
def searchone4reload
|
||||
attachment = Attachment.find_by_id(params[:fileid]);
|
||||
respond_to do |format|
|
||||
format.html{render :layout => nil,:locals=>{:file=>attachment,:course=>@course}}
|
||||
end
|
||||
end
|
||||
|
||||
def search
|
||||
sort = ""
|
||||
@sort = ""
|
||||
|
|
|
@ -84,15 +84,10 @@ class IssuesController < ApplicationController
|
|||
@issue_pages = Paginator.new @issue_count, @limit, params['page']
|
||||
@offset ||= @issue_pages.offset
|
||||
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
|
||||
:order => sort_clause,
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
:order => sort_clause,
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
@issue_count_by_group = @query.issue_count_by_group
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
|
||||
|
|
|
@ -31,7 +31,7 @@ class ProjectsController < ApplicationController
|
|||
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
|
||||
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
||||
before_filter :file, :statistics, :watcherlist
|
||||
before_filter :file, :statistics #:watcherlist
|
||||
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
|
||||
before_filter :memberAccess, only: :member
|
||||
|
||||
|
@ -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
|
||||
|
@ -417,10 +417,14 @@ class ProjectsController < ApplicationController
|
|||
@members = @project.member_principals.includes(:roles, :principal).all.sort
|
||||
end
|
||||
else
|
||||
roles = Role.find_all_givable
|
||||
@subPage_title = l :label_member_list
|
||||
@members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all
|
||||
@applied_members = appied_project_members(@project, @members)
|
||||
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
|
||||
render_403
|
||||
else
|
||||
roles = Role.find_all_givable
|
||||
@subPage_title = l :label_member_list
|
||||
@members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all
|
||||
@applied_members = appied_project_members(@project, @members)
|
||||
end
|
||||
end
|
||||
@members = paginateHelper @members
|
||||
render :layout => 'base_courses' if @project.project_type == 1
|
||||
|
@ -676,11 +680,13 @@ class ProjectsController < ApplicationController
|
|||
true
|
||||
end
|
||||
|
||||
# added by huang
|
||||
|
||||
def watcherlist
|
||||
if @watched
|
||||
@users -= watched.watcher_users
|
||||
unless @project.nil?
|
||||
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
|
||||
render_403
|
||||
else
|
||||
@users -= watched.watcher_users if @watched
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -383,6 +383,8 @@ class UsersController < ApplicationController
|
|||
# scope = User.logged.status(@status)
|
||||
# @search_by = params[:search_by] ? params[:search_by][:id] : 0
|
||||
# scope = scope.like(params[:name],@search_by) if params[:name].present?
|
||||
@search_by = params[:search_by] ? params[:search_by] : 0
|
||||
|
||||
us = UsersService.new
|
||||
scope = us.search_user params
|
||||
@user_count = scope.count
|
||||
|
|
|
@ -85,6 +85,9 @@ class WordsController < ApplicationController
|
|||
elsif @journal_destroyed.jour_type == "Course"
|
||||
@course = Course.find @journal_destroyed.jour_id
|
||||
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
elsif @journal_destroyed.jour_type == "Principal"
|
||||
@user = User.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -593,13 +593,38 @@ module ApplicationHelper
|
|||
Project.project_tree(projects, &block)
|
||||
end
|
||||
|
||||
# 项目版本库可见权限判断
|
||||
# 条件:1、modules中设置不可见或项目没有版本库;2、如果项目是私有或者项目版本库隐藏则必须是项目成员才可见
|
||||
def visible_repository?(project)
|
||||
@result = false
|
||||
unless project.enabled_modules.where("name = 'repository'").empty? || project.repositories.count == 0
|
||||
if (project.hidden_repo || !project.is_public?)
|
||||
if User.current.member_of?(project)
|
||||
@result = true
|
||||
end
|
||||
else
|
||||
@result = true
|
||||
end
|
||||
end
|
||||
return @result
|
||||
end
|
||||
|
||||
# 判断当前用户是否为项目管理员
|
||||
def is_project_manager?(user_id,project_id)
|
||||
def is_project_manager?(user_id, project_id)
|
||||
@result = false
|
||||
mem = Member.where("user_id = ? and project_id = ?",user_id, project_id)
|
||||
unless mem.blank?
|
||||
mem.first.roles.to_s.include?("Manager")
|
||||
@result = false
|
||||
@result = mem.first.roles.to_s.include?("Manager") ? true : false
|
||||
end
|
||||
return @result
|
||||
end
|
||||
|
||||
# 公开项目资源可以引用,admin和管理员和资源上传者拥有设置公开私有权限
|
||||
def authority_pubilic_for_files(project, file)
|
||||
@result = false
|
||||
if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id || User.current.admin) &&
|
||||
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
|
||||
@result = true
|
||||
end
|
||||
return @result
|
||||
end
|
||||
|
|
|
@ -67,29 +67,33 @@ module IssuesHelper
|
|||
s.html_safe
|
||||
end
|
||||
|
||||
#获取跟踪类型
|
||||
#REDO:时间紧需要优化,两个方法可以综合成一个
|
||||
#获取跟踪类型及样式
|
||||
#REDO:时间紧可以优化.
|
||||
def get_issue_type(value)
|
||||
issuetype = []
|
||||
if value == "缺陷" || value == 1
|
||||
class_type = "red_btn_cir ml10"
|
||||
issuetype << "red_btn_cir ml10"
|
||||
issuetype << "缺陷"
|
||||
elsif value == "功能" || value == 2
|
||||
class_type = "blue_btn_cir ml10"
|
||||
issuetype << "blue_btn_cir ml10"
|
||||
issuetype << "功能"
|
||||
elsif value == "支持" || value == 3
|
||||
class_type = "green_btn_cir ml10"
|
||||
issuetype << "green_btn_cir ml10"
|
||||
issuetype << "支持"
|
||||
elsif value == "任务" || value == 4
|
||||
issuetype << "orange_btn_cir ml10"
|
||||
issuetype << "任务"
|
||||
else
|
||||
class_type = "orange_btn_cir ml10"
|
||||
issuetype << "bgreen_btn_cir ml10"
|
||||
issuetype << "周报"
|
||||
end
|
||||
end
|
||||
|
||||
def get_issue_typevalue(value)
|
||||
if value == "缺陷" || value == 1
|
||||
assign = "缺陷"
|
||||
elsif value == "功能" || value == 2
|
||||
assign = "功能"
|
||||
elsif value == "支持" || value == 3
|
||||
assign = "支持"
|
||||
def principals_options_for_isuue_list(project)
|
||||
if User.current.member_of?(project)
|
||||
project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
|
||||
else
|
||||
assign = "任务"
|
||||
project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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,19 @@ 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]]
|
||||
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
|
||||
|
|
|
@ -4,6 +4,7 @@ class UsersService
|
|||
include AvatarHelper
|
||||
include CoursesHelper
|
||||
include ApiHelper
|
||||
include WordsHelper
|
||||
#将用户注册的功能函数写这里
|
||||
#参数约定
|
||||
#成功返回注册后的User实例,失败直接抛异常
|
||||
|
@ -154,6 +155,34 @@ class UsersService
|
|||
@user
|
||||
end
|
||||
|
||||
# 获取某个用户的所有留言信息
|
||||
def get_all_messages params
|
||||
user = User.find(params[:user_id])
|
||||
jours = user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
jours.update_all(:is_readed => true, :status => false)
|
||||
jours.each do |journal|
|
||||
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
end
|
||||
jours
|
||||
end
|
||||
|
||||
# 回复用户
|
||||
def reply_user_messages params,current_user
|
||||
user = User.find(params[:user_id])
|
||||
parent_id = params[:parent_id]
|
||||
author_id = current_user.id
|
||||
reply_user_id = params[:ref_user_id]
|
||||
reply_id = params[:ref_message_id]
|
||||
content = params[:content]
|
||||
options = {:user_id => author_id,
|
||||
:status => true,
|
||||
:m_parent_id => parent_id,
|
||||
:m_reply_id => reply_id,
|
||||
:reply_id => reply_user_id,
|
||||
:notes => content,
|
||||
:is_readed => false}
|
||||
user.add_jour(nil, nil,nil,options)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
@ -206,10 +235,18 @@ class UsersService
|
|||
}
|
||||
scope = User.logged.status(status)
|
||||
if params[:is_search_assitant].nil?
|
||||
watcher = User.watched_by(params[:user_id])
|
||||
watcher.push(params[:user_id])
|
||||
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件(bug:#2270) start
|
||||
#say by yutao: params[:user_id]这个是指谁发起的搜索么? 如果是 这个值貌似应该从session获取 怪怪的赶脚-_-!
|
||||
search_by = params[:search_by] ? params[:search_by] : "0"
|
||||
scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present?
|
||||
if params[:name].present?
|
||||
if !params[:user_id].nil?
|
||||
watcher = User.watched_by(params[:user_id])
|
||||
watcher.push(params[:user_id])
|
||||
scope = scope.where("id not in (?)",watcher)
|
||||
end
|
||||
scope = scope.like(params[:name],search_by)
|
||||
end
|
||||
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
|
||||
else
|
||||
teachers = searchTeacherAndAssistant(Course.find(params[:course_id]))
|
||||
scope = scope.where("id not in (?)",teachers.map{|t| t.user_id}).like(params[:name],search_by) if params[:name].present?
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
<div class="attachments" style="font-weight:normal;">
|
||||
<% is_float ||= false %>
|
||||
<% for attachment in attachments %>
|
||||
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<div style="float:left;">
|
||||
<p style="height:14px;line-height:10px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%if is_float%>
|
||||
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
|
||||
<% end%>
|
||||
|
@ -50,9 +51,10 @@
|
|||
:id => attachment,
|
||||
:filename => attachment.filename%>
|
||||
<% end %>
|
||||
<span title="<%= attachment.description%>">
|
||||
<%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %>
|
||||
</span>
|
||||
</div>
|
||||
<div style="float:left;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="<%= attachment.description%>">
|
||||
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
|
||||
</div>
|
||||
<span class="size">(
|
||||
<%= number_to_human_size attachment.filesize %>)
|
||||
</span>
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
$("#error_show").html("<%= @message.html_safe %>");
|
||||
<% else %>
|
||||
closeModal();
|
||||
searchone4reload('<%=params[:file_id]%>');
|
||||
<% 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>
|
||||
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
<script>
|
||||
function searchone4reload(fileid){
|
||||
var url = "<%= searchone4reload_course_files_path(@course)%>";
|
||||
var data = {};data.fileid=fileid;
|
||||
$.ajax({
|
||||
url:url,dataType:'text',data:data,success:function(text){
|
||||
var container_file_div = $("#container_files_"+fileid);
|
||||
container_file_div.after(text);
|
||||
container_file_div.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
function show_upload(obj)
|
||||
{
|
||||
switch(obj)
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="files_tag" id="files_tag">
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="for_img_thumbnails">
|
||||
<% curse_attachments.each do |file| %>
|
||||
<% if file.is_public? || User.current.member_of_course?(course) %>
|
||||
<div class="re_con_box">
|
||||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
<% curse_attachments.each do |file| %>
|
||||
<% if file.is_public? || User.current.member_of_course?(course) %>
|
||||
<div class="re_con_box" id="container_files_<%= file.id %>">
|
||||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
|
||||
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
|
||||
</span>
|
||||
<% else %>
|
||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="">
|
||||
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% else %>
|
||||
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||
<% else %>
|
||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="">
|
||||
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% else %>
|
||||
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
|
|
|
@ -20,14 +20,16 @@
|
|||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
<% if User.current.logged? %>
|
||||
<%#--私有项目资源不能引用,不能设置公开私有--%>
|
||||
<%#--公开项目资源可以应用,管理员和资源上传者拥有设置公开私有权限--%>
|
||||
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id) && project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project" %>
|
||||
<% 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) %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
|
||||
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -27,6 +27,8 @@ $('#upload_file_div').slideToggle('slow');
|
|||
<%elsif @course%>
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
|
||||
$("#courses_files_count_info").html("<%= @all_attachments.count%>");
|
||||
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
|
||||
<% end %>
|
||||
<% end %>
|
||||
$(document).ready(img_thumbnails);
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
|
||||
<% if file.is_public? || User.current.member_of_course?(course) %>
|
||||
<div class="re_con_box" id="container_files_<%= file.id %>">
|
||||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
|
||||
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
|
||||
</span>
|
||||
<% else %>
|
||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="">
|
||||
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% else %>
|
||||
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||
<% end %>
|
|
@ -12,7 +12,7 @@
|
|||
<%= link_to issue.author.name, user_path(issue.author), :class => "problem_name c_orange fl" %>
|
||||
<span class="fl"><%= l(:label_post_on_issue) %>(<%= "#{raw column_content[2]}" %>):</span>
|
||||
<div class="problem_tit_div fl">
|
||||
<%=link_to "#{column_content[4]}<span class = '#{get_issue_type(column_content[1])}'>#{get_issue_typevalue(column_content[1])}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %>
|
||||
<%=link_to "#{column_content[4]}<span class = '#{get_issue_type(column_content[1])[0]}'>#{get_issue_type(column_content[1])[1]}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
|
|
|
@ -1,19 +1,38 @@
|
|||
<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[nhtype='dateinput']").each(function(){
|
||||
$(this).attr('readonly',true);
|
||||
$(this).datepicker({
|
||||
dateFormat: 'yy-mm-dd',
|
||||
showButtonPanel: true,showClearButton: true,showTodayButton: true,
|
||||
changeMonth: true,
|
||||
changeYear: true
|
||||
});
|
||||
$(this).change(function(){
|
||||
$("#issue_query_form").submit();
|
||||
})
|
||||
});
|
||||
});
|
||||
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();
|
||||
remote_function();
|
||||
}
|
||||
|
||||
function EnterPress(e){
|
||||
|
@ -31,43 +50,58 @@
|
|||
</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="problem_search_btn fl" onclick="nh_reset_form();" >清空</a>-->
|
||||
</div><!--problem_search end-->
|
||||
|
||||
<div id="filter_form" class="fr" >
|
||||
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给",0]),
|
||||
|
||||
<%= select( :issue, :user_id, principals_options_for_isuue_list(@project),
|
||||
{ :include_blank => false,:selected=>@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 class="cl"></div>
|
||||
<%# end %>
|
||||
<p class="problem_p fl" ><%= l(:label_issues_sum) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.count %></a>
|
||||
<%= l(:lable_issues_undo) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').count %> </a>
|
||||
<!--<div>-->
|
||||
<!--<div style="float:left;">创建时间 : </div>-->
|
||||
<!--<div>-->
|
||||
<!--<%#= text_field_tag 'issue_create_date_start', '',:readonly=>true, :size=>15, :onchange => "remote_function()",:style=>'float:left;'%>-->
|
||||
<!--<%#= calendar_for('issue_create_date_start') %>-->
|
||||
<!--</div>-->
|
||||
<!--<div style="float:left;"> - </div>-->
|
||||
<!--<div>-->
|
||||
<!--<%#= text_field_tag 'issue_create_date_end', '',:readonly=>true, :size=>15, :onchange => "remote_function()",:style=>'float:left;'%>-->
|
||||
<!--<%#= calendar_for('issue_create_date_end') %>-->
|
||||
<!--</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>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>");
|
||||
$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>");
|
||||
$("#v_subject").focus();
|
||||
$("#v_subject").blur();
|
|
@ -2,7 +2,6 @@
|
|||
<h2 class="project_h2"><%= l(:label_issue_new) %></h2>
|
||||
</div>
|
||||
<%= call_hook(:view_issues_new_top, {:issue => @issue}) %>
|
||||
|
||||
<%= labelled_form_for @issue, :url => project_issues_path(@project),
|
||||
:html => {:id => 'issue-form', :multipart => true} do |f| %>
|
||||
<%= error_messages_for 'issue' %>
|
||||
|
@ -16,7 +15,6 @@
|
|||
</a>
|
||||
<%#= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %>
|
||||
<% end %>
|
||||
|
||||
<div id="preview" class="wiki"></div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
<div class="talk_txt fl">
|
||||
<p class="pro_page_tit" style="word-break:break-all;">
|
||||
<%= @issue.subject %>
|
||||
<span class='<%= "#{get_issue_type(@issue.tracker_id)}" %>'><%= get_issue_typevalue(@issue.tracker_id) %></span>
|
||||
<span class='<%= "#{get_issue_type(@issue.tracker_id)[0]}" %>'><%= get_issue_type(@issue.tracker_id)[1] %></span>
|
||||
</p><br/>
|
||||
|
||||
<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>
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.issues.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.issues.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
|
||||
<% unless @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %>
|
||||
<% if @project.hidden_repo || !@project.is_public? %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- more -->
|
||||
<div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>
|
||||
<ul class="navContent" id="navContent">
|
||||
<%= render 'projects/tools_expand' %>
|
||||
</ul>
|
|
@ -1,29 +0,0 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,40 +0,0 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.issues.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.issues.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
|
@ -20,5 +20,4 @@
|
|||
!Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %>
|
||||
<%= exit_project_link(@project) %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<span>| </span>
|
||||
<%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>)
|
||||
<span>| </span>
|
||||
<%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue' %>)</div>
|
||||
<%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程信息 end-->
|
||||
<div class="info_box">
|
||||
|
@ -127,7 +127,7 @@
|
|||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange" %>
|
||||
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
|
||||
<%= link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white') if is_teacher %>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
|
|
|
@ -35,43 +35,6 @@
|
|||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<script type="text/javascript">
|
||||
function regexName()
|
||||
{
|
||||
var name = $.trim($("#name").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
|
||||
$("#project_name_span").css('color','#ff0000');
|
||||
$("#project_name_span").focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_name_span").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function submitSerch()
|
||||
{
|
||||
if(regexName()){$("#project_search_form").submit();}
|
||||
}
|
||||
</script>
|
||||
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<br />
|
||||
<span id="project_name_span" style="float: left"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/forums", forums_path %></a></td>
|
||||
|
|
|
@ -1,247 +1,245 @@
|
|||
<% @nav_dispaly_project_label = 1
|
||||
@nav_dispaly_forum_label = 1 %>
|
||||
@nav_dispaly_forum_label = 1 %>
|
||||
<%#@nav_dispaly_project_label = 1 %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<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 %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','select_list_move' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<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 %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','select_list_move' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- 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 => 'layouts/base_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 => 'layouts/base_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 => 'layouts/base_friend_group')) %>');
|
||||
$("#close_light").attr("onClick","close_window('friend_organization');");
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("服务器异常,请与管理员联系");
|
||||
}
|
||||
}
|
||||
);
|
||||
<!--项目的三种类型-->
|
||||
<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;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<!--add by huang-->
|
||||
<body>
|
||||
<div id="Container">
|
||||
<%= render :partial => 'layouts/new_header'%>
|
||||
<div class="cl"></div>
|
||||
else if($("#research_group").attr("checked") == "checked"){
|
||||
project_type = 2;
|
||||
|
||||
<!--TopBar begin-->
|
||||
<div id="TopBar">
|
||||
<div class="topbar_info02 fl">
|
||||
<h2>
|
||||
<a href="http://<%= Setting.host_name %>" target="_blank" class="c_blue">
|
||||
<%= l(:label_projects_community) %>
|
||||
</a>
|
||||
</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) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="search fl">
|
||||
}
|
||||
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>
|
||||
<div id="Container">
|
||||
<%= render :partial => 'layouts/new_header'%>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form", :class => "search_form") do %>
|
||||
<%= text_field_tag 'name', params[:name], :placeholder => "项目名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>
|
||||
<a href="#" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
<span id="project_name_span" class="fl"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div><!--TopBar end-->
|
||||
<div id="content">
|
||||
<div id="LSide" class="fl">
|
||||
<div class="project_info">
|
||||
<div class="pr_info_logo fl mr10 mb5">
|
||||
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %>
|
||||
</div>
|
||||
<div class="pr_info_id fl mb5 f14">
|
||||
<%= l(:label_project_id)%><%= @project.id %>
|
||||
</div>
|
||||
<!--关注、申请加入/退出项目-->
|
||||
<div id="join_exit_project_div">
|
||||
<% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%>
|
||||
<% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%>
|
||||
<%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %>
|
||||
</div>
|
||||
<!-- 项目得分 -->
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
|
||||
<% if @project.is_public? %>
|
||||
<span class="img_private"><%= l(:label_public)%></span>
|
||||
<% else %>
|
||||
<span class="img_private"><%= l(:label_private)%></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<% if @project.project_type == 0 %>
|
||||
<span class="fb f14 "><%= l(:label_project_score)%> :</span>
|
||||
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
|
||||
:action => 'show_projects_score',
|
||||
:remote => true,
|
||||
:id => @project.id
|
||||
}, :class => "c_orange f14" ) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--参数-->
|
||||
<div class="pr_info_foot">
|
||||
<%= 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>)
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--参数 end-->
|
||||
|
||||
<!--邀请加入-->
|
||||
<div class="subNavBox">
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="$('#navContent_invit').toggle(500);"><%= l(:label_invite)%></div>
|
||||
<ul class="navContent " style="display:block" id="navContent_invit">
|
||||
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
|
||||
<% if User.current.allowed_to?(:manage_members, @project) %>
|
||||
<li><%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %><!--end-->
|
||||
<!--menu 左侧工具栏 -->
|
||||
<!--project_new_type: 1为开发组;2为科研组;3为朋友圈子-->
|
||||
<div id="project_memu_list">
|
||||
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
|
||||
<%= render :partial => 'layouts/base_development_group', :locals => {:project => @project}%>
|
||||
<% elsif @project.project_new_type == 2 %>
|
||||
<%= render :partial => 'layouts/base_research_team', :locals => {:project => @project}%>
|
||||
<% else %>
|
||||
<%= render :partial => 'layouts/base_friend_group', :locals => {:project => @project}%>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
</div><!--项目侧导航 end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<!-- 项目描述 -->
|
||||
<div class="project_intro">
|
||||
<div id="course_description" class="course_description">
|
||||
<h4 ><%= l(:label_project_overview)%>:</h4>
|
||||
<div id="course_description_content" class="break_word">
|
||||
<%= textilizable(@project.description) if @project.description && !@project.description.blank? %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lg-foot" id="lg-foot" onclick="show_more_msg();">
|
||||
<label id="expend_more_information" value="show_more"><%= l(:label_expend_information)%></label>
|
||||
<span class="g-arr-down">
|
||||
<img id="arrow" src="/images/jiantou.jpg" width="12" height="6" />
|
||||
</span>
|
||||
</div>
|
||||
</div><!--项目简介 end-->
|
||||
|
||||
<!-- tag模块 -->
|
||||
<div class="project_Label">
|
||||
<h4 class="mb5"><%= l(:label_tag)%>:</h4>
|
||||
<div class="tag_h">
|
||||
<div id="tags">
|
||||
<%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--项目标签 end-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/new_footer'%>
|
||||
<div class="cl"></div>
|
||||
</div><!--Container end-->
|
||||
<div id="light" class="white_content02">
|
||||
<!-- 这里写需弹出框的HTML代码 -->
|
||||
<% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%>
|
||||
<div ><a href="javascript:void(0)" onClick="close_window('<%= text%>');" class="box_close" id="close_light"></a></div>
|
||||
<div class=" mt10">
|
||||
<h3 class="mb10 c_blue">请选择项目类型:</h3>
|
||||
<ul class="mb10" id="project_type">
|
||||
<li><input type="radio" name="project_type" <%= @project.project_new_type == 1 ? 'checked' : ''%> id="development_group"/><label class="f14"> 开发模式:<span class="f12 ml5 c_grey">为团队开发提供一系列在线协同工具。</span></label></li>
|
||||
<li><input type="radio" name="project_type" <%= @project.project_new_type == 2 ? 'checked' : ''%> id="research_group"/><label class="f14"> 研讨模式:<span class="f12 ml5 c_grey">为小组研究提供阶段汇报和交流工具。</span></label></li>
|
||||
<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>
|
||||
<!--TopBar begin-->
|
||||
<div id="TopBar">
|
||||
<div class="topbar_info02 fl">
|
||||
<h2>
|
||||
<a href="http://<%= Setting.host_name %>" target="_blank" class="c_blue">
|
||||
<%= l(:label_projects_community) %>
|
||||
</a>
|
||||
</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) %>
|
||||
</p>
|
||||
</div>
|
||||
<div id="fade" class="black_overlay">123</div>
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
<div class="search fl">
|
||||
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form", :class => "search_form") do %>
|
||||
<%= text_field_tag 'name', params[:name], :placeholder => "项目名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>
|
||||
<a href="#" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
<span id="project_name_span" class="fl"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div><!--TopBar end-->
|
||||
<div id="content">
|
||||
<div id="LSide" class="fl">
|
||||
<div class="project_info">
|
||||
<div class="pr_info_logo fl mr10 mb5">
|
||||
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %>
|
||||
</div>
|
||||
<div class="pr_info_id fl mb5 f14">
|
||||
<%= l(:label_project_id)%><%= @project.id %>
|
||||
</div>
|
||||
<!--关注、申请加入/退出项目-->
|
||||
<div id="join_exit_project_div">
|
||||
<% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%>
|
||||
<% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%>
|
||||
<%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %>
|
||||
</div>
|
||||
<!-- 项目得分 -->
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
|
||||
<% if @project.is_public? %>
|
||||
<span class="img_private"><%= l(:label_public)%></span>
|
||||
<% else %>
|
||||
<span class="img_private"><%= l(:label_private)%></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<% if @project.project_type == 0 %>
|
||||
<span class="fb f14 "><%= l(:label_project_score)%> :</span>
|
||||
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
|
||||
:action => 'show_projects_score',
|
||||
:remote => true,
|
||||
:id => @project.id}, :class => "c_orange f14" ) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--参数-->
|
||||
<div class="pr_info_foot">
|
||||
<%= 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>)
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--参数 end-->
|
||||
|
||||
<!--邀请加入-->
|
||||
<div class="subNavBox">
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit"><%= l(:label_invite)%></div>
|
||||
<ul class="navContent " style="display:block" id="navContent_invit">
|
||||
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
|
||||
<% if User.current.allowed_to?(:manage_members, @project) %>
|
||||
<li><%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %><!--end-->
|
||||
<!--menu 左侧工具栏 -->
|
||||
<!--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}%>
|
||||
<% elsif @project.project_new_type == 2 %>
|
||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project}%>
|
||||
<% else %>
|
||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project}%>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
</div><!--项目侧导航 end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<!-- 项目描述 -->
|
||||
<div class="project_intro">
|
||||
<div id="course_description" class="course_description">
|
||||
<h4 ><%= l(:label_project_overview)%>:</h4>
|
||||
<div id="course_description_content" class="break_word">
|
||||
<%= textilizable(@project.description) if @project.description && !@project.description.blank? %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lg-foot" id="lg-foot" onclick="show_more_msg();">
|
||||
<label id="expend_more_information" value="show_more"><%= l(:label_expend_information)%></label>
|
||||
<span class="g-arr-down">
|
||||
<img id="arrow" src="/images/jiantou.jpg" width="12" height="6" />
|
||||
</span>
|
||||
</div>
|
||||
</div><!--项目简介 end-->
|
||||
|
||||
<!-- tag模块 -->
|
||||
<div class="project_Label">
|
||||
<h4 class="mb5"><%= l(:label_tag)%>:</h4>
|
||||
<div class="tag_h">
|
||||
<div id="tags">
|
||||
<%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--项目标签 end-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/new_footer'%>
|
||||
<div class="cl"></div>
|
||||
</div><!--Container end-->
|
||||
<div id="light" class="white_content02">
|
||||
<!-- 这里写需弹出框的HTML代码 -->
|
||||
<% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%>
|
||||
<div ><a href="javascript:void(0)" onClick="close_window('<%= text%>');" class="box_close" id="close_light"></a></div>
|
||||
<div class=" mt10">
|
||||
<h3 class="mb10 c_blue">请选择项目类型:</h3>
|
||||
<ul class="mb10" id="project_type">
|
||||
<li><input type="radio" name="project_type" <%= @project.project_new_type == 1 ? 'checked' : ''%> id="development_group"/><label class="f14"> 开发模式:<span class="f12 ml5 c_grey">为团队开发提供一系列在线协同工具。</span></label></li>
|
||||
<li><input type="radio" name="project_type" <%= @project.project_new_type == 2 ? 'checked' : ''%> id="research_group"/><label class="f14"> 研讨模式:<span class="f12 ml5 c_grey">为小组研究提供阶段汇报和交流工具。</span></label></li>
|
||||
<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>
|
||||
</div>
|
||||
<div id="fade" class="black_overlay">123</div>
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.issues.visible.all.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.issues.visible.all.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
|
||||
<% if visible_repository?(@project) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- more -->
|
||||
<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>
|
|
@ -0,0 +1,29 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,40 @@
|
|||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.issues.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.issues.visible.all.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end%>
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_invite_join) %></h2>
|
||||
</div>
|
||||
|
@ -68,5 +67,32 @@
|
|||
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;
|
||||
}
|
||||
});
|
||||
if(user_ischeck==false){
|
||||
nh_show_err_message('请选择用户!');
|
||||
return false;
|
||||
}
|
||||
var role_ischeck=false;
|
||||
$("input[name='membership[role_ids][]']").each(function(){
|
||||
if($(this).prop('checked')){
|
||||
role_ischeck=true;
|
||||
}
|
||||
});
|
||||
if(role_ischeck==false){
|
||||
nh_show_err_message('请选择角色!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,6 +1,6 @@
|
|||
<script type="text/javascript">
|
||||
<%if @select_tab%>
|
||||
$(function(){
|
||||
$(function(){
|
||||
<%if @select_tab%>
|
||||
<%if @select_tab == "modules"%>
|
||||
project_setting(2);
|
||||
<% elsif @select_tab == "versions"%>
|
||||
|
@ -10,10 +10,10 @@
|
|||
project_setting(6);
|
||||
$("#pro_st_edit_ku").toggle();
|
||||
<%else%>
|
||||
|
||||
<% end%>
|
||||
});
|
||||
<% end%>
|
||||
<% end%>
|
||||
$("div[nhname='pro_setting']").show();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="project_r_h">
|
||||
|
@ -21,7 +21,7 @@
|
|||
</div>
|
||||
|
||||
<!--通过admin界面配置,不同角色显示不同的模块-->
|
||||
<div class=" pro_setting">
|
||||
<div class=" pro_setting" nhname="pro_setting" style="display:none;">
|
||||
<div id="pro_st_tb_" class="pro_st_tb_">
|
||||
<ul>
|
||||
<% show_memu = show_project_memu User.current%>
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
}
|
||||
$.ajax({
|
||||
type :"POST",
|
||||
url :prefix + '/school/search_school/?key_word='+encodeURIComponent(value)+'&province='+province,
|
||||
url :prefix + '/school/search_school/?key_word='+encodeURIComponent(value)+'&province='+encodeURIComponent(province),
|
||||
data :'text',
|
||||
success: function(data){
|
||||
$("#schoollist").html(data);
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<div class='' style="float:left;max-width:300px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">
|
||||
<% unless course.is_public == 1 %>
|
||||
<span class="private_project"><%= l(:label_private) %></span>
|
||||
<% end %>
|
||||
<%= link_to(course.name.truncate(25, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
<%= link_to(course.name+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<span class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
<%#=course.try(:teacher).try(:name)%>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
$('#jours_count').html("<%= @jours_count %>");
|
||||
<% elsif @course && @jours_count%>
|
||||
$('#course_jour_count').html("(<%= @jours_count %>)");
|
||||
<% elsif @user && @jours_count%>
|
||||
$('#jour_count').html("<%= @jours_count %>");
|
||||
<% end %>
|
||||
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
|
||||
destroyedItem.fadeOut(600,function(){
|
||||
|
|
|
@ -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: "是无效的"
|
||||
|
@ -435,4 +436,4 @@ zh:
|
|||
last: "末页 »"
|
||||
previous: "« 上一页"
|
||||
next: "下一页 »"
|
||||
truncate: "..."
|
||||
truncate: "..."
|
||||
|
|
|
@ -1521,4 +1521,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
|
||||
|
||||
|
|
|
@ -393,6 +393,7 @@ zh:
|
|||
label_document_added: 文档已添加
|
||||
label_forum_message_added: 贴吧发帖成功
|
||||
label_forum_add: 贴吧创建成功
|
||||
label_forum_reply: 贴吧回复成功
|
||||
label_message_reply: 回帖人
|
||||
label_document_public_info: (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该文档。)
|
||||
label_role: 角色
|
||||
|
@ -1984,3 +1985,4 @@ zh:
|
|||
label_code: 代码
|
||||
|
||||
error_upload_avatar_to_large: "超过大小限制 (%{max_size})"
|
||||
not_valid_image_file: 不是有效的图片文件
|
||||
|
|
|
@ -715,6 +715,7 @@ RedmineApp::Application.routes.draw do
|
|||
collection do
|
||||
match "getattachtype", :via => [:get, :post]
|
||||
match "search",:via => [:post,:get]
|
||||
match "searchone4reload",:via => [:post,:get]
|
||||
match "search_tag_attachment", :via => [:post,:get]
|
||||
end
|
||||
member do
|
||||
|
|
|
@ -541,7 +541,6 @@ ActiveRecord::Schema.define(:version => 20150514133640) do
|
|||
t.integer "is_teacher_score", :default => 0
|
||||
end
|
||||
|
||||
add_index "homework_attaches", ["bid_id"], :name => "bid_id"
|
||||
add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
|
||||
|
||||
create_table "homework_evaluations", :force => true do |t|
|
||||
|
@ -556,9 +555,7 @@ ActiveRecord::Schema.define(:version => 20150514133640) do
|
|||
t.integer "bid_id"
|
||||
end
|
||||
|
||||
add_index "homework_for_courses", ["bid_id"], :name => "bid_id"
|
||||
add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
|
||||
add_index "homework_for_courses", ["course_id"], :name => "course_id"
|
||||
add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
|
||||
|
||||
create_table "homework_users", :force => true do |t|
|
||||
|
@ -1163,14 +1160,12 @@ ActiveRecord::Schema.define(:version => 20150514133640) do
|
|||
create_table "students_for_courses", :force => true do |t|
|
||||
t.integer "student_id"
|
||||
t.integer "course_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "student_idCopy"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
|
||||
add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
|
||||
add_index "students_for_courses", ["student_id"], :name => "student_id"
|
||||
|
||||
create_table "taggings", :force => true do |t|
|
||||
t.integer "tag_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')))
|
||||
|
|
|
@ -20,8 +20,8 @@ module Redmine
|
|||
notifications << Notifiable.new('message_posted')
|
||||
notifications << Notifiable.new('wiki_content_added')
|
||||
notifications << Notifiable.new('wiki_content_updated')
|
||||
notifications << Notifiable.new('forum_add')
|
||||
notifications << Notifiable.new('forum_message_added', 'forum_add')
|
||||
notifications << Notifiable.new('forum_reply')
|
||||
notifications << Notifiable.new('forum_message_added', 'forum_reply')
|
||||
notifications
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,37 @@
|
|||
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,4]== 0xff.chr + 0xd8.chr + 0xff.chr + 0xe0.chr
|
||||
end
|
||||
def png?(data)
|
||||
data[0,2]==0x89.chr + 80.chr
|
||||
end
|
||||
|
||||
def image?
|
||||
begin
|
||||
f = File.open(@file,'rb') # rb means to read using binary
|
||||
return false if f.size < 9
|
||||
data = f.read(9) # magic numbers are up to 9 bytes
|
||||
return bitmap?(data) || gif?(data) || jpeg?(data) || png?(data)
|
||||
ensure
|
||||
f.close
|
||||
end
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -384,4 +384,45 @@ function submitProjectBoard()
|
|||
{
|
||||
$("#message-form").submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//cookie记忆html区块 显示/隐藏 的代码 start
|
||||
$(function(){
|
||||
var personalized_expand_key = "personalized_expand";
|
||||
function personalized_init(){
|
||||
var personalized_map = cookieget(personalized_expand_key);
|
||||
if(personalized_map!=false){
|
||||
personalized_map = JSON.parse(personalized_map);
|
||||
$("*[nhtype='toggle4cookie']").each(function(){
|
||||
var personalized_id=$(this).data('id');
|
||||
var val = personalized_map[personalized_id];
|
||||
if(val!=undefined && val!=$(this).data('val')){
|
||||
personalized_click($(this),0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function personalized_click(obj,timeout){
|
||||
var target = $(obj.data('target'));
|
||||
var oldval = obj.data('val');
|
||||
var val='';
|
||||
if(oldval=='expand'){val='retract';}else{val='expand';}
|
||||
obj.data('val',val);
|
||||
var personalized_map = cookieget(personalized_expand_key);
|
||||
if(personalized_map == false){
|
||||
personalized_map={};
|
||||
}else{
|
||||
personalized_map = JSON.parse(personalized_map);
|
||||
}
|
||||
var personalized_id=obj.data('id');
|
||||
personalized_map[personalized_id]=val;
|
||||
cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
|
||||
target.toggle(timeout);
|
||||
}
|
||||
$("*[nhtype='toggle4cookie']").click(function(){
|
||||
personalized_click($(this),500);
|
||||
});
|
||||
|
||||
personalized_init();
|
||||
});
|
||||
//cookie记忆html区块 显示/隐藏 的代码 end
|
|
@ -1904,6 +1904,18 @@ input.autocomplete.ajax-loading {
|
|||
background-image: url(../images/loading.gif);
|
||||
}
|
||||
|
||||
.private_project {
|
||||
position: relative;
|
||||
bottom: 2px;
|
||||
text-transform: uppercase;
|
||||
background: #d22;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
padding: 0px 2px 0px 2px;
|
||||
font-size: 60%;
|
||||
margin-right: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
/***** Flash & error messages ****/
|
||||
#errorExplanation, div.flash, .nodata, .warning, .conflict {
|
||||
padding: 4px 4px 4px 30px;
|
||||
|
@ -2782,3 +2794,4 @@ div.repos_explain{
|
|||
padding-bottom: 20px;
|
||||
}
|
||||
.upload_img img{max-width: 100%;}
|
||||
#activity .upload_img img{width: 580px;}
|
||||
|
|
|
@ -177,6 +177,7 @@ a:hover.blue_u_btn{background:#64bdd9; color:#fff;}
|
|||
.green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;}
|
||||
.blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;}
|
||||
.orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;}
|
||||
.bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;}
|
||||
/* commonpic */
|
||||
.pic_date{ display:block; background:url(../images/new_project/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; float:left;}
|
||||
.pic_add{ display:block; background:url(../images/new_project/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; float:left;}
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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