Merge branch 'szzh' into develop
This commit is contained in:
commit
c0067eb616
1
Gemfile
1
Gemfile
|
@ -6,6 +6,7 @@ unless RUBY_PLATFORM =~ /w32/
|
|||
gem 'iconv'
|
||||
end
|
||||
|
||||
gem 'grack', path:'./lib/grack'
|
||||
gem 'rest-client'
|
||||
gem "mysql2", "= 0.3.18"
|
||||
gem 'redis-rails'
|
||||
|
|
|
@ -25,21 +25,29 @@ class AccountController < ApplicationController
|
|||
# Login request and validation
|
||||
def login
|
||||
if request.get?
|
||||
@login = params[:login] || true
|
||||
if User.current.logged?
|
||||
redirect_to home_url
|
||||
redirect_to user_path(User.current)
|
||||
else
|
||||
render :layout => 'login'
|
||||
end
|
||||
else
|
||||
authenticate_user
|
||||
end
|
||||
end
|
||||
|
||||
# 服务协议
|
||||
def agreement
|
||||
render :layout => 'static_base'
|
||||
end
|
||||
|
||||
# Log out current user and redirect to welcome page
|
||||
def logout
|
||||
if User.current.anonymous?
|
||||
redirect_to home_url
|
||||
redirect_to signin_path
|
||||
elsif request.post?
|
||||
logout_user
|
||||
redirect_to home_url
|
||||
redirect_to signin_path
|
||||
end
|
||||
# display the logout form
|
||||
end
|
||||
|
@ -50,16 +58,16 @@ class AccountController < ApplicationController
|
|||
|
||||
# Lets user choose a new password
|
||||
def lost_password
|
||||
(redirect_to(home_url); return) unless Setting.lost_password?
|
||||
(redirect_to(signin_path); return) unless Setting.lost_password?
|
||||
if params[:token]
|
||||
@token = Token.find_token("recovery", params[:token].to_s)
|
||||
if @token.nil? || @token.expired?
|
||||
redirect_to home_url
|
||||
redirect_to signin_path
|
||||
return
|
||||
end
|
||||
@user = @token.user
|
||||
unless @user && @user.active?
|
||||
redirect_to home_url
|
||||
redirect_to signin_path
|
||||
return
|
||||
end
|
||||
if request.post?
|
||||
|
@ -71,7 +79,7 @@ class AccountController < ApplicationController
|
|||
return
|
||||
end
|
||||
end
|
||||
render :template => "account/password_recovery"
|
||||
render :template => "account/password_recovery"
|
||||
return
|
||||
else
|
||||
if request.post?
|
||||
|
@ -79,6 +87,7 @@ class AccountController < ApplicationController
|
|||
# user not found or not active
|
||||
unless user && user.active?
|
||||
flash.now[:error] = l(:notice_account_unknown_email)
|
||||
render :layout => 'static_base'
|
||||
return
|
||||
end
|
||||
# user cannot change its password
|
||||
|
@ -91,16 +100,17 @@ class AccountController < ApplicationController
|
|||
if token.save
|
||||
Mailer.run.lost_password(token)
|
||||
flash[:notice] = l(:notice_account_lost_email_sent)
|
||||
redirect_to signin_url
|
||||
redirect_to lost_password_path
|
||||
return
|
||||
end
|
||||
end
|
||||
render :layout => 'static_base'
|
||||
end
|
||||
end
|
||||
|
||||
# User self-registration
|
||||
def register
|
||||
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
|
||||
(redirect_to(signin_path); return) unless Setting.self_registration? || session[:auth_source_registration]
|
||||
if request.get?
|
||||
session[:auth_source_registration] = nil
|
||||
@user = User.new(:language => current_language.to_s)
|
||||
|
@ -128,10 +138,12 @@ class AccountController < ApplicationController
|
|||
end
|
||||
when '3'
|
||||
#register_automatically(@user)
|
||||
unless @user.new_record?
|
||||
if !@user.new_record?
|
||||
self.logged_user = @user
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
redirect_to my_account_url
|
||||
else
|
||||
redirect_to signin_path
|
||||
end
|
||||
else
|
||||
#register_manually_by_administrator(@user)
|
||||
|
@ -175,11 +187,11 @@ class AccountController < ApplicationController
|
|||
|
||||
# Token based account activation
|
||||
def activate
|
||||
(redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present?
|
||||
(redirect_to(signin_path); return) unless Setting.self_registration? && params[:token].present?
|
||||
token = Token.find_token('register', params[:token].to_s)
|
||||
(redirect_to(home_url); return) unless token and !token.expired?
|
||||
(redirect_to(signin_path); return) unless token and !token.expired?
|
||||
user = token.user
|
||||
(redirect_to(home_url); return) unless user.registered?
|
||||
(redirect_to(signin_path); return) unless user.registered?
|
||||
user.activate
|
||||
if user.save
|
||||
token.destroy
|
||||
|
@ -266,7 +278,7 @@ class AccountController < ApplicationController
|
|||
user = User.find_or_initialize_by_identity_url(identity_url)
|
||||
if user.new_record?
|
||||
# Self-registration off
|
||||
(redirect_to(home_url); return) unless Setting.self_registration?
|
||||
(redirect_to(signin_path); return) unless Setting.self_registration?
|
||||
|
||||
# Create on the fly
|
||||
user.login = registration['nickname'] unless registration['nickname'].nil?
|
||||
|
@ -353,12 +365,15 @@ class AccountController < ApplicationController
|
|||
|
||||
def invalid_credentials
|
||||
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
flash.now[:error] = l(:notice_account_invalid_creditentials)
|
||||
flash[:error] = l(:notice_account_invalid_creditentials)
|
||||
# render :layout => 'login'
|
||||
redirect_to signin_path(:login=>true)
|
||||
end
|
||||
|
||||
def invalid_credentials_new
|
||||
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
flash.now[:error] = l(:notice_account_invalid_creditentials_new)
|
||||
flash[:error] = l(:notice_account_invalid_creditentials_new)
|
||||
render signin_path(:login=>true)
|
||||
end
|
||||
|
||||
# Register a user for email activation.
|
||||
|
|
|
@ -337,6 +337,19 @@ class AdminController < ApplicationController
|
|||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#学校列表
|
||||
def schools
|
||||
@school_name = params[:school_name]
|
||||
if @school_name
|
||||
@schools = School.where("name like '%#{@school_name}%'")
|
||||
else
|
||||
@schools = School.all
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
#移动端版本管理
|
||||
def mobile_version
|
||||
@versions = PhoneAppVersion.reorder('created_at desc')
|
||||
|
@ -382,4 +395,78 @@ class AdminController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
#留言列表
|
||||
def leave_messages
|
||||
@jour = JournalsForMessage.find_by_sql("SELECT * FROM journals_for_messages AS j1
|
||||
WHERE j1.jour_type IN ('Course','Principal') AND (j1.m_parent_id IS NULL OR (j1.m_parent_id IN (SELECT id FROM journals_for_messages WHERE jour_type IN ('Course','Principal')))) order by created_on desc")
|
||||
@jour = paginateHelper @jour,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#帖子
|
||||
def messages_list
|
||||
@memo = Memo.reorder("created_at desc")
|
||||
@memo = paginateHelper @memo,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#课程讨论区的帖子
|
||||
def course_messages
|
||||
@course_ms=Message.joins("join boards on messages.board_id=boards.id where boards.course_id is not NULL").reorder('created_on desc')
|
||||
@course_ms = paginateHelper @course_ms,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#项目讨论区的帖子
|
||||
def project_messages
|
||||
@project_ms=Message.joins("join boards on messages.board_id=boards.id where boards.project_id != -1").reorder('created_on desc')
|
||||
@project_ms = paginateHelper @project_ms,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#通知
|
||||
def notices
|
||||
@news = News.where('course_id is not NULL').order('created_on desc')
|
||||
@news = paginateHelper @news,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#最近登录用户列表
|
||||
def latest_login_users
|
||||
scope = User.order('last_login_on desc')
|
||||
scope = scope.where("last_login_on>= '#{params[:startdate]} 00:00:00'") if params[:startdate].present?
|
||||
scope =scope.where("last_login_on <= '#{params[:enddate]} 23:59:59'") if params[:enddate].present?
|
||||
@user = scope
|
||||
@user = paginateHelper @user,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#作业
|
||||
def homework
|
||||
@homework = HomeworkCommon.order('end_time desc')
|
||||
@homework = paginateHelper @homework,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -557,12 +557,13 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def redirect_back_or_default(default, options={})
|
||||
back_url = params[:back_url].to_s
|
||||
back_url = '' #params[:back_url].to_s
|
||||
if back_url.present?
|
||||
begin
|
||||
uri = URI.parse(back_url)
|
||||
# do not redirect user to another host or to the login or register page
|
||||
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
|
||||
back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s)
|
||||
redirect_to(back_url)
|
||||
return
|
||||
end
|
||||
|
|
|
@ -67,7 +67,29 @@ class BoardsController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def show
|
||||
def show
|
||||
#¸üжÔÓ¦µÄforge_messages±íµÄviewed×Ö¶Î
|
||||
if @project
|
||||
query_forge_messages = @board.messages
|
||||
query_forge_messages.each do |query_forge_message|
|
||||
query = query_forge_message.forge_messages
|
||||
query.each do |forge_message|
|
||||
if User.current.id == forge_message.user_id
|
||||
forge_message.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif @course
|
||||
query_course_messages = @board.messages
|
||||
query_course_messages.each do |query_course_message|
|
||||
query = query_course_message.course_messages
|
||||
query.each do |course_message|
|
||||
if User.current.id == course_message.user_id
|
||||
course_message.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {
|
||||
|
|
|
@ -39,9 +39,14 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
@state = 5 #未登录
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
|
||||
end
|
||||
# if @state == 1 || @state == 3
|
||||
# respond_to course_path(course.id)
|
||||
# else
|
||||
respond_to do |format|
|
||||
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
|
||||
end
|
||||
#end
|
||||
|
||||
rescue Exception => e
|
||||
@state = 4 #已经加入了课程
|
||||
respond_to do |format|
|
||||
|
@ -101,74 +106,18 @@ class CoursesController < ApplicationController
|
|||
# 课程搜索
|
||||
# add by nwb
|
||||
def search
|
||||
courses_all = Course.all_course
|
||||
name = params[:name]
|
||||
if name.blank?
|
||||
@courses = []
|
||||
@courses_all = []
|
||||
@course_count = 0
|
||||
@course_pages = Paginator.new @course_count, per_page_option, params['page']
|
||||
if params[:name].empty?
|
||||
courses = Course.visible
|
||||
@courses = paginateHelper courses,10
|
||||
else
|
||||
@courses = courses_all.visible
|
||||
if params[:name].present?
|
||||
@courses_all = @courses.like(params[:name])
|
||||
else
|
||||
@courses_all = @courses;
|
||||
end
|
||||
@course_count = @courses_all.count
|
||||
@course_pages = Paginator.new @course_count, per_page_option, params['page']
|
||||
|
||||
# 课程的动态数
|
||||
@course_activity_count=Hash.new
|
||||
@courses_all.each do |course|
|
||||
@course_activity_count[course.id]=0
|
||||
end
|
||||
|
||||
case params[:course_sort_type]
|
||||
when '0'
|
||||
@courses = @courses_all.order("created_at desc")
|
||||
@s_type = 0
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
when '1'
|
||||
@courses = @courses_all.order("course_ac_para desc")
|
||||
@s_type = 1
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
when '2'
|
||||
@courses = @courses_all.order("watchers_count desc")
|
||||
@s_type = 2
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
when '3'
|
||||
@course_activity_count=get_course_activity @courses_all,@course_activity_count_array
|
||||
@courses=handle_course @courses_all,@course_activity_count
|
||||
@s_type = 3
|
||||
@courses = @courses[@course_pages.offset, @course_pages.per_page]
|
||||
|
||||
else
|
||||
@s_type = 0
|
||||
@courses = @courses_all.order("created_at desc")
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
end
|
||||
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'")
|
||||
@courses = paginateHelper courses,10
|
||||
end
|
||||
|
||||
@name = params[:name]
|
||||
@type = 'courses'
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'course_base'
|
||||
scope = Course
|
||||
unless params[:closed]
|
||||
scope = scope.active
|
||||
end
|
||||
}
|
||||
format.atom {
|
||||
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
||||
|
@ -658,92 +607,9 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
|
||||
return
|
||||
end
|
||||
@users_by_role = @course.users_by_role
|
||||
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
|
||||
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
|
||||
end
|
||||
@key = User.current.rss_key
|
||||
#新增内容
|
||||
@days = Setting.activity_days_default.to_i
|
||||
if params[:from]
|
||||
begin; @date_to = params[:from].to_date + 1; rescue; end
|
||||
end
|
||||
has = {
|
||||
"show_course_files" => true,
|
||||
"show_course_news" => true,
|
||||
"show_course_messages" => true,
|
||||
#"show_course_journals_for_messages" => true,
|
||||
# "show_bids" => true,
|
||||
# "show_homeworks" => true,
|
||||
"show_polls" => true
|
||||
}
|
||||
@date_to ||= Date.today + 1
|
||||
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
|
||||
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
||||
if @author.nil?
|
||||
# 显示老师和助教的活动
|
||||
# @authors = searchTeacherAndAssistant(@course)
|
||||
@authors = course_all_member(@course)
|
||||
events = []
|
||||
key = "course_events_#{@course.id}".to_sym
|
||||
if Rails.env.production? && Setting.course_cahce_enabled?
|
||||
events = Rails.cache.read(key) || []
|
||||
end
|
||||
if events.empty?
|
||||
@authors.each do |author|
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||
:with_subprojects => false,
|
||||
:author => author.user)
|
||||
|
||||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events += @activity.events(@days, @course.created_at)
|
||||
else
|
||||
events += @activity.events(@days, @course.created_at, :is_public => 1)
|
||||
end
|
||||
end
|
||||
Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled?
|
||||
end
|
||||
else
|
||||
# @author = @course.teacher
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||
:with_subprojects => false,
|
||||
:author => @author)
|
||||
|
||||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events(@days, @course.created_at)
|
||||
else
|
||||
events = @activity.events(@days, @course.created_at, :is_public => 1)
|
||||
end
|
||||
end
|
||||
|
||||
# 无新动态时,显示老动态
|
||||
if events.count == 0
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events
|
||||
else
|
||||
events = @activity.events(:is_public => 1)
|
||||
end
|
||||
end
|
||||
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
|
||||
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
|
||||
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
|
||||
end
|
||||
|
||||
sorted_events = sort_activity_events_course(events)
|
||||
events = paginateHelper sorted_events,10
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
# documents
|
||||
|
||||
|
||||
course_activities = @course.course_activities.order("created_at desc")
|
||||
@canShowRealName = User.current.member_of_course? @course
|
||||
@course_activities = paginateHelper course_activities,10
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
format.api
|
||||
|
|
|
@ -177,11 +177,11 @@ class FilesController < ApplicationController
|
|||
def index
|
||||
@flag = params[:flag] || false
|
||||
#sort_init 'filename', 'asc'
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
'filename' => "#{Attachment.table_name}.filename",
|
||||
'size' => "#{Attachment.table_name}.filesize",
|
||||
'downloads' => "#{Attachment.table_name}.downloads"
|
||||
# sort_init 'created_on', 'desc'
|
||||
# sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
# 'filename' => "#{Attachment.table_name}.filename",
|
||||
# 'size' => "#{Attachment.table_name}.filesize",
|
||||
# 'downloads' => "#{Attachment.table_name}.downloads"
|
||||
sort = ""
|
||||
@sort = ""
|
||||
@order = ""
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class HomeworkCommonController < ApplicationController
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
require "base64"
|
||||
layout "base_courses"
|
||||
before_filter :find_course, :only => [:index,:new,:create,:next_step]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
|
||||
|
@ -22,7 +23,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
@homework = HomeworkCommon.new
|
||||
@homework.safe_attributes = params[:homework_common]
|
||||
@homework.late_penalty = 0
|
||||
@homework.late_penalty = 2
|
||||
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
|
||||
|
||||
|
@ -30,7 +31,7 @@ class HomeworkCommonController < ApplicationController
|
|||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.absence_penalty = 2
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
|
@ -51,7 +52,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
@homework = HomeworkCommon.new
|
||||
@homework.safe_attributes = params[:homework_common]
|
||||
@homework.late_penalty = 0
|
||||
@homework.late_penalty = 2
|
||||
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
|
||||
|
||||
|
@ -59,7 +60,7 @@ class HomeworkCommonController < ApplicationController
|
|||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.absence_penalty = 2
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
|
@ -99,12 +100,14 @@ class HomeworkCommonController < ApplicationController
|
|||
question = {title:homework.name,content:homework.description}
|
||||
question[:input] = []
|
||||
question[:output] = []
|
||||
if params[:input] && params[:output]
|
||||
if params[:input] && params[:output] && params[:result]
|
||||
params[:input].each do |k,v|
|
||||
if params[:output].include? k
|
||||
homework_test = HomeworkTest.new
|
||||
homework_test.input = v
|
||||
homework_test.output = params[:output][k]
|
||||
homework_test.result = params[:result][k]
|
||||
homework_test.error_msg = params[:error_msg]
|
||||
homework.homework_tests << homework_test
|
||||
question[:input] << homework_test.input
|
||||
question[:output] << homework_test.output
|
||||
|
@ -221,17 +224,21 @@ class HomeworkCommonController < ApplicationController
|
|||
homework_test = HomeworkTest.find id
|
||||
homework_test.destroy if homework_test
|
||||
end
|
||||
if params[:input] && params[:output]
|
||||
if params[:input] && params[:output] && params[:result]
|
||||
params[:input].each do |k,v|
|
||||
if params[:output].include? k
|
||||
homework_test = HomeworkTest.find_by_id k
|
||||
if homework_test #已存在的测试,修改
|
||||
homework_test.input = v
|
||||
homework_test.output = params[:output][k]
|
||||
homework_test.result = params[:result][k]
|
||||
homework_test.error_msg = params[:error_msg]
|
||||
else #不存在的测试,增加
|
||||
homework_test = HomeworkTest.new
|
||||
homework_test.input = v
|
||||
homework_test.output = params[:output][k]
|
||||
homework_test.result = params[:result][k]
|
||||
homework_test.error_msg = params[:error_msg]
|
||||
homework_test.homework_common = @homework
|
||||
end
|
||||
homework_test.save
|
||||
|
@ -351,6 +358,24 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def programing_test
|
||||
test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
|
||||
@index = params[:index]
|
||||
uri = URI('http://192.168.80.21:8080/api/realtime.json')
|
||||
body = test.to_json
|
||||
res = Net::HTTP.new(uri.host, uri.port).start do |client|
|
||||
request = Net::HTTP::Post.new(uri.path)
|
||||
request.body = body
|
||||
request["Content-Type"] = "application/json"
|
||||
client.request(request)
|
||||
end
|
||||
result = JSON.parse(res.body)
|
||||
@err_msg = result["compile_error_msg"]
|
||||
result["results"].each do |re|
|
||||
@result = re["status"]
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
#获取课程
|
||||
def find_course
|
||||
|
|
|
@ -112,7 +112,19 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
|
||||
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
|
||||
query = @issue.forge_messages
|
||||
if User.current.id == @issue.assigned_to_id
|
||||
query.update_all(:viewed => true)
|
||||
end
|
||||
# 缺陷状态更新
|
||||
query_journals = @issue.journals
|
||||
if User.current.id == @issue.author_id
|
||||
query_journals.each do |query_journal|
|
||||
query_journal.forge_messages.update_all(:viewed => true)
|
||||
end
|
||||
end
|
||||
#
|
||||
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
|
||||
@journals.each_with_index {|j,i| j.indice = i+1}
|
||||
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
||||
|
|
|
@ -115,6 +115,8 @@ class MemosController < ApplicationController
|
|||
|
||||
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
|
||||
def show
|
||||
#更新贴吧帖子留言对应的memo_messages的viewed字段
|
||||
query_memo_messages = @memo.memo_messages
|
||||
pre_count = REPLIES_PER_PAGE
|
||||
|
||||
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
||||
|
|
|
@ -137,7 +137,7 @@ class MyController < ApplicationController
|
|||
@se.identity = params[:identity].to_i if params[:identity]
|
||||
@se.technical_title = params[:technical_title] if params[:technical_title]
|
||||
@se.student_id = params[:no] if params[:no]
|
||||
@se.brief_introduction = params[:brief_introduction]
|
||||
# @se.brief_introduction = params[:brief_introduction]
|
||||
@se.description = params[:description]
|
||||
|
||||
if @user.save && @se.save
|
||||
|
@ -157,7 +157,7 @@ class MyController < ApplicationController
|
|||
File.delete(diskfile1) if File.exist?(diskfile1)
|
||||
end
|
||||
|
||||
render :layout=>'base_users_new'
|
||||
render :layout=>'new_base_user'
|
||||
end
|
||||
|
||||
# Destroys user's account
|
||||
|
@ -174,7 +174,7 @@ class MyController < ApplicationController
|
|||
logout_user
|
||||
flash.now[:notice] = l(:notice_account_deleted)
|
||||
end
|
||||
redirect_to home_url
|
||||
redirect_to signin_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class NewsController < ApplicationController
|
|||
|
||||
@news_count = scope.count
|
||||
@q = params[:subject]
|
||||
if params[:subject].nil?
|
||||
if params[:subject].nil? || params[:subject].blank?
|
||||
scope_order = scope.all(:include => [:author, :course],
|
||||
:order => "#{News.table_name}.created_on DESC")
|
||||
else
|
||||
|
@ -99,6 +99,31 @@ class NewsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
#更新news对应的forge_messages的viewed字段
|
||||
query_forge_news = @news.forge_messages
|
||||
query_forge_news.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
#更新news对应的course_messages的viewed字段
|
||||
query_course_news = @news.course_messages
|
||||
query_course_news.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
#更新项目新闻的评阅的viewed字段
|
||||
current_forge_comments = @news.comments
|
||||
current_forge_comments.each do |current_forge_comment|
|
||||
query_forge_comment = current_forge_comment.forge_messages
|
||||
query_forge_comment.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cs = CoursesService.new
|
||||
result = cs.show_course_news params,User.current
|
||||
@news = result[:news]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#encoding utf-8
|
||||
class PollController < ApplicationController
|
||||
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
|
||||
before_filter :find_container, :only => [:new,:create, :index]
|
||||
|
@ -27,6 +28,12 @@ class PollController < ApplicationController
|
|||
render_403
|
||||
return
|
||||
end
|
||||
query_course_poll = @poll.course_messages
|
||||
query_course_poll.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
#已提交问卷的用户不能再访问该界面
|
||||
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
|
||||
|
@ -137,11 +144,19 @@ class PollController < ApplicationController
|
|||
@poll_questions.poll_answers.new question_option
|
||||
end
|
||||
end
|
||||
if @poll_questions.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
# 如果是插入的话,那么从插入的这个id以后的question_num都将要+1
|
||||
if params[:quest_id]
|
||||
@is_insert = true
|
||||
@poll.poll_questions.where("question_number > #{params[:quest_num].to_i}").update_all(" question_number = question_number + 1")
|
||||
@poll_question_num = params[:quest_num].to_i
|
||||
@poll_questions.question_number = params[:quest_num].to_i + 1
|
||||
end
|
||||
if @poll_questions.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#修改题目
|
||||
|
@ -328,6 +343,37 @@ class PollController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def import_poll
|
||||
@poll = Poll.find(params[:to_id])
|
||||
question_num = @poll.poll_questions.select("max(question_number) question_number").first.question_number
|
||||
import_poll = Poll.find(params[:import_id])
|
||||
import_poll.poll_questions.each_with_index do |question,index|
|
||||
option = {
|
||||
:is_necessary => question.is_necessary,
|
||||
:question_title => question.question_title,
|
||||
:question_type => question.question_type,
|
||||
:question_number => question_num + index+1
|
||||
}
|
||||
poll_questions = @poll.poll_questions.new option
|
||||
for i in 1..question.poll_answers.count
|
||||
answer = question.poll_answers[i-1][:answer_text]
|
||||
question_option = {
|
||||
:answer_position => i,
|
||||
:answer_text => answer
|
||||
}
|
||||
poll_questions.poll_answers.new question_option
|
||||
end
|
||||
@poll.poll_questions << poll_questions
|
||||
end
|
||||
if @poll.save
|
||||
@poll = Poll.find(params[:to_id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#重新发布问卷
|
||||
def republish_poll
|
||||
@poll.poll_questions.each do |poll_question|
|
||||
|
@ -371,6 +417,70 @@ class PollController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 将其他地方的问卷导出来
|
||||
def other_poll
|
||||
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的问卷 进行导入
|
||||
tea_ids = '('
|
||||
tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')'
|
||||
@polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
|
||||
@polls_group_id = params[:polls_group_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 将问卷导入本课程
|
||||
def import_other_poll
|
||||
course_id = params[:course_id]
|
||||
@course = Course.find(course_id)
|
||||
params[:polls].each_with_index do |p,i|
|
||||
poll = Poll.find(p)
|
||||
option = {
|
||||
:polls_name => poll.polls_name || l(:label_poll_new),
|
||||
:polls_type => 'Course',
|
||||
:polls_group_id => course_id,
|
||||
:polls_status => 1,
|
||||
:user_id => User.current.id,
|
||||
:published_at => Time.now,
|
||||
:closed_at => Time.now,
|
||||
:show_result => 1,
|
||||
:polls_description => poll.polls_description
|
||||
}
|
||||
@poll = Poll.create option
|
||||
|
||||
poll.poll_questions.each do | q|
|
||||
#question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title]
|
||||
option = {
|
||||
:is_necessary => q[:is_necessary],
|
||||
:question_title => q[:question_title],
|
||||
:question_type => q[:question_type] || 1,
|
||||
:question_number => q[:question_number]
|
||||
}
|
||||
@poll_questions = @poll.poll_questions.new option
|
||||
|
||||
for i in 1..q.poll_answers.count
|
||||
answer = q.poll_answers[i-1].nil? ? l(:label_new_answer) : q.poll_answers[i-1][:answer_text]
|
||||
question_option = {
|
||||
:answer_position => i,
|
||||
:answer_text => answer
|
||||
}
|
||||
@poll_questions.poll_answers.new question_option
|
||||
end
|
||||
end
|
||||
@poll.save
|
||||
end
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
if @is_teacher
|
||||
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
|
||||
else
|
||||
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
|
||||
end
|
||||
@polls = paginateHelper polls,20 #分页
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_poll_and_course
|
||||
@poll = Poll.find params[:id]
|
||||
|
|
|
@ -86,8 +86,15 @@ class ProjectsController < ApplicationController
|
|||
@project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
|
||||
else
|
||||
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
|
||||
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
|
||||
end
|
||||
@projects = @project_pages.order("created_on desc")
|
||||
@limit = 10#per_page_option
|
||||
|
||||
@project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
|
||||
@project_pages = Paginator.new @project_count, @limit, params['page']
|
||||
@name = params[:name]
|
||||
@type = 'projects'
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base'
|
||||
|
@ -150,11 +157,15 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
render :layout => 'base'
|
||||
if User.current.login?
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
render :layout => 'base'
|
||||
else
|
||||
redirect_to signin_url
|
||||
end
|
||||
end
|
||||
|
||||
def share
|
||||
|
@ -167,6 +178,10 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
unless User.current.login?
|
||||
redirect_to signin_url
|
||||
return
|
||||
end
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
@project = Project.new
|
||||
|
@ -280,11 +295,11 @@ class ProjectsController < ApplicationController
|
|||
|
||||
# 根据私密性,取出符合条件的所有数据
|
||||
if User.current.member_of?(@project) || User.current.admin?
|
||||
@events_pages = ForgeActivity.where("project_id = ?",@project).order("created_at desc").page(params['page'|| 1]).per(20);
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20);
|
||||
#events = @activity.events(@date_from, @date_to)
|
||||
else
|
||||
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
|
||||
= ?",@project,1).order("created_at desc")
|
||||
= ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc")
|
||||
.page(params['page'|| 1]).per(10);
|
||||
# @events = @activity.events(@date_from, @date_to, :is_public => 1)
|
||||
end
|
||||
|
@ -361,37 +376,6 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# dts测试工具
|
||||
def dts_dep
|
||||
render_403 unless User.current.admin?
|
||||
@dts = Dts.all
|
||||
end
|
||||
|
||||
# dts云部署
|
||||
def yun_dep
|
||||
render_403 unless User.current.admin?
|
||||
end
|
||||
|
||||
# 软件知识库
|
||||
def soft_knowledge
|
||||
render_403 unless User.current.admin?
|
||||
end
|
||||
|
||||
# 在线开发平台
|
||||
def online_dev
|
||||
render_403 unless User.current.admin?
|
||||
end
|
||||
|
||||
# 软件资源库
|
||||
def soft_file
|
||||
render_403 unless User.current.admin?
|
||||
end
|
||||
|
||||
# 软件服务
|
||||
def soft_service
|
||||
render_403 unless User.current.admin?
|
||||
end
|
||||
|
||||
#发送邮件邀请新用户
|
||||
def invite_members_by_mail
|
||||
if User.current.member_of?(@project) || User.current.admin?
|
||||
|
|
|
@ -136,7 +136,7 @@ update
|
|||
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
|
||||
attrs = pickup_extra_info
|
||||
if((@repository_tag!="")&¶ms[:repository_scm]=="Git")
|
||||
params[:repository][:url]=@project_path
|
||||
params[:repository][:url]=@project_path
|
||||
end
|
||||
###xianbo
|
||||
@repository = Repository.factory(params[:repository_scm])
|
||||
|
@ -449,6 +449,8 @@ update
|
|||
def stats
|
||||
@project_id = params[:id]
|
||||
@repository_id = @repository.identifier
|
||||
# 提交次数统计
|
||||
@status_commit_count = Changeset.count(:conditions => ["#{Changeset.table_name}.repository_id = ?", @repository.id])
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
|
|
|
@ -4,28 +4,21 @@ class SchoolController < ApplicationController
|
|||
|
||||
def upload
|
||||
uploaded_io = params[:logo]
|
||||
school_id = 0
|
||||
schools = School.where("name = ?", params[:school])
|
||||
|
||||
schools.each do |s|
|
||||
school_id = s.id
|
||||
end
|
||||
|
||||
school_id ||= params[:id]
|
||||
unless uploaded_io.nil?
|
||||
File.open(Rails.root.join('public', 'images', 'school', school_id.to_s+'.png'), 'wb') do |file|
|
||||
file.write(uploaded_io.read)
|
||||
end
|
||||
|
||||
s1 = School.find(school_id)
|
||||
s1.logo_link = '/images/school/'+school_id.to_s+'.png'
|
||||
s1.save
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
redirect_to admin_schools_url(:school_name => params[:school_name])
|
||||
end
|
||||
|
||||
def upload_logo
|
||||
|
||||
@school = School.find params[:id]
|
||||
@school_name = params[:school_name]
|
||||
end
|
||||
|
||||
#获取制定学校开设的课程数
|
||||
|
|
|
@ -207,7 +207,7 @@ class SoftapplicationsController < ApplicationController
|
|||
@softapplication.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to home_url }
|
||||
format.html { redirect_to signin_path }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,6 +11,13 @@ class StudentWorkController < ApplicationController
|
|||
protect_from_forgery :except => :set_program_score
|
||||
|
||||
def index
|
||||
#设置作业对应的forge_messages表的viewed字段
|
||||
query_student_work = @homework.course_messages
|
||||
query_student_work.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group]
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
course_group = CourseGroup.find_by_id(@group) if @group
|
||||
|
@ -387,8 +394,8 @@ class StudentWorkController < ApplicationController
|
|||
if stundet_work && params[:results] && params[:results].class.to_s == "Array"
|
||||
homework_common = stundet_work.homework_common
|
||||
params[:results].each do |result|
|
||||
homework_test = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'").first
|
||||
if homework_test
|
||||
homework_tests = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'")
|
||||
homework_tests.each do |homework_test|
|
||||
student_work_test = StudentWorkTest.new
|
||||
student_work_test.student_work = stundet_work
|
||||
student_work_test.homework_test = homework_test
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,9 +22,26 @@ class WatchersController < ApplicationController
|
|||
def watch
|
||||
s = WatchesService.new
|
||||
watchables = s.watch params.merge(:current_user_id => User.current.id)
|
||||
if params[:action_name] == 'watch'
|
||||
limit = 10;
|
||||
query = User.watched_by(params[:target_id]);
|
||||
@obj_count = query.count();
|
||||
@obj_pages = Paginator.new @obj_count,limit,params['page']
|
||||
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
|
||||
@action = 'watch'
|
||||
elsif params[:action_name] == 'fans'
|
||||
limit = 10;
|
||||
query = User.find(params[:target_id]).watcher_users;
|
||||
@obj_count = query.count();
|
||||
@obj_pages = Paginator.new @obj_count,limit,params['page']
|
||||
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
|
||||
@action = 'fans'
|
||||
else
|
||||
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (true ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add'} }
|
||||
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add',:list => @list,:action_name=>params[:action_name],:page=>params[:page],:count=>@obj_count} }
|
||||
end
|
||||
rescue Exception => e
|
||||
if e.message == "404"
|
||||
|
@ -38,9 +55,25 @@ class WatchersController < ApplicationController
|
|||
def unwatch
|
||||
s = WatchesService.new
|
||||
watchables = s.unwatch params.merge(:current_user_id => User.current.id)
|
||||
if params[:action_name] == 'watch'
|
||||
limit = 10;
|
||||
query = User.watched_by(params[:target_id]);
|
||||
@obj_count = query.count();
|
||||
@obj_pages = Paginator.new @obj_count,limit,params['page']
|
||||
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
|
||||
@action = 'watch'
|
||||
elsif params[:action_name] == 'fans'
|
||||
limit = 10;
|
||||
query = User.find(params[:target_id]).watcher_users;
|
||||
@obj_count = query.count();
|
||||
@obj_pages = Paginator.new @obj_count,limit,params['page']
|
||||
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
|
||||
@action = 'fans'
|
||||
else
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (false ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'delete'} }
|
||||
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'delete',:list=>@list,:action_name=>params[:action_name],:page=>params[:page],:count=>@obj_count} }
|
||||
end
|
||||
rescue Exception => e
|
||||
if e.message == "404"
|
||||
|
|
|
@ -27,7 +27,8 @@ class WelcomeController < ApplicationController
|
|||
|
||||
def index
|
||||
# 企业版定制: params[:project]为传过来的参数
|
||||
|
||||
redirect_to signin_path
|
||||
return
|
||||
unless params[:organization].nil?
|
||||
@organization = Organization.find params[:organization]
|
||||
# @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all
|
||||
|
@ -100,44 +101,6 @@ class WelcomeController < ApplicationController
|
|||
@course_page = FirstPage.find_by_page_type('course')
|
||||
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
|
||||
@logoLink ||= logolink()
|
||||
|
||||
##3-8月份为查找春季课程,9-2月份为查找秋季课程
|
||||
#month_now = Time.now.strftime("%m").to_i
|
||||
#year_now = Time.new.strftime("%Y").to_i
|
||||
#(month_now >= 3 && month_now < 9) ? course_term = l(:label_spring) : course_term = l(:label_autumn)
|
||||
##year_now -= 1 if year_now < 3
|
||||
#@school_id.nil? ? @cur_school_course = [] : @cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term)
|
||||
##未登录或者当前学校未开设课程
|
||||
#if @cur_school_course.empty?
|
||||
# @has_course = false
|
||||
# User.current.logged? ? course_count = 9 : course_count = 10
|
||||
# @cur_school_course += find_all_new_hot_course(course_count, @school_id, year_now, course_term)
|
||||
# while @cur_school_course.count < 9 do
|
||||
# if course_term == l(:label_spring)
|
||||
# course_term = l(:label_autumn)
|
||||
# year_now -= 1
|
||||
# else
|
||||
# course_term = l(:label_spring)
|
||||
# end
|
||||
# @cur_school_course += find_all_new_hot_course((10-@cur_school_course.count), nil, year_now, course_term)
|
||||
# end
|
||||
#else
|
||||
# if @cur_school_course.count < 9
|
||||
# @has_course = false
|
||||
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, @school_id, year_now, course_term)
|
||||
# if @cur_school_course.count < 9
|
||||
# if course_term == l(:label_spring)
|
||||
# course_term = l(:label_autumn)
|
||||
# year_now -= 1
|
||||
# else
|
||||
# course_term = l(:label_spring)
|
||||
# end
|
||||
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, nil, year_now, course_term)
|
||||
# end
|
||||
# else
|
||||
# @has_course = true
|
||||
# end
|
||||
#end
|
||||
end
|
||||
|
||||
def logolink()
|
||||
|
@ -209,7 +172,7 @@ class WelcomeController < ApplicationController
|
|||
redirect_to users_search_url(:name => search_condition, :search_by => search_by, :role => :student)
|
||||
else
|
||||
#redirect_to home_path, :alert => l(:label_sumbit_empty)
|
||||
(redirect_to home_url, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
|
||||
(redirect_to signin_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
|
||||
end
|
||||
}
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class WordsController < ApplicationController
|
|||
include ApplicationHelper
|
||||
before_filter :find_user, :only => [:new, :create, :destroy, :more, :back]
|
||||
def create
|
||||
if params[:new_form][:user_message].size>0
|
||||
if params[:new_form][:user_message].size>0 && User.current.logged?
|
||||
unless params[:user_id].nil?
|
||||
if params[:reference_content]
|
||||
message = params[:new_form][:user_message] + "\n" + params[:reference_content]
|
||||
|
@ -18,22 +18,13 @@ class WordsController < ApplicationController
|
|||
list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id)
|
||||
end
|
||||
@jour = list.last
|
||||
# @user.count_new_jour
|
||||
# if a_message.size > 5
|
||||
# @message = a_message[-5, 5]
|
||||
# else
|
||||
# @message = a_message
|
||||
# end
|
||||
# @message_count = a_message.count
|
||||
end
|
||||
end
|
||||
# @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
|
||||
# @jour = paginateHelper @jours,10
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@jour = paginateHelper jours,10
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -79,21 +70,22 @@ class WordsController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
|
||||
if @journal_destroyed.jour_type == "Bid"
|
||||
@bid = Bid.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
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
|
||||
@is_user = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
@journal_destroyed = JournalsForMessage.find params[:object_id]
|
||||
if @journal_destroyed.destroy
|
||||
if @journal_destroyed.jour_type == "Bid"
|
||||
@bid = Bid.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
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
|
||||
@is_user = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -206,7 +198,15 @@ class WordsController < ApplicationController
|
|||
flash[:error] = feedback.errors.full_messages[0]
|
||||
redirect_to project_feedback_url(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
#给用户留言
|
||||
def leave_user_message
|
||||
@user = User.find(params[:id])
|
||||
if params[:new_form][:user_message].size>0 && User.current.logged? && @user
|
||||
@user.add_jour(User.current, params[:new_form][:user_message])
|
||||
end
|
||||
redirect_to feedback_path(@user)
|
||||
end
|
||||
|
||||
# add by nwb
|
||||
|
|
|
@ -1812,7 +1812,7 @@ module ApplicationHelper
|
|||
#获取用户未过期的课程
|
||||
def get_user_course user
|
||||
courses_doing = []
|
||||
user.courses.each do |course|
|
||||
user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course|
|
||||
if !course_endTime_timeout?(course)
|
||||
courses_doing.push course
|
||||
end
|
||||
|
@ -1852,7 +1852,8 @@ module ApplicationHelper
|
|||
candown = true
|
||||
elsif attachment.container.class.to_s=="StudentWork"
|
||||
candown = true
|
||||
|
||||
elsif attachment.container.class.to_s == "User"
|
||||
candown = (attachment.is_public == 1 || attachment.is_public == true || attachment.author_id == User.current.id)
|
||||
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
|
||||
course = attachment.container.courses.first
|
||||
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
|
||||
|
@ -2313,7 +2314,27 @@ module ApplicationHelper
|
|||
elsif homework.homework_type == 2 #编程作业不能修改作品
|
||||
"<span class='fr mr10 pr_join_span ' title='编程作业不可修改作品'>作品已交</span>".html_safe
|
||||
else
|
||||
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
|
||||
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit c_blue'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
|
||||
def user_for_homework_common homework,is_teacher
|
||||
if is_teacher #老师显示作品数量
|
||||
link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_homework homework
|
||||
if work.nil?
|
||||
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
|
||||
else
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
|
||||
link_to "修改作品", "", :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
elsif homework.homework_type == 2 #编程作业不能修改作品
|
||||
link_to "作品已交", "",:class => 'c_blue',:title => "编程作业不可修改作品"
|
||||
else
|
||||
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2378,4 +2399,108 @@ module ApplicationHelper
|
|||
end
|
||||
notice.html_safe
|
||||
end
|
||||
|
||||
#老师C语言的标准代码
|
||||
def c_stantard_code_teacher
|
||||
"// 老师您好!这是一个C语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <stdio.h> //引用必须头文件
|
||||
int main(int argc, char** argv) {
|
||||
int a = atoi(argv[1]); //将第一个输入转成整型
|
||||
int b = atoi(argv[2]); //将第二个输入转换为整型
|
||||
|
||||
printf(\"%d\",a+b); //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
|
||||
#老师C++语言的标准代码
|
||||
def c_stantard_code_teacher_
|
||||
"// 老师您好!这是一个C++语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <iostream> //引用必须头文件
|
||||
#include <cstdlib>
|
||||
using namespace std;
|
||||
int main(int argc, char** argv){
|
||||
int a = atoi(argv[1]); //将第一个输入转成整型
|
||||
int b = atoi(argv[2]); //将第二个输入转换为整型
|
||||
cout<<a+b; //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
|
||||
#学生C语言的标准代码
|
||||
def c_stantard_code_student
|
||||
"// 同学好!这是一个C语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <stdio.h> //引用必须头文件
|
||||
int main(int argc, char** argv) {
|
||||
int a = atoi(argv[1]); //将第一个输入转成整型
|
||||
int b = atoi(argv[2]); //将第二个输入转换为整型
|
||||
|
||||
printf(\"%d\",a+b); //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
|
||||
#学生C++语言的标准代码
|
||||
def c_stantard_code_student_
|
||||
"// 同学好!这是一个C++语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <iostream> //引用必须头文件
|
||||
#include <cstdlib>
|
||||
using namespace std;
|
||||
int main(int argc, char** argv){
|
||||
int a = atoi(argv[1]); //将第一个输入转成整型
|
||||
int b = atoi(argv[2]); //将第二个输入转换为整型
|
||||
cout<<a+b; //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
|
||||
#判断用户是否已经提交了问卷
|
||||
def has_commit_poll?(poll_id,user_id)
|
||||
pu = PollUser.find_by_poll_id_and_user_id(poll_id,user_id)
|
||||
if pu.nil?
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -676,4 +676,61 @@ module CoursesHelper
|
|||
end
|
||||
result
|
||||
end
|
||||
|
||||
#生成课程相关动态的链接
|
||||
def course_activity_link activity
|
||||
# activity = CourseActivity.first
|
||||
title = ""
|
||||
url = ""
|
||||
if activity.course_act
|
||||
case activity.course_act_type
|
||||
when "Course"
|
||||
title = activity.course_act.name
|
||||
url = course_path activity.course
|
||||
when "HomeworkCommon"
|
||||
title = "作业 " + activity.course_act.name
|
||||
url = student_work_index_path(:homework => activity.course_act.id)
|
||||
when "News"
|
||||
title = "通知公告 " + activity.course_act.title
|
||||
url = course_news_index_path(activity.course)
|
||||
when "Attachment"
|
||||
title = "课件 " + activity.course_act.filename
|
||||
url = course_files_path(activity.course)
|
||||
when "Message"
|
||||
title = "课程讨论区 " + activity.course_act.subject
|
||||
url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id)
|
||||
when "JournalsForMessage"
|
||||
title = "留言 " + activity.course_act.notes
|
||||
url = course_feedback_path(activity.course)
|
||||
when "Poll"
|
||||
title = "问卷 " + activity.course_act.polls_name
|
||||
url = poll_path(activity.course_act_id)
|
||||
end
|
||||
end
|
||||
link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb"
|
||||
end
|
||||
|
||||
#课程动态的描述
|
||||
def course_activity_desc activity
|
||||
desc = ""
|
||||
if activity.course_act
|
||||
case activity.course_act_type
|
||||
when "Course"
|
||||
desc = ""
|
||||
when "HomeworkCommon"
|
||||
desc = activity.course_act.description
|
||||
when "News"
|
||||
desc = activity.course_act.description
|
||||
when "Attachment"
|
||||
desc = ""
|
||||
when "Message"
|
||||
desc = activity.course_act.content
|
||||
when "JournalsForMessage"
|
||||
desc = ""
|
||||
when "Poll"
|
||||
desc = activity.course_act.polls_description
|
||||
end
|
||||
end
|
||||
desc.html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -66,4 +66,31 @@ module HomeworkCommonHelper
|
|||
link
|
||||
end
|
||||
|
||||
#将状态转换为错误信息
|
||||
def status_to_err_msg status
|
||||
case status.to_i
|
||||
when -1
|
||||
'编译出错'
|
||||
when -2
|
||||
'输入和输出不匹配'
|
||||
when -3
|
||||
'输入和输出不匹配'
|
||||
when 1
|
||||
'运行出错'
|
||||
when 2
|
||||
'超时'
|
||||
when 3
|
||||
'内存超出'
|
||||
when 4
|
||||
'输出超出'
|
||||
when 5
|
||||
'禁用函数'
|
||||
when 6
|
||||
'其他错误'
|
||||
when 0
|
||||
'成功'
|
||||
else
|
||||
'未知错误'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -380,6 +380,22 @@ module IssuesHelper
|
|||
value = content_tag("i", h(value)) if value
|
||||
end
|
||||
end
|
||||
# 缺陷更新结果在消息中显示样式
|
||||
if no_html == "message"
|
||||
label = content_tag(:span, label, :class => "issue_update_message")
|
||||
old_value = content_tag("span", h(old_value)) if detail.old_value
|
||||
old_value = content_tag("del", old_value) if detail.old_value and detail.value.blank?
|
||||
if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key)
|
||||
# Link to the attachment if it has not been removed
|
||||
if options[:token].nil?
|
||||
value = atta.filename
|
||||
else
|
||||
value = atta.filename
|
||||
end
|
||||
else
|
||||
value = content_tag(:span, h(value), :class => "issue_update_message_value") if value
|
||||
end
|
||||
end
|
||||
|
||||
if detail.property == 'attr' && detail.prop_key == 'description'
|
||||
s = l(:text_journal_changed_no_detail, :label => label)
|
||||
|
|
|
@ -47,7 +47,7 @@ module PollHelper
|
|||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#统计答题百分比,统计结果保留两位小数
|
||||
def statistics_result_percentage(e, t)
|
||||
e = e.to_f
|
||||
|
@ -74,4 +74,13 @@ module PollHelper
|
|||
end
|
||||
end
|
||||
|
||||
#带勾选框的问卷列表
|
||||
def poll_check_box_tags(name,polls,current_poll)
|
||||
s = ''
|
||||
polls.each do |poll|
|
||||
s << "<label>#{ check_box_tag name, poll.id, false, :id => nil } #{h poll.polls_name.blank? ? l(:label_poll_new) : poll.polls_name } [#{ h Course.find(poll.polls_group_id).name}]</label><br/>"
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
||||
end
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
module RepositoriesHelper
|
||||
if Rails.env.development?
|
||||
ROOT_PATH="/tmp/" if Rails.env.development?
|
||||
ROOT_PATH="/private/tmp/"
|
||||
else
|
||||
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
|
||||
end
|
||||
|
|
|
@ -29,6 +29,29 @@ module UsersHelper
|
|||
["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
|
||||
end
|
||||
|
||||
def get_resource_type type
|
||||
case type
|
||||
when 'Course'
|
||||
'课程资源'
|
||||
when 'Project'
|
||||
'项目资源'
|
||||
when 'Issue'
|
||||
'缺陷附件'
|
||||
when 'Message'
|
||||
'讨论区附件'
|
||||
when 'Document'
|
||||
'文档附件'
|
||||
when 'News'
|
||||
'通知附件'
|
||||
when 'HomewCommon'
|
||||
'作业附件'
|
||||
when 'StudentWorkScore'
|
||||
'批改附件'
|
||||
when 'Principal'
|
||||
'用户资源'
|
||||
end
|
||||
end
|
||||
|
||||
def user_mail_notification_options(user)
|
||||
user.valid_notification_options.collect {|o| [l(o.last), o.first]}
|
||||
end
|
||||
|
@ -321,6 +344,7 @@ module UsersHelper
|
|||
list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all
|
||||
return [count,list];
|
||||
end
|
||||
|
||||
def get_visitor_users(obj)
|
||||
query = Visitor.where("master_id=?",obj.id)
|
||||
count = query.count
|
||||
|
@ -332,46 +356,59 @@ module UsersHelper
|
|||
end
|
||||
|
||||
def get_create_course_count(user)
|
||||
if user == User.current
|
||||
user.courses.count
|
||||
else
|
||||
user.courses.where("is_public = 1").count
|
||||
end
|
||||
user.courses.visible.where("tea_id = ?",user.id).count
|
||||
end
|
||||
|
||||
#获取加入课程数
|
||||
def get_join_course_count(user)
|
||||
user.coursememberships.count - get_create_course_count(user)
|
||||
user.courses.visible.count - get_create_course_count(user)
|
||||
end
|
||||
|
||||
#发布作业数
|
||||
def get_homework_commons_count(user)
|
||||
HomeworkCommon.where("user_id = ?",user.id).count
|
||||
end
|
||||
|
||||
#资源数
|
||||
def get_projectandcourse_attachment_count(user)
|
||||
Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count
|
||||
end
|
||||
|
||||
#创建项目数
|
||||
def get_create_project_count(user)
|
||||
Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count
|
||||
user.projects.visible.where("projects.user_id=#{user.id}").count
|
||||
end
|
||||
|
||||
#加入项目数
|
||||
def get_join_project_count(user)
|
||||
user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user)
|
||||
user.projects.visible.count - get_create_project_count(user)
|
||||
end
|
||||
|
||||
#创建缺陷数
|
||||
def get_create_issue_count(user)
|
||||
Issue.where("author_id = ?",user.id).count
|
||||
end
|
||||
|
||||
#解决缺陷数
|
||||
def get_resolve_issue_count(user)
|
||||
Issue.where("assigned_to_id = ? and status_id=3",user.id).count
|
||||
end
|
||||
|
||||
#参与匿评数
|
||||
def get_anonymous_evaluation_count(user)
|
||||
StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count
|
||||
end
|
||||
|
||||
def query_activities(query)
|
||||
list = query.limit(8).all
|
||||
result = [];
|
||||
list = query.limit(13).all
|
||||
result = []
|
||||
for item in list
|
||||
container = get_activity_container(item)
|
||||
result << { :item=>item,:e=>container }
|
||||
end
|
||||
return result
|
||||
result
|
||||
end
|
||||
|
||||
def get_activity_container activity
|
||||
return activity.activity_container
|
||||
end
|
||||
|
@ -387,6 +424,19 @@ module UsersHelper
|
|||
end
|
||||
return str.html_safe
|
||||
end
|
||||
|
||||
# journal.details 记录每个动作的新旧值
|
||||
def get_issue_des_update(journal)
|
||||
no_html = "message"
|
||||
arr = details_to_strings(journal.details, no_html)
|
||||
unless journal.notes.empty?
|
||||
arr << "留言内容:" + journal.notes
|
||||
end
|
||||
str = ''
|
||||
arr.each { |item| str = str+item }
|
||||
return str
|
||||
end
|
||||
|
||||
def get_activity_act_showname(activity)
|
||||
case activity.act_type
|
||||
when "HomeworkCommon"
|
||||
|
@ -417,6 +467,7 @@ module UsersHelper
|
|||
return activity.act_type
|
||||
end
|
||||
end
|
||||
|
||||
def get_activity_act_createtime(activity)
|
||||
case activity.act_type
|
||||
when "HomeworkCommon"
|
||||
|
@ -427,6 +478,7 @@ module UsersHelper
|
|||
return activity.act.created_on
|
||||
end
|
||||
end
|
||||
|
||||
def get_activity_container_url e
|
||||
if !e.visible?
|
||||
return "javascript:;"
|
||||
|
@ -437,6 +489,7 @@ module UsersHelper
|
|||
end
|
||||
return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name)
|
||||
end
|
||||
|
||||
def get_activity_url(activity,e)
|
||||
if !e.visible?
|
||||
return "javascript:;"
|
||||
|
@ -465,6 +518,7 @@ module UsersHelper
|
|||
return 'javascript:;'
|
||||
end
|
||||
end
|
||||
|
||||
def get_activity_opt(activity,e)
|
||||
case activity.act_type
|
||||
when "HomeworkCommon"
|
||||
|
@ -474,17 +528,29 @@ module UsersHelper
|
|||
when "Issue"
|
||||
return '发表了问题'
|
||||
when "Journal"
|
||||
return '回复了问题'
|
||||
return '更新了问题'
|
||||
when "JournalsForMessage"
|
||||
return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈'
|
||||
#return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : ''
|
||||
when "Message"
|
||||
return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子'
|
||||
when "Poll"
|
||||
return '发布了问卷'
|
||||
return '创建了问卷'
|
||||
else
|
||||
return '有了新动态'
|
||||
end
|
||||
end
|
||||
|
||||
#获取指定用户作为老师的课程
|
||||
def get_as_teacher_courses user
|
||||
type = []
|
||||
user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
|
||||
option = []
|
||||
option << course.name
|
||||
option << course.id
|
||||
type << option
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -27,6 +27,8 @@ class Attachment < ActiveRecord::Base
|
|||
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
include UserScoreHelper
|
||||
|
||||
|
@ -71,8 +73,8 @@ class Attachment < ActiveRecord::Base
|
|||
cattr_accessor :thumbnails_storage_path
|
||||
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
||||
|
||||
before_save :files_to_final_location
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score
|
||||
before_save :files_to_final_location,:act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity
|
||||
after_update :office_conver, :be_user_score
|
||||
after_destroy :delete_from_disk,:down_user_score
|
||||
|
||||
|
@ -552,4 +554,10 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.container_type == "Course" && self.course_acts.empty?
|
||||
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,10 @@ class Comment < ActiveRecord::Base
|
|||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
# 课程/项目 消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
#end
|
||||
acts_as_event :datetime => :updated_on,
|
||||
:description => :comments,
|
||||
:type => 'news',
|
||||
|
@ -31,7 +35,19 @@ class Comment < ActiveRecord::Base
|
|||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :commented, :author, :comments
|
||||
safe_attributes 'comments'
|
||||
after_create :send_mail
|
||||
after_create :send_mail, :act_as_system_message
|
||||
|
||||
def act_as_system_message
|
||||
if self.commented.course
|
||||
if self.author_id != self.commented.author_id
|
||||
self.course_messages << CourseMessage.new(:user_id => self.commented.author_id, :course_id => self.commented.course.id, :viewed => false)
|
||||
end
|
||||
else # 项目相关
|
||||
if self.author_id != self.commented.author_id
|
||||
self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_mail
|
||||
if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||
|
|
|
@ -33,6 +33,12 @@ class Course < ActiveRecord::Base
|
|||
has_many :student_works, :through => :homework_commons, :dependent => :destroy
|
||||
|
||||
has_many :course_groups, :dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
|
||||
has_many :course_activities
|
||||
# 课程消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
|
||||
acts_as_taggable
|
||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||
|
@ -44,7 +50,7 @@ class Course < ActiveRecord::Base
|
|||
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
|
||||
validates_length_of :description, :maximum => 10000
|
||||
before_save :self_validate
|
||||
after_create :create_board_sync
|
||||
after_create :create_board_sync, :act_as_course_activity
|
||||
before_destroy :delete_all_members
|
||||
|
||||
safe_attributes 'extra',
|
||||
|
@ -310,6 +316,11 @@ class Course < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)
|
||||
end
|
||||
|
||||
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
|
||||
#def name
|
||||
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
class CourseActivity < ActiveRecord::Base
|
||||
attr_accessible :user_id, :course_act_id,:course_act_type,:course_id
|
||||
# 虚拟关联
|
||||
belongs_to :course_act ,:polymorphic => true
|
||||
belongs_to :course
|
||||
belongs_to :user
|
||||
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
|
||||
after_save :add_user_activity
|
||||
before_destroy :destroy_user_activity
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
def add_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.course_act_type.to_s}' and act_id = '#{self.course_act_id}'").first
|
||||
if user_activity
|
||||
user_activity.save
|
||||
else
|
||||
user_activity = UserActivity.new
|
||||
user_activity.act_id = self.course_act_id
|
||||
user_activity.act_type = self.course_act_type
|
||||
user_activity.container_type = "Course"
|
||||
user_activity.container_id = self.course_id
|
||||
user_activity.save
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.course_act_type.to_s}' and act_id = '#{self.course_act_id}'")
|
||||
user_activity.destroy_all
|
||||
end
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
class CourseMessage < ActiveRecord::Base
|
||||
attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status
|
||||
|
||||
# 多态 虚拟关联
|
||||
belongs_to :course_message ,:polymorphic => true
|
||||
belongs_to :course
|
||||
belongs_to :user
|
||||
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
||||
|
||||
validates :user_id,presence: true
|
||||
validates :course_id,presence: true
|
||||
validates :course_message_id,presence: true
|
||||
validates :course_message_type, presence: true
|
||||
validates_length_of :content, :maximum => 100
|
||||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
|
@ -19,5 +19,27 @@ class ForgeActivity < ActiveRecord::Base
|
|||
validates :project_id,presence: true
|
||||
validates :forge_act_id,presence: true
|
||||
validates :forge_act_type, presence: true
|
||||
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
|
||||
after_save :add_user_activity
|
||||
before_destroy :destroy_user_activity
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
def add_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'").first
|
||||
if user_activity
|
||||
user_activity.save
|
||||
else
|
||||
user_activity = UserActivity.new
|
||||
user_activity.act_id = self.forge_act_id
|
||||
user_activity.act_type = self.forge_act_type
|
||||
user_activity.container_type = "Project"
|
||||
user_activity.container_id = self.project_id
|
||||
user_activity.save
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'")
|
||||
user_activity.destroy_all
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
class ForgeMessage < ActiveRecord::Base
|
||||
# 公共表中活动类型,命名规则:TYPE_OF_{类名}_ACT
|
||||
TYPE_OF_ISSUE_ACT = "Issue"
|
||||
TYPE_OF_MESSAGE_ACT = "Message"
|
||||
TYPE_OF_ATTACHMENT_ACT = "Attachment"
|
||||
TYPE_OF_DOCUMENT_ACT = "Document"
|
||||
TYPE_OF_JOURNAL_ACT = "Journal"
|
||||
TYPE_OF_WIKI_ACT = "Wiki"
|
||||
TYPE_OF_NEWS_ACT = "News"
|
||||
|
||||
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed
|
||||
|
||||
belongs_to :forge_message ,:polymorphic => true
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
||||
|
||||
validates :user_id,presence: true
|
||||
validates :project_id,presence: true
|
||||
validates :forge_message_id,presence: true
|
||||
validates :forge_message_type, presence: true
|
||||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
|
@ -39,6 +39,7 @@ class Forum < ActiveRecord::Base
|
|||
logger.debug "send mail for forum add."
|
||||
Mailer.run.forum_add(self) if Setting.notified_events.include?('forum_add')
|
||||
end
|
||||
|
||||
# Updates topic_count, memo_count and last_memo_id attributes for +board_id+
|
||||
def self.reset_counters!(forum_id)
|
||||
forum_id = forum_id.to_i
|
||||
|
|
|
@ -13,17 +13,40 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
has_many :student_works, :dependent => :destroy
|
||||
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# 课程消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
acts_as_attachable
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
|
||||
:description => :description,
|
||||
:author => :author,
|
||||
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||
after_create :act_as_activity, :send_mail
|
||||
after_create :act_as_activity, :send_mail, :act_as_course_activity, :act_as_course_message
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.course
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id)
|
||||
end
|
||||
end
|
||||
|
||||
#课程作业消息记录
|
||||
def act_as_course_message
|
||||
if self.course
|
||||
self.course.members.each do |m|
|
||||
if m.user_id != self.user_id
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#删除对应的图片
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class HomeworkTest < ActiveRecord::Base
|
||||
attr_accessible :input, :output, :homework_common_id
|
||||
attr_accessible :input, :output, :homework_common_id,:result,:error_msg
|
||||
|
||||
belongs_to :homework_common
|
||||
has_many :student_work_test
|
||||
|
|
|
@ -49,6 +49,8 @@ class Issue < ActiveRecord::Base
|
|||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
# ForgeMessage虚拟关联(多态)
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
|
||||
|
||||
|
||||
acts_as_nested_set :scope => 'root_id', :dependent => :destroy
|
||||
|
@ -80,7 +82,7 @@ class Issue < ActiveRecord::Base
|
|||
attr_reader :current_journal
|
||||
|
||||
# fq
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message
|
||||
after_update :be_user_score
|
||||
after_destroy :down_user_score
|
||||
# after_create :be_user_score
|
||||
|
@ -138,6 +140,21 @@ class Issue < ActiveRecord::Base
|
|||
:project_id => self.project_id)
|
||||
end
|
||||
# end
|
||||
|
||||
# 发布缺陷forge_messages中添加记录
|
||||
def act_as_forge_message
|
||||
# 指派给自己的缺陷不提示消息
|
||||
unless self.author_id == self.assigned_to_id
|
||||
self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, :project_id => self.project_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
|
||||
# 更新缺陷
|
||||
#def act_as_forge_message_update
|
||||
# unless self.author_id == self.assigned_to_id
|
||||
# self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, :project_id => self.project_id, :viewed => false)
|
||||
# end
|
||||
#end
|
||||
|
||||
|
||||
# Returns a SQL conditions string used to find all issues visible by the specified user
|
||||
|
@ -235,9 +252,10 @@ class Issue < ActiveRecord::Base
|
|||
base_reload(*args)
|
||||
end
|
||||
|
||||
def to_param
|
||||
@to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize
|
||||
end
|
||||
# 之所以注释是以为最终以id形式显示,另外如果项目名称带点号或者纯数字会出现问题
|
||||
# def to_param
|
||||
# @to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize
|
||||
# end
|
||||
|
||||
# Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields
|
||||
def available_custom_fields
|
||||
|
|
|
@ -29,6 +29,8 @@ class Journal < ActiveRecord::Base
|
|||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 被ForgeMessage虚拟关联
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
|
||||
# end
|
||||
attr_accessor :indice
|
||||
|
||||
|
@ -48,7 +50,7 @@ class Journal < ActiveRecord::Base
|
|||
before_create :split_private_notes
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity,:be_user_score,:act_as_forge_activity
|
||||
after_save :act_as_activity,:be_user_score,:act_as_forge_activity, :act_as_forge_message
|
||||
# end
|
||||
#after_destroy :down_user_score
|
||||
#before_save :be_user_score
|
||||
|
@ -163,10 +165,20 @@ class Journal < ActiveRecord::Base
|
|||
# Description 公共表中需要保存一份该记录
|
||||
def act_as_forge_activity
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.user_id,
|
||||
:project_id => self.issue.project.id)
|
||||
:project_id => self.issue.project.id)
|
||||
|
||||
end
|
||||
|
||||
# 缺陷状态更改,消息提醒
|
||||
def act_as_forge_message
|
||||
if self.user_id != self.issue.author_id
|
||||
self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, :project_id => self.issue.project_id, :viewed => false)
|
||||
end
|
||||
if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送
|
||||
self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
|
||||
# 更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建了缺陷留言且留言不为空,不为空白
|
||||
|
|
|
@ -56,9 +56,14 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
acts_as_attachable
|
||||
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# 消息关联
|
||||
has_many :course_messages, :class_name => 'CourseMessage',:as =>:course_message ,:dependent => :destroy
|
||||
has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:journals_for_message, :dependent => :destroy
|
||||
|
||||
validates :notes, presence: true, if: :is_homework_jour?
|
||||
after_create :act_as_activity #huang
|
||||
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message
|
||||
after_create :reset_counters!
|
||||
after_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
|
@ -177,4 +182,45 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,7
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.jour_type == 'Course'
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id)
|
||||
end
|
||||
end
|
||||
|
||||
# 课程作品留言消息通知
|
||||
def act_as_course_message
|
||||
if self.jour_type == 'StudentWorksScore'
|
||||
if self.user_id != self.jour.user_id
|
||||
self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.student_work.homework_common.course.id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 用户留言消息通知
|
||||
def act_as_user_feedback_message
|
||||
# 主留言
|
||||
receivers = []
|
||||
if self.reply_id == 0
|
||||
if self.user_id != self.jour_id # 过滤自己给自己的留言消息
|
||||
receivers << self.jour
|
||||
end
|
||||
else # 留言回复
|
||||
reply_to = User.find(self.reply_id)
|
||||
if self.user_id != self.reply_id # 添加我回复的那个人
|
||||
receivers << reply_to
|
||||
end
|
||||
if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发
|
||||
receivers << self.parent.jour
|
||||
end
|
||||
end
|
||||
if self.jour_type == 'Principal'
|
||||
receivers.each do |r|
|
||||
self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -388,7 +388,8 @@ class Mailer < ActionMailer::Base
|
|||
@user = applied.user
|
||||
recipients = @project.manager_recipients
|
||||
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||
@token = Token.get_token_from_user(@user, 'autologin')
|
||||
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members', :token => @token.value)
|
||||
mail :to => recipients,
|
||||
:subject => s
|
||||
end
|
||||
|
|
|
@ -16,6 +16,9 @@ class Memo < ActiveRecord::Base
|
|||
acts_as_attachable
|
||||
has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
# 消息
|
||||
has_many :memo_messages, :class_name =>'MemoMessage', :dependent => :destroy
|
||||
# end
|
||||
belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id'
|
||||
# acts_as_searchable :column => ['subject', 'content'],
|
||||
# #:include => { :forum => :p}
|
||||
|
@ -44,7 +47,7 @@ class Memo < ActiveRecord::Base
|
|||
"parent_id",
|
||||
"replies_count"
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!, :send_mail
|
||||
after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message
|
||||
# after_update :update_memos_forum
|
||||
after_destroy :reset_counters!,:delete_kindeditor_assets#,:down_user_score -- 公共区发帖暂不计入得分
|
||||
# after_create :send_notification
|
||||
|
@ -59,6 +62,32 @@ class Memo < ActiveRecord::Base
|
|||
Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
|
||||
# 公共贴吧消息记录
|
||||
# 原则:贴吧创始人;发帖人,wanglingchun(特殊用户)
|
||||
def send_message
|
||||
receivers = []
|
||||
u = User.find(6)
|
||||
receivers << u
|
||||
# 主贴
|
||||
if self.parent_id.nil?
|
||||
if self.author_id != self.forum.creator_id # 发帖人不是吧主
|
||||
receivers << self.forum.creator
|
||||
end
|
||||
else # 回帖
|
||||
# 添加吧主
|
||||
if self.author_id != self.forum.creator_id
|
||||
receivers << self.forum.creator
|
||||
end
|
||||
# 添加发帖人
|
||||
if self.author_id != self.parent.author_id
|
||||
receivers << self.parent.author
|
||||
end
|
||||
end
|
||||
receivers.each do |r|
|
||||
self.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => self.forum_id, :memo_id => self.id, :memo_type => "Memo", :viewed => false)
|
||||
end
|
||||
end
|
||||
|
||||
def cannot_reply_to_locked_topic
|
||||
errors.add :base, l(:label_memo_locked) if root.locked? && self != root
|
||||
end
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class MemoMessage < ActiveRecord::Base
|
||||
attr_accessible :forum_id, :memo_id, :memo_type, :user_id, :viewed
|
||||
|
||||
belongs_to :memo
|
||||
belongs_to :user
|
||||
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
||||
|
||||
validates :user_id,presence: true
|
||||
validates :forum_id,presence: true
|
||||
validates :memo_id,presence: true
|
||||
validates :memo_type, presence: true
|
||||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
|
@ -32,7 +32,13 @@ class Message < ActiveRecord::Base
|
|||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
# 课程/项目 消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
#end
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
||||
|
@ -68,7 +74,7 @@ class Message < ActiveRecord::Base
|
|||
after_update :update_messages_board
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets
|
||||
|
||||
after_create :act_as_activity,:be_user_score,:act_as_forge_activity, :send_mail
|
||||
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail
|
||||
#before_save :be_user_score
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
|
@ -185,11 +191,56 @@ class Message < ActiveRecord::Base
|
|||
:project_id => self.board.project.id)
|
||||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.course
|
||||
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id)
|
||||
end
|
||||
end
|
||||
|
||||
# 课程讨论区添加消息:
|
||||
# 老师发帖所有人都能收到消息
|
||||
# 学生发帖,有人回复则给该学生消息,没回复则不给其它人发送消息
|
||||
# 帖子被回复的可以收到消息通知
|
||||
# 项目讨论区添加消息:
|
||||
# 主贴项目成员都能收到
|
||||
# 回帖:帖子的发布人收到
|
||||
def act_as_system_message
|
||||
if self.course
|
||||
if self.parent_id.nil? # 主贴
|
||||
self.course.members.each do |m|
|
||||
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
else # 回帖
|
||||
self.course.members.each do |m|
|
||||
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
else # 项目相关
|
||||
if self.parent_id.nil? # 主贴
|
||||
self.project.members.each do |m|
|
||||
if m.user_id != self.author_id
|
||||
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
else # 回帖
|
||||
self.project.members.each do |m|
|
||||
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
||||
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建message且无parent的为发帖
|
||||
|
||||
if self.parent_id.nil? && !self.board.project.nil?
|
||||
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
|
||||
update_memo_number(self.author,1)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class MessageAll < ActiveRecord::Base
|
||||
attr_accessible :message_id, :message_type, :user_id
|
||||
# 虚拟关联---项目消息表/课程消息表/用户留言消息表/贴吧消息表
|
||||
belongs_to :message ,:polymorphic => true
|
||||
end
|
|
@ -23,12 +23,18 @@ class News < ActiveRecord::Base
|
|||
#added by nwb
|
||||
belongs_to :course
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
|
||||
has_many :comments, :as => :commented, :dependent => :destroy, :order => "created_on"
|
||||
# fq
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
# 课程/项目消息关联
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
#end
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
||||
|
@ -49,7 +55,7 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_activity,:act_as_forge_activity,:add_author_as_watcher, :send_mail
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail
|
||||
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
|
@ -121,6 +127,33 @@ class News < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.course
|
||||
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.course_id)
|
||||
end
|
||||
end
|
||||
|
||||
#课程/项目通知 消息发送
|
||||
#消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒
|
||||
def act_as_system_message
|
||||
if self.course
|
||||
self.course.members.each do |m|
|
||||
if m.user_id != self.author_id
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
else
|
||||
if !self.project.nil?
|
||||
self.project.members.each do |m|
|
||||
if m.user_id != self.author_id
|
||||
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Time 2015-03-31 13:50:54
|
||||
# Author lizanle
|
||||
# Description 删除news后删除对应的资源
|
||||
|
@ -132,4 +165,4 @@ class News < ActiveRecord::Base
|
|||
Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -8,7 +8,12 @@ class Poll < ActiveRecord::Base
|
|||
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
|
||||
# 添加课程的poll动态
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
after_create :act_as_activity
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
after_create :act_as_activity, :act_as_course_activity
|
||||
# 课程消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
after_save :act_as_course_message, :act_as_activity, :act_as_course_activity
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" },
|
||||
:description => :polls_description,
|
||||
|
@ -27,4 +32,30 @@ class Poll < ActiveRecord::Base
|
|||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.polls_type == "Course"
|
||||
if self.polls_status == 2 #问卷是发布状态
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id)
|
||||
elsif self.polls_status == 1 #问卷是新建状态
|
||||
self.course_acts.destroy_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 发布问卷,出了发布者外,其他人都能收到消息通知
|
||||
def act_as_course_message
|
||||
if self.polls_type == "Course"
|
||||
if self.polls_status == 2 #问卷是发布状态
|
||||
Course.find(self.polls_group_id).members.each do |m|
|
||||
if m.user_id != self.user_id
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.polls_group_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
elsif self.polls_status == 1 #问卷是新建状态
|
||||
self.course_messages.destroy_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -91,6 +91,8 @@ class Project < ActiveRecord::Base
|
|||
|
||||
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
||||
has_many :project_tags, :class_name => 'ProjectTags'
|
||||
# 关联虚拟表
|
||||
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
|
||||
belongs_to :organization
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#encoding=UTF-8
|
||||
class StudentWorksScore < ActiveRecord::Base
|
||||
#reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评
|
||||
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role
|
||||
|
@ -5,6 +6,35 @@ class StudentWorksScore < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
belongs_to :student_work
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
after_save :act_as_course_message
|
||||
|
||||
# 评阅作品消息提示
|
||||
def act_as_course_message
|
||||
if self.student_work && self.student_work.user && self.student_work.homework_common.course
|
||||
receiver = self.student_work.user
|
||||
# 判断是第一次评阅还是更新 status:0 新建;1 更新
|
||||
if self.created_at == self.updated_at
|
||||
if self.comment.nil?
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score}", :status=> false)
|
||||
else
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score} 评语:#{self.comment}", :status=> false)
|
||||
end
|
||||
else # 更新
|
||||
if self.comment.nil?
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score}", :status=> true)
|
||||
else
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score} 评语:#{self.comment}", :status=> true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -109,7 +109,6 @@ class User < Principal
|
|||
has_many :contests, :foreign_key => 'author_id', :dependent => :destroy
|
||||
has_many :softapplications, :foreign_key => 'user_id', :dependent => :destroy
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
|
||||
has_many :journal_replies, :dependent => :destroy
|
||||
has_many :activities, :dependent => :destroy
|
||||
has_many :students_for_courses
|
||||
|
@ -128,8 +127,16 @@ class User < Principal
|
|||
has_many :messages, :foreign_key => 'author_id'
|
||||
has_one :user_score, :dependent => :destroy
|
||||
has_many :documents # 项目中关联的文档再次与人关联
|
||||
# end
|
||||
# 关联消息表
|
||||
has_many :forge_messages
|
||||
has_many :course_messages
|
||||
has_many :memo_messages
|
||||
has_many :user_feedback_messages
|
||||
|
||||
# 虚拟转换
|
||||
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
|
||||
has_many :issue_assigns, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Issue"'
|
||||
has_many :status_updates, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Journal"'
|
||||
# 邮件邀请状态
|
||||
# has_many :invite_lists
|
||||
# end
|
||||
|
@ -150,7 +157,8 @@ class User < Principal
|
|||
nil
|
||||
}
|
||||
|
||||
|
||||
acts_as_attachable :view_permission => :view_files,
|
||||
:delete_permission => :manage_files
|
||||
acts_as_customizable
|
||||
############################added by william
|
||||
acts_as_taggable
|
||||
|
@ -235,10 +243,43 @@ class User < Principal
|
|||
|
||||
# ======================================================================
|
||||
|
||||
# 查询用户未读过的记录
|
||||
# 用户留言记录
|
||||
def count_new_jour
|
||||
count = self.new_jours.count
|
||||
# count = self.journals_for_messages(:conditions => ["status=? and is_readed = ? " ,1, 0]).count
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
def count_new_issue_assign_to
|
||||
self.issue_assigns
|
||||
end
|
||||
|
||||
# 新消息统计
|
||||
def count_new_message
|
||||
course_count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count
|
||||
forge_count = ForgeMessage.where("user_id =? and viewed =?", User.current.id, 0).count
|
||||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", User.current.id, 0).count
|
||||
user_memo_count = MemoMessage.where("user_id =? and viewed =?", User.current.id, 0).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
def issue_status_update
|
||||
self.status_updates
|
||||
end
|
||||
# end
|
||||
|
||||
def extensions
|
||||
self.user_extensions ||= UserExtensions.new
|
||||
end
|
||||
|
||||
# User现在可以作为一个Container_type,而Attachment的Container方法会有一个Container.try(:project),
|
||||
# 所以这里定义一个空方法,保证不报错
|
||||
def project
|
||||
|
||||
end
|
||||
|
||||
def user_score_attr
|
||||
self.user_score ||= UserScore.new
|
||||
end
|
||||
|
@ -258,7 +299,7 @@ class User < Principal
|
|||
###添加留言 fq
|
||||
def add_jour(user, notes, reference_user_id = 0, options = {})
|
||||
if options.count == 0
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true)
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true, :is_readed => false)
|
||||
else
|
||||
jfm = self.journals_for_messages.build(options)
|
||||
jfm.save
|
||||
|
@ -291,11 +332,7 @@ class User < Principal
|
|||
name
|
||||
end
|
||||
## end
|
||||
|
||||
def count_new_jour
|
||||
count = self.new_jours.count
|
||||
end
|
||||
|
||||
|
||||
#added by nie
|
||||
def count_new_journal_reply
|
||||
count = self.journal_reply.count
|
||||
|
@ -418,7 +455,7 @@ class User < Principal
|
|||
end
|
||||
|
||||
def nickname(formatter = nil)
|
||||
login
|
||||
login.nil? || (login && login.empty?) ? "AnonymousUser" : login
|
||||
end
|
||||
|
||||
def name(formatter = nil)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class UserActivity < ActiveRecord::Base
|
||||
attr_accessible :act_type,:act_id,:container_type,:container_id
|
||||
# 虚拟关联---项目动态表/课程动态表
|
||||
belongs_to :act ,:polymorphic => true
|
||||
# 虚拟关联---项目/课程
|
||||
belongs_to :container ,:polymorphic => true
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
class UserFeedbackMessage < ActiveRecord::Base
|
||||
attr_accessible :journals_for_message_id, :journals_for_message_type, :user_id, :viewed
|
||||
|
||||
belongs_to :journals_for_message
|
||||
belongs_to :user
|
||||
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
||||
|
||||
validates :user_id,presence: true
|
||||
validates :journals_for_message_id,presence: true
|
||||
validates :journals_for_message_type, presence: true
|
||||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,51 @@
|
|||
<%= stylesheet_link_tag 'new_user'%>
|
||||
<!--<div class="homepageContentContainer mb20" >-->
|
||||
<div class="homepageContent BgBox mt10">
|
||||
<h2 class="BgBox_h2">Trustie服务协议</h2>
|
||||
<div class="AgreementBox">
|
||||
<p>尊敬的用户,您好!<br />
|
||||
欢迎使用Trustie平台,在您使用Trustie平台前,请您认真阅读并遵守《Trustie服务协议》(以下简称"本协议"),请您务必审慎阅读、充分理解协议的各条款内容。<br />
|
||||
当您在注册过程中点击查看"看过并同意本服务协议",按照注册流程成功注册为Trustie平台的用户即表示您已充分阅读、理解并完全接受本协议中的全部条款。您承诺接受并遵守本协议的约定,届时您不应以未阅读本协议的内容等理由,主张本协议无效或本协议中的某些条款无效,或要求撤销本协议。</p>
|
||||
<h4 class="Agreementh4">一、Trustie平台权利和义务</h4>
|
||||
<p>1、尊重用户隐私:尊重用户隐私,保障用户隐私安全是Trustie平台的一项基本政策;<br />
|
||||
2、管理平台用户:Trustie平台依据国家法律、地方法律和国际法律等的标准以及本行业的规则来管理平台注册用户;<br />
|
||||
3、处理用户反馈:Trustie平台的相关人员会及时处理用户反馈的问题并给予及时回复。</p>
|
||||
<h4 class="Agreementh4">二、用户权利和义务</h4>
|
||||
<p>用户在使用Trustie平台的过程中,必须遵守如下原则:<br />
|
||||
1、遵守中国的有关法律和法规;<br />
|
||||
2、使用网络服务不作非法用途;<br />
|
||||
3、不干扰和混乱网络服务;<br />
|
||||
4、遵守所有使用网络服务的网络协议、规定、程序和惯例;<br />
|
||||
5、不传输任何非法的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的,淫秽等信息资料;<br />
|
||||
6、不传输任何教唆他人构成犯罪行为的资料;<br />
|
||||
7、用户不得故意或者过失损害Trustie平台合法权利和利益。及时回复。</p>
|
||||
<h4 class="Agreementh4">三、关于责任</h4>
|
||||
<p>鉴于网络服务的特殊性,用户同意Trustie团队有权在事先通知的情况下,变更、中断、升级部分网络服务。Trustie团队不担保网络服务不会中断,但承诺在用户可承受的时间内快速恢复服务,同时确保用户数据的安全性和可靠性。</p>
|
||||
<h4 class="Agreementh4">四、服务条款的修改</h4>
|
||||
<p>Trustie团队保留在必要时对本协议修改的权利,一旦发生变动,这些条款可由Trustie团队及时更新,且毋须另行通知,修改后的条款一旦在网页上公布即有效代替原来的服务条款。您可随时查阅最新版服务条款。</p>
|
||||
<p class=" mt15 fb">本协议最终解释权归Trustie团队所有。</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!---BgBox end--->
|
||||
<!--</div><!–-homepageContentContainer end-–>-->
|
||||
<script>
|
||||
$(".resourcesList").mousedown(function(e) {
|
||||
if (3 == e.which) {
|
||||
document.oncontextmenu = function() {return false;}
|
||||
$("#contextMenu").hide();
|
||||
$("#contextMenu").attr("style","display: block; position: fixed; top:"
|
||||
+ e.pageY
|
||||
+ "px; left:"
|
||||
+ e.pageX
|
||||
+ "px; width: 80px;");
|
||||
$("#contextMenu").show();
|
||||
}
|
||||
|
||||
});
|
||||
$(".resourcesList").click(function(e) {
|
||||
$("#contextMenu").hide();
|
||||
document.oncontextmenu = function() {return true;}
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,17 +1,78 @@
|
|||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<%= call_hook :view_account_login_top %>
|
||||
<%= stylesheet_link_tag 'new_user'%>
|
||||
<%= stylesheet_link_tag 'leftside'%>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function clearInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == content) {
|
||||
$('#' + id).val('');
|
||||
<script type="text/javascript">
|
||||
|
||||
// $(document).ready(function(){
|
||||
// $("#loginSignButton").click(function(){
|
||||
// $("#signUpBox").css({display:"block"});
|
||||
// $("#loginInBox").css({display:"none"});
|
||||
// });
|
||||
// $("#loginInButton").click(function(){
|
||||
// $("#signUpBox").css({display:"none"});
|
||||
// $("#loginInBox").css({display:"block"});
|
||||
// });
|
||||
// });
|
||||
// $(function(){
|
||||
// $("#username").keypress(function(e){
|
||||
// alert(11);
|
||||
// if (e.keyCode == '13') {
|
||||
// $('#main_login_form').submit();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// $("#password").keypress(function(e){
|
||||
// if (e.keyCode == '13') {
|
||||
// $('#main_login_form').submit();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".homepageSearchIcon").click(function(){
|
||||
var val=$('input:radio[name="search_type"]:checked').val();
|
||||
if(val==null){
|
||||
$("#navSearchAlert").css({display:"block"});
|
||||
}
|
||||
else {
|
||||
$("#navSearchAlert").css({display:"none"});
|
||||
}
|
||||
});
|
||||
// $("#loginInButton").click(function(){
|
||||
// $("#signUpBox").css({display:"none"});
|
||||
// $("#loginInBox").css({display:"block"});
|
||||
// });
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".navHomepageSearchBoxcontainer").mouseover(function(){
|
||||
$(".navSearchTypeBox").css({display:"block"});
|
||||
});
|
||||
$(".navHomepageSearchBoxcontainer").mouseout(function(){
|
||||
$(".navSearchTypeBox").css({display:"none"});
|
||||
});
|
||||
})
|
||||
$(document).ready(function(){
|
||||
if(<%= @login%>){
|
||||
$("#signUpBox").css({display:"none"});
|
||||
$("#loginInBox").css({display:"block"});
|
||||
}else{
|
||||
$("#signUpBox").css({display:"block"});
|
||||
$("#loginInBox").css({display:"none"});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// $('#regist_btn').bind('keyup', function(event) {
|
||||
// if (event.keyCode == "13" && $("#signUpBox").css('display') == 'block')) {
|
||||
// register();
|
||||
// }
|
||||
//});
|
||||
function clearInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == content) {
|
||||
$('#' + id).val('');
|
||||
}
|
||||
}
|
||||
|
||||
function showInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
|
@ -19,80 +80,207 @@
|
|||
$('#' + id).val(content);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
|
||||
</head>
|
||||
<div id="login-form">
|
||||
<%= form_tag(signin_path) do %>
|
||||
<%= back_url_hidden_field_tag %>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="username">
|
||||
<%=l(:lable_user_name)%>:
|
||||
</label>
|
||||
</td>
|
||||
<td align="left">
|
||||
<%= text_field_tag 'username', params[:username], :tabindex => '1' , :value => "#{l(:label_login_prompt)}",
|
||||
:onfocus => "clearInfo('username','#{l(:label_login_prompt)}')",
|
||||
:onblur => "showInfo('username','#{l(:label_login_prompt)}')",
|
||||
:style => "resize: none;font-size: 12px;color: #818283;"%>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="password">
|
||||
<%=l(:field_password)%>:
|
||||
</label>
|
||||
</td>
|
||||
<td align="left">
|
||||
<%= password_field_tag 'password', nil, :tabindex => '2' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% if Setting.openid? %>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="openid_url">
|
||||
<%=l(:field_identity_url)%>
|
||||
</label>
|
||||
</td>
|
||||
<td align="left">
|
||||
<%= text_field_tag "openid_url", nil, :tabindex => '3' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td align="left">
|
||||
<% if Setting.autologin? %>
|
||||
<label for="autologin">
|
||||
<%= check_box_tag 'autologin', 1, true, :tabindex => 4 %>
|
||||
<%= l(:label_stay_logged_in) %>
|
||||
</label>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" >
|
||||
|
||||
<span style="float: left">
|
||||
<% if Setting.lost_password? %>
|
||||
<%= link_to l(:label_password_lost), lost_password_path %>
|
||||
<% end %></span>
|
||||
|
||||
<span style="float: right">
|
||||
<input type="submit" class="small" name="login" value="<%=l(:button_login)%> »" tabindex="5"/></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= call_hook :view_account_login_bottom %>
|
||||
|
||||
<% if params[:username].present? %>
|
||||
<%= javascript_tag "$('#password').focus();" %>
|
||||
<% else %>
|
||||
<%= javascript_tag "$('#username').focus();" %>
|
||||
<% end %>
|
||||
function login(){
|
||||
$('#main_login_form').submit(); //表单提交没有任何反应的原因:js冲突
|
||||
}
|
||||
|
||||
function register(){
|
||||
if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){
|
||||
$("#main_reg_form").submit();
|
||||
}else{
|
||||
$('#user_login').blur();
|
||||
$('#user_mail').blur();
|
||||
$('#user_password').blur();
|
||||
$('#user_password_confirmation').blur();
|
||||
}
|
||||
}
|
||||
var $login_correct = false;
|
||||
var $mail_correct = false;
|
||||
var $passwd_correct = false;
|
||||
var $passwd_comfirm_correct = false;
|
||||
jQuery(document).ready(function () {
|
||||
var $login = $('#user_login')
|
||||
var $mail = $('#user_mail')
|
||||
var $password = $('#user_password')
|
||||
var $password_confirmation = $('#user_password_confirmation')
|
||||
$login.blur(function (event) {
|
||||
if ($(this).is('#user_login')) {
|
||||
$.get(
|
||||
'<%=account_valid_ajax_path%>',
|
||||
{ valid: "login",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#login_req').html('<span style="color: green">'+data.message+'</span>');
|
||||
$login_correct = true;
|
||||
} else {
|
||||
$('#login_req').html( '<span style="color: red">'+data.message+'</span>');
|
||||
$login_correct = false;
|
||||
}
|
||||
$('#login_req').css('display','block');
|
||||
});
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
$mail.blur(function (event) {
|
||||
if ($(this).is('#user_mail')) {
|
||||
$.get('<%=account_valid_ajax_path%>',
|
||||
{ valid: "mail",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#mail_req').html( '<span style="color: green">'+data.message+'</span>' );
|
||||
$mail_correct = true;
|
||||
} else {
|
||||
$('#mail_req').html( '<span style="color: red">'+data.message+'</span>' );
|
||||
$mail_correct = false;
|
||||
}
|
||||
$('#mail_req').css('display','block');
|
||||
});
|
||||
}
|
||||
;
|
||||
});
|
||||
$password.blur(function () {
|
||||
var pas1 = document.getElementById("user_password").value;
|
||||
var password_min_length = <%= Setting.password_min_length.to_i %>
|
||||
if (pas1.length >= password_min_length) {
|
||||
$('#passwd_req').html('');
|
||||
$passwd_correct = true;
|
||||
}
|
||||
else {
|
||||
$('#passwd_req').html( '<span style="color: red">'+'<%= l(:setting_password_min_length_limit, :count => Setting.password_min_length.to_i) %>'+'</span>');
|
||||
$passwd_correct = false;
|
||||
}
|
||||
$('#passwd_req').css('display','block');
|
||||
|
||||
|
||||
});
|
||||
$password_confirmation.blur(function () {
|
||||
var password_min_length = <%= Setting.password_min_length.to_i %>
|
||||
var pas1 = document.getElementById("user_password").value;
|
||||
var pas2 = document.getElementById("user_password_confirmation").value;
|
||||
if (pas1.length >= password_min_length && pas1 == pas2 ) {
|
||||
$('#confirm_req').html('<span style="color: green">'+'<%= l(:setting_password_success) %>'+'</span>');
|
||||
$passwd_comfirm_correct = true;
|
||||
}
|
||||
else {
|
||||
$('#confirm_req').html('<span style="color: red">'+'<%= l(:setting_password_error) %>'+'</span>');
|
||||
$passwd_comfirm_correct = false;
|
||||
|
||||
}
|
||||
$('#confirm_req').css('display','block');
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function user_name_keypress(e){
|
||||
if (e.keyCode == '13') {
|
||||
$('#main_login_form').submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="loginContentContainer">
|
||||
<div class="loginContent">
|
||||
<div class="loginLeft">
|
||||
<div class="loginLogo"><img src="images/trustie_big_log.png" width="100" height="88" alt="Trustie Logo" /></div>
|
||||
<div class="loginInro">欢迎加入Trustie高校创新实践社区!老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。Trustie是在中国推行大规模开放在线研究模式(MOORE)的支撑平台。</div>
|
||||
</div>
|
||||
<div class="loginRight">
|
||||
<div id="loginInBox">
|
||||
<div class="loginChooseBox">
|
||||
<div class="mb5">
|
||||
<ul class="loginChooseList">
|
||||
<li class="loginChoose fl"><span class="loginChooseTab">登录</span></li>
|
||||
<li class="loginChooseBorder fl"></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="loginSignAlert" style="color: red"><%= flash.empty? || flash[:error].nil? ? "" : flash[:error].html_safe %></div>
|
||||
</div>
|
||||
<div class="loginIn">
|
||||
|
||||
<%= form_tag(signin_path,:id=>'main_login_form',:method=>'post') do %>
|
||||
<%= back_url_hidden_field_tag %>
|
||||
<div class="mb20">
|
||||
<%= text_field_tag 'username', params[:username], :tabindex => '1' ,
|
||||
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%>
|
||||
<!--<input type="text" placeholder="请输入邮箱地址或昵称" class="loginSignBox" />-->
|
||||
</div>
|
||||
<% if Setting.openid? %>
|
||||
<div class="mb20">
|
||||
<%= text_field_tag "openid_url", nil, :tabindex => '3',:placeholder=>'请输入OpenId URL' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<!--<input type="text" placeholder="请输密码" class="loginSignBox" />-->
|
||||
<%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码', :onkeypress => "user_name_keypress(event);"%>
|
||||
</div>
|
||||
<div class="loginSignOption">
|
||||
<% if Setting.autologin? %>
|
||||
<div class="fl mt3 mr5">
|
||||
<%= check_box_tag 'autologin', 1, true, :tabindex => 4 %>
|
||||
</div>
|
||||
<%= l(:label_stay_logged_in) %>
|
||||
<% end %>
|
||||
<a href="<%= lost_password_path %>" class="newsBlue mr40 fr">
|
||||
<% if Setting.lost_password? %>
|
||||
<u>忘记密码?</u>
|
||||
<% end %>
|
||||
</a></div>
|
||||
<% end %>
|
||||
<div class="loginInButton" >
|
||||
<a href="javascript:void(0);" id="login_btn" class="c_white db" onclick="$('#main_login_form').submit();">登录</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="signUpBox">
|
||||
<div class="loginChooseBox">
|
||||
<ul class="loginChooseList">
|
||||
<li class="loginChoose fl"><span class="loginChooseTab">注册<%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></a></span>
|
||||
<li class="loginChooseBorder fl"></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="loginIn">
|
||||
<%= form_for :user, :url => register_path,:method=>'post',:html=>{:id=>'main_reg_form'} do |f| %>
|
||||
<%= error_messages_for 'user' %>
|
||||
<div class="loginSignRow">
|
||||
<!--<input type="text" placeholder="请输入邮箱地址" class="loginSignBox" />-->
|
||||
<%= f.text_field :mail,:size => 25, :class=>'loginSignBox' ,:placeholder=>"请输入邮箱地址"%>
|
||||
<div class="loginSignAlert" id="mail_req" style="display: none" >请输入有效邮箱地址</div>
|
||||
</div>
|
||||
<div class="loginSignRow">
|
||||
<!--<input type="text" placeholder="请输入密码" class="loginSignBox" />-->
|
||||
<%= f.password_field :password, :size => 25,:placeholder=>"请输入密码",:class=>'loginSignBox' %>
|
||||
<div class="loginSignAlert" id="passwd_req" style="display: none">至少需要 6 个字符</div>
|
||||
</div>
|
||||
<div class="loginSignRow">
|
||||
<!--<input type="text" placeholder="请再次输入密码" class="loginSignBox" />-->
|
||||
<%= f.password_field :password_confirmation, :size => 25,:placeholder=>"请再次输入密码",:class=>'loginSignBox' %>
|
||||
<div class="loginSignAlert" id="confirm_req" style="display: none">密码不一致</div>
|
||||
</div>
|
||||
<div class="loginSignRow">
|
||||
<!--<input type="text" placeholder="请输入用户昵称" class="loginSignBox" />-->
|
||||
<%= f.text_field :login, :size => 25,:placeholder=>"请输入用户昵称",:class=>'loginSignBox'%>
|
||||
<div class="loginSignAlert" id="login_req" style="display: none">用户昵称为2-18个中英文,数字或下划线</div>
|
||||
</div>
|
||||
<div class="loginSignOption">
|
||||
<div class="fl mt3 mr5">
|
||||
<input type="checkbox" id="read_and_confirm"/>
|
||||
</div>
|
||||
我已阅读并接受<a href="<%= agreement_path %>" class="newsBlue"><u>Trustie服务协议</u></a>条款</div>
|
||||
<div class="loginUpButton">
|
||||
<a href="javascript:void(0);" class="c_white db" id="regist_btn" onclick="register();">注册</a>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<h3><%=l(:label_password_forget)%></h3>
|
||||
<%= stylesheet_link_tag 'new_user'%>
|
||||
|
||||
<%= form_tag(lost_password_path) do %>
|
||||
<div class="box tabular">
|
||||
<p>
|
||||
<label for="mail"><%=l(:field_mail)%> <span class="required">*</span></label>
|
||||
<%= text_field_tag 'mail', nil, :size => 40, :placeholder => '请输入注册邮箱'%>
|
||||
<%= submit_tag l(:button_submit) %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="homepageContentContainer " style="margin-top:20px;">
|
||||
<div class="homepageContent BgBox">
|
||||
<h2 class="BgBox_h2">忘记密码</h2>
|
||||
<div class="BgBoxCon">
|
||||
<%= form_tag(lost_password_path) do %>
|
||||
<p class="BgBoxConP mb5">通过注册邮箱链接重设密码</p>
|
||||
<!--<input type="text" class="NomalInput mb20 " value="请输入登录邮箱地址" />-->
|
||||
<%= text_field_tag 'mail', nil, :size => 40, :placeholder => '请输入注册邮箱',:class=>'NomalInput mb20'%>
|
||||
<% if flash[:error] %>
|
||||
<p class="c_red mb5"><%= flash[:error]%></p>
|
||||
<!--<div style="color: red" class="mb5" ><%#= flash[:error]%></div>-->
|
||||
<% elsif flash[:notice] %>
|
||||
<p class="c_green mb5"><%= flash[:notice]%></p>
|
||||
<!--<div style="color: green" class="mb5" ><%#= flash[:notice]%></div>-->
|
||||
<% end %>
|
||||
<div class="LoginButton"><a href="javascript:void(0);" class="c_white db" onclick="$(this).parent().parent().submit();">提交</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!---BgBox end--->
|
||||
</div><!---homepageContentContainer end--->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
<h3><%=l(:label_password_lost)%></h3>
|
||||
|
||||
<%= error_messages_for 'user' %>
|
||||
<div style="margin-top:20px;width:100%; background-color:#eaebed;">
|
||||
<div style="width:1000px; background-color:#eaebed; margin:0 auto; width:968px; border:1px solid #dddddd; background:#fff; padding:15px; padding-top:10px;margin: 20px auto">
|
||||
<h2 style="font-size:16px; color:#484848; width:968px;border-bottom:1px solid #e3e3e3; padding-bottom:5px;">重置密码</h2>
|
||||
<div style="width:310px; margin:80px auto;">
|
||||
<%= form_tag(lost_password_path) do %>
|
||||
<%= hidden_field_tag 'token', @token.value %>
|
||||
<!--<input type="text" class="NomalInput " value="新密码" />-->
|
||||
<%= password_field_tag 'new_password', nil, :size => 25,:placeholder=>'新密码',:style=>"width:308px; height:38px; border:1px solid #98a1a6; outline:none; color:#888888; font-size:14px; " %>
|
||||
<p style=" color:#F00 ;margin-bottom:5px;">至少需要 6 个字符</p>
|
||||
<!--<input type="text" class="NomalInput mb20 " value="确定密码" />-->
|
||||
<%= password_field_tag 'new_password_confirmation', nil, :size => 25,:placeholder=>'确定密码',:style=>"width:308px; height:38px; border:1px solid #98a1a6; outline:none; color:#888888; font-size:14px;margin-bottom:20px; " %>
|
||||
<div style="width:315px; height:40px; background-color:#269ac9; font-size:14px; text-align:center; line-height:40px; vertical-align:middle;"><a href="javascript:void(0);" style=" color:#fff;display:block !important;" onclick="$(this).parent().parent().submit();">提交</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= form_tag(lost_password_path) do %>
|
||||
<%= hidden_field_tag 'token', @token.value %>
|
||||
<div class="box tabular">
|
||||
<p>
|
||||
<label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password', nil, :size => 25 %>
|
||||
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="new_password_confirmation"><%= l(:field_password_confirmation)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>
|
||||
</p>
|
||||
</div>
|
||||
<p><%= submit_tag l(:button_save) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<div class="tabs">
|
||||
<ul>
|
||||
<li><%= link_to l(:label_forum), {:action => 'messages_list'}, class: "#{current_page?(messages_list_path)? 'selected' : nil }" %></li>
|
||||
<li><%= link_to l(:label_borad_course), {:action => 'course_messages'}, class: "#{current_page?(course_messages_path)? 'selected' : nil }" %></li>
|
||||
<li><%= link_to l(:label_borad_project), {:action => 'project_messages'}, class: "#{current_page?(project_messages_path)? 'selected' : nil }" %></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,69 @@
|
|||
<h3>
|
||||
<%=l(:label_message_plural)%>
|
||||
</h3>
|
||||
|
||||
<%= render 'tab_messages' %>
|
||||
<h4><%=l(:label_borad_course) %></h4>
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程ID)">
|
||||
来源(课程ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
时间
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
标题
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
回复数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=@page*30%>
|
||||
<% for course in @course_ms -%>
|
||||
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= @count %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= Board.where('id=?',course.board_id).first.course_id %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if course.try(:author).try(:realname) == ' '%><%= course.try(:author)%><% else %><%=course.try(:author).try(:realname) %><% end %>'>
|
||||
<% if course.try(:author).try(:realname) == ' '%>
|
||||
<%= link_to(course.try(:author), user_path(course.author)) %>
|
||||
<% else %>
|
||||
<%= link_to(course.try(:author).try(:realname), user_path(course.author)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(course.created_on) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=course.subject %>'>
|
||||
<%= link_to(course.subject, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= link_to(course.replies_count, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_message_plural)) -%>
|
|
@ -0,0 +1,66 @@
|
|||
<h3>
|
||||
<%=l(:label_user_homework)%>
|
||||
</h3>
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
作业名称
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
课程名称
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
提交作品数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
提交截止日期
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%@count=@page*30 %>
|
||||
<% for homework in @homework do %>
|
||||
<% @count+=1 %>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<%=@count %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.name%>'>
|
||||
<%=link_to(homework.name, student_work_index_path(:homework => homework.id))%>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.course.name%>'>
|
||||
<%= link_to(homework.course.name, course_path(homework.course.id)) %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
|
||||
<% if homework.try(:user).try(:realname) == ' '%>
|
||||
<%= link_to(homework.try(:user), user_path(homework.user_id)) %>
|
||||
<% else %>
|
||||
<%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=link_to(StudentWork.where('homework_common_id=?',homework.id).count, student_work_index_path(:homework => homework.id))%>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=format_date(homework.end_time) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_user_homework)) -%>
|
|
@ -0,0 +1,96 @@
|
|||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
|
||||
<h3>
|
||||
<%=l(:label_latest_login_user_list)%>
|
||||
</h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= l(:label_filter_plural) %>
|
||||
</legend>
|
||||
<label style="float:left">开始日期:</label>
|
||||
<%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
|
||||
<%= calendar_for('startdate')%><span style="float: left "> </span>
|
||||
<label style="float:left">结束日期:</label>
|
||||
<%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
|
||||
<%= calendar_for('enddate')%>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_users'}, :class => 'icon icon-reload' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
登录时间
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
用户id
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
用户姓名
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
用户昵称
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
用户身份
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=@page * 30 %>
|
||||
<% for user in @user do %>
|
||||
<tr>
|
||||
<% @count +=1 %>
|
||||
<td align="center">
|
||||
<%=@count %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=format_date(user.last_login_on) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=user.id %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if user.try(:realname) == ' '%><%= user.login%><% else %><%=user.try(:realname) %><% end %>'>
|
||||
<% if user.try(:realname) == ' '%>
|
||||
<%= link_to(user.login, user_path(user)) %>
|
||||
<% else %>
|
||||
<%= link_to(user.try(:realname), user_path(user)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=link_to(user.login, user_path(user)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<% case user.user_extensions.identity %>
|
||||
<% when 0 %>
|
||||
<%='老师' %>
|
||||
<% when 1 %>
|
||||
<%='学生' %>
|
||||
<% when 2 %>
|
||||
<%='企业' %>
|
||||
<% when 3 %>
|
||||
<%='开发者' %>
|
||||
<% else %>
|
||||
<%='未知身份' %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_latest_login_user_list)) -%>
|
|
@ -0,0 +1,96 @@
|
|||
<h3>
|
||||
<%=l(:label_leave_message_list)%>
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
类型
|
||||
</th>
|
||||
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程或用户ID)">
|
||||
来源(课程或用户ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
留言人
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
留言时间
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
留言内容
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
回复数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count = @page * 30 %>
|
||||
<% for journal in @jour -%>
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= @count %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%case journal.jour_type %>
|
||||
<% when 'Principal' %>
|
||||
<%='用户主页' %>
|
||||
<% when 'Course' %>
|
||||
<%='课程' %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= journal.jour_id %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<% if journal.try(:user).try(:realname) == ' '%><%= journal.try(:user)%><% else %><%=journal.try(:user).try(:realname) %><% end %>'>
|
||||
<% if journal.try(:user).try(:realname) == ' '%>
|
||||
<%= link_to(journal.try(:user), user_path(journal.user)) %>
|
||||
<% else %>
|
||||
<%= link_to(journal.try(:user).try(:realname), user_path(journal.user)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(journal.created_on) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=journal.notes %>'>
|
||||
<%case journal.jour_type %>
|
||||
<% when 'Principal' %>
|
||||
<%= link_to(journal.notes.html_safe, feedback_path(journal.jour_id)) %>
|
||||
<% when 'Course' %>
|
||||
<%= link_to(journal.notes.html_safe, course_feedback_path(journal.jour_id)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if(journal.m_reply_count) %>
|
||||
<%case journal.jour_type %>
|
||||
<% when 'Principal' %>
|
||||
<%= link_to(journal.m_reply_count, feedback_path(journal.jour_id)) %>
|
||||
<% when 'Course' %>
|
||||
<%= link_to(journal.m_reply_count, course_feedback_path(journal.jour_id)) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%case journal.jour_type %>
|
||||
<% when 'Principal' %>
|
||||
<%= link_to(0, feedback_path(journal.jour_id)) %>
|
||||
<% when 'Course' %>
|
||||
<%= link_to(0, course_feedback_path(journal.jour_id)) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_leave_message_list)) -%>
|
|
@ -0,0 +1,71 @@
|
|||
<h3>
|
||||
<%=l(:label_message_plural)%>
|
||||
</h3>
|
||||
|
||||
<%= render 'tab_messages' %>
|
||||
<h4><%=l(:label_forum) %></h4>
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(贴吧ID)">
|
||||
来源(贴吧ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
时间
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
标题
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
回复数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=@page * 30%>
|
||||
<% for memo in @memo -%>
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= @count %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= memo.forum_id %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if memo.try(:author).try(:realname) == ' '%><%= memo.try(:author)%><% else %><%=memo.try(:author).try(:realname) %><% end %>'>
|
||||
<% if memo.try(:author).try(:realname) == ' '%>
|
||||
<%= link_to(memo.try(:author), user_path(memo.author)) %>
|
||||
<% else %>
|
||||
<%= link_to(memo.try(:author).try(:realname), user_path(memo.author)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(memo.created_at) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=memo.subject %>'>
|
||||
<% if memo.parent_id.nil? || memo.subject.starts_with?('RE:')%>
|
||||
<%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %>
|
||||
<% else %>
|
||||
<%= link_to("RE:"+memo.subject, forum_memo_path(memo.forum, memo)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_message_plural)) -%>
|
|
@ -0,0 +1,78 @@
|
|||
<h3>
|
||||
<%=l(:label_notification_list)%>
|
||||
</h3>
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
课程id
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
课程名称
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
主讲老师
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
时间
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
标题
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
回复数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=@page * 30%>
|
||||
<% for news in @news -%>
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= @count %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=news.course_id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.name %>">
|
||||
<%=link_to(news.course.name, course_path(news.course)) %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.try(:teacher).try(:realname) %>">
|
||||
<%=link_to(news.course.try(:teacher).try(:realname), user_path(news.course.teacher)) %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if news.try(:author).try(:realname) == ' '%><%= news.try(:author)%><% else %><%=news.try(:author).try(:realname) %><% end %>'>
|
||||
<% if news.try(:author).try(:realname) == ' '%>
|
||||
<%= link_to(news.try(:author), user_path(news.author)) %>
|
||||
<% else %>
|
||||
<%= link_to(news.try(:author).try(:realname), user_path(news.author)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(news.created_on) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=news.title %>'>
|
||||
<%= link_to(news.title, news_path(news)) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= link_to(news.comments_count, news_path(news)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_notification_list)) -%>
|
|
@ -0,0 +1,70 @@
|
|||
<h3>
|
||||
<%=l(:label_message_plural)%>
|
||||
</h3>
|
||||
|
||||
<%= render 'tab_messages' %>
|
||||
<h4><%=l(:label_borad_project) %></h4>
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(项目ID)">
|
||||
来源(项目ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
时间
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
标题
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
回复数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=@page * 30 %>
|
||||
<% for project in @project_ms -%>
|
||||
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= @count %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= Board.where('id=?',project.board_id).first.project_id %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if project.try(:author).try(:realname) == ' '%><%= project.try(:author)%><% else %><%=project.try(:author).try(:realname) %><% end %>'>
|
||||
<% if project.try(:author).try(:realname) == ' '%>
|
||||
<%= link_to(project.try(:author), user_path(project.author)) %>
|
||||
<% else %>
|
||||
<%= link_to(project.try(:author).try(:realname), user_path(project.author)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(project.created_on) %>
|
||||
</td>
|
||||
<td title='<%=project.subject %>' style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name">
|
||||
<%= link_to(project.subject, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= link_to(project.replies_count, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_message_plural)) -%>
|
|
@ -0,0 +1,50 @@
|
|||
<h3 style="float: left">
|
||||
<%=l(:label_school_plural)%>
|
||||
</h3>
|
||||
<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %>
|
||||
<%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%>
|
||||
<input style="float: right;margin-right: 10px;" id="v_subject" placeholder="学校名称" type="text" name="school_name" value="<%= @school_name%>">
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="autoscroll" style="margin-top: 40px;">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 100px;">
|
||||
LOGO
|
||||
</th>
|
||||
<th>
|
||||
学校名称
|
||||
</th>
|
||||
<th style="width: 100px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @schools.each do |school|%>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align:center;vertical-align: middle;">
|
||||
<%= school.id %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= image_tag(school.logo_link,width:40,height:40) %>
|
||||
</td>
|
||||
<td style="text-align:center;vertical-align: middle;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=school.name%>'>
|
||||
<span>
|
||||
<%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="buttons" style="vertical-align: middle;">
|
||||
<%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %>
|
||||
<%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
|
@ -17,6 +17,8 @@ if (window.Messenger) {
|
|||
Messenger().post({
|
||||
id: "label_apply_project_waiting",
|
||||
message: "<%= l(:label_apply_project_waiting) %>",
|
||||
showCloseButton: true,
|
||||
showCloseButton: true
|
||||
});
|
||||
};
|
||||
|
||||
$("#applied_project_link_<%= @project.id%>").replaceWith("<%= escape_javascript(link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => @project.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{@project.id}") %>");
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<% elsif @status == 2%>
|
||||
alert("<%= l('project.join.tips.success') %>");
|
||||
hideModal($("#popbox"));
|
||||
$("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>");
|
||||
<% elsif @status == 3%>
|
||||
alert("<%= l('project.join.tips.has') %>");
|
||||
<%else%>
|
||||
|
|
|
@ -29,32 +29,32 @@
|
|||
<% is_float ||= false %>
|
||||
<% for attachment in attachments %>
|
||||
<div style="float:left;">
|
||||
<p style="height:14px;line-height:12px;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%>
|
||||
<span title="<%= attachment.filename %>" id = "attachment_">
|
||||
<p style="height:14px;line-height:12px;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%>
|
||||
<span title="<%= attachment.filename %>" id = "attachment_">
|
||||
<% if options[:length] %>
|
||||
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
|
||||
<% else %>
|
||||
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%>
|
||||
<% end %>
|
||||
</span>
|
||||
<%if is_float%>
|
||||
</div>
|
||||
<% end%>
|
||||
<%if is_float%>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
<% if attachment.is_text? %>
|
||||
<%= link_to image_tag('magnifier.png'),
|
||||
:controller => 'attachments',
|
||||
:action => 'show',
|
||||
:id => attachment,
|
||||
:filename => attachment.filename%>
|
||||
<% end %>
|
||||
<% if attachment.is_text? %>
|
||||
<%= link_to image_tag('magnifier.png'),
|
||||
:controller => 'attachments',
|
||||
:action => 'show',
|
||||
:id => attachment,
|
||||
:filename => attachment.filename%>
|
||||
<% end %>
|
||||
</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>
|
||||
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
|
||||
</div>
|
||||
<span class="size">(
|
||||
<%= number_to_human_size attachment.filesize %>)
|
||||
</span>
|
||||
|
@ -66,6 +66,16 @@
|
|||
:class => 'delete delete-homework-icon',
|
||||
:remote => true,
|
||||
:title => l(:button_delete) %>
|
||||
<% elsif attachment.container_type == 'Issue' %>
|
||||
<% if User.current == attachment.author %>
|
||||
<%= link_to image_tag('delete.png'), attachment_path(attachment),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,
|
||||
:class => 'delete',
|
||||
#:remote => true,
|
||||
#:id => "attachments_" + attachment.id.to_s,
|
||||
:title => l(:button_delete) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to image_tag('delete.png'), attachment_path(attachment),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
|
@ -89,13 +99,13 @@
|
|||
</p>
|
||||
<% end %>
|
||||
<div class="thumbnails">
|
||||
<% if defined?(thumbnails) && thumbnails %>
|
||||
<% images = attachments.select(&:thumbnailable?) %>
|
||||
<% if images.any? %>
|
||||
<% if defined?(thumbnails) && thumbnails %>
|
||||
<% images = attachments.select(&:thumbnailable?) %>
|
||||
<% if images.any? %>
|
||||
<% images.each do |attachment| %>
|
||||
<div class="pro_pic fl " width="100" height="73"><%= thumbnail_issue_tag(attachment) %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= error_messages_for @board %>
|
||||
|
||||
<div class="box tabular">
|
||||
<p style="width:666;">
|
||||
<p style="width:666px;">
|
||||
<%= f.text_field :name, :required => true %>
|
||||
</p><!--by young-->
|
||||
<p>
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
<style type="text/css">
|
||||
div.talk_new .ke-container{margin-left:2px;}
|
||||
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
div.ke-toolbar .ke-outline{border:none;}*/
|
||||
.break_word {width:100%;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
@ -16,14 +9,14 @@
|
|||
for (var i=0; i<menuids.length; i++){
|
||||
var div = document.getElementById(menuids[i]);
|
||||
if(div == undefined)continue;
|
||||
var ultags=div.getElementsByTagName("ul")
|
||||
var ultags=div.getElementsByTagName("ul");
|
||||
for (var t=0; t<ultags.length; t++){
|
||||
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
|
||||
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle";
|
||||
ultags[t].parentNode.onmouseover=function(){
|
||||
this.getElementsByTagName("ul")[0].style.display="block"
|
||||
this.getElementsByTagName("ul")[0].style.display="block";
|
||||
}
|
||||
ultags[t].parentNode.onmouseout=function(){
|
||||
this.getElementsByTagName("ul")[0].style.display="none"
|
||||
this.getElementsByTagName("ul")[0].style.display="none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,46 +39,6 @@
|
|||
|
||||
<script type="text/javascript">//侧导航
|
||||
|
||||
//window.onload = function () {
|
||||
// var topic_id = getParam('topic_id');
|
||||
// document.getElementById(topic_id).focus();
|
||||
//}
|
||||
//
|
||||
//var getParam = function(name){
|
||||
// var search = document.location.search;
|
||||
// var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
|
||||
// var matcher = pattern.exec(search);
|
||||
// var items = null;
|
||||
// if(null != matcher){
|
||||
// try{
|
||||
// items = decodeURIComponent(decodeURIComponent(matcher[1]));
|
||||
// }catch(e){
|
||||
// try{
|
||||
// items = decodeURIComponent(matcher[1]);
|
||||
// }catch(e){
|
||||
// items = matcher[1];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return items;
|
||||
//};
|
||||
//
|
||||
//function show_newtalk()
|
||||
//{
|
||||
// $("#about_newtalk").toggle();
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
//
|
||||
//function show_newtalk1(id)
|
||||
//{
|
||||
// $(id).toggle();
|
||||
// $(id).focus();
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(params.subject!=undefined){
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
|
||||
<!--gcm-->
|
||||
<p class="stats">
|
||||
<%= content_tag('span', link_to("#{@course_activity_count[@course.id]}", course_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %>
|
||||
<%= content_tag('span', link_to("#{@course.course_activities.count}", course_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_activity, :count => @course.course_activities.count)) %>
|
||||
</p>
|
||||
<!--gcm-->
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="ping_dispic">
|
||||
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
|
||||
</div>
|
||||
<div class="ping_discon upload_img" style="width: 610px;">
|
||||
<div class="ping_discon upload_img" style="width: 670px;">
|
||||
<div class="ping_distop f14">
|
||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||
<span>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<img src="/images/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级" />
|
||||
</a>
|
||||
<% end%>
|
||||
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('');$('#edit_group_<%= group.id %>').slideToggle();$('#new_group_name').hide();">
|
||||
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('<%= group.name%>');$('#edit_group_<%= group.id %>').slideToggle();$('#new_group_name').hide();">
|
||||
<img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" />
|
||||
</a>
|
||||
<% end %>
|
||||
|
|
|
@ -4,13 +4,16 @@
|
|||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功");
|
||||
hideModal($("#popbox"));
|
||||
hideModal($("#popbox02"));
|
||||
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
|
||||
<% elsif @state == 1 %>
|
||||
alert("密码错误");
|
||||
<% elsif @state == 2 %>
|
||||
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
|
||||
<% elsif @state == 3 %>
|
||||
alert("您已经加入了课程");
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
|
||||
<% elsif @state == 4 %>
|
||||
alert("您加入的课程不存在");
|
||||
<% elsif @state == 5 %>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
</li>
|
||||
<li class=" ml90" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
|
||||
<a href="http://<%= Setting.host_course%>" target="_blank" class="blue_btn grey_btn fl c_white">取消</a>
|
||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end%>
|
||||
|
|
|
@ -39,17 +39,17 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @courses.size == 0 %>
|
||||
<%= render :partial => 'layouts/no_content'%>
|
||||
<% if @courses && !@courses.empty? %>
|
||||
<div id="courses-index">
|
||||
<%= render_course_hierarchy(@courses)%>
|
||||
</div>
|
||||
<% else %>
|
||||
<div id="courses-index">
|
||||
<%= render_course_hierarchy(@courses)%>
|
||||
</div>
|
||||
<%= render :partial => 'layouts/no_content'%>
|
||||
<% end %>
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @course_pages %>
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,83 +1,37 @@
|
|||
<div class="project_r_h">
|
||||
<% if @controller_name=='ActivityNotifys' %>
|
||||
<a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
|
||||
<h2 class="fl project_h2" style="width:100px;">与我相关
|
||||
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
|
||||
</h2>
|
||||
<div class="fr mt10 mr5 c_grey02">
|
||||
<a class="c_dblue">
|
||||
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
|
||||
</a>
|
||||
</div>
|
||||
<% else %>
|
||||
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
|
||||
<% if User.current.logged? %>
|
||||
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
|
||||
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
|
||||
</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @events_by_day != nil && @events_by_day.size >0 %>
|
||||
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
||||
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
|
||||
<div class="problem_main" nhname="container">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
|
||||
</a>
|
||||
<div class="problem_txt fl mt5 upload_img">
|
||||
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %>
|
||||
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
|
||||
<span class="fl"> </span>
|
||||
<span class="fl"> <%= l(:label_new_activity) %>:</span>
|
||||
<%
|
||||
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
|
||||
(e.event_type.eql?("bid") ? homework_course_path(@course) :
|
||||
(e.event_type.eql?("message") || e.event_type.eql?("reply") ?
|
||||
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url))
|
||||
%>
|
||||
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
|
||||
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
|
||||
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
|
||||
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
|
||||
<%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
|
||||
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
|
||||
<%end%>
|
||||
<br />
|
||||
<p class="mt5 break_word"><%= e.event_description.html_safe %>
|
||||
<br />
|
||||
<div class="cl"></div>
|
||||
<%= l :label_activity_time %> : <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %>
|
||||
</p>
|
||||
<%= link_to_attachments_course(e) if e.class.to_s == "News" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程动态 end-->
|
||||
<% end%>
|
||||
<% end%>
|
||||
<% elsif @controller_name=='ActivityNotifys' %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end%>
|
||||
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
|
||||
<div class="problem_main">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
|
||||
</a>
|
||||
<div class="problem_txt fl mt5">
|
||||
<%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %>
|
||||
<%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %>
|
||||
<span class="fl"> <%= l(:label_user_create_project) %>:</span>
|
||||
<%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%>
|
||||
<br />
|
||||
<p class="mt5">
|
||||
<br />
|
||||
<%= l :label_create_time %> : <%= format_time(@course.created_at) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程动态 end-->
|
||||
<%@course_activities.each do |activity|%>
|
||||
<div class="problem_main" nhname="container">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %>
|
||||
</a>
|
||||
<div class="problem_txt fl mt5 upload_img">
|
||||
<%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %>
|
||||
<span class="fl"> </span>
|
||||
<span class="fl"> <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %>:</span>
|
||||
<%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
|
||||
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
|
||||
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
|
||||
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
|
||||
<%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
|
||||
<!--span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span-->
|
||||
<%#end%>
|
||||
<%= link_to course_activity_link activity%>
|
||||
<div class="cl"></div>
|
||||
<p class="mt5 break_word">
|
||||
<%= course_activity_desc activity%>
|
||||
<br />
|
||||
<div class="cl"></div>
|
||||
<%= activity.course_act_type == "Course" ? l(:label_create_time) : l(:label_activity_time) %> : <%= format_time(activity.created_at) %>
|
||||
</p>
|
||||
<%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程动态 end-->
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
|
|
|
@ -24,6 +24,8 @@ $('#upload_file_div').slideToggle('slow');
|
|||
<% if @project %>
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
|
||||
$("#project_files_count_info").html("<%= @all_attachments.count%>");
|
||||
$("#project_files_count_nav").html("(<%= @all_attachments.count%>)")
|
||||
// 添加文件上传成功提示
|
||||
<% unless params[:attachments].nil? %>
|
||||
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
</td>
|
||||
<td rowspan="2" width="250px" >
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'forums', :action => "search_forum", :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
<%#= form_tag(:controller => 'forums', :action => "search_forum", :method => :get) do %>
|
||||
<%#= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<%# end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -48,11 +48,12 @@
|
|||
<ul class="ml10">
|
||||
<li>
|
||||
<label class="label02">迟交扣分: </label>
|
||||
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
|
||||
<span class="fl mt5"> 分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<li style="display: none;">
|
||||
<label class="label02" >是否匿评: </label>
|
||||
<%= f.check_box :homework_type, :class => "mb10 mt5 fl" %>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
|
||||
<li>
|
||||
<label class="label02">迟交扣分: </label>
|
||||
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
|
||||
<span class="fl mt5"> 分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
@ -56,7 +57,7 @@
|
|||
<ul>
|
||||
<li >
|
||||
<label class="label02"> 开发语言: </label>
|
||||
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %>
|
||||
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
|
@ -78,7 +79,7 @@
|
|||
|
||||
<li >
|
||||
<label class="label02"> 标准代码: </label>
|
||||
<textarea name="standard_code" class=" w547 h150 mb10 fl"><%= homework.homework_detail_programing.standard_code%></textarea>
|
||||
<textarea name="standard_code" class=" w547 h400 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || c_stantard_code_teacher%></textarea>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
|
@ -87,16 +88,25 @@
|
|||
<div>
|
||||
<li>
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w200 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
|
||||
<input type="text" class="fl h26 w190 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w200 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
|
||||
<input type="text" class="fl h26 w190 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
|
||||
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
|
||||
<!--span class="green_btn fl ml5 mt1">测试</span-->
|
||||
<% if homework_test.result && !homework_test.result.to_s.empty?%>
|
||||
<% if homework_test.result == 0%>
|
||||
<a class="green_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">正确</a>
|
||||
<% else%>
|
||||
<a class="red_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">错误</a>
|
||||
<% end%>
|
||||
<% else%>
|
||||
<a class="blue_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">测试</a>
|
||||
<% end%>
|
||||
<input type="hidden" id="test_result_<%= homework_test.id%>" name="result[<%= homework_test.id%>]" value="<%= homework_test.result%>"/>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -105,19 +115,79 @@
|
|||
<div>
|
||||
<li>
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w200 mb10" name="input[0]" />
|
||||
<input type="text" class="fl h26 w190 mb10" name="input[0]" value="1 2"/>
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w200 mb10" name="output[0]" />
|
||||
<input type="text" class="fl h26 w190 mb10" name="output[0]" value="3"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
|
||||
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
|
||||
<!--span class="green_btn fl ml5 mt1">测试</span-->
|
||||
<a class="blue_btn fl ml5 mt programing_test" onclick="programing_test('0')" id="test_send_0">测试</a>
|
||||
<input type="hidden" id="test_result_0" name="result[0]" />
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<input type="hidden" name="error_msg" id="homework_test_error_msg" value="<%= homework.homework_tests.first.error_msg if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg%>">
|
||||
<table class="border_ce" cellpadding="0" cellspacing="0" id="homework_work_test_show" style="display: <%= homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg && !homework.homework_tests.first.error_msg.empty? ? "block" : "none"%>">
|
||||
<tbody>
|
||||
<tr class="border_t" >
|
||||
<td class="td_end fb c_red w60 td_board_left">
|
||||
错误信息:
|
||||
</td>
|
||||
<td class="td_end wl" id="homework_work_test_desc">
|
||||
<% if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg %>
|
||||
<%= homework.homework_tests.first.error_msg%>
|
||||
<% end%>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
//点击测试,发送
|
||||
function programing_test(obj) {
|
||||
$.post(
|
||||
'<%= programing_test_homework_common_index_path%>',
|
||||
{
|
||||
src: $("textarea[name='standard_code']").val(),
|
||||
input: $("input[name='input[" + obj +"]']").val(),
|
||||
output: $("input[name='output[" + obj + "]']").val(),
|
||||
language: $("select[name='language']").val(),
|
||||
index: obj
|
||||
},
|
||||
function (data) {
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function init_programing_test()
|
||||
{
|
||||
$(".programing_test").each(function(){
|
||||
$(this).removeClass("green_btn red_btn").addClass("blue_btn").text("测试");
|
||||
$(this).next("input").val("");
|
||||
});
|
||||
}
|
||||
|
||||
function homework_language_change(obj)
|
||||
{
|
||||
if(obj.val() == "1")
|
||||
{
|
||||
// alert(1);
|
||||
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher%>");
|
||||
|
||||
}
|
||||
else if(obj.val() == "2")
|
||||
{
|
||||
// alert(2);
|
||||
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher_%>");
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -49,29 +49,31 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<% if homework.homework_type == 2 && homework.homework_detail_programing%>
|
||||
<table class="border_ce" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr class="<%= cycle("", "b_grey") %>">
|
||||
<td class="td_tit">
|
||||
输入
|
||||
</td>
|
||||
<td class="td_tit">
|
||||
输出
|
||||
</td>
|
||||
</tr>
|
||||
<% homework.homework_tests.each do |test|%>
|
||||
<% if @is_teacher%>
|
||||
<table class="border_ce" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr class="<%= cycle("", "b_grey") %>">
|
||||
<td class="td_tit">
|
||||
<%=test.input%>
|
||||
输入
|
||||
</td>
|
||||
<td class="td_tit">
|
||||
<%= test.output%>
|
||||
输出
|
||||
</td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="cl"></div>
|
||||
<% homework.homework_tests.each do |test|%>
|
||||
<tr class="<%= cycle("", "b_grey") %>">
|
||||
<td class="td_tit">
|
||||
<%=test.input%>
|
||||
</td>
|
||||
<td class="td_tit">
|
||||
<%= test.output%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
|
||||
<div class="mt5">
|
||||
<span class="tit_fb" style="width: auto;"> 开发语言:</span>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
|
@ -22,7 +22,7 @@
|
|||
<%= hidden_field_tag "homework_common[homework_type]","2"%>
|
||||
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
$("#test_send_<%= @index%>").replaceWith("<a class='<%= @result == 0 ? 'green_btn' : 'red_btn'%> fl ml5 mt1 programing_test' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%></a>");
|
||||
$("#test_result_<%= @index%>").val("<%= @result%>");
|
||||
<% if @err_msg || @result != 0%>
|
||||
$("#homework_work_test_show").show();
|
||||
$("#homework_work_test_desc").text("<%= escape_javascript(@err_msg || status_to_err_msg(@result))%>");
|
||||
<% if @err_msg%>
|
||||
$("#homework_test_error_msg").val("<%= escape_javascript(@err_msg)%>");
|
||||
<% end%>
|
||||
<% else%>
|
||||
$("#homework_work_test_show").hide();
|
||||
$("#homework_test_error_msg").val("");
|
||||
<% end%>
|
|
@ -6,7 +6,7 @@
|
|||
<div class="pro_page_box">
|
||||
<div class="pro_page_top break_word">
|
||||
<%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %>
|
||||
<a href="javascript:void(0)"><%= "#" + @issue.project_index %></a>
|
||||
<a href="javascript:void(0)"><%= "#" + @issue.id.to_s %></a>
|
||||
</div>
|
||||
<div class="problem_main">
|
||||
<div class="ping_dispic">
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<div id="Footer">
|
||||
<div class="footerAboutContainer">
|
||||
<ul class="footerAbout">
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
|
||||
<li class="fl"><a href="http://forge.trustie.net/projects/2/feedback" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_recruitment_information)%></a>|</li>
|
||||
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
|
||||
<select class="languageBox">
|
||||
<option value="Chinese" selected="selected">中文</option>
|
||||
<option value="English">英文</option>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<ul class="departments">
|
||||
<li class="fl mr10">
|
||||
<strong><%= l(:label_hosted_organization)%></strong><a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47" class=" ml10 f_grey" target="_blank"><%= l(:label_hosted_by)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="mr45 f_grey" target="_blank"><%= l(:label_sponsor)%></a>
|
||||
</li>
|
||||
<li class="fl mr10">
|
||||
<strong><%= l(:label_partners)%></strong><a href="http://eecs.pku.edu.cn" class="ml10 f_grey" target="_blank"><%= l(:label_co_organizer_EECS)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://scse.buaa.edu.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_BHU)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://www.iscas.ac.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_CAS)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://www.inforbus.com/" class="f_grey" target="_blank"><%= l(:label_co_organizer_InforS)%></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<ul class="copyright">
|
||||
<li class="fl"><%= l(:label_rights_reserved)%></li>
|
||||
<span class="fl mw15">|</span>
|
||||
<li class="fl"><a href="http://www.miibeian.gov.cn/" class="fl f_grey" target="_blank"><%= l(:label_license)%></a></li>
|
||||
</ul>
|
||||
</div><!--Footer end-->
|
||||
<div class="cl"></div>
|
|
@ -18,7 +18,7 @@
|
|||
<ul class="sub_menu">
|
||||
<% if @show_course == 1 && !visiable %>
|
||||
<% hasCourse=false %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<% hasCourse=true %>
|
||||
<% break %>
|
||||
|
@ -34,9 +34,10 @@
|
|||
</li>
|
||||
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
|
||||
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
|
||||
{:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user},
|
||||
{:controller=> 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user},
|
||||
{:class => 'my-message'} if User.current.logged?%>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
|
|
@ -9,65 +9,60 @@
|
|||
<div id="menu">
|
||||
<ul class="menu">
|
||||
<% if User.current.logged? %>
|
||||
<li>
|
||||
<%=link_to_user(User.current)%><!--<a href="javascript:void(0);" class="parent">用户名称</a>-->
|
||||
<ul>
|
||||
<% hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||
visiable = hidden_non_project && hidden_non_project.value == "0"%>
|
||||
<% if @show_course == 1 && !visiable %>
|
||||
<%# if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
||||
<% hasCourse=false %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<% hasCourse=true %>
|
||||
<li>
|
||||
<%=link_to_user(User.current)%><!--<a href="javascript:void(0);" class="parent">用户名称</a>-->
|
||||
<ul>
|
||||
<% hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||
visiable = hidden_non_project && hidden_non_project.value == "0"%>
|
||||
<% if @show_course == 1 && !visiable %>
|
||||
<%# if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
||||
<% hasCourse=false %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<% hasCourse=true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if hasCourse %>
|
||||
<% if hasCourse %>
|
||||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
|
||||
<ul>
|
||||
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<%# end -%>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.projects.count>0 %>
|
||||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
|
||||
<ul>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
|
||||
<% end %>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
|
||||
<li title="<%=project.name%>">
|
||||
<a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>">
|
||||
<%=project.name%>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<%# end -%>
|
||||
<% end %>
|
||||
<li><a href="<%= url_for(:controller => 'my', :action => 'account') %>">编辑资料</a></li>
|
||||
</ul>
|
||||
</li><!---level1 end--->
|
||||
<!--消息提醒-->
|
||||
<div class="navHomepageNews">
|
||||
<%= link_to image_tag("/images/news_icon_small.png" , :width => "21", :height => "24"), user_message_path(User.current) %>
|
||||
<% if User.current.count_new_message >0 %>
|
||||
<div class="newsActive"><%= link_to "" , user_message_path(User.current) %></div>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.projects.count>0 %>
|
||||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
|
||||
<ul>
|
||||
<% User.current.projects.each do |project| %>
|
||||
<li title="<%=project.name%>"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>"><%=project.name%></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><a href="<%= url_for(:controller => 'my', :action => 'account') %>">编辑资料</a></li>
|
||||
<!--<li><a href="javascript:void(0);" class="parent">我的课程</a>-->
|
||||
<!--<ul>-->
|
||||
<!--<li><a href="javascript:void(0);">新建课程</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的课程0我的课程我的课程01我的课程011</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
|
||||
<!--</ul><!–-level3 end-–>-->
|
||||
<!--</li><!–-level2 end-–>-->
|
||||
<!--<li><a href="javascript:void(0);" class="parent">我的项目</a>-->
|
||||
<!--<ul>-->
|
||||
<!--<li><a href="javascript:void(0);">新建项目</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的项目01</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的项目0</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的项目02</a></li>-->
|
||||
<!--</ul><!–-level3 end-–>-->
|
||||
<!--</li><!–-level2 end-–>-->
|
||||
<!--<li><a href="javascript:void(0);">我的主页</a></li>-->
|
||||
</ul>
|
||||
</li><!---level1 end--->
|
||||
<!--<li ><a href="javascript:void(0);">退出</a></li>-->
|
||||
</div>
|
||||
<!--消息提醒end-->
|
||||
<!--<li ><a href="javascript:void(0);">退出</a></li>-->
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= render_menu :account_menu -%>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<div id="Footer">
|
||||
<div class="footerAboutContainer">
|
||||
<ul class="footerAbout">
|
||||
<li class="fl"><span class="f_grey mw20" title="暂未开放"><%= l(:label_about_us)%></span>|</li>
|
||||
<li class="fl"><a href="http://forge.trustie.net/projects/2/member" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
|
||||
<li class="fl"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
|
||||
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
|
||||
<li class="fl"><span class="f_grey mw20" title="暂未开放"><%= l(:label_forums)%></span></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<ul class="departments">
|
||||
<li class="fl mr10">
|
||||
<strong><%= l(:label_hosted_organization)%></strong><a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47" class=" ml10 f_grey" target="_blank"><%= l(:label_hosted_by)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="mr45 f_grey" target="_blank"><%= l(:label_sponsor)%></a>
|
||||
</li>
|
||||
<li class="fl mr10">
|
||||
<strong><%= l(:label_partners)%></strong><a href="http://eecs.pku.edu.cn" class="ml10 f_grey" target="_blank"><%= l(:label_co_organizer_EECS)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://scse.buaa.edu.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_BHU)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://www.iscas.ac.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_CAS)%></a>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<a href="http://www.inforbus.com/" class="f_grey" target="_blank"><%= l(:label_co_organizer_InforS)%></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<ul class="copyright">
|
||||
<li class="fl mr30"><%= l(:label_rights_reserved)%></li>
|
||||
<li class="fl"><a href="http://www.miibeian.gov.cn/" class="fl f_grey" target="_blank"><%= l(:label_license)%></a></li>
|
||||
</ul>
|
||||
</div><!--Footer end-->
|
|
@ -0,0 +1,119 @@
|
|||
<div class="navHomepage">
|
||||
<div class="navHomepageLogo fl">
|
||||
<%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), user_activities_path(User.current.id)%>
|
||||
</div>
|
||||
<div class="fl">
|
||||
<ul>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "首页",user_activities_path(User.current.id), :class => "c_white f16 db"%>
|
||||
</li>
|
||||
<li class="navHomepageMenu fl">
|
||||
<a href="<%=url_for(:controller => 'users', :action => 'user_resource',:id=>User.current.id,:type=>1)%>" class="c_white f16 db">资源库</a></li>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "作业", user_homeworks_user_path(User.current.id), :class => "c_white f16 db"%>
|
||||
</li>
|
||||
<li class="navHomepageMenu fl mr30">
|
||||
<a href="http://forge.trustie.net/forums/1/memos/1168" class="c_white f16 db">帮助中心</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
<% type = type%>
|
||||
$(function (){
|
||||
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
|
||||
$('input:radio[value="courses"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'projects' ){
|
||||
$('input:radio[value="projects"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'users' ){
|
||||
$('input:radio[value="users"]').attr('checked','checked');
|
||||
}
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$("#navHomepageSearchInput").keypress(function(e){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (e.keyCode == '13' && name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
$(this).parent().submit();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function search_in_header(obj){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
obj.parent().submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="fl" id="navHomepageSearch">
|
||||
<!--<form class="navHomepageSearchBox">-->
|
||||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索"/>
|
||||
<input type="hidden" name="search_type" id="type" value=""/>
|
||||
<input type="text" class="none"/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
|
||||
<% end %>
|
||||
<div class="navSearchTypeBox" id="navHomepageSearchType">
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="courses" name="search_type" checked/>
|
||||
课程
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="projects" name="search_type" />
|
||||
项目
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="users" name="search_type" />
|
||||
用户
|
||||
</div>
|
||||
<div id="navSearchAlert" class="fr mr10">
|
||||
<span class="c_red">请选择搜索类型</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="navHomepageProfile">
|
||||
<ul>
|
||||
<li class="homepageProfileMenuIcon">
|
||||
<%= link_to "<div class='mt5 mb8'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
|
||||
<ul class="topnav_login_list">
|
||||
<li>
|
||||
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
|
||||
</li>
|
||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||
<li>
|
||||
<%= link_to "退出",signout_path,:class => "menuGrey",:method => "post"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="navHomepageNews">
|
||||
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon" %>
|
||||
<% if User.current.count_new_message >0 %>
|
||||
<div ><%= link_to "" , user_message_path(User.current), :class => "newsActive" %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//搜索相关
|
||||
$("#navHomepageSearch").mouseover(function(){
|
||||
$("#navHomepageSearchType").show();
|
||||
}).mouseout(function(){
|
||||
$("#navHomepageSearchType").hide();
|
||||
});
|
||||
|
||||
function signout(){
|
||||
$.post(
|
||||
'<%= signout_path%>',
|
||||
{}
|
||||
);
|
||||
}
|
||||
</script>
|
|
@ -21,14 +21,15 @@
|
|||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="msgserver">
|
||||
<div class="mt5">
|
||||
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
|
||||
<%= l(:label_technical_support) %>白 羽</a>
|
||||
<iframe name="hiddentab" style="display: none"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side_bottom"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="show_btn"><span>在线客服</span></div>
|
||||
<div class="show_btn">
|
||||
<span>在线客服</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<li id="my_courses_li">
|
||||
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
|
||||
<ul id="my_courses_ul">
|
||||
<% user_course.reverse.each do |course| %>
|
||||
<% user_course.each do |course| %>
|
||||
<li title="<%=course.name%>">
|
||||
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
|
||||
</li>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<li id="my_projects_li">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
|
||||
<ul id="my_projects_ul" >
|
||||
<% User.current.projects.reverse.each do |project| %>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
|
||||
<li title="<%=project.name%>">
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
|
||||
</li>
|
||||
|
@ -53,6 +53,9 @@
|
|||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<% end -%>
|
||||
<%= header_render_menu :account_menu -%>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
<div class="navHomepage">
|
||||
<div class="navHomepageLogo fl">
|
||||
<%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), signin_path%>
|
||||
</div>
|
||||
<div class="fl">
|
||||
<ul>
|
||||
<li class="navHomepageMenu fl mr40">
|
||||
<a href="http://forge.trustie.net/forums/1/memos/1168" class="c_white f16">帮助中心</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
function search(doc){
|
||||
//alert(1)
|
||||
// val = $('input:radio[name="search_type"]:checked').val();
|
||||
// alert(2)
|
||||
// $("#search_type").val(val);
|
||||
// alert(3)
|
||||
$(doc).parent().submit();
|
||||
}
|
||||
<% type = type%>
|
||||
$(function (){
|
||||
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
|
||||
$('input:radio[value="courses"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'projects' ){
|
||||
$('input:radio[value="projects"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'users' ){
|
||||
$('input:radio[value="users"]').attr('checked','checked');
|
||||
}
|
||||
});
|
||||
|
||||
function search_in_header(obj){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
obj.parent().submit();
|
||||
}
|
||||
}
|
||||
|
||||
function search_in_header_I(e,obj){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (e.keyCode == '13' && name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
obj.parent().submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="fl" id="navHomepageSearch">
|
||||
<!--<form class="navHomepageSearchBox">-->
|
||||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" onkeypress="search_in_header_I(event,$(this));"/>
|
||||
<input type="hidden" name="search_type" id="type" value=""/>
|
||||
<input type="text" style="display: none;"/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
|
||||
<% end %>
|
||||
<div class="navSearchTypeBox" id="navHomepageSearchType">
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="courses" name="search_type" checked/>
|
||||
课程
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="projects" name="search_type" />
|
||||
项目
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="users" name="search_type" />
|
||||
用户
|
||||
</div>
|
||||
<div id="navSearchAlert" class="fr mr10">
|
||||
<span class="c_red">请选择搜索类型</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="loginInButton" class="fr ml20">
|
||||
<a href="<%= signin_path(:login=>true) %>" class="c_white db">登录</a>
|
||||
</div>
|
||||
<div id="loginSignButton" class="fr">
|
||||
<a href="<%= signin_path(:login=>false) %>" class="c_white db">注册</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//搜索相关
|
||||
$("#navHomepageSearch").mouseover(function(){
|
||||
$("#navHomepageSearchType").show();
|
||||
}).mouseout(function(){
|
||||
$("#navHomepageSearchType").hide();
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
|
||||
<%= user.user_extensions.brief_introduction %>
|
||||
<% else%>
|
||||
这位童鞋很懒,什么也没有留下~
|
||||
<% end %>
|
||||
<% if User.current == user%>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_user_introduction();"%>
|
||||
<% end%>
|
|
@ -0,0 +1,12 @@
|
|||
<% courses.each do |course|%>
|
||||
<li class="homepageLeftMenuCoursesLine">
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}", :title => course.name%>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if courses.size == 5%>
|
||||
<li class="homepageLeftMenuMore" id="user_show_more_course">
|
||||
<input type="hidden" value="<%= page%>" id="course_page_num">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= user_courses4show_user_path(user.id)%>');"></a>
|
||||
</li>
|
||||
<% end%>
|
|
@ -4,7 +4,7 @@
|
|||
<ul class="course_sub_menu">
|
||||
<% course_index = 0 %>
|
||||
|
||||
<% User.current.courses.reverse.each do |course| %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %>
|
||||
<% course_index += 1 %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
|
||||
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
|
||||
<% User.current.projects.reverse.each do |project| %>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
|
||||
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<% projects.each do |project|%>
|
||||
<li class="homepageLeftMenuCoursesLine">
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => project.name%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if projects.size == 5%>
|
||||
<li class="homepageLeftMenuMore" id="user_show_more_project">
|
||||
<input type="hidden" value="<%= page%>" id="project_page_num">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_project('<%= user_projects4show_user_path(user.id)%>');"></a>
|
||||
</li>
|
||||
<% end%>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue