Merge branch 'develop' into daiao_dev
Conflicts: app/views/admin/excellent_all_courses.html.erb
This commit is contained in:
commit
cb11cac506
|
@ -0,0 +1 @@
|
|||
{"access_token":"oEEf8ZKAB8Y2G0o_xnTPkPJHKKk8iHkLC-f5ptvQ2nCMj9IpC86ivLD2-p38GfOkuG-HuQp3pWZqhs3NJXUMdPLWsr5k67hPZYuqg4ozLccx0xdLswapj0mn8ovZhK1tKIKiAFAOMO","expires_in":7200,"got_token_at":1467012449}
|
|
@ -34,3 +34,4 @@ vendor/cache
|
|||
/config/initializers/gitlab_config.rb
|
||||
1234567
|
||||
public/javascripts/wechat/node_modules/
|
||||
.ruby-version
|
||||
|
|
10
Gemfile
10
Gemfile
|
@ -1,12 +1,15 @@
|
|||
source 'https://ruby.taobao.org/'
|
||||
### <20><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>bundle config mirror.https://rubygems.org https://gems.ruby-china.org <20>л<EFBFBD><D0BB><EFBFBD>ruby-chinaԴ
|
||||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel
|
||||
gem 'certified'
|
||||
end
|
||||
|
||||
gem 'certified'
|
||||
gem 'net-ssh', '2.9.1'
|
||||
gem 'jenkins_api_client'
|
||||
gem 'nokogiri'
|
||||
|
||||
gem 'wechat',path: 'lib/wechat'
|
||||
gem 'grack', path:'lib/grack'
|
||||
|
@ -31,7 +34,6 @@ gem 'acts-as-taggable-on', '2.4.1'
|
|||
gem 'spreadsheet'
|
||||
gem 'ruby-ole'
|
||||
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
|
||||
#gem "rmagick", ">= 2.0.0"
|
||||
gem 'binding_of_caller'
|
||||
gem 'chinese_pinyin'
|
||||
# gem 'sunspot_rails', '~> 1.3.3'
|
||||
|
@ -81,7 +83,7 @@ group :assets do
|
|||
gem 'coffee-rails', '~> 3.2.1'
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
gem 'therubyracer', :platforms => :ruby
|
||||
# gem 'therubyracer', :platforms => :ruby
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
end
|
||||
|
|
|
@ -18,11 +18,13 @@ module Mobile
|
|||
require_relative 'apis/blog_comments'
|
||||
require_relative 'apis/new_comment'
|
||||
require_relative 'apis/praise'
|
||||
require_relative 'apis/resources'
|
||||
|
||||
class API < Grape::API
|
||||
version 'v1', using: :path
|
||||
format :json
|
||||
content_type :json, "application/json;charset=UTF-8"
|
||||
use ActionDispatch::Session::CookieStore
|
||||
use Mobile::Middleware::ErrorHandler
|
||||
|
||||
helpers do
|
||||
|
@ -34,6 +36,10 @@ module Mobile
|
|||
raise('Unauthorized. 用户认证失败.') unless current_user
|
||||
end
|
||||
|
||||
def session
|
||||
env['rack.session']
|
||||
end
|
||||
|
||||
def current_user
|
||||
openid = params[:openid]
|
||||
if openid
|
||||
|
@ -66,9 +72,9 @@ module Mobile
|
|||
mount Apis::BlogComments
|
||||
mount Apis::NewComment
|
||||
mount Apis::Praise
|
||||
mount Apis::Resources
|
||||
|
||||
#add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'})
|
||||
#add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
|
||||
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ module Mobile
|
|||
|
||||
params do
|
||||
requires :page, type: Integer
|
||||
requires :openid, type: String
|
||||
requires :token, type: String
|
||||
end
|
||||
post do
|
||||
authenticate!
|
||||
|
|
|
@ -14,8 +14,9 @@ module Mobile
|
|||
optional :token, type: String
|
||||
end
|
||||
get do
|
||||
authenticate!
|
||||
cs = CoursesService.new
|
||||
courses = cs.course_list(params,current_user.nil? ? User.find(2):current_user)
|
||||
courses = cs.user_courses_list(current_user)
|
||||
present :data, courses, with: Mobile::Entities::Course
|
||||
present :status, 0
|
||||
end
|
||||
|
@ -97,25 +98,20 @@ module Mobile
|
|||
|
||||
desc "加入课程"
|
||||
params do
|
||||
requires :course_password, type: String
|
||||
requires :token, type: String
|
||||
requires :invite_code, type: String, desc: '邀请码'
|
||||
end
|
||||
post ":id" do
|
||||
post "join" do
|
||||
authenticate!
|
||||
cs = CoursesService.new
|
||||
status = cs.join_course({:object_id => params[:id],:course_password => params[:course_password]},current_user)
|
||||
out = {status: status[:state]}
|
||||
message = case status[:state]
|
||||
when 0; "加入成功"
|
||||
when 1; "密码错误"
|
||||
when 2; "课程已过期 请联系课程管理员重启课程。(在配置课程处)"
|
||||
when 3; "您已经加入了课程"
|
||||
when 4; "您加入的课程不存在"
|
||||
when 5; "您还未登录"
|
||||
else; "未知错误,请稍后再试"
|
||||
end
|
||||
out.merge(message: message)
|
||||
status = cs.join_course({role: "10", openid: params[:openid], invite_code: params[:invite_code]}, current_user)
|
||||
{
|
||||
status: status[:state],
|
||||
messsge:CoursesService::JoinCourseError.message(status[:state])
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
desc "退出课程"
|
||||
params do
|
||||
requires :token, type: String
|
||||
|
@ -201,6 +197,7 @@ module Mobile
|
|||
end
|
||||
route_param :id do
|
||||
get do
|
||||
authenticate!
|
||||
cs = CoursesService.new
|
||||
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
|
||||
#course = Course.find(params[:id])
|
||||
|
@ -388,7 +385,16 @@ module Mobile
|
|||
end
|
||||
|
||||
|
||||
|
||||
desc '获取测验列表'
|
||||
params do
|
||||
requires :token, type:String
|
||||
end
|
||||
get ':course_id/exercises' do
|
||||
authenticate!
|
||||
exercises = Course.find(params[:course_id]).exercises
|
||||
present :data,exercises,with:Mobile::Entities::Exercise
|
||||
present :status,0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,8 @@ module Mobile
|
|||
|
||||
desc "get special issuse"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
authenticate!
|
||||
user = current_user
|
||||
issue = Issue.find params[:id]
|
||||
present :data, issue, with: Mobile::Entities::Issue,user: user
|
||||
present :status, 0
|
||||
|
|
|
@ -7,7 +7,8 @@ module Mobile
|
|||
|
||||
desc "get special journal"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
authenticate!
|
||||
user = current_user
|
||||
jour = JournalsForMessage.find params[:id]
|
||||
present :data, jour, with: Mobile::Entities::Jours,user: user
|
||||
present :status, 0
|
||||
|
|
|
@ -7,7 +7,8 @@ module Mobile
|
|||
|
||||
desc "get special topic"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
authenticate!
|
||||
user = current_user
|
||||
message = Message.find params[:id]
|
||||
present :data, message, with: Mobile::Entities::Message,user: user
|
||||
present :status, 0
|
||||
|
|
|
@ -11,12 +11,12 @@ module Mobile
|
|||
params do
|
||||
requires :type, type: String
|
||||
requires :content, type: String
|
||||
requires :openid, type: String
|
||||
requires :token, type: String
|
||||
end
|
||||
post ':id' do
|
||||
authenticate!
|
||||
type = params[:type]
|
||||
result = 1
|
||||
current_user = UserWechat.find_by_openid(params[:openid]).user
|
||||
if params[:content]!="" && current_user
|
||||
case type
|
||||
when "HomeworkCommon"
|
||||
|
|
|
@ -7,7 +7,8 @@ module Mobile
|
|||
|
||||
desc "get special news"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
authenticate!
|
||||
user = current_user
|
||||
news = News.find params[:id]
|
||||
present :data, news, with: Mobile::Entities::News,user: user
|
||||
present :status, 0
|
||||
|
|
|
@ -9,12 +9,13 @@ module Mobile
|
|||
|
||||
params do
|
||||
requires :type, type: String
|
||||
requires :openid, type: String
|
||||
requires :token, type: String
|
||||
end
|
||||
post ':id' do
|
||||
authenticate!
|
||||
obj_id = params[:id]
|
||||
obj_type = params[:type]
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
user = current_user
|
||||
pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",obj_id,obj_type.to_s,user.id).first
|
||||
if pts.blank?
|
||||
praise_or_cancel(obj_type,obj_id,user,1)
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#coding=utf-8
|
||||
module Mobile
|
||||
module Apis
|
||||
class Resources < Grape::API
|
||||
|
||||
resource :resources do
|
||||
|
||||
desc '获取所有课件'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get do
|
||||
authenticate!
|
||||
data = current_user.course_attachments
|
||||
present :data, data, with: Mobile::Entities::Attachment
|
||||
present :status, 0
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
desc '获取所有作业'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get 'homeworks' do
|
||||
authenticate!
|
||||
|
||||
homeworks = current_user.homework_commons
|
||||
|
||||
present :data, homeworks, with: Mobile::Entities::Homework
|
||||
present :status, 0
|
||||
|
||||
end
|
||||
|
||||
desc '获取所有测验'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get 'exercies' do
|
||||
authenticate!
|
||||
|
||||
exercises = current_user.exercises
|
||||
present :data, exercises, with: Mobile::Entities::Exercise
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -4,6 +4,48 @@ module Mobile
|
|||
class Users < Grape::API
|
||||
resource :users do
|
||||
|
||||
desc "查询是否已绑定"
|
||||
params do
|
||||
requires :openid, type: String, desc: 'wechat openid'
|
||||
end
|
||||
post 'isbind' do
|
||||
openid = params[:openid]
|
||||
uw = UserWechat.where(openid: openid).first
|
||||
raise "还未绑定trustie帐户" unless uw
|
||||
|
||||
user = uw.user
|
||||
::ApiKey.delete_all(user_id: user.id)
|
||||
key = ::ApiKey.create!(user_id: user.id)
|
||||
present status: 0, token: key.access_token
|
||||
end
|
||||
|
||||
desc "绑定微信用户"
|
||||
params do
|
||||
requires :login, type: String, desc: 'username'
|
||||
requires :password, type: String, desc: 'password'
|
||||
end
|
||||
post 'wxbind' do
|
||||
openid = session[:wechat_openid]
|
||||
logger.debug "openid ============== #{openid}"
|
||||
raise "无法获取到openid,请在微信中打开本页面" unless openid
|
||||
uw = UserWechat.where(openid: openid).first
|
||||
raise "此微信号已绑定用户(#{uw.user.login}), 不能重复绑定" if uw
|
||||
|
||||
user, last_login_on = User.try_to_login(params[:login], params[:password])
|
||||
raise "用户名或密码错误,请重新输入" unless user
|
||||
#补全用户信息
|
||||
|
||||
raise "此用户已经绑定过公众号, 请换一个帐户试试" if user.user_wechat
|
||||
|
||||
UserWechat.create!(
|
||||
openid: openid,
|
||||
user: user
|
||||
)
|
||||
# ws = WechatService.new
|
||||
# ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, format_time(Time.now))
|
||||
present status: 0, message: '您已成功绑定Trustie平台'
|
||||
end
|
||||
|
||||
desc "注册用户"
|
||||
params do
|
||||
requires :login, type: String, desc: 'username'
|
||||
|
|
|
@ -7,7 +7,8 @@ module Mobile
|
|||
|
||||
desc "get one homework"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
authenticate!
|
||||
user = current_user
|
||||
homework = HomeworkCommon.find params[:id]
|
||||
present :data, homework, with: Mobile::Entities::Whomework,user: user
|
||||
present :status, 0
|
||||
|
|
|
@ -45,6 +45,8 @@ module Mobile
|
|||
course_expose :tea_id
|
||||
course_expose :term
|
||||
course_expose :time
|
||||
course_expose :invite_code
|
||||
course_expose :qrcode
|
||||
course_expose :updated_at
|
||||
course_expose :course_student_num
|
||||
expose :teacher, using: Mobile::Entities::User do |c, opt|
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class Exercise < Grape::Entity
|
||||
expose :exercise_name
|
||||
expose :exercise_description
|
||||
end
|
||||
end
|
||||
end
|
|
@ -26,6 +26,8 @@ module Mobile
|
|||
u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.student_id
|
||||
when :realname
|
||||
u.nil? ? "" : get_user_realname(u)
|
||||
when :name
|
||||
u.nil? ? "" : u.show_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -57,6 +59,11 @@ module Mobile
|
|||
user_expose :student_num
|
||||
# 活跃值
|
||||
user_expose :active_count
|
||||
|
||||
user_expose :role_name
|
||||
|
||||
user_expose :name
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the QualityAnalyses controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the syllabuses controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -67,12 +67,15 @@ class AdminController < ApplicationController
|
|||
def excellent_all_courses
|
||||
name = params[:name]
|
||||
@order = ""
|
||||
if params[:order] == 'asc'
|
||||
courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) asc, c.id desc")
|
||||
@sort = ""
|
||||
if params[:sort] && (params[:order] == 'act')
|
||||
courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc")
|
||||
@order = params[:order]
|
||||
elsif params[:order] == 'desc'
|
||||
courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) DESC, c.id desc")
|
||||
@sort = params[:sort]
|
||||
elsif params[:sort] && (params[:order] == 'time')
|
||||
courses = Course.find_by_sql("SELECT * FROM courses WHERE name like '%#{name}%' ORDER BY time #{params[:sort]},id desc")
|
||||
@order = params[:order]
|
||||
@sort = params[:sort]
|
||||
else
|
||||
courses = Course.like(name).order('created_at desc')
|
||||
end
|
||||
|
@ -99,6 +102,22 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#取消精品
|
||||
def cancel_excellent_course
|
||||
@course = Course.find params[:id]
|
||||
unless @course.nil?
|
||||
if @course.is_excellent == 1 || @course.excellent_option == 1
|
||||
@course.update_column('is_excellent', 0)
|
||||
@course.update_column('excellent_option', 0)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
redirect_to excellent_courses_url
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面课程资源列表
|
||||
def course_resource_list
|
||||
|
||||
|
|
|
@ -916,4 +916,11 @@ class ApplicationController < ActionController::Base
|
|||
call_hook(:controller_account_success_authentication_after, {:user => user })
|
||||
end
|
||||
|
||||
def user_unlogged_check
|
||||
if !User.current.logged?
|
||||
render(:partial => 'organizations/unlogged_tip')
|
||||
return false
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -265,6 +265,10 @@ class AttachmentsController < ApplicationController
|
|||
@history.save #历史记录保存完毕
|
||||
#将最新保存的记录 数据替换到 需要修改的文件记录
|
||||
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes")
|
||||
# 如果附件描述被修改,则保存附件
|
||||
unless params[:description] == @attachment.description
|
||||
@old_attachment.description = params[:description]
|
||||
end
|
||||
@old_attachment.save
|
||||
#删除当前记录
|
||||
@attachment.delete
|
||||
|
|
|
@ -74,7 +74,7 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
@state = 5 #未登录
|
||||
end
|
||||
@object_id = params[:object_id]
|
||||
@object_id = @course.id if @course
|
||||
respond_to do |format|
|
||||
format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} }
|
||||
end
|
||||
|
@ -1224,7 +1224,7 @@ class CoursesController < ApplicationController
|
|||
def member_to_xls homeworks, course, members,groups
|
||||
xls_report = StringIO.new
|
||||
book = Spreadsheet::Workbook.new
|
||||
sheet1 = book.create_worksheet :name => "student"
|
||||
sheet1 = book.create_worksheet :name => "总成绩"
|
||||
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
||||
#sheet1.row(0).default_format = blue
|
||||
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
|
||||
|
@ -1268,6 +1268,121 @@ class CoursesController < ApplicationController
|
|||
count_row += 1
|
||||
end
|
||||
|
||||
homeworks.each_with_index do |home, i|
|
||||
sheet = book.create_worksheet :name => "第#{i+1}次作业"
|
||||
sheet[0,0] = "课程编号"
|
||||
sheet[0,1] = course.id
|
||||
sheet[1,0] = "课程学期"
|
||||
sheet[1,1] = course.time.to_s+"年"+course.term
|
||||
sheet[2,0] = "课程名称"
|
||||
sheet[2,1] = course.name
|
||||
sheet[3,0] = "教师团队"
|
||||
sheet[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、')
|
||||
sheet[4,0] = "主讲教师"
|
||||
sheet[4,1] = course.teacher.show_name
|
||||
sheet[4,0] = "作业批次"
|
||||
sheet[4,1] = "第#{i+1}次作业"
|
||||
sheet[4,0] = "作业名称"
|
||||
sheet[4,1] = home.name
|
||||
if home.homework_type == 1 #普通作业
|
||||
if home.anonymous_comment ==0
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 6
|
||||
items = home.student_works.order("work_score desc")
|
||||
items.each_with_index do |stu, j|
|
||||
sheet[count_row,0]= j + 1
|
||||
sheet[count_row,1] = stu.user.show_name
|
||||
sheet[count_row,2] = stu.user.login
|
||||
sheet[count_row,3] = stu.user.user_extensions.student_id
|
||||
sheet[count_row,4] = stu.name
|
||||
sheet[count_row,5] = strip_html stu.description
|
||||
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
|
||||
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
|
||||
if home.anonymous_comment ==0
|
||||
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
|
||||
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
|
||||
sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
||||
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
||||
sheet[count_row,12] = format_time(stu.created_at)
|
||||
else
|
||||
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
||||
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
||||
sheet[count_row,10] = format_time(stu.created_at)
|
||||
end
|
||||
count_row += 1
|
||||
end
|
||||
elsif home.homework_type == 2 #编程作业
|
||||
if home.anonymous_comment ==0
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 6
|
||||
items = home.student_works.order("work_score desc")
|
||||
items.each_with_index do |stu, j|
|
||||
sheet[count_row,0]= j + 1
|
||||
sheet[count_row,1] = stu.user.show_name
|
||||
sheet[count_row,2] = stu.user.login
|
||||
sheet[count_row,3] = stu.user.user_extensions.student_id
|
||||
sheet[count_row,4] = stu.name
|
||||
sheet[count_row,5] = stu.description
|
||||
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
|
||||
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
|
||||
sheet[count_row,8] = stu.system_score.nil? ? l(:label_without_score) : stu.system_score.round(2)
|
||||
if home.anonymous_comment ==0
|
||||
sheet[count_row,9] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
|
||||
sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
|
||||
sheet[count_row,11] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
||||
sheet[count_row,12] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
||||
sheet[count_row,13] = format_time(stu.created_at)
|
||||
else
|
||||
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
||||
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
||||
sheet[count_row,11] = format_time(stu.created_at)
|
||||
end
|
||||
count_row += 1
|
||||
end
|
||||
elsif home.homework_type == 3 #分组作业
|
||||
if home.anonymous_comment ==0
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 6
|
||||
items = home.student_works.order("work_score desc")
|
||||
items.each_with_index do |stu, j|
|
||||
sheet[count_row,0] = j + 1
|
||||
sheet[count_row,1] = get_group_member_names stu
|
||||
sheet[count_row,2] = stu.name
|
||||
sheet[count_row,3] = (stu.project_id == 0 || stu.project_id.nil?) ? l(:excel_no_project) : stu.project.name
|
||||
sheet[count_row,4] = strip_html stu.description
|
||||
sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
|
||||
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
|
||||
if home.anonymous_comment ==0
|
||||
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
|
||||
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
|
||||
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
||||
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
||||
sheet[count_row,11] = format_time(stu.created_at)
|
||||
else
|
||||
sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
||||
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
||||
sheet[count_row,9] = format_time(stu.created_at)
|
||||
end
|
||||
count_row += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
=begin
|
||||
group0 = CourseGroup.new();
|
||||
group0.id = 0;
|
||||
|
|
|
@ -49,6 +49,11 @@ class ExerciseController < ApplicationController
|
|||
return
|
||||
end
|
||||
@exercise = Exercise.find params[:id]
|
||||
@exercise.course_messages.each do |message|
|
||||
if User.current.id == message.user_id && message.viewed == 0
|
||||
message.update_attributes(:viewed => true) if message.viewed == 0
|
||||
end
|
||||
end
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
exercise_end = @exercise.end_time > Time.now
|
||||
if @exercise.time == -1
|
||||
|
|
|
@ -26,7 +26,7 @@ class FilesController < ApplicationController
|
|||
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
|
||||
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
|
||||
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
|
||||
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file]
|
||||
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description]
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
|
@ -483,6 +483,7 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && attachments[:files] && tag_name != ""
|
||||
attachments[:files].each do |attachment|
|
||||
attachment.tag_list.add(tag_name)
|
||||
attachment.description = params[:description]
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
@ -493,6 +494,7 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && attachments[:files] && tag_name != ""
|
||||
attachments[:files].each do |attachment|
|
||||
attachment.tag_list.add(tag_name)
|
||||
attachment.description = params[:description]
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
@ -600,6 +602,7 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && attachments[:files] && tag_name != ""
|
||||
attachments[:files].each do |attachment|
|
||||
attachment.tag_list.add(tag_name)
|
||||
attachment.description = params[:description]
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
@ -610,6 +613,7 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && attachments[:files] && tag_name != ""
|
||||
attachments[:files].each do |attachment|
|
||||
attachment.tag_list.add(tag_name)
|
||||
attachment.description = params[:description]
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
@ -911,5 +915,10 @@ class FilesController < ApplicationController
|
|||
|
||||
def upload_files_menu
|
||||
|
||||
end
|
||||
end
|
||||
def update_file_description
|
||||
@attachment = Attachment.find(params[:id])
|
||||
@attachment.description = params[:description]
|
||||
@attachment.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,4 +54,8 @@ class OrgMemberController < ApplicationController
|
|||
def index
|
||||
|
||||
end
|
||||
|
||||
def deleteOrgMember
|
||||
destroy
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,14 +9,15 @@ class OrgSubfieldsController < ApplicationController
|
|||
@subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id], :priority => @organization.org_subfields.order("priority").last.priority + 1)
|
||||
if !params[:sub_dir].blank?
|
||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase)
|
||||
end
|
||||
end
|
||||
@subfield.update_attributes(:field_type => params[:field_type])
|
||||
#默认类型为帖子
|
||||
@subfield.update_attributes(:field_type => params[:field_type]||"Post")
|
||||
# admin配置的类型
|
||||
update_status_by_type(@subfield, params[:field_type])
|
||||
update_status_by_type(@subfield, params[:field_type]||"Post")
|
||||
else
|
||||
@res = false
|
||||
end
|
||||
|
@ -56,6 +57,10 @@ class OrgSubfieldsController < ApplicationController
|
|||
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
|
||||
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
|
||||
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first
|
||||
if @org_subfield.nil?
|
||||
render_404
|
||||
return
|
||||
end
|
||||
if @org_subfield.field_type == 'Post'
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
class PraiseTreadController < ApplicationController
|
||||
|
||||
accept_api_auth :tread_plus,:praise_plus
|
||||
before_filter :require_login,:only => [:praise_plus,:tread_plus]
|
||||
# before_filter :require_login,:only => [:praise_plus,:tread_plus]
|
||||
before_filter :user_unlogged_check,:only => [:praise_plus,:tread_plus,:praise_minus]
|
||||
|
||||
def praise_plus
|
||||
@obj = nil
|
||||
@activity = false
|
||||
|
||||
if request.get?
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
|
|
|
@ -100,8 +100,8 @@ class ProjectsController < ApplicationController
|
|||
render_404
|
||||
end
|
||||
|
||||
def course
|
||||
render_404
|
||||
def courserender_404
|
||||
|
||||
end
|
||||
|
||||
# Time 2015-01-29 11:19:11
|
||||
|
@ -299,6 +299,8 @@ class ProjectsController < ApplicationController
|
|||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||
return
|
||||
end
|
||||
|
||||
logger.debug "111111111"*100
|
||||
# over
|
||||
@author = params[:user_id].blank? ? nil : User.active.find(params[:user_id])
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
|
@ -319,6 +321,7 @@ class ProjectsController < ApplicationController
|
|||
else
|
||||
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10);
|
||||
end
|
||||
logger.debug "2"*100
|
||||
# g = Gitlab.client
|
||||
unless @project.gpid.nil? || @project.project_score.changeset_num == 0
|
||||
# rep_statics_commit = @project.rep_statics.order("commits_num desc")
|
||||
|
@ -332,12 +335,20 @@ class ProjectsController < ApplicationController
|
|||
@a_commits_del = rep_statics_code.map {|s| s.del.to_i }
|
||||
@a_commits_changeset = rep_statics_code.map {|s| s.changeset.to_i }
|
||||
g = Gitlab.client
|
||||
logger.debug "3"*100
|
||||
begin
|
||||
g_branch = g.project(@project.gpid).default_branch.to_s
|
||||
rescue
|
||||
logger.error("get gitlab project failed!")
|
||||
gid = @project.gpid
|
||||
logger.debug "31"*100
|
||||
g_branch = g.project(gid)
|
||||
logger.debug "4"*100
|
||||
g_branch = g_branch.default_branch.to_s
|
||||
logger.debug "5"*100
|
||||
rescue =>e
|
||||
logger.error("get gitlab project failed: " + e)
|
||||
end
|
||||
logger.debug "6"*100
|
||||
@rev = g_branch.nil? ? "master" : g_branch
|
||||
logger.debug "7"*100
|
||||
end
|
||||
# 根据对应的请求,返回对应的数据
|
||||
respond_to do |format|
|
||||
|
@ -393,7 +404,7 @@ class ProjectsController < ApplicationController
|
|||
unless @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
@gitlab_branches = g.branches(@project.gpid)
|
||||
@branch_names = g.branches(@project.gpid).map{|b| b.name}
|
||||
@branch_names = @gitlab_branches.map{|b| b.name}
|
||||
@gitlab_default_branch = g.project(@project.gpid).default_branch
|
||||
end
|
||||
end
|
||||
|
@ -645,7 +656,7 @@ class ProjectsController < ApplicationController
|
|||
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
|
||||
params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0
|
||||
# 更新公开私有时同步gitlab公开私有
|
||||
unless @project.gpid.nil?
|
||||
if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? true : false)
|
||||
g = Gitlab.client
|
||||
params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
|
||||
end
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
class QualityAnalysisController < ApplicationController
|
||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||
before_filter :authorize
|
||||
layout "base_projects"
|
||||
include ApplicationHelper
|
||||
require 'jenkins_api_client'
|
||||
require 'nokogiri'
|
||||
require 'json'
|
||||
require 'open-uri'
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
jenkins_address = Redmine::Configuration['jenkins_address']
|
||||
@client = JenkinsApi::Client.new(:server_url => jenkins_address,
|
||||
:username => "temp",
|
||||
:password => '123123')
|
||||
#@client.exists?(job_name)
|
||||
@g = Gitlab.client
|
||||
user_name = User.find(params[:user_id]).try(:login)
|
||||
branch = params[:branch].nil? ? "master" : params[:branch]
|
||||
language = params[:language]
|
||||
path = params[:path]
|
||||
identifier = params[:identifier]
|
||||
qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
|
||||
version = qa.nil? ? 1 : qa.sonar_version + 1
|
||||
properties = "sonar.projectKey=#{user_name}:#{identifier}
|
||||
sonar.projectName=#{user_name}:#{identifier}
|
||||
sonar.projectVersion=#{version}
|
||||
sonar.sources=#{path}
|
||||
sonar.language=#{language.downcase}
|
||||
sonar.sourceEncoding=utf-8"
|
||||
git_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
|
||||
|
||||
# # # modify config
|
||||
@doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
|
||||
@doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
|
||||
@doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
|
||||
@doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties #sonar-properties
|
||||
#
|
||||
# replace config.xml of jenkins
|
||||
@client = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml)
|
||||
# relace gitlab hook
|
||||
# genkins address
|
||||
@g.add_project_hook(@project.gpid, jenkins_address + "/project/#{user_name}_#{identifier}")
|
||||
if qa.nil?
|
||||
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :sonar_version => version, :path => path, :branch => branch, :language => language)
|
||||
|
||||
else
|
||||
qa.update_attribute(:sonar_version, version)
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@sonar_address = Redmine::Configuration['sonar_address']
|
||||
# if params[:resource_id].nil?
|
||||
# @name_flag = true
|
||||
# @quality_analyses = QualityAnalysis.where(:project_id => @project.id)
|
||||
# # @quality_analyses.map {|qa| qa.}
|
||||
# # if @quality_analyses.count > 0
|
||||
# # @quality_analyses.each do |qa|
|
||||
# # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
|
||||
# #
|
||||
# # end
|
||||
# # end
|
||||
# # projects_date = open(@sonar_address + "/api/projects/index").read
|
||||
# # arr = JSON.parse(projects_date).map {|m| m["nm"]}
|
||||
# # arr.map
|
||||
# else
|
||||
qa = QualityAnalysis.where(:project_id => @project.id).first
|
||||
@resource_id = qa.author_login+":"+qa.rep_identifier
|
||||
@name_flag = false
|
||||
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read
|
||||
@complexity =JSON.parse(complexity_date).first
|
||||
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
|
||||
@sonar_issues = JSON.parse(issue_date).first
|
||||
# end
|
||||
end
|
||||
|
||||
# Find project of id params[:project_id]
|
||||
def find_project_by_project_id
|
||||
@project = Project.find(params[:project_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Authorize the user for the requested action
|
||||
def authorize(ctrl = params[:controller], action = params[:action], global = false)
|
||||
unless @project.archived? && @project.gpid.nil?
|
||||
true
|
||||
else
|
||||
render_403 :message => :notice_not_authorized_archived_project
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -30,11 +30,13 @@ class RepositoriesController < ApplicationController
|
|||
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
|
||||
default_search_scope :changesets
|
||||
|
||||
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats]
|
||||
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis]
|
||||
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
|
||||
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive]
|
||||
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
|
||||
# 链接gitlab
|
||||
before_filter :connect_gitlab, :only => [:quality_analysis]
|
||||
accept_rss_auth :revisions
|
||||
# hidden repositories filter // 隐藏代码过滤器
|
||||
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
|
||||
|
@ -43,6 +45,7 @@ class RepositoriesController < ApplicationController
|
|||
helper :project_score
|
||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||
$g=Gitlab.client
|
||||
require 'net/ssh'
|
||||
|
||||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||
def new
|
||||
|
@ -306,6 +309,37 @@ update
|
|||
end
|
||||
end
|
||||
|
||||
def quality_analysis
|
||||
gitlab_branches = @g.branches(@project.gpid)
|
||||
@branch_names = gitlab_branches.map{|b| b.name}
|
||||
@gitlab_default_branch = @g.project(@project.gpid).default_branch
|
||||
# language = params[:language]
|
||||
# branch = params[:branch]
|
||||
# path = params[:path]
|
||||
# user_name = User.find(@project.user_id).try(:login)
|
||||
# rep_name = params[:repository_id]
|
||||
# host = "192.168.0.200"
|
||||
# port = "1125"
|
||||
# username = "git"
|
||||
# password = "123123"
|
||||
# server_cmd1 = "sh gitclone.sh" + " " + user_name + " " + rep_name
|
||||
# # 连接到远程主机 foobar
|
||||
# ssh = Net::SSH.start(host, username, :port => port, :password => password) do |ssh|
|
||||
# result = ssh.exec!(server_cmd1)
|
||||
# path = "/home/git/repo/" + user_name + "/" + rep_name
|
||||
# # sonar 分析
|
||||
# # server_cmd2
|
||||
# # 删除clone的版本库
|
||||
# # server_cmd3
|
||||
# end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{
|
||||
render :layout => "base_projects"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
DestroyRepositoryTask.new.destroy(User.current.id, @repository.id)
|
||||
@repository.hidden = true
|
||||
|
@ -360,7 +394,7 @@ update
|
|||
# ip = RepositoriesHelper::REPO_IP_ADDRESS
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
# REDO:需优化,仅测试用
|
||||
@zip_path = gitlab_address.to_s + "/api/v3/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=YTyCv4978MXmdL2B9C62"
|
||||
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
|
||||
if @repository.type.to_s == "Repository::Gitlab"
|
||||
@repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git"
|
||||
else
|
||||
|
@ -615,6 +649,14 @@ update
|
|||
project.project_score.update_attribute(:commit_time, date.created_at)
|
||||
end
|
||||
|
||||
# 链接gitlab
|
||||
def connect_gitlab
|
||||
@g = Gitlab.client
|
||||
unless @project.gpid.nil?
|
||||
@g_project = @g.project(@project.gpid)
|
||||
end
|
||||
end
|
||||
|
||||
def find_repository
|
||||
@repository = Repository.find(params[:id])
|
||||
@project = @repository.project
|
||||
|
|
|
@ -1096,7 +1096,8 @@ class StudentWorkController < ApplicationController
|
|||
all_student_ids = "(" + pro.members.map{|member| member.user_id}.join(",") + ")"
|
||||
end
|
||||
all_students = User.where("id in #{all_student_ids}")
|
||||
@commit_student_ids = @homework.student_work_projects.map{|student| student.user_id}
|
||||
student_work_id = @homework.student_work_projects.where("user_id=? and student_work_id is not null",User.current.id).first.nil? ? -1 : @homework.student_work_projects.where("user_id=?",User.current.id).first.student_work_id
|
||||
@commit_student_ids = @homework.student_work_projects.where("student_work_id != #{student_work_id}").map{|student| student.user_id}
|
||||
@users = searchstudent_by_name all_students,name
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -1115,6 +1116,20 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def get_user_infor
|
||||
req = Hash.new(false)
|
||||
user = User.where("id = #{params[:user_id].to_i}").first
|
||||
if user
|
||||
req[:id] = user.id
|
||||
req[:name] = user.show_name
|
||||
req[:student_id] = user.user_extensions.student_id
|
||||
req[:valid] = true
|
||||
else
|
||||
req[:valid] = false
|
||||
end
|
||||
render :json => req
|
||||
end
|
||||
|
||||
private
|
||||
def searchstudent_by_name users, name
|
||||
mems = []
|
||||
|
@ -1194,13 +1209,18 @@ class StudentWorkController < ApplicationController
|
|||
sheet1 = book.create_worksheet :name => "homework"
|
||||
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
||||
sheet1.row(0).default_format = blue
|
||||
if @homework.homework_type == 1 #匿评作业
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)])
|
||||
if @homework.homework_type == 1 #普通作业
|
||||
if @homework.anonymous_comment ==0
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 1
|
||||
items.each do |homework|
|
||||
sheet1[count_row,0]=homework.user.id
|
||||
sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s
|
||||
sheet1[count_row,1] = homework.user.show_name
|
||||
sheet1[count_row,2] = homework.user.login
|
||||
sheet1[count_row,3] = homework.user.user_extensions.student_id
|
||||
sheet1[count_row,4] = homework.user.mail
|
||||
|
@ -1208,18 +1228,31 @@ class StudentWorkController < ApplicationController
|
|||
sheet1[count_row,6] = strip_html homework.description
|
||||
sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
|
||||
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
|
||||
sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
|
||||
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,11] = format_time(homework.created_at)
|
||||
if @homework.anonymous_comment ==0
|
||||
sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
|
||||
sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
|
||||
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
|
||||
sheet1[count_row,12] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,13] = format_time(homework.created_at)
|
||||
else
|
||||
sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
|
||||
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,11] = format_time(homework.created_at)
|
||||
end
|
||||
count_row += 1
|
||||
end
|
||||
elsif @homework.homework_type == 2 #编程作业
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)])
|
||||
if @homework.anonymous_comment ==0
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 1
|
||||
items.each do |homework|
|
||||
sheet1[count_row,0]=homework.user.id
|
||||
sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s
|
||||
sheet1[count_row,1] = homework.user.show_name
|
||||
sheet1[count_row,2] = homework.user.login
|
||||
sheet1[count_row,3] = homework.user.user_extensions.student_id
|
||||
sheet1[count_row,4] = homework.user.mail
|
||||
|
@ -1228,11 +1261,48 @@ class StudentWorkController < ApplicationController
|
|||
sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
|
||||
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
|
||||
sheet1[count_row,9] = homework.system_score.nil? ? l(:label_without_score) : homework.system_score.round(2)
|
||||
sheet1[count_row,10] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
|
||||
sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,12] = format_time(homework.created_at)
|
||||
if @homework.anonymous_comment ==0
|
||||
sheet1[count_row,10] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
|
||||
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
|
||||
sheet1[count_row,12] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
|
||||
sheet1[count_row,13] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,14] = format_time(homework.created_at)
|
||||
else
|
||||
sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
|
||||
sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,12] = format_time(homework.created_at)
|
||||
end
|
||||
count_row += 1
|
||||
end
|
||||
elsif @homework.homework_type == 3 #分组作业
|
||||
if @homework.anonymous_comment ==0
|
||||
sheet1.row(0).concat([l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet1.row(0).concat([l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 1
|
||||
items.each do |homework|
|
||||
sheet1[count_row,0] = get_group_member_names homework
|
||||
sheet1[count_row,1] = homework.name
|
||||
sheet1[count_row,2] = (homework.project_id == 0 || homework.project_id.nil?) ? l(:excel_no_project) : homework.project.name
|
||||
sheet1[count_row,3] = strip_html homework.description
|
||||
sheet1[count_row,4] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
|
||||
sheet1[count_row,5] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
|
||||
if @homework.anonymous_comment ==0
|
||||
sheet1[count_row,6] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
|
||||
sheet1[count_row,7] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
|
||||
sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
|
||||
sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,10] = format_time(homework.created_at)
|
||||
else
|
||||
sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
|
||||
sheet1[count_row,7] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
|
||||
sheet1[count_row,8] = format_time(homework.created_at)
|
||||
end
|
||||
count_row += 1
|
||||
end
|
||||
end
|
||||
book.write xls_report
|
||||
xls_report.string
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
class SyllabusesController < ApplicationController
|
||||
|
||||
before_filter :is_logged, :only => [:index, :show]
|
||||
before_filter :find_syllabus, :only => [:show]
|
||||
def index
|
||||
user = User.current
|
||||
@syllabuses = user.syllabuses
|
||||
end
|
||||
|
||||
def show
|
||||
@courses = @syllabus.courses
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def find_syllabus
|
||||
@syllabus = Syllabus.find params[:id]
|
||||
end
|
||||
|
||||
def is_logged
|
||||
redirect_to signin_path unless User.current.logged?
|
||||
end
|
||||
end
|
|
@ -87,7 +87,10 @@ class UsersController < ApplicationController
|
|||
|
||||
#展开所有回复
|
||||
def show_all_replies
|
||||
@comment = JournalsForMessage.find params[:comment].to_i
|
||||
case params[:type]
|
||||
when 'JournalsForMessage'
|
||||
@comment = JournalsForMessage.find params[:comment].to_i
|
||||
end
|
||||
end
|
||||
|
||||
#二级回复
|
||||
|
@ -95,6 +98,7 @@ class UsersController < ApplicationController
|
|||
case params[:type]
|
||||
when 'HomeworkCommon'
|
||||
@reply = JournalsForMessage.find params[:reply_id]
|
||||
@type = 'HomeworkCommon'
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
|
@ -102,6 +106,11 @@ class UsersController < ApplicationController
|
|||
end
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
when 'JournalsForMessage'
|
||||
@reply = JournalsForMessage.find params[:reply_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'JournalsForMessage'
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -130,9 +139,12 @@ class UsersController < ApplicationController
|
|||
onclick_time = User.current.onclick_time.onclick_time
|
||||
messages.each do |message_all|
|
||||
# 未读的消息存放在数组
|
||||
if (message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0) || (message_all.message_type == "SystemMessage"&& !message_all.message.nil? && message_all.message.created_at > onclick_time)
|
||||
@message_alls << message_all.message
|
||||
break if @message_alls.length == 5
|
||||
mess = message_all.message
|
||||
if (message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
break if @message_alls.length == 10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -154,33 +166,41 @@ class UsersController < ApplicationController
|
|||
update_message_viewed(@user)
|
||||
end
|
||||
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
||||
courses = @user.courses.where("is_delete = 1")
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||
case params[:type]
|
||||
when nil
|
||||
# 系统消息为管理员发送,我的消息中包含有系统消息
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
@message_alls << message_all.message
|
||||
mess = message_all.message
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
end
|
||||
when 'unviewed'
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("user_id =?", @user.id).includes(:message).order("created_at desc")
|
||||
messages = MessageAll.where("message_alls.user_id =?", @user.id).includes(:message).order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
# 在点击或者刷新消息列表后未读的消息存放在数组
|
||||
if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0
|
||||
@message_alls << message_all.message
|
||||
mess = message_all.message
|
||||
if message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
end
|
||||
end
|
||||
#课程相关消息
|
||||
when 'homework'
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =? and course_id NOT IN #{course_ids}", @user.id).order("created_at desc")
|
||||
when 'course_message'
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =? and course_id NOT IN #{course_ids}", "Message", @user.id).order("created_at desc")
|
||||
when 'course_news'
|
||||
# 课程通知包含发布的通知和回复的通知
|
||||
@message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =?", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =? and course_id NOT IN #{course_ids}", @user.id).order("created_at desc")
|
||||
when 'poll'
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =? and course_id NOT IN #{course_ids}", "Poll", @user.id).order("created_at desc")
|
||||
#项目相关消息
|
||||
when 'issue'
|
||||
@message_alls = ForgeMessage.where("forge_message_type in ('Issue', 'Journal') and user_id =?" , @user.id).order("created_at desc")
|
||||
|
@ -1478,8 +1498,8 @@ class UsersController < ApplicationController
|
|||
# 减少数据库交互
|
||||
watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(','))
|
||||
user_ids = "(" + @user.id.to_s + watched_user_ids + ")"
|
||||
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
|
||||
blog_ids = "(" + watched_user_blog_ids + ")"
|
||||
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}")
|
||||
blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")"
|
||||
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
|
@ -3250,7 +3270,11 @@ class UsersController < ApplicationController
|
|||
@journals = obj.comments.reorder("created_on desc")
|
||||
when 'JournalsForMessage'
|
||||
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.children.reorder("created_on desc")
|
||||
journals = []
|
||||
@journals = get_all_children(journals, obj)
|
||||
@type = 'JournalsForMessage'
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@allow_delete = params[:allow_delete]
|
||||
when 'Issue'
|
||||
obj = Issue.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.journals.reorder("created_on desc")
|
||||
|
|
|
@ -3,10 +3,12 @@ class WechatsController < ActionController::Base
|
|||
wechat_responder
|
||||
|
||||
include ApplicationHelper
|
||||
|
||||
ROOT_URL = ENV["wechat_url"] || "#{Setting.protocol}://#{Setting.host_name}"
|
||||
#ROOT_URL = "http://www.trustie.net"
|
||||
# default text responder when no other match
|
||||
on :text do |request, content|
|
||||
request.reply.text "您的意见已收到,感谢您的反馈!" # Just echo
|
||||
#邀请码
|
||||
sendBindClass(request, {invite_code: content})
|
||||
end
|
||||
|
||||
# When receive 'help', will trigger this responder
|
||||
|
@ -35,13 +37,13 @@ class WechatsController < ActionController::Base
|
|||
|
||||
# When subscribe user scan scene_id in public account
|
||||
on :scan, with: 'scene_id' do |request, ticket|
|
||||
request.reply.text "Subscribe user #{request[:FromUserName]} Ticket #{ticket}"
|
||||
sendBindClass(request, {ticket: ticket})
|
||||
end
|
||||
|
||||
# When no any on :scan responder can match subscribe user scaned scene_id
|
||||
on :event, with: 'scan' do |request|
|
||||
if request[:EventKey].present?
|
||||
request.reply.text "event scan got EventKey #{request[:EventKey]} Ticket #{request[:Ticket]}"
|
||||
sendBindClass(request, {ticket: request[:Ticket]})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -62,6 +64,9 @@ class WechatsController < ActionController::Base
|
|||
request.reply.text "User: #{request[:FromUserName]} click #{key}"
|
||||
end
|
||||
|
||||
on :click, with: 'DEV' do |request, key|
|
||||
request.reply.text "此功能正在开发中,很快就会上线,谢谢!"
|
||||
end
|
||||
# When user view URL in the menu button
|
||||
on :view, with: 'http://wechat.somewhere.com/view_url' do |request, view|
|
||||
request.reply.text "#{request[:FromUserName]} view #{view}"
|
||||
|
@ -128,12 +133,36 @@ class WechatsController < ActionController::Base
|
|||
default_msg(request)
|
||||
end
|
||||
|
||||
on :click, with: 'JOIN_CLASS' do |request, key|
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
unless uw
|
||||
sendBind(request)
|
||||
else
|
||||
request.reply.text "请直接回复5位班级邀请码\n(不区分大小写):"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def sendBindClass(request, params)
|
||||
begin
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
if !uw
|
||||
return sendBind(request)
|
||||
else
|
||||
return join_class(params, uw.user, request)
|
||||
end
|
||||
rescue => e
|
||||
logger.error e.inspect
|
||||
logger.error e.backtrace.join("\n")
|
||||
return request.reply.text e
|
||||
end
|
||||
end
|
||||
|
||||
def default_msg(request)
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
if uw && uw.user
|
||||
request.reply.text "欢迎回来, #{uw.user.show_name}"
|
||||
else
|
||||
request.reply.text "欢迎关注Trustie创新实践社区"
|
||||
sendBind(request)
|
||||
end
|
||||
end
|
||||
|
@ -145,8 +174,8 @@ class WechatsController < ActionController::Base
|
|||
|
||||
您还未绑定确实的用户,请先绑定,谢谢!" } }
|
||||
request.reply.news(news) do |article, n, index| # article is return object
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{login_wechat_url}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
|
||||
pic_url = "#{Setting.protocol}://#{Setting.host_name}/images/weixin_pic.jpg"
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login#wechat_redirect"
|
||||
pic_url = "#{ROOT_URL}/images/weixin_pic.jpg"
|
||||
article.item title: "#{n[:title]}",
|
||||
description: n[:content],
|
||||
pic_url: pic_url,
|
||||
|
@ -154,18 +183,52 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def join_class(params, user, request)
|
||||
course = nil
|
||||
course = Course.where(qrcode: params[:ticket]).first if params[:ticket]
|
||||
course = Course.where(invite_code: params[:invite_code]).first if params[:invite_code]
|
||||
raise "班级不存在,请确认您的邀请码是否输入正确,谢谢!" unless course
|
||||
|
||||
cs = CoursesService.new
|
||||
status = cs.join_course({invite_code: course.invite_code}, user)
|
||||
logger.info status
|
||||
if status[:state] != 0
|
||||
raise CoursesService::JoinCourseError.message(status[:state])
|
||||
end
|
||||
|
||||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
|
||||
content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
|
||||
return request.reply.news(news) do |article, n, index| # article is return object
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
|
||||
pic_url = "#{ROOT_URL}/images/wechat/class.jpg"
|
||||
article.item title: "#{n[:title]}",
|
||||
description: n[:content],
|
||||
pic_url: pic_url,
|
||||
url: url
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
### controller method
|
||||
module Controllers
|
||||
def get_open_id
|
||||
def get_bind
|
||||
begin
|
||||
|
||||
code = params[:code] || session[:wechat_code]
|
||||
openid = get_openid_from_code(code)
|
||||
|
||||
raise "无法获取到微信openid" unless openid
|
||||
render :json => {status:0, openid: openid}
|
||||
|
||||
uw = UserWechat.where(openid: openid).first
|
||||
raise "还未绑定trustie帐户" unless uw
|
||||
logger.debug "get_bind ============= #{uw}"
|
||||
|
||||
user = uw.user
|
||||
::ApiKey.delete_all(user_id: user.id)
|
||||
key = ::ApiKey.create!(user_id: user.id)
|
||||
|
||||
render :json =>{status: 0, token: key.access_token}
|
||||
rescue Exception=>e
|
||||
render :json => {status: -1, msg: e.message}
|
||||
render :json => {status: -1, message: e.message}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -175,14 +238,14 @@ class WechatsController < ActionController::Base
|
|||
code = params[:code] || session[:wechat_code]
|
||||
openid = get_openid_from_code(code)
|
||||
|
||||
raise "无法获取到openid" unless openid
|
||||
raise "此微信号已绑定用户, 不能重复绑定" if user_binded?(openid)
|
||||
raise "无法获取到openid,请在微信中打开本页面" unless openid
|
||||
raise "此微信号已绑定用户,不能重复绑定" if user_binded?(openid)
|
||||
|
||||
user, last_login_on = User.try_to_login(params[:username], params[:password])
|
||||
raise "用户名或密码错误,请重新输入" unless user
|
||||
raise "用户名或密码错误,请重新输入" unless user
|
||||
#补全用户信息
|
||||
|
||||
raise "此用户已经绑定过公众号, 请换一个帐户试试" if user.user_wechat
|
||||
raise "此用户已经绑定过公众号,请换一个帐户试试" if user.user_wechat
|
||||
|
||||
UserWechat.create!(
|
||||
openid: openid,
|
||||
|
@ -206,19 +269,26 @@ class WechatsController < ActionController::Base
|
|||
|
||||
def user_activities
|
||||
session[:wechat_code] = params[:code] if params[:code]
|
||||
code = params[:code] || session[:wechat_code]
|
||||
openid = get_openid_from_code(code)
|
||||
@wechat_user = user_binded?(openid)
|
||||
unless @wechat_user
|
||||
redirect_to login_wechat_path
|
||||
return
|
||||
@path = '/'+(params[:state] || '')
|
||||
open_id = get_openid_from_code(params[:code]) rescue
|
||||
unless open_id
|
||||
render 'wechats/open_wechat', layout: nil and return
|
||||
end
|
||||
if params[:state] == 'myclass'
|
||||
@course_id = params[:id];
|
||||
end
|
||||
|
||||
session[:wechat_openid] = open_id
|
||||
if params[:code]
|
||||
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
|
||||
end
|
||||
render 'wechats/user_activities', layout: nil
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def get_openid_from_code(code)
|
||||
return 'oCnvgvz8R7QheXE-R9Kkr39j8Ndg' if code =='only-for-test'
|
||||
openid = session[:wechat_openid]
|
||||
|
||||
unless openid
|
||||
|
|
|
@ -54,15 +54,16 @@ class WordsController < ApplicationController
|
|||
:reply_id => reply_user_id,
|
||||
:notes => content,
|
||||
:is_readed => false}
|
||||
@jfm = add_reply_adapter options
|
||||
@activity = params[:activity_id].nil? ? JournalsForMessage.find(parent_id) : JournalsForMessage.find(params[:activity_id].to_i)
|
||||
@jfm = add_reply_adapter(@activity, options)
|
||||
@save_succ = true if @jfm.errors.empty?
|
||||
if @save_succ
|
||||
update_course_activity('JournalsForMessage',parent_id)
|
||||
update_user_activity('JournalsForMessage',parent_id)
|
||||
update_forge_activity('JournalsForMessage',parent_id)
|
||||
update_org_activity('JournalsForMessage',parent_id)
|
||||
update_principal_activity('JournalsForMessage',parent_id)
|
||||
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
|
||||
update_course_activity('JournalsForMessage',@activity.id)
|
||||
update_user_activity('JournalsForMessage',@activity.id)
|
||||
update_forge_activity('JournalsForMessage',@activity.id)
|
||||
update_org_activity('JournalsForMessage',@activity.id)
|
||||
update_principal_activity('JournalsForMessage',@activity.id)
|
||||
@activity.update_attribute(:updated_on,Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
# format.html {
|
||||
|
@ -76,8 +77,6 @@ class WordsController < ApplicationController
|
|||
format.js {
|
||||
#@reply_type = params[:reply_type]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity = JournalsForMessage.find(parent_id)
|
||||
@is_activity = params[:is_activity] if params[:is_activity]
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -92,13 +91,14 @@ class WordsController < ApplicationController
|
|||
elsif @journal_destroyed.jour_type == "Course"
|
||||
@course = Course.find @journal_destroyed.jour_id
|
||||
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
|
||||
@activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id]
|
||||
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
|
||||
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
|
||||
@is_activity = params[:is_activity].to_i if params[:is_activity]
|
||||
@activity = @journal_destroyed.parent if @journal_destroyed.parent
|
||||
@activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id]
|
||||
unless @activity
|
||||
redirect_to feedback_path(@user)
|
||||
return
|
||||
|
@ -374,28 +374,44 @@ class WordsController < ApplicationController
|
|||
obj
|
||||
end
|
||||
|
||||
def add_reply_adapter options
|
||||
def add_reply_adapter obj, options
|
||||
#modify by nwb
|
||||
#添加对课程留言的支持
|
||||
#留言回复应该不关系其所属的Class,而关心的是其所属的父留言
|
||||
obj = obj_distinguish_url_origin || User.find_by_id(2)
|
||||
if obj.kind_of? User
|
||||
obj.add_jour(nil, nil, nil, options)
|
||||
elsif obj.kind_of? Project
|
||||
Project.add_new_jour(nil, nil, obj.id, options)
|
||||
elsif obj.kind_of? Course
|
||||
Course.add_new_jour(nil, nil, obj.id, options)
|
||||
elsif obj.kind_of? Bid
|
||||
obj.add_jour(nil, nil, nil, options)
|
||||
elsif obj.kind_of? Contest
|
||||
obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
elsif obj.kind_of? Softapplication
|
||||
obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
elsif obj.kind_of? HomeworkAttach
|
||||
obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
else
|
||||
raise "create reply obj unknow type.#{obj.class}"
|
||||
case obj.jour_type
|
||||
when 'Principal'
|
||||
obj.jour.add_jour(nil, nil, nil, options)
|
||||
when 'Project'
|
||||
Project.add_new_jour(nil, nil, obj.jour_id, options)
|
||||
when 'Course'
|
||||
Course.add_new_jour(nil, nil, obj.jour_id, options)
|
||||
when 'Bid'
|
||||
obj.jour.add_jour(nil, nil, nil, options)
|
||||
when 'Contest'
|
||||
obj.jour.add_jour(nil, nil, obj.jour_id, options)
|
||||
when 'Softapplication'
|
||||
obj.jour.add_jour(nil, nil, obj.jour_id, options)
|
||||
when 'HomeworkAttach'
|
||||
obj.jour.add_jour(nil, nil, obj.jour_id, options)
|
||||
end
|
||||
# obj = obj_distinguish_url_origin || User.find_by_id(2)
|
||||
# if obj.kind_of? User
|
||||
# obj.add_jour(nil, nil, nil, options)
|
||||
# elsif obj.kind_of? Project
|
||||
# Project.add_new_jour(nil, nil, obj.id, options)
|
||||
# elsif obj.kind_of? Course
|
||||
# Course.add_new_jour(nil, nil, obj.id, options)
|
||||
# elsif obj.kind_of? Bid
|
||||
# obj.add_jour(nil, nil, nil, options)
|
||||
# elsif obj.kind_of? Contest
|
||||
# obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
# elsif obj.kind_of? Softapplication
|
||||
# obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
# elsif obj.kind_of? HomeworkAttach
|
||||
# obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
# else
|
||||
# raise "create reply obj unknow type.#{obj.class}"
|
||||
# end
|
||||
end
|
||||
#######end of message
|
||||
end
|
||||
|
|
|
@ -489,4 +489,26 @@ module ApiHelper
|
|||
self.update_attribute(:praise_num, self.praise_num.to_i - num)
|
||||
end
|
||||
|
||||
|
||||
class Errors
|
||||
def self.define_error(arr)
|
||||
@errors = {}
|
||||
arr.each_with_index { |item, index|
|
||||
if index %2 == 1
|
||||
@errors[arr[index-1]] = item
|
||||
end
|
||||
}
|
||||
if arr.count % 2== 1
|
||||
@default_error = arr.last
|
||||
else
|
||||
@default_error = "未知错误"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.message(msg_id)
|
||||
@errors[msg_id] || @default_error
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -3127,6 +3127,26 @@ def get_reply_parents parents_rely, comment
|
|||
parents_rely
|
||||
end
|
||||
|
||||
#获取回复的所有父节点(不包括根节点)
|
||||
def get_reply_parents_no_root parents_rely, comment
|
||||
if !comment.parent.nil? && !comment.parent.parent.nil?
|
||||
parents_rely << comment.parent
|
||||
get_reply_parents_no_root parents_rely, comment.parent
|
||||
end
|
||||
parents_rely
|
||||
end
|
||||
|
||||
#获取留言的所有子节点
|
||||
def get_all_children result, jour
|
||||
if jour.kind_of? JournalsForMessage
|
||||
jour.children.each do |jour_child|
|
||||
result << jour_child
|
||||
get_all_children result, jour_child
|
||||
end
|
||||
end
|
||||
result.sort! { |a,b| b.created_on <=> a.created_on }
|
||||
end
|
||||
|
||||
#将有置顶属性的提到数组前面
|
||||
def sort_by_sticky topics
|
||||
tmpTopics = []
|
||||
|
@ -3283,3 +3303,20 @@ def get_hw_index(hw,is_teacher)
|
|||
index = hw_ids.index(hw.id)
|
||||
return index
|
||||
end
|
||||
|
||||
def get_group_member_names work
|
||||
result = ""
|
||||
unless work.nil?
|
||||
work.student_work_projects.each do |member|
|
||||
user = User.where(:id => member.user_id).first
|
||||
unless user.nil?
|
||||
if result != ""
|
||||
result += "、#{user.show_name}"
|
||||
else
|
||||
result += user.show_name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
|
|
|
@ -44,9 +44,9 @@ module CoursesHelper
|
|||
def visible_excellent_course obj
|
||||
# if course.is_pu
|
||||
end
|
||||
|
||||
|
||||
# 返回x项目成员数量,即roles表中定义的所有成员
|
||||
def projectCount project
|
||||
def projectCount project
|
||||
#searchCountByRoles project, AllPeople
|
||||
project.members.count
|
||||
end
|
||||
|
@ -147,10 +147,10 @@ module CoursesHelper
|
|||
|
||||
# 返回学生数量,即roles表中定义的Reporter
|
||||
#def studentCount project
|
||||
# searchStudent(project).count
|
||||
# or
|
||||
# searchStudent(project).count
|
||||
# end
|
||||
# searchStudent(project).count
|
||||
# or
|
||||
# searchStudent(project).count
|
||||
# end
|
||||
|
||||
# 判断用户是否是课程的管理员
|
||||
# add by nwb
|
||||
|
@ -225,11 +225,11 @@ module CoursesHelper
|
|||
#end
|
||||
|
||||
# 注意:此方法有问题,速度慢且结果不准
|
||||
# alias studentCountOrigin studentCount
|
||||
# alias studentCountOrigin studentCount
|
||||
#def studentCount course
|
||||
# count = studentCountOrigin course
|
||||
#garble count
|
||||
# end
|
||||
# count = studentCountOrigin course
|
||||
#garble count
|
||||
# end
|
||||
|
||||
#获取课程所有成员
|
||||
def course_all_member course
|
||||
|
@ -265,7 +265,7 @@ module CoursesHelper
|
|||
def garble count
|
||||
count = count.round( 1-count.to_s.size ).to_i
|
||||
return count.to_s if count.to_s.size.eql?(1)
|
||||
count.to_s << '+'
|
||||
count.to_s << '+'
|
||||
end
|
||||
|
||||
# =====================================================================================
|
||||
|
@ -274,7 +274,7 @@ module CoursesHelper
|
|||
#searchPeopleByRoles(project, TeacherRoles)
|
||||
members = []
|
||||
project.members.includes(:user).each do |m|
|
||||
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
|
||||
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
|
||||
end
|
||||
members
|
||||
end
|
||||
|
@ -304,8 +304,8 @@ module CoursesHelper
|
|||
members
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def searchStudent_by_name project, name
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
members = []
|
||||
|
@ -324,29 +324,29 @@ module CoursesHelper
|
|||
mems = []
|
||||
if name != ""
|
||||
name = name.to_s.downcase
|
||||
members.each do |m|
|
||||
members.each do |m|
|
||||
username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase
|
||||
if(m.user[:login].to_s.downcase.include?(name) || m.user.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name))
|
||||
mems << m
|
||||
end
|
||||
end
|
||||
else
|
||||
mems = members
|
||||
end
|
||||
mems = members
|
||||
end
|
||||
mems
|
||||
end
|
||||
def searchgroupmember_by_name members, name, group
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
mems = []
|
||||
if name != ""
|
||||
members.each do |m|
|
||||
if m.course_group_id == group.id
|
||||
username = m.user[:lastname].to_s + m.user[:firstname].to_s
|
||||
if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name))
|
||||
mems << m
|
||||
members.each do |m|
|
||||
if m.course_group_id == group.id
|
||||
username = m.user[:lastname].to_s + m.user[:firstname].to_s
|
||||
if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name))
|
||||
mems << m
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
mems = members
|
||||
end
|
||||
|
@ -458,7 +458,7 @@ module CoursesHelper
|
|||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs")
|
||||
end
|
||||
|
||||
|
||||
def findCourseTime project
|
||||
str = ""
|
||||
begin
|
||||
|
@ -683,9 +683,9 @@ module CoursesHelper
|
|||
#file_count
|
||||
Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment|
|
||||
if attachment.is_public? || User.current.member_of_course?(@course) || User.current.admin?
|
||||
activities[attachment.container_id]+=1
|
||||
activities[attachment.container_id]+=1
|
||||
else
|
||||
activities[attachment.container_id]
|
||||
activities[attachment.container_id]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -704,8 +704,8 @@ module CoursesHelper
|
|||
#news
|
||||
News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news|
|
||||
if news.author.member_of_course?(@course)
|
||||
activities[news.course_id]+=1
|
||||
end
|
||||
activities[news.course_id]+=1
|
||||
end
|
||||
end
|
||||
|
||||
#homework_count
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
# encoding: utf-8
|
||||
module QualityAnalysisHelper
|
||||
|
||||
def sqale_rating_status val
|
||||
arr = []
|
||||
if val.to_i > 0 && val.to_i < 5
|
||||
arr << "很好"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 5 && val.to_i < 10
|
||||
arr << "较好"
|
||||
arr << "b_slow_yellow"
|
||||
elsif val.to_i > 10 && val.to_i < 20
|
||||
arr << "中等"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
arr << "较差"
|
||||
arr << "b_slow_red"
|
||||
elsif val.to_i > 20
|
||||
arr << "很差"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def complexity_status val
|
||||
arr = []
|
||||
if val.to_i < 10
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 10 && val.to_i < 15
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 15
|
||||
arr << "很高"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def duplicated_lines_density_status val
|
||||
arr = []
|
||||
if val.to_i < 30
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 30 && val.to_i < 50
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 50
|
||||
arr << "很高"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def comment_lines_density_status val
|
||||
arr = []
|
||||
if val.to_i < 20
|
||||
arr << "较低"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
arr << "正常"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 50
|
||||
arr << "较高"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def score_sqale_rating val
|
||||
if val.to_i > 0 && val.to_i < 5
|
||||
"5"
|
||||
elsif val.to_i > 5 && val.to_i < 10
|
||||
"4"
|
||||
elsif val.to_i > 10 && val.to_i < 20
|
||||
"3"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
"2"
|
||||
elsif val.to_i > 20
|
||||
"1"
|
||||
end
|
||||
end
|
||||
|
||||
def lines_scale val
|
||||
if val.to_i < 5000
|
||||
"小型"
|
||||
elsif val.to_i >5000 && val.to_i < 50000
|
||||
"中型"
|
||||
else
|
||||
"大型"
|
||||
end
|
||||
end
|
||||
|
||||
#统计答题百分比,统计结果保留两位小数
|
||||
def statistics_result_percentage(e, t)
|
||||
e = e.to_f
|
||||
t = t.to_f
|
||||
t == 0 ? 0 : format("%.2f", e*100/t)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module SyllabusesHelper
|
||||
end
|
|
@ -147,7 +147,9 @@ module UsersHelper
|
|||
|
||||
# 统计未读消息数
|
||||
def unviewed_message(user)
|
||||
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
courses = user.courses.where("is_delete = 1")
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||
course_count = CourseMessage.where("user_id =? and viewed =? and course_id not in #{course_ids}", user, 0).count
|
||||
forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#coding=utf-8
|
||||
|
||||
require 'elasticsearch/model'
|
||||
class Course < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
@ -24,6 +26,7 @@ class Course < ActiveRecord::Base
|
|||
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
||||
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
||||
belongs_to :syllabus
|
||||
# has_many :bid
|
||||
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||
has_many :memberships, :class_name => 'Member'
|
||||
|
@ -64,7 +67,7 @@ class Course < ActiveRecord::Base
|
|||
acts_as_attachable :view_permission => :view_course_files,
|
||||
:delete_permission => :manage_files
|
||||
|
||||
validates_presence_of :password, :term,:name
|
||||
validates_presence_of :term,:name
|
||||
validates_format_of :class_period, :with =>/^[1-9]\d*$/
|
||||
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
|
||||
validates_length_of :description, :maximum => 10000
|
||||
|
@ -91,6 +94,7 @@ class Course < ActiveRecord::Base
|
|||
|
||||
acts_as_customizable
|
||||
|
||||
scope :not_deleted, lambda{where(is_delete: 0)}
|
||||
scope :all_course
|
||||
scope :active, lambda { where(:status => STATUS_ACTIVE) }
|
||||
scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
|
||||
|
@ -404,6 +408,7 @@ class Course < ActiveRecord::Base
|
|||
self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false)
|
||||
end
|
||||
|
||||
|
||||
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
|
||||
#def name
|
||||
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
|
||||
|
@ -421,12 +426,14 @@ class Course < ActiveRecord::Base
|
|||
# __elasticsearch__.delete_document
|
||||
# end
|
||||
def create_course_ealasticsearch_index
|
||||
return if Rails.env.development?
|
||||
if self.is_public == 1 and self.is_delete == 0 #公开 和 没有被删除的课程才被索引
|
||||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
|
||||
def update_course_ealasticsearch_index
|
||||
return if Rails.env.development?
|
||||
if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
|
||||
begin
|
||||
self.__elasticsearch__.update_document
|
||||
|
@ -443,6 +450,7 @@ class Course < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def delete_course_ealasticsearch_index
|
||||
return if Rails.env.development?
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
|
@ -450,6 +458,36 @@ class Course < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 延迟生成邀请码
|
||||
def invite_code
|
||||
return generate_invite_code
|
||||
end
|
||||
|
||||
# 生成邀请码
|
||||
CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
|
||||
def generate_invite_code
|
||||
code = read_attribute(:invite_code)
|
||||
if !code || code.size <5
|
||||
code = CODES.sample(5).join
|
||||
return generate_invite_code if Course.where(invite_code: code).present?
|
||||
self[:invite_code] = code
|
||||
save! && reload
|
||||
end
|
||||
code
|
||||
end
|
||||
|
||||
|
||||
def generate_qrcode
|
||||
ticket = self.qrcode
|
||||
if !ticket || ticket.size < 10
|
||||
response = Wechat.api.qrcode_create_scene(invite_code)
|
||||
logger.debug "response = #{response}"
|
||||
self.qrcode = response['ticket']
|
||||
save! && reload
|
||||
ticket = qrcode
|
||||
end
|
||||
ticket
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ class Project < ActiveRecord::Base
|
|||
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
|
||||
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
|
||||
# 创建project之后默认创建一个board,之后的board去掉了board的概念
|
||||
after_create :create_board_sync,:acts_as_forge_activities,:create_project_ealasticsearch_index
|
||||
after_create :create_board_sync,:acts_as_forge_activities, :create_project_ealasticsearch_index
|
||||
before_destroy :delete_all_members,:delete_project_ealasticsearch_index
|
||||
after_update :update_project_ealasticsearch_index
|
||||
def remove_references_before_destroy
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class QualityAnalysis < ActiveRecord::Base
|
||||
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language
|
||||
|
||||
def user_rep_name
|
||||
self.author_login+":"+self.rep_identifier
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class SonarAnalysis < ActiveRecord::Base
|
||||
attr_accessible :author_login, :project_id, :rep_identifier
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class Syllabus < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
has_many :courses
|
||||
attr_accessible :description, :title
|
||||
end
|
|
@ -90,6 +90,7 @@ class User < Principal
|
|||
has_many :homework_users
|
||||
has_many :homework_attaches, :through => :homework_users
|
||||
has_many :homework_evaluations
|
||||
has_many :syllabuses, :dependent => :destroy
|
||||
#问卷相关关关系
|
||||
has_many :poll_users, :dependent => :destroy
|
||||
has_many :poll_votes, :dependent => :destroy
|
||||
|
@ -144,6 +145,7 @@ class User < Principal
|
|||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
has_many :principal_acts, :class_name => 'PrincipalActivity',:as =>:principal_act ,:dependent => :destroy
|
||||
has_many :file_commit, :class_name => 'Attachment', :foreign_key => 'author_id', :conditions => "container_type = 'Project' or container_type = 'Version'"
|
||||
has_many :course_attachments , :class_name => 'Attachment', :foreign_key => 'author_id', :conditions => "container_type = 'Course'"
|
||||
####
|
||||
# added by bai
|
||||
has_many :join_in_contests, :dependent => :destroy
|
||||
|
@ -247,7 +249,7 @@ class User < Principal
|
|||
before_save :update_hashed_password
|
||||
before_destroy :remove_references_before_destroy,:delete_user_ealasticsearch_index
|
||||
# added by fq
|
||||
after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index
|
||||
after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index,:add_new_jour
|
||||
# end
|
||||
# 更新邮箱用户或用户名的同事,同步更新邀请信息
|
||||
after_update :update_invite_list,:update_user_ealasticsearch_index
|
||||
|
@ -1144,6 +1146,22 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
|
||||
#为新注册用户发送留言
|
||||
def add_new_jour
|
||||
if Message.where("id=19278").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
lead_message1 = Message.find(19278)
|
||||
notes1 = lead_message1.content
|
||||
# lead_message2 = Message.find(19292)
|
||||
# notes2 = lead_message2.content
|
||||
# lead_message3 = Message.find(19291)
|
||||
# notes3 = lead_message3.content
|
||||
# # user_id 默认为课程使者创建
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
end
|
||||
end
|
||||
|
||||
# 更新邮箱的同事,更新invite_lists表中的邮箱信息
|
||||
def update_invite_list
|
||||
invite_lists = InviteList.where("user_id =?",self.id).all
|
||||
|
|
|
@ -32,6 +32,18 @@ class CoursesService
|
|||
course_list
|
||||
end
|
||||
|
||||
|
||||
def user_courses_list(current_user)
|
||||
courses = current_user.courses.not_deleted
|
||||
courses.inject([]) {|course_list, course|
|
||||
course_list << {:course => course,:img_url => url_to_avatar(course),
|
||||
:current_user_is_member => current_user.member_of_course?(course),
|
||||
:current_user_is_teacher => is_course_teacher(current_user,course),
|
||||
course_student_num: searchStudent(course).count
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
#搜索课程
|
||||
def search_course params,current_user
|
||||
courses_all = Course.all_course
|
||||
|
@ -68,7 +80,6 @@ class CoursesService
|
|||
if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
|
||||
raise '403'
|
||||
end
|
||||
@teachers= searchTeacherAndAssistant(c)
|
||||
#@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1'
|
||||
case params[:role]
|
||||
when '1'
|
||||
|
@ -87,7 +98,11 @@ class CoursesService
|
|||
gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender
|
||||
work_unit = get_user_work_unit m.user
|
||||
location = get_user_location m.user
|
||||
users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, :brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname}
|
||||
users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender,
|
||||
:work_unit => work_unit, :mail => m.user.mail, :location => location,
|
||||
role_name: m.roles.first.name,
|
||||
name: m.user.show_name,
|
||||
:brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname}
|
||||
end
|
||||
users
|
||||
end
|
||||
|
@ -162,6 +177,9 @@ class CoursesService
|
|||
#显示课程
|
||||
def show_course(params,current_user)
|
||||
course = Course.find(params[:id])
|
||||
course.generate_invite_code
|
||||
course.generate_qrcode
|
||||
|
||||
if course.school
|
||||
work_unit = course.school.name
|
||||
else
|
||||
|
@ -193,7 +211,7 @@ class CoursesService
|
|||
@course.extra = 'course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
|
||||
@course.send(:safe_attributes=, params[:course], current_user)
|
||||
#@course.safe_attributes(current_user,params[:course])
|
||||
@course.password = params[:course][:password]
|
||||
#@course.password = params[:course][:password]
|
||||
@course.tea_id = current_user.id
|
||||
@course.term = params[:term]
|
||||
@course.time = params[:time]
|
||||
|
@ -252,7 +270,7 @@ class CoursesService
|
|||
def edit_course(params,course,current_user)
|
||||
course.send(:safe_attributes=, params[:course], current_user)
|
||||
#course.safe_attributes = params[:course]
|
||||
course.password = params[:course][:password]
|
||||
#course.password = params[:course][:password]
|
||||
course.time = params[:time]
|
||||
course.term = params[:term]
|
||||
course.end_time = params[:end_time]
|
||||
|
@ -300,23 +318,27 @@ class CoursesService
|
|||
@state
|
||||
end
|
||||
|
||||
class JoinCourseError < Errors
|
||||
define_error [
|
||||
0, '加入成功',
|
||||
1, '密码错误',
|
||||
2, '课程已过期 请联系课程管理员重启课程。',
|
||||
3, '您已经加入了课程',
|
||||
4, '您加入的课程不存在',
|
||||
5, '您还未登录',
|
||||
6, '申请成功,请等待审核完毕',
|
||||
7, '您已经发送过申请了,请耐心等待',
|
||||
8, '您已经是该课程的教师了',
|
||||
9, '您已经是该课程的教辅了',
|
||||
10, '您已经是该课程的管理员了',
|
||||
'未知错误,请稍后再试'
|
||||
]
|
||||
end
|
||||
#加入课程
|
||||
#object_id:课程id
|
||||
#course_password :加入课程的密码
|
||||
#@state == 0 加入成功
|
||||
#@state == 1 密码错误
|
||||
#@state == 2 课程已过期 请联系课程管理员重启课程。(在配置课程处)
|
||||
#@state == 3 您已经加入了课程
|
||||
#@state == 4 您加入的课程不存在
|
||||
#@state == 5 您还未登录
|
||||
#@state == 6 申请成功,请等待审核完毕
|
||||
#@state == 7 您已经发送过申请了,请耐心等待
|
||||
#@state == 8 您已经是该课程的教师了
|
||||
#@state == 9 您已经是该课程的教辅了
|
||||
#@state == 10 您已经是该课程的管理员了
|
||||
#@state 其他 未知错误,请稍后再试
|
||||
def join_course params,current_user
|
||||
course = Course.find_by_id params[:object_id]
|
||||
course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
|
||||
|
||||
@state = 10
|
||||
if course
|
||||
|
@ -326,7 +348,7 @@ class CoursesService
|
|||
if current_user.member_of_course?(course) #如果已经是成员
|
||||
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
||||
roleName = member.roles[0].name if member
|
||||
if params[:course_password] == course.password
|
||||
if params[:invite_code].present?
|
||||
#如果加入角色为学生 并且当前是学生
|
||||
if params[:role] == "10" && roleName == "Student"
|
||||
@state = 3
|
||||
|
@ -341,7 +363,7 @@ class CoursesService
|
|||
#如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
|
||||
elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
|
||||
@state = 7
|
||||
else
|
||||
Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
|
@ -352,19 +374,19 @@ class CoursesService
|
|||
elsif params[:role] == "10" && roleName != "Student"
|
||||
member.role_ids = [params[:role]]
|
||||
member.save
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id])
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
end
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
else
|
||||
if params[:course_password] == course.password
|
||||
if params[:invite_code].present?
|
||||
if params[:role] == "10" || params[:role] == nil
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id])
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
else
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
|
|
|
@ -2,32 +2,6 @@
|
|||
<%= stylesheet_link_tag 'leftside'%>
|
||||
|
||||
<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();
|
||||
|
@ -38,10 +12,6 @@
|
|||
$("#navSearchAlert").css({display:"none"});
|
||||
}
|
||||
});
|
||||
// $("#loginInButton").click(function(){
|
||||
// $("#signUpBox").css({display:"none"});
|
||||
// $("#loginInBox").css({display:"block"});
|
||||
// });
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
|
@ -62,42 +32,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
// $('#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);
|
||||
if (text.val() == '') {
|
||||
$('#' + id).val(content);
|
||||
}
|
||||
}
|
||||
|
||||
function login(){
|
||||
$('#main_login_form').submit(); //表单提交没有任何反应的原因:js冲突
|
||||
}
|
||||
|
||||
function register(){
|
||||
if($("#loginUpButton").hasClass('loginUpDisableButton')){
|
||||
return;
|
||||
}
|
||||
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;
|
||||
|
@ -118,7 +52,7 @@
|
|||
$('#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_req').html( '<span style="color: #c00202">'+data.message+'</span>');
|
||||
$login_correct = false;
|
||||
}
|
||||
$('#login_req').css('display','block');
|
||||
|
@ -129,7 +63,7 @@
|
|||
|
||||
$mail.blur(function (event) {
|
||||
if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
|
||||
$('#mail_req').html( '<span style="color: red">邮件格式不对</span>').show();
|
||||
$('#mail_req').html( '<span style="color: #c00202">邮件格式不对</span>').show();
|
||||
$mail_correct = false;
|
||||
return ;
|
||||
}
|
||||
|
@ -142,7 +76,7 @@
|
|||
$('#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_req').html( '<span style="color: #c00202">'+data.message+'</span>' );
|
||||
$mail_correct = false;
|
||||
}
|
||||
$('#mail_req').css('display','block');
|
||||
|
@ -158,7 +92,7 @@
|
|||
$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_req').html( '<span style="color: #c00202">'+'<%= l(:setting_password_min_length_limit, :count => Setting.password_min_length.to_i) %>'+'</span>');
|
||||
$passwd_correct = false;
|
||||
}
|
||||
$('#passwd_req').css('display','block');
|
||||
|
@ -174,7 +108,7 @@
|
|||
$passwd_comfirm_correct = true;
|
||||
}
|
||||
else {
|
||||
$('#confirm_req').html('<span style="color: red">'+'<%= l(:setting_password_error) %>'+'</span>');
|
||||
$('#confirm_req').html('<span style="color: #c00202">'+'<%= l(:setting_password_error) %>'+'</span>');
|
||||
$passwd_comfirm_correct = false;
|
||||
|
||||
}
|
||||
|
@ -184,121 +118,90 @@
|
|||
|
||||
});
|
||||
});
|
||||
|
||||
function user_name_keypress(e){
|
||||
if (e.keyCode == '13') {
|
||||
$('#main_login_form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
function changeRegisterBtn(checkbox){
|
||||
if(checkbox.checked == true){
|
||||
$("#loginUpButton").removeClass('loginUpDisableButton');
|
||||
$("#loginUpButton").addClass('loginUpButton');
|
||||
}else{
|
||||
$("#loginUpButton").removeClass('loginUpButton')
|
||||
$("#loginUpButton").addClass('loginUpDisableButton');
|
||||
}
|
||||
}
|
||||
</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创新实践社区!在这里,您的创新意识和创新潜力将得到充分发挥!目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。<br/><br/> Trustie社区的理想是:让创新过程变的更美好!</div>
|
||||
|
||||
<div class="new_login" id = "loginInBox">
|
||||
<div class="new_login_con">
|
||||
<div class="new_login_txt fl">
|
||||
<h3> 欢迎加入Trustie创新实践社区</h3>
|
||||
<p>在这里,您的创新意识和创新潜力将得到充分发挥!目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。</p>
|
||||
</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">
|
||||
<div class="new_login_box fr mr45 mt100">
|
||||
<h2 class="new_login_h2">登录
|
||||
<a href="<%= register_url_without_domain %>" class="fr mt5">立即注册</a><div class="cl"></div>
|
||||
</h2>
|
||||
<div class="new_login_form">
|
||||
<%= form_tag(signin_path,:id=>'main_login_form',:method=>'post') do %>
|
||||
<%= back_url_hidden_field_tag %>
|
||||
<ul>
|
||||
<li class="new_loggin_users">
|
||||
<%= text_field_tag 'username', params[:username], :tabindex => '1', :class=>'new_loggin_input',:placeholder=>'请输入邮箱地址或登录名', :onkeypress => "user_name_keypress(event);"%>
|
||||
</li>
|
||||
<li class="new_login_lock">
|
||||
<%= password_field_tag 'password', nil, :tabindex => '2', :class => 'new_loggin_input' , :placeholder => '请输入登录密码', :onkeypress => "user_name_keypress(event);"%>
|
||||
<p class="new_login_error"><%= flash.empty? || flash[:error].nil? ? "" : flash[:error].html_safe %></p>
|
||||
</li>
|
||||
|
||||
<%= 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>
|
||||
<li>
|
||||
<% if Setting.autologin? %>
|
||||
<label><%= check_box_tag 'autologin', 1, true, :tabindex => 4, :class => "new_login_check" %><%= l(:label_stay_logged_in) %></label>
|
||||
<% end %>
|
||||
<a href="<%= lost_password_path %>" class="fr">
|
||||
<% if Setting.lost_password? %>忘记密码<% end %>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li><button type="submit" class="new_login_submit"><a href="javascript:void(0);" id="login_btn" onclick="$('#main_login_form').submit();" style="text-decoration: none;">登录</a></button></li>
|
||||
</ul>
|
||||
<% 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" onchange="changeRegisterBtn(this);"/>
|
||||
</div>
|
||||
我已阅读并接受<a href="<%= agreement_path %>" class="newsBlue"><u>Trustie服务协议</u></a>条款</div>
|
||||
<div class="loginUpDisableButton" id="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>
|
||||
<%# 注册 %>
|
||||
<div class="new_register" id = "signUpBox">
|
||||
<div class="new_register_con">
|
||||
<div class="new_login_txt fl new_register_left">
|
||||
<h3> 欢迎加入Trustie创新实践社区</h3>
|
||||
<p>在这里,您的创新意识和创新潜力将得到充分发挥!目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。</p>
|
||||
</div>
|
||||
<div class="new_login_box fr mr45 mt50">
|
||||
<h2 class="new_login_h2">注册<a href="<%= signin_url_without_domain %>" class="fr mt5">已有账号 请登录</a><div class="cl"></div></h2>
|
||||
<div class="new_login_form">
|
||||
<%= form_for :user, :url => register_path,:method=>'post', :html => {:id=>'main_reg_form'} do |f| %>
|
||||
<%= error_messages_for 'user' %>
|
||||
<ul>
|
||||
<li class="new_register_li">
|
||||
<%= f.text_field :mail, :size => 25, :class => 'new_register_input' , :placeholder => "请输入邮箱地址"%>
|
||||
<p class="new_login_error" id="mail_req" style="display: none" >请输入正确的邮箱</p>
|
||||
</li>
|
||||
<li class="new_register_li">
|
||||
<%= f.password_field :password, :size => 25, :placeholder => "请输入密码", :class => 'new_register_input' %>
|
||||
<p class="new_login_error" id="passwd_req" style="display: none">请输入6-16位密码,区分大小写,不能使用空格!</p>
|
||||
</li>
|
||||
<li class="new_register_li">
|
||||
<%= f.password_field :password_confirmation, :size => 25, :placeholder => "请再次输入密码", :class=> 'new_register_input' %>
|
||||
<p class="new_login_error" id="confirm_req" style="display: none">两次密码不一致!</p>
|
||||
</li>
|
||||
<li class="new_register_li">
|
||||
<%= f.text_field :login, :size => 25, :placeholder => "请输入用户登录名", :class => 'new_register_input'%>
|
||||
<p class="new_login_error" id="login_req" style="display: none">用户登录名为2-18个中英文,数字或下划线</p>
|
||||
</li>
|
||||
<li>
|
||||
<label><input type="checkbox" checked id="read_and_confirm" onchange="changeRegisterBtn(this);" class=" new_login_check">我已阅读并接受<a href="<%= agreement_path %>" >Trustie服务协议条款</a></label>
|
||||
</li>
|
||||
<li>
|
||||
<div class="new_login_submit" id="loginUpButton">
|
||||
<a href="javascript:void(0);" id="regist_btn" onclick="register();" class ="db" style="text-decoration: none;">注册</a>
|
||||
</div>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<td class="center">
|
||||
<%= course.course_activities.count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.time %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= link_to( course.is_excellent == 1 || course.excellent_option == 1 ? "取消精品" : "设为精品", { :controller => 'admin', :action => 'set_excellent_course', :id => course.id },:remote=>true, :class => 'icon-del') %>
|
||||
</td>
|
||||
|
|
|
@ -48,11 +48,14 @@
|
|||
<th style="width: 30px;">
|
||||
资源数
|
||||
</th>
|
||||
<th style="width: 40px;">
|
||||
<th style="width: 30px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 40px;" class = "<%= @order == 'desc' ? 'st_up' : (@order == 'asc' ? 'st_down' : '') %>">
|
||||
<%=link_to '动态数', excellent_all_courses_path(:order=> @order == "desc" ? 'asc' : 'desc') %>
|
||||
<th style="width: 40px;" class = "<%= @order == 'act' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
|
||||
<%=link_to '动态数', excellent_all_courses_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'act') %>
|
||||
</th>
|
||||
<th style="width: 40px;" class = "<%= @order == 'time' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
|
||||
<%=link_to '开课学期', excellent_all_courses_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'time') %>
|
||||
</th>
|
||||
<th style="width: 40px;">
|
||||
</tr>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
</h3>
|
||||
<%= render 'tab_excellent_courses' %>
|
||||
<%= render 'admin/tab_excellent_courses' %>
|
||||
|
||||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
|
@ -33,12 +33,14 @@
|
|||
<th style="width: 25px;">
|
||||
资源数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
<th style="width: 50px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
<th style="width: 50px;">
|
||||
动态数
|
||||
</th>
|
||||
<th style="width: 40px;">
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -74,6 +76,9 @@
|
|||
<td class="center">
|
||||
<%= course.course_activities.count%>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= link_to( course.is_excellent == 1 || course.excellent_option == 1 ? "取消精品" : "设为精品", { :controller => 'admin', :action => 'cancel_excellent_course', :id => course.id }, :class => 'icon-del') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
@ -59,12 +59,12 @@
|
|||
<td class="center">
|
||||
<%= format_date(journal.created_on) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=journal.notes %>'>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=strip_html(journal.notes) %>'>
|
||||
<%case journal.jour_type %>
|
||||
<% when 'Principal' %>
|
||||
<%= link_to(journal.notes.html_safe, feedback_path(journal.jour_id)) %>
|
||||
<%= link_to(strip_html(journal.notes), feedback_path(journal.jour_id)) %>
|
||||
<% when 'Course' %>
|
||||
<%= link_to(journal.notes.html_safe, course_feedback_path(journal.jour_id)) %>
|
||||
<%= link_to(strip_html(journal.notes), course_feedback_path(journal.jour_id)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!--<div class="resourceUploadPopup">-->
|
||||
<span class="uploadDialogText">更新资源版本</span>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div class="uploadBoxContainer mt0">
|
||||
<div>
|
||||
<div>
|
||||
<div>当前版本
|
||||
<span class="attachment" >
|
||||
|
@ -39,10 +39,19 @@
|
|||
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
</div>
|
||||
<div class="uploadResourceIntr">
|
||||
<div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
|
||||
<div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>
|
||||
<div class="W300 uploadResourceIntr fontGrey2">
|
||||
<span id="upload_file_count" class="mr15">(未选择文件)</span>
|
||||
<span>您可以上传小于<span class="c_red">50MB</span>的文件</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5 mt5">
|
||||
<p class="c_dark f14" style="line-height:30px;">描述:</p>
|
||||
<div class="fl">
|
||||
<textarea style="resize:none" type="text" placeholder="请编辑资源描述" name="description" class="InputBox fl H60 W420" ><%= @attachment.description %></textarea>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div style="margin-top: 10px" >
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<% if course_id%>
|
||||
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
|
||||
<% end %>
|
||||
<input type="hidden" name="blog_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<% if course_id%>
|
||||
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
|
||||
<% end %>
|
||||
<input type="hidden" name="blog_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -87,11 +87,7 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<% if @article.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% end %>
|
||||
<%= link_to @article.author.show_name, user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
|
@ -126,11 +122,6 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @article.id %>">
|
||||
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
|
||||
|
@ -146,11 +137,7 @@
|
|||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= link_to reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script type="text/javascript">
|
||||
function submit_copy_course() {
|
||||
if(regex_course_name('new')&®ex_course_class_period('new')&®ex_time_term('new')&®ex_course_password('new'))
|
||||
if(regex_course_name('new')&®ex_course_class_period('new')&®ex_time_term('new'))
|
||||
{
|
||||
$("#new_course").submit();
|
||||
document.getElementById("submit_copy_course").onclick = "";
|
||||
|
@ -79,15 +79,15 @@
|
|||
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<!--<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%#= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" style="display: none;">
|
||||
<input type="text" name="course[password]" id="new_course_course_password" class="hwork_input02 grey_border" onkeyup="regex_course_password('new');" value="<%=@course.password %>">
|
||||
<!--<a id="psw_btn" href="javascript:void(0)">显示明码</a>-->
|
||||
<input type="text" name="course[password]" id="new_course_course_password" class="hwork_input02 grey_border" onkeyup="regex_course_password('new');" value="<%#=@course.password %>">
|
||||
<!–<a id="psw_btn" href="javascript:void(0)">显示明码</a>–>
|
||||
<span class="c_red" id="new_course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="ml95 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
</li>-->
|
||||
<li class="ml50">
|
||||
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl grey_border" ><%= @course.description.nil? ? "" : @course.description %></textarea>
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
<div id="popbox">
|
||||
<div class="C" >
|
||||
<div class="C_top">
|
||||
<h2>快速进入课程通道</h2>
|
||||
<p>只要持有课程ID和密码,就可快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!</p>
|
||||
<h2>快速加入课程通道</h2>
|
||||
<p>只要持有课程邀请码,就可以快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!</p>
|
||||
</div>
|
||||
<div class="C_form">
|
||||
<%= form_tag({:controller => 'courses',
|
||||
|
@ -62,17 +62,13 @@
|
|||
<li>
|
||||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<span class="tips" style="width: 68px; display: inline-block;">课 程 ID:</span>
|
||||
<input class=" width190" name="object_id" id="object_id" type="text" value="" >
|
||||
<span class="tips" style="width: 90px; display: inline-block;">课程邀请码:</span>
|
||||
<input class="width190" style="margin-left: 0px;" name="invite_code" id="object_id" type="text" value="" >
|
||||
<input type="text" style="display: none"/>
|
||||
</li>
|
||||
<li class="mB5">课程ID是所在课程网址中显示的序号</li>
|
||||
<li>
|
||||
<span class="tips" style="width: 68px; display: inline-block;">密 码:</span>
|
||||
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
|
||||
</li>
|
||||
<li style="margin-top: 30px;">
|
||||
<span style="margin-right: 20px;">身 份:</span>
|
||||
<li class="mB5">课程邀请码是所在课程页面中显示的邀请码</li>
|
||||
<li style="margin-top: 15px;">
|
||||
<span style="margin-right: 5px;"><span style="margin-right:43px;">身</span><span>份</span>:</span>
|
||||
<% if User.current.logged? && User.current.extensions && User.current.extensions.identity == 0%>
|
||||
<select name="role" class="IDType">
|
||||
<option value="9">教师</option>
|
||||
|
|
|
@ -6,4 +6,5 @@ $('#ajax-modal').siblings().remove();
|
|||
$('#ajax-modal').before(' <a href="javascript:void(0);" onclick="hideModal()" class="resourceClose" style="margin-left: 285px"></a>');
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("courseOutlinePopup");
|
||||
$('#ajax-modal').parent().removeClass("copyCoursePopup");
|
||||
$('#ajax-modal').css("padding-left","16px")//.css("padding-bottom","16px");
|
||||
|
|
|
@ -6,14 +6,14 @@ $("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@c
|
|||
alert("加入成功");
|
||||
hideModal();
|
||||
$("#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%>"
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= 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%>"
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 4 %>
|
||||
alert("您加入的课程不存在");
|
||||
<% elsif @state == 5 %>
|
||||
|
@ -27,15 +27,15 @@ hidden_join_course_form();
|
|||
<% elsif @state == 8%>
|
||||
alert("您已经是该课程的教师了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 9%>
|
||||
alert("您已经是该课程的教辅了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 10%>
|
||||
alert("您已经是该课程的管理员了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% else %>
|
||||
alert("未知错误,请稍后再试");
|
||||
<% end %>
|
||||
|
|
|
@ -32,15 +32,15 @@
|
|||
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<!--<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%#= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" style="display: none;">
|
||||
<input type="password" name="course[password]" id="new_course_course_password" class="hwork_input02" onkeyup="regex_course_password('new');">
|
||||
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
|
||||
<span class="c_red" id="new_course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="ml80 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
</li>-->
|
||||
<li class="ml45">
|
||||
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
|
||||
|
|
|
@ -57,14 +57,14 @@
|
|||
<span class="c_red" id="edit_course_time_term_notice"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="password" name="course[password]" id="edit_course_course_password" class="hwork_input02" value="<%= @course.password%>" onkeyup="regex_course_password('edit');">
|
||||
<!--<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%#= l(:label_new_course_password)%> :</label>
|
||||
<input type="password" name="course[password]" id="edit_course_course_password" class="hwork_input02" value="<%#= @course.password%>" onkeyup="regex_course_password('edit');">
|
||||
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
|
||||
<span class="c_red" id="edit_course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
</li>-->
|
||||
<li class="ml45">
|
||||
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" maxlength="6000"><%= @course.description%></textarea>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
|
|
|
@ -75,11 +75,7 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<% if @article.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% end %>
|
||||
<%= link_to @article.author.show_name, user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
|
@ -109,11 +105,6 @@
|
|||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @article.id %>">
|
||||
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
|
||||
|
@ -129,11 +120,7 @@
|
|||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= link_to reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
|
@ -184,20 +171,24 @@
|
|||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @article.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer" style="margin-top: 8px">
|
||||
<div nhname='new_message_<%= @article.id%>' style="display:none;">
|
||||
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
|
||||
<input type="hidden" name="course_id" value="<%= @course.id%>">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<div nhname='toolbar_container_<%= @article.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @article.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @article.id%>' style="display:none;">
|
||||
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
|
||||
<input type="hidden" name="course_id" value="<%= @course.id%>">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<div nhname='toolbar_container_<%= @article.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @article.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -63,4 +63,11 @@
|
|||
<%#end%>
|
||||
<% end%>
|
||||
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>
|
||||
<% if exercise.show_result == 1 %>
|
||||
<% if exercise.end_time <= Time.now %>
|
||||
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
|
||||
<% else %>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间未到,暂不能查看统计结果">统计结果</li>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<% end%>
|
|
@ -20,7 +20,13 @@
|
|||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mb5">得分:<span class="c_red"><%=exercise_user.score %>分</span></div>
|
||||
<div>
|
||||
<div class="fl mb5">得分:<span class="c_red"><%=exercise_user.score %>分</span></div>
|
||||
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) || (exercise.exercise_status == 3 && exercise.show_result == 1) %>
|
||||
<%= link_to '返回统计列表>>',student_exercise_list_exercise_path(exercise.id,:course_id => exercise.course.id) , :class => "fr linkBlue" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
<table class="hwork-table-wrap">
|
||||
<tr class="b_grey hworkH30" style="border-bottom:1px solid #eaeaea;">
|
||||
<th class="hworkList340 width530" colspan="6">
|
||||
<span class="c_dark f14 fb fl mr5">序号</span>
|
||||
<span class="c_dark f14 fb fl mr55"> </span>
|
||||
<span class="c_dark f14 fb fl mr60">姓名</span>
|
||||
<span class="c_dark f14 fb fl mr60">学号</span>
|
||||
<span class="c_dark f14 fb fl">班级</span>
|
||||
</th>
|
||||
<table class="hwork-table-wrap" style="border-bottom:1px solid #eaeaea;">
|
||||
<tr class="b_grey hworkH30">
|
||||
<th class="hworkList30 pl5 pr5"><span class="c_dark f14 fb">序号</span></th>
|
||||
<th class="hworkList50"> </th>
|
||||
<th class="hworkList60"><span class="c_dark f14 fb">姓名</span></th>
|
||||
<th class="hworkList80"><span class="c_dark f14 fb">学号</span></th>
|
||||
<th class="hworkList80"><span class="c_dark f14 fb">班级</span></th>
|
||||
<th width="230"> </th>
|
||||
<th class="hworkList130">
|
||||
<%= link_to "时间",'',:class => "c_dark f14 fb fl ml50" ,:remote => true%>
|
||||
<%= link_to "时间",'',:class => "c_dark f14 fb" ,:remote => true%>
|
||||
</th>
|
||||
<th class="hworkList50">
|
||||
<%= link_to "成绩",'',:class => "c_dark f14 fb fl ml10",:remote => true%>
|
||||
<%= link_to "成绩",'',:class => "c_dark f14 fb",:remote => true%>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<% @exercise_users_list.each_with_index do |exercise, index|%>
|
||||
<tr class="hworkListRow" id="student_work_<%= exercise.id%>">
|
||||
<td class="pl5 pr5" style="width:28px; text-align:center;"><%=index + 1 %></td>
|
||||
<td class="pl5 pr5" style="text-align:center;"><%=index + 1 %></td>
|
||||
<td class="hworkPortrait pr10 float-none">
|
||||
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %>
|
||||
</td>
|
||||
|
@ -30,7 +29,7 @@
|
|||
<td class="hworkStID student_work_<%= exercise.id%> float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
|
||||
--
|
||||
</td>
|
||||
<td width="200"> </td>
|
||||
<td width="230"> </td>
|
||||
<td class="hworkList130 c_grey">
|
||||
<% if exercise.created_at%>
|
||||
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<p ondblclick=show_edit_file_description('<%= file.id %>')>
|
||||
资源描述:<% if file.description.blank? %><span style="color:#C5C5BE; cursor:pointer;" title="双击可编辑">双击添加描述</span><% else %><span style="cursor:pointer;" title="双击可编辑"><%= file.description %></span><% end %>
|
||||
<%#= file.description.blank? ? "该资源暂无描述" : file.description %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_file_description("+file.id.to_s+");"%>
|
||||
</p>
|
|
@ -1,7 +1,7 @@
|
|||
<% delete_allowed = User.current.admin? %>
|
||||
|
||||
<% org_subfield_attachments.each do |file| %>
|
||||
<% if file.is_public == 1 or User.current.member_of_org?(file.container.organization) %>
|
||||
<% if file.is_public == 1 or User.current.member_of_org?(file.container.organization) || User.current.admin? %>
|
||||
<div class="resources mt10" id="container_files_<%= file.id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
|
@ -36,6 +36,22 @@
|
|||
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<span id="reference_number_<%= file.id %>"><%= file.quotes.nil? ? 0:file.quotes %></span></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if User.current.logged? && ((delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" )%>
|
||||
<div>
|
||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||
</div>
|
||||
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
||||
onblur="edit_file_description('<%= update_file_description_org_subfield_file_path(file.container,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 mb4">
|
||||
资源描述:<% if file.description.blank? %><span style="color:#C5C5BE;">未添加</span><% else %><%= file.description %><% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
<%= link_to truncate(file.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(file.id, file.filename),
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
|
||||
<% if User.current.logged? || User.current.admin? %>
|
||||
<% if ((manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file)) || User.current.admin? %>
|
||||
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% if authority_pubilic_for_files(project, file) && delete_allowed %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
|
@ -43,6 +43,19 @@
|
|||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if User.current.admin? || ( User.current.logged? && ( (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file))) %>
|
||||
<div>
|
||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||
</div>
|
||||
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
||||
onblur="edit_file_description('<%= update_file_description_project_file_path(project,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 mb4">
|
||||
资源描述:<% if file.description.blank? %><span style="color:#C5C5BE;">未添加</span><% else %><%= file.description %><% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 2 代表是项目里的资源 -->
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
|
|
|
@ -35,6 +35,19 @@
|
|||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if User.current.admin? || (User.current.logged? && ( (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project")) %>
|
||||
<div>
|
||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||
</div>
|
||||
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
||||
onblur="edit_file_description('<%= update_file_description_project_file_path(project,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 mb4">
|
||||
资源描述:<% if file.description.blank? %><span style="color:#C5C5BE;">未添加</span><% else %><%= file.description %><% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
|
|
|
@ -35,10 +35,22 @@
|
|||
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<% unless file.description.blank? %>
|
||||
<%# unless file.description.blank? %>
|
||||
<div class="cl"></div>
|
||||
<div class="fontGrey2 mb4">资源描述:<%= file.description %></div>
|
||||
<% end %>
|
||||
<% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course")) %>
|
||||
<div>
|
||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||
</div>
|
||||
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
||||
onblur="edit_file_description('<%= update_file_description_course_file_path(@course,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 mb4">
|
||||
资源描述:<% if file.description.blank? %><span style="color:#C5C5BE;">未添加</span><% else %><%= file.description %><% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
|
@ -48,9 +60,9 @@
|
|||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<% if User.current.logged? || User.current.admin? %>
|
||||
<% if User.current.admin? || ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) %>
|
||||
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course") %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %></li>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %>
|
||||
<% if User.current.admin? || (User.current.logged? ) %>
|
||||
<% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %>
|
||||
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
|
|
|
@ -22,6 +22,13 @@
|
|||
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => project} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">文件描述:</label>
|
||||
<div class="fl">
|
||||
<input type="text" name="description" placeholder="文件描述" class="InputBox fl W160">
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
|
|
|
@ -16,6 +16,13 @@
|
|||
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
|
||||
<%= render :partial => 'files/org_subfield_upload_attachment_list', :locals => {:container => org_subfield}%>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">文件描述:</label>
|
||||
<div class="fl">
|
||||
<input type="text" name="description" placeholder="文件描述" class="InputBox fl W160">
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
$("#file_description_show_<%= @attachment.id %>").html("<%= escape_javascript render(:partial => "files/file_description", :locals => {:file => @attachment}) %>");
|
||||
$("#file_description_show_<%= @attachment.id %>").show();
|
||||
$("#file_description_edit_<%= @attachment.id %>").hide();
|
|
@ -1,6 +1,7 @@
|
|||
<%if @save_flag%>
|
||||
$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
|
||||
$('#reorder_time').click();
|
||||
//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
|
||||
//$('#reorder_time').click();
|
||||
window.location.href= "<%= host_with_protocol %>"+"/forums/" + "<%= @forum.id%>"
|
||||
<%else%>
|
||||
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
|
||||
<%end %>
|
||||
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
|
||||
<%end %>
|
||||
|
|
|
@ -45,11 +45,15 @@
|
|||
<li>
|
||||
<a href="javascript:void(0);" class="menu_arrow" style="font-size:16px; color:#4b4b4b; font-weight: normal; padding-left: 0px;">作业</a>
|
||||
<ul style="max-height:240px; overflow-y:auto; overflow-x:hidden;">
|
||||
<% @homework_commons.each_with_index do |homework_common,index |%>
|
||||
<li class="pr10">
|
||||
<%= link_to "作业#{@homework_commons.count - index}:#{homework_common.name}",student_work_index_path(:homework => homework_common.id),:target=>"_blank"%>
|
||||
</li>
|
||||
<% end%>
|
||||
<% if @homework_commons.empty? %>
|
||||
<li class="pr10" style="font-weight: normal; color: #888888; width: 120px; padding-left: 15px; padding-bottom: 5px;">目前尚未发布作业</li>
|
||||
<% else %>
|
||||
<% @homework_commons.each_with_index do |homework_common,index |%>
|
||||
<li class="pr10">
|
||||
<%= link_to "作业#{@homework_commons.count - index}:#{homework_common.name}",student_work_index_path(:homework => homework_common.id),:target=>"_blank"%>
|
||||
</li>
|
||||
<% end%>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -62,23 +62,27 @@
|
|||
</div>
|
||||
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id %>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5 fl">
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id %>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5 fl">
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
|
|
|
@ -5,21 +5,25 @@
|
|||
</div>
|
||||
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= @issue.id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="quote" value=""/>
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id%>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id%>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<span nhname='contentmsg_<%= @issue.id%>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @issue.id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="quote" value=""/>
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id%>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id%>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<span nhname='contentmsg_<%= @issue.id%>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
|
|
|
@ -84,13 +84,15 @@
|
|||
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div>
|
||||
<% end %>
|
||||
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
|
||||
<!--<div class="shadowbox_news undis" id="user_messages_list">
|
||||
<%#=render :partial => 'layouts/message_loading' %>
|
||||
</div>-->
|
||||
<div class="shadowbox_news undis" id="user_messages_list">
|
||||
<%=render :partial => 'layouts/message_loading' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var onUserMessages = false;
|
||||
var onNotice = false;
|
||||
//搜索相关
|
||||
$("#navHomepageSearch").mouseover(function(){
|
||||
$("#navHomepageSearchType").show();
|
||||
|
@ -98,15 +100,30 @@
|
|||
$("#navHomepageSearchType").hide();
|
||||
});
|
||||
|
||||
/*$("#user_messages").mouseenter(function(){
|
||||
$("#user_messages").mouseenter(function(){
|
||||
onNotice = true;
|
||||
$("#user_messages_list").show();
|
||||
$.get('<%#=user_messages_unviewed_users_path %>');
|
||||
$("#ajax-indicator").hide();
|
||||
if($("#message_list_detail").length == 0){
|
||||
$.get('<%=user_messages_unviewed_users_path %>');
|
||||
$("#ajax-indicator").hide();
|
||||
}
|
||||
var obj = $("#user_messages_list");
|
||||
clearTimeout(obj.timer);
|
||||
}).mouseleave(function(){
|
||||
$("#user_messages_list").hide();
|
||||
$("#user_messages_list").html("<%#=escape_javascript(render :partial => 'layouts/message_loading') %>");
|
||||
|
||||
});*/
|
||||
onNotice = false;
|
||||
var obj = $("#user_messages_list");
|
||||
setTimeout(function(){
|
||||
if(!onNotice && !onUserMessages) {
|
||||
obj.hide();
|
||||
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
|
||||
} }, 500);
|
||||
});
|
||||
$("#message_list_detail").mouseenter(function(event){
|
||||
event.stopPropagation();
|
||||
onUserMessages = true;
|
||||
}).mouseleave(function(){
|
||||
onUserMessages = false;
|
||||
});
|
||||
|
||||
$("#navHomepageProfile").mouseenter(function(){
|
||||
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
<font></font>
|
||||
<div id="message_list_detail">
|
||||
<h4 class="shadowbox_news_title">未读消息</h4>
|
||||
<p style="display: none;" id="none_message" class="shadowbox_news_p text_c">无未读消息</p>
|
||||
<ul class="shadowbox_news_list">
|
||||
<%# user_messages = User.current.user_messages_unviewed %>
|
||||
<% messages.each do |ma| %>
|
||||
<% if ma.class == SystemMessage %>
|
||||
<li><a href="<%=user_system_messages_path(User.current) %>" target="_blank" title="Trustie平台 发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%>"><span class="shadowbox_news_user">Trustie平台 </span>发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%></a></li>
|
||||
<li><a href="<%=user_system_messages_path(User.current) %>" target="_blank" title="Trustie平台 发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%>"><span class="shadowbox_news_user">Trustie平台 </span>发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%></a></li>
|
||||
<% elsif ma.class == CourseMessage %>
|
||||
<% if ma.course_message_type == "News" %>
|
||||
<li><a href="<%=news_path(ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.author.show_name %> 发布了通知:<%= ma.course_message.title%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span>发布了通知:<%= ma.course_message.title%></a></li>
|
||||
<li><a href="<%=news_path(ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.author.show_name %> 发布了通知:<%= ma.course_message.title%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span>发布了通知:<%= ma.course_message.title%></a></li>
|
||||
<% elsif ma.course_message_type == "Comment" %>
|
||||
<li><a href="<%=news_path(ma.course_message.commented.id) %>" target="_blank" title="<%=ma.course_message.author.show_name %> 评论了通知:<%=ma.course_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span>评论了通知:<%= ma.course_message.commented.title%></a></li>
|
||||
<li><a href="<%=news_path(ma.course_message.commented.id) %>" target="_blank" title="<%=ma.course_message.author.show_name %> 评论了通知:<%=ma.course_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span>评论了通知:<%= ma.course_message.commented.title%></a></li>
|
||||
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status.nil? %>
|
||||
<li><a href="<%= (!User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil?) ? new_student_work_path(:homework => ma.course_message.id) : student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布了课程作业:作业标题:<%= ma.course_message.name%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布了课程作业:作业标题:<%= ma.course_message.name%></a></li>
|
||||
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布的作业:作业标题:<%= ma.course_message.name%>的截止日期快到了"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布的作业:作业标题:<%= ma.course_message.name%>的截止日期快到了</a></li>
|
||||
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 启动了作业匿评:作业标题:<%= ma.course_message.name%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>启动了作业匿评:作业标题:<%= ma.course_message.name%></a></li>
|
||||
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 关闭了作业匿评:作业标题:<%= ma.course_message.name%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>关闭了作业匿评:作业标题:<%= ma.course_message.name%></a></li>
|
||||
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 启动作业匿评失败:<%= ma.course_message.name%>(失败原因:提交作品的人数低于2人)"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>启动作业匿评失败:<%= ma.course_message.name%>(失败原因:提交作品的人数低于2人)</a></li>
|
||||
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 5 %>
|
||||
|
@ -33,42 +36,133 @@
|
|||
<% href = 'javascript:void(0)' %>
|
||||
<% end %>
|
||||
<li><a href="<%= href %>" target="_blank" title="<%=ma.course_message.user.show_name %> 申请引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>申请引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%></a></li>
|
||||
<% elsif ma.course_message_type == "ApplyResource" && ma.status == 1 %>
|
||||
<% if ma.course_message.container_type == "Course" %>
|
||||
<% href = course_files_path(ma.course_message.container_id) %>
|
||||
<% elsif ma.course_message.container_type == "Project" %>
|
||||
<% href = project_files_path(ma.course_message.container_id) %>
|
||||
<% elsif ma.course_message.container_type == "OrgSubfield" %>
|
||||
<% href = org_subfield_files_path(ma.course_message.container_id) %>
|
||||
<% else %>
|
||||
<% href = 'javascript:void(0)' %>
|
||||
<% end %>
|
||||
<li><a href="<%= href %>" target="_blank" title="<%=User.find(ma.course_message.apply_user_id).show_name %> <%= ma.apply_result == 2 ? '同意' : '拒绝'%>引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%>"><span class="shadowbox_news_user"><%=User.find(ma.course_message.apply_user_id).show_name %> </span><%= ma.apply_result == 2 ? '同意' : '拒绝'%>引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%></a></li>
|
||||
<% elsif ma.course_message_type == "Poll" %>
|
||||
<li><a href="<%= poll_path(ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name%></a></li>
|
||||
<% elsif ma.course_message_type == "Message" %>
|
||||
<% content = ma.course_message.parent_id.nil? ? ma.course_message.subject : ma.course_message.content.html_safe %>
|
||||
<% href = course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id) %>
|
||||
<li><a href="<%= href %>" target="_blank" title="<%=ma.course_message.author.show_name %> <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %><%= content%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %><%= content%></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWorksScore" %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.student_work.homework_common_id) %>" target="_blank" title="<%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%>"><span class="shadowbox_news_user"><%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> </span><%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%></a></li>
|
||||
<% elsif ma.course_message_type == "JournalsForMessage" %>
|
||||
<% if ma.course_message.jour_type == 'Course' %>
|
||||
<li><a href="<%= course_feedback_path(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 在课程中留言了:<%= ma.course_message.notes.html_safe%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>在课程中留言了:<%= ma.course_message.notes.html_safe%></a></li>
|
||||
<% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
|
||||
<li><a href="<%= homework_common_index_url_in_org(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span><%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%></a></li>
|
||||
<% else %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= ma.course_message.notes%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> </span>回复了作品评论:<%= ma.course_message.notes%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.course_message_type == "ApplyResource" && ma.status == 1 %>
|
||||
<% if ma.course_message.container_type == "Course" %>
|
||||
<% href = course_files_path(ma.course_message.container_id) %>
|
||||
<% elsif ma.course_message.container_type == "Project" %>
|
||||
<% href = project_files_path(ma.course_message.container_id) %>
|
||||
<% elsif ma.course_message.container_type == "OrgSubfield" %>
|
||||
<% href = org_subfield_files_path(ma.course_message.container_id) %>
|
||||
<% else %>
|
||||
<% href = 'javascript:void(0)' %>
|
||||
<% end %>
|
||||
<li><a href="<%= href %>" target="_blank" title="<%=User.find(ma.course_message.apply_user_id).show_name %> <%= ma.apply_result == 2 ? '同意' : '拒绝'%>引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%>"><span class="shadowbox_news_user"><%=User.find(ma.course_message.apply_user_id).show_name %> </span><%= ma.apply_result == 2 ? '同意' : '拒绝'%>引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%></a></li>
|
||||
<% elsif ma.course_message_type == "Poll" %>
|
||||
<li><a href="<%= poll_path(ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name%></a></li>
|
||||
<% elsif ma.course_message_type == "Message" %>
|
||||
<% content = ma.course_message.parent_id.nil? ? ma.course_message.subject : ma.course_message.content.html_safe %>
|
||||
<% href = course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id) %>
|
||||
<li><a href="<%= href %>" target="_blank" title="<%=ma.course_message.author.show_name %> <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %><%= content%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %><%= content%></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWorksScore" %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.student_work.homework_common_id) %>" target="_blank" title="<%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%>"><span class="shadowbox_news_user"><%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> </span><%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%></a></li>
|
||||
<% elsif ma.course_message_type == "JournalsForMessage" %>
|
||||
<% if ma.course_message.jour_type == 'Course' %>
|
||||
<li><a href="<%= course_feedback_path(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 在课程中留言了:<%= ma.course_message.notes.html_safe%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>在课程中留言了:<%= ma.course_message.notes.html_safe%></a></li>
|
||||
<% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
|
||||
<li><a href="<%= homework_common_index_url_in_org(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span><%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%></a></li>
|
||||
<% else %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= ma.course_message.notes%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> </span>回复了作品评论:<%= ma.course_message.notes%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id) %>" target="_blank" title="<%=ma.course_message.homework_common.user.show_name %>老师 发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评"><span class="shadowbox_news_user"><%=ma.course_message.homework_common.user.show_name %>老师 </span>发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评</a></li>
|
||||
<% elsif ma.course_message_type == "StudentWork" && ma.status == 1 %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id, :show_work_id => ma.course_message_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>同学 重新提交了作品:<%=ma.course_message.name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>同学 </span>重新提交了作品:<%=ma.course_message.name %></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWork" && ma.status == 2 %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id, :show_work_id => ma.course_message_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>同学 追加新附件了:作业标题:<%=ma.course_message.homework_common.name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>同学 </span>追加新附件了:作业标题:<%=ma.course_message.homework_common.name %></a></li>
|
||||
<% elsif ma.course_message_type == "Course" %>
|
||||
<li><a href="<%=course_path(ma.course_message) %>" target="_blank" title="系统提示 您成功创建了课程:课程名称:<%=ma.course_message.name %>"><span class="shadowbox_news_user">系统提示 </span>您成功创建了课程:课程名称:<%=ma.course_message.name %></a></li>
|
||||
<% elsif ma.course_message_type == "JoinCourseRequest" %>
|
||||
<% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}" %>
|
||||
<li><a href="<%=user_path(User.find(ma.course_message_id), :course_id => ma.course_id) %>" target="_blank" title="系统提示 您有了新的课程成员申请:<%=content %>"><span class="shadowbox_news_user">系统提示 </span>您有了新的课程成员申请:<%=content %></a></li>
|
||||
<% elsif ma.course_message_type == "CourseRequestDealResult" %>
|
||||
<% content = ma.status == 1 ? '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过' : '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝' %>
|
||||
<li><a href="<%=course_path(Course.find(ma.course_id)) %>" target="_blank" title="系统提示 课程申请进度反馈:<%=content %>"><span class="shadowbox_news_user">系统提示 </span>课程申请进度反馈:<%=content %></a></li>
|
||||
<% elsif ma.course_message_type == "JoinCourse" and ma.status == 0 %>
|
||||
<li><a href="<%=course_member_path(ma.course) %>" target="_blank" title="<%=User.find(ma.course_message_id).show_name %> 将您加入了课程:<%=ma.course.name %>"><span class="shadowbox_news_user"><%=User.find(ma.course_message_id).show_name %> </span>将您加入了课程:<%=ma.course.name %></a></li>
|
||||
<% elsif ma.course_message_type == "JoinCourse" and ma.status == 1 %>
|
||||
<li><a href="<%=user_path(ma.course_message_id) %>" target="_blank" title="系统提示 您增加了新的课程成员:<%=User.find(ma.course_message_id).login+"("+User.find(ma.course_message_id).show_name+")" %>"><span class="shadowbox_news_user">系统提示 </span>您增加了新的课程成员:<%=User.find(ma.course_message_id).login+"("+User.find(ma.course_message_id).show_name+")" %></a></li>
|
||||
<% elsif ma.course_message_type == "RemoveFromCourse" %>
|
||||
<li><a href="<%=member_course_path(ma.course) %>" target="_blank" title="<%=User.find(ma.course_message_id).show_name %> 将您移出了课程:<%=ma.course.name %>"><span class="shadowbox_news_user"><%=User.find(ma.course_message_id).show_name %> </span>将您移出了课程:<%=ma.course.name %></a></li>
|
||||
<% elsif ma.course_message_type == "Exercise" && ma.status == 2 %>
|
||||
<li><a href="<%=exercise_path(:id => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布了课程测验:测验题目:<%=ma.course_message.exercise_name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布了课程测验:测验题目:<%=ma.course_message.exercise_name %></a></li>
|
||||
<% elsif ma.course_message_type == "Exercise" && ma.status == 3 %>
|
||||
<li><a href="<%=exercise_path(:id => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布的测验:<%=ma.course_message.exercise_name %> 截止时间快到了"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布的测验:<%=ma.course_message.exercise_name %> 截止时间快到了</a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == ForgeMessage %>
|
||||
<% if ma.forge_message_type == "AppliedProject" %>
|
||||
<li><a href="<%=settings_project_path(:id => ma.project, :tab => "members") %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 申请加入项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>申请加入项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "JoinProject" %>
|
||||
<li><a href="<%=project_member_path(ma.project) %>" target="_blank" title="<%=User.find(ma.forge_message_id).show_name %> 将您加入了项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=User.find(ma.forge_message_id).show_name %> </span>将您加入了项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "RemoveFromProject" %>
|
||||
<li><a href="<%=member_project_path(ma.project) %>" target="_blank" title="<%=User.find(ma.forge_message_id).show_name %> 将您移出了项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=User.find(ma.forge_message_id).show_name %> </span>将您移出了项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "RemoveFromProject" %>
|
||||
<li><a href="<%=project_path(ma.project) %>" target="_blank" title="<%=User.find(ma.forge_message_id).show_name %> 邀请你加入项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=User.find(ma.forge_message_id).show_name %> </span>邀请你加入项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "Issue" && ma.status == 1 %>
|
||||
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!</a></li>
|
||||
<% elsif ma.forge_message_type == "Issue" && ma.status != 1 %>
|
||||
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%></a></li>
|
||||
<% elsif ma.forge_message_type == "Journal" %>
|
||||
<li><a href="<%=issue_path(:id => ma.forge_message.journalized_id) %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>更新了问题状态:<%= ma.forge_message.journalized.subject%></a></li>
|
||||
<% elsif ma.forge_message_type == "Message" %>
|
||||
<li><a href="<%=project_boards_path(ma.forge_message.project,:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,:topic_id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%></a></li>
|
||||
<% elsif ma.forge_message_type == "News" %>
|
||||
<li><a href="<%=news_path(ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>发布了新闻:<%= ma.forge_message.title.html_safe%></a></li>
|
||||
<% elsif ma.forge_message_type == "Comment" %>
|
||||
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == MemoMessage %>
|
||||
<% if ma.memo_type == "Memo" %>
|
||||
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == UserFeedbackMessage %>
|
||||
<% if ma.journals_for_message_type == "JournalsForMessage" %>
|
||||
<li><a href="<%=feedback_path(ma.journals_for_message.jour_id) %>" target="_blank" title="<%=ma.journals_for_message.user.show_name %> <%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe%>"><span class="shadowbox_news_user"><%=ma.journals_for_message.user.show_name %> </span><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == OrgMessage %>
|
||||
<% if ma.message_type == 'ApplySubdomain' %>
|
||||
<li><a href="<%=feedback_path(ma.journals_for_message.jour_id) %>" target="_blank" title="<%=ma.organization.name %> 申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>"><span class="shadowbox_news_user"><%=ma.organization.name %> </span>申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%></a></li>
|
||||
<% elsif ma.message_type == 'AgreeApplySubdomain' %>
|
||||
<li><a href="javascript:void(0)" target="_blank" title="系统提示 管理员同意了您的子域名申请:<%= ma.content%>"><span class="shadowbox_news_user">系统提示 </span>管理员同意了您的子域名申请:<%= ma.content%></a></li>
|
||||
<% end %>
|
||||
<% elsif AtMessage === ma && ma.at_valid? %>
|
||||
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
|
||||
<% href = course_boards_path(ma.at_message.course,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
|
||||
<li><a href="<%=href %>" target="_blank" title="<%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>"><span class="shadowbox_news_user"><%=ma.author.show_name %> </span>提到了你:<%= ma.subject.html_safe%></a></li>
|
||||
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
|
||||
<% href = project_boards_path(ma.at_message.project,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
|
||||
<li><a href="<%=href %>" target="_blank" title="<%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>"><span class="shadowbox_news_user"><%=ma.author.show_name %> </span>提到了你:<%= ma.subject.html_safe%></a></li>
|
||||
<% else %>
|
||||
<% content = '<span class="shadowbox_news_user">'+ma.author.show_name+' </span>提到了你:'+ma.subject.html_safe %>
|
||||
<li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--<li><span class="shadowbox_news_user">教辅测试老师</span><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试辅测试老辅测试老老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank"><span class="c_red">【课程通知】</span>发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
-->
|
||||
</ul>
|
||||
<%= link_to '查看全部', user_message_path(User.current), :class => "shadowbox_news_all", :target =>"_Blank" %>
|
||||
<a onclick = "show_more();" id = "show_more_messages" style="display: none; cursor: pointer;" class = "shadowbox_news_all">展开更多</a>
|
||||
<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :style => "display:none", :target =>"_Blank" %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
if($(".shadowbox_news_list li").length > 5) {
|
||||
$(".shadowbox_news_list li").hide();
|
||||
$(".shadowbox_news_list li").eq(0).show();
|
||||
$(".shadowbox_news_list li").eq(1).show();
|
||||
$(".shadowbox_news_list li").eq(2).show();
|
||||
$(".shadowbox_news_list li").eq(3).show();
|
||||
$(".shadowbox_news_list li").eq(4).show();
|
||||
$("#show_more_messages").show();
|
||||
} else if ($(".shadowbox_news_list li").length == 0) {
|
||||
$("#none_message").show();
|
||||
$("#show_all_messages").show();
|
||||
}
|
||||
else {
|
||||
$("#show_all_messages").show();
|
||||
}
|
||||
});
|
||||
function show_more() {
|
||||
$(".shadowbox_news_list li").show();
|
||||
$("#show_more_messages").hide();
|
||||
$("#show_all_messages").show();
|
||||
}
|
||||
</script>
|
|
@ -1,8 +1,10 @@
|
|||
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
|
||||
<%= user.user_extensions.brief_introduction %>
|
||||
<% else%>
|
||||
这位童鞋很懒,什么也没有留下~
|
||||
<% end %>
|
||||
<span>
|
||||
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
|
||||
<%= user.user_extensions.brief_introduction %>
|
||||
<% else%>
|
||||
这位童鞋很懒,什么也没有留下~
|
||||
<% end %>
|
||||
</span>
|
||||
<% 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%>
|
||||
<% end %>
|
||||
|
|
|
@ -57,6 +57,12 @@
|
|||
<div class="project_info" style="position: relative" id="project_info_<%=@course.id %>">
|
||||
<%=render :partial=>'layouts/project_info' %>
|
||||
</div><!--课程信息 end-->
|
||||
<% if (User.current.logged? && User.current.member_of_course?(@course)) || is_teacher %>
|
||||
<div class="info_box mb10">
|
||||
<p class="f14">邀请码</p>
|
||||
<p class="f14 fontBlue2"><%=@course.generate_invite_code %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="info_box">
|
||||
<ul>
|
||||
<li><%= l(:label_main_teacher)%> : <%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
|
||||
|
@ -173,7 +179,7 @@
|
|||
</div><!--项目标签 end-->
|
||||
<!--课程推荐-->
|
||||
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %></div>
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %> (自2016年5月)</div>
|
||||
</div><!--LSide end-->
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
|
||||
|
||||
</div>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @organization.visits.to_i %></div>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @organization.visits.to_i %> (自2016年5月)</div>
|
||||
</div>
|
||||
<div class="homepageRight" style="margin-top:<%= (params[:show_homepage].nil? && User.current.logged?) ? '10px':'0px' %>;">
|
||||
<%= render_flash_messages %>
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
<div class="cl"></div>
|
||||
</div><!--项目标签 end-->
|
||||
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @project.visits.to_i %></div>
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @project.visits.to_i %> (自2016年5月)</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -14,19 +14,8 @@
|
|||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color: #fff">
|
||||
<div class="navContainer">
|
||||
<% is_current_user = User.current.logged? && User.current == @user%>
|
||||
<% if User.current.logged? %>
|
||||
|
|
|
@ -139,9 +139,9 @@
|
|||
|
||||
<div>
|
||||
<div class="homepageSignature break_word">
|
||||
<p id="user_brief_introduction_show">
|
||||
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
|
||||
</p>
|
||||
<div id="user_brief_introduction_show">
|
||||
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
|
||||
</div>
|
||||
|
@ -284,7 +284,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %></div>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> (自2016年5月)</div>
|
||||
</div>
|
||||
<div class="homepageRight">
|
||||
<%= yield %>
|
||||
|
@ -349,6 +349,7 @@
|
|||
$(function(){
|
||||
$('#user_hide_course').hide();
|
||||
$('#user_hide_project').hide();
|
||||
autoUrl("user_brief_introduction_show");
|
||||
});
|
||||
|
||||
$("#courseMenu").mouseenter(function(){
|
||||
|
|
|
@ -81,11 +81,6 @@
|
|||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!--<div class="homepagePostReplyBannerMore">-->
|
||||
<!--<%# if @reply_count > 2%>-->
|
||||
<!--<a# href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @memo.id%>" onclick="expand_reply('#reply_div_<%#= @memo.id %>','#reply_btn_<%#= @memo.id%>')" data-count="<%= @reply_count %>" data-init="0" >点击展开更多回复</a>-->
|
||||
<!--<%# end %>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @memo.id %>">
|
||||
<% @replies.each_with_index do |reply,i| %>
|
||||
|
@ -119,19 +114,23 @@
|
|||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @memo.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= @memo.id%>' style="display:none;">
|
||||
<%= form_for('memo',:url=>forum_memos_path,:method => "post") do |f|%>
|
||||
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
|
||||
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
|
||||
<div nhname='toolbar_container_<%= @memo.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @memo.id%>' name="memo[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @memo.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @memo.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @memo.id%>' style="display:none;">
|
||||
<%= form_for('memo',:url=>forum_memos_path,:method => "post") do |f|%>
|
||||
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
|
||||
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
|
||||
<div nhname='toolbar_container_<%= @memo.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @memo.id%>' name="memo[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @memo.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @memo.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -71,11 +71,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="postDetailCreater">
|
||||
<% if @topic.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% end %>
|
||||
<%= link_to @topic.author.show_name, user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
|
@ -114,11 +110,7 @@
|
|||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= link_to reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
|
|
|
@ -103,11 +103,7 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<% if @topic.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% end %>
|
||||
<%= link_to @topic.author.show_name, user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
|
@ -127,11 +123,6 @@
|
|||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @topic.id %>">
|
||||
<% @replies.each_with_index do |reply,i| %>
|
||||
|
@ -147,11 +138,7 @@
|
|||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= link_to reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
|
|
|
@ -2,17 +2,21 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="reply[subject]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="reply[subject]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="org_document_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="org_document_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="org_document_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="org_document_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
$("#org_members_count_id").html("");
|
||||
$("#org_members_count_id").html("<%= @org.org_members.count %>")
|
||||
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
|
|
@ -4,6 +4,8 @@
|
|||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>");
|
||||
//默认选中第一个
|
||||
$("input[name='field_type']").get(0).checked=true;
|
||||
<% end %>
|
||||
$("#subfield_name").val("");
|
||||
$("#sub_dir").val("");
|
|
@ -387,17 +387,21 @@
|
|||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
|
||||
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
|
||||
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue