Merge branch 'develop' into daiao_dev

Conflicts:
	db/schema.rb
This commit is contained in:
daiao 2016-07-05 15:44:47 +08:00
commit cc72ca8473
173 changed files with 5659 additions and 3035 deletions

13
Gemfile
View File

@ -3,14 +3,17 @@ source 'https://ruby.taobao.org/'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
gem 'iconv'
gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel
if RUBY_PLATFORM =~ /darwin/
gem "rmagick", "= 2.15.4" ## osx must be this version
else
gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel
end
gem 'certified'
gem 'net-ssh', '2.9.1'
gem 'jenkins_api_client'
gem 'nokogiri'
end
gem 'net-ssh', '2.9.1'
gem 'jenkins_api_client'
gem 'nokogiri'
gem 'wechat',path: 'lib/wechat'
gem 'grack', path:'lib/grack'
gem 'gitlab', path: 'lib/gitlab-cli'

View File

@ -239,14 +239,23 @@ class AccountController < ApplicationController
end
def resendmail
result = {:status=>1, :email=>""}
user = User.find(params[:user]) if params[:user]
result[:email] = user.mail
token = Token.new(:user => user, :action => "register")
if token.save
Mailer.run.register(token)
# Mailer.run.register(token)
Mailer.register(token).deliver
else
yield if block_given?
result[:status] = 0
end
render :json => result
end
def email_activation
end
private
@ -264,6 +273,7 @@ class AccountController < ApplicationController
if user.nil?
invalid_credentials
elsif user.status == 2
@user = user
invalid_credentials_new
elsif user.new_record?
onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id })
@ -375,8 +385,9 @@ class AccountController < ApplicationController
def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
flash[:error] = l(:notice_account_invalid_creditentials_new)
render signin_path(:login=>true)
# flash[:error] = l(:notice_account_invalid_creditentials_new)
# render signin_path(:login=>true)
render :action => 'email_activation'
end
# Register a user for email activation.

View File

@ -612,7 +612,7 @@ class AttachmentsController < ApplicationController
@attachment.container.board.course)
@course = @attachment.container.board.course
else
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
unless @attachment.container_type == 'Syllabus' || @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
@project = @attachment.project
end
end

View File

@ -125,7 +125,9 @@ class BoardsController < ApplicationController
if @order.to_i == 2
@type = 2
@topics.each do |topic|
topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count)
all_comments = []
count=get_all_children(all_comments, topic).count
topic[:infocount] = get_praise_num(topic) + count
if topic[:infocount] < 0
topic[:infocount] = 0
end

View File

@ -715,6 +715,7 @@ class CoursesController < ApplicationController
@trackers = Tracker.sorted.all
@course = Course.new
@course.safe_attributes = params[:course]
@syllabus = Syllabus.where("id = #{params[:syllabus_id].to_i}").first if params[:syllabus_id]
# month = Time.now.month
render :layout => 'new_base'
else

View File

@ -44,7 +44,8 @@ class MessagesController < ApplicationController
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
page = 1 + offset / REPLIES_PER_PAGE
end
@reply_count = @topic.children.count
all_comments = []
@reply_count = get_all_children(all_comments, @topic).count
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
messages_replies = @topic.children.
@ -137,26 +138,32 @@ class MessagesController < ApplicationController
# Reply to a topic
def reply
if params[:reply][:content] == ""
if params[:is_board]
if @project
(redirect_to project_boards_path(@project), :notice => l(:label_reply_empty);return)
elsif @course
(redirect_to course_boards_path(@course), :notice => l(:label_reply_empty);return)
end
else
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
if params[:parent_id]
parent = Message.find params[:parent_id]
@reply = Message.new
@reply.author = User.current
@reply.board = parent.board
@reply.content = params[:content]
@reply.subject = "RE: #{parent.subject}"
@reply.reply_id = params[:reply_id]
# @reply.reply_id = params[:id]
parent.children << @reply
@topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i)
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@is_course = params[:is_course] if params[:is_course]
@is_board = params[:is_board] if params[:is_board]
else
@quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@topic.children << @reply
# @reply.reply_id = params[:id]
end
@quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
# @reply.reply_id = params[:id]
@topic.children << @reply
update_course_activity(@topic.class,@topic.id)
update_user_activity(@topic.class,@topic.id)
update_forge_activity(@topic.class,@topic.id)
@ -182,14 +189,10 @@ class MessagesController < ApplicationController
respond_to do |format|
format.js
end
elsif params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
return
else
redirect_to board_message_url(@board, @topic, :r => @reply)
redirect_to board_message_url(@board, @topic)
return
end
end
@ -251,6 +254,17 @@ class MessagesController < ApplicationController
# Delete a messages
def destroy
if params[:user_activity_id]
@message.destroy
@topic = Message.find(params[:activity_id].to_i)
@user_activity_id = params[:user_activity_id]
@is_course = params[:is_course]
@is_board = params[:is_board]
respond_to do |format|
format.js
end
return
end
if @project
(render_403; return false) unless @message.destroyable_by?(User.current)
elsif @course
@ -299,12 +313,12 @@ class MessagesController < ApplicationController
end
def quote
@subject = @message.subject
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
@temp = Message.new
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @message.author.show_name)} <br/>#{@message.content.html_safe}</blockquote>".html_safe
# @subject = @message.subject
# @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
#
# @content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
# @temp = Message.new
# @temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @message.author.show_name)} <br/>#{@message.content.html_safe}</blockquote>".html_safe
end
def preview

View File

@ -127,12 +127,14 @@ class MyController < ApplicationController
end
@user.safe_attributes = params[:user]
@user.lastname = params[:lastname]
@user.firstname = ""
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
#@user.login = params[:login]
unless @user.user_extensions.nil?
if @user.user_extensions.identity == 2
@user.firstname = params[:enterprise_name]
# @user.firstname = params[:enterprise_name]
end
end
@ -144,7 +146,7 @@ class MyController < ApplicationController
# end
@se.school_id = params[:occupation]
@se.gender = params[:gender]
@se.gender = params[:sex]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@se.identity = params[:identity].to_i if params[:identity]

View File

@ -131,6 +131,8 @@ class PraiseTreadController < ApplicationController
@obj = Bid.find_by_id(id)
when 'Contest'
@obj = Contest.find_by_id(id)
when 'Syllabus'
@obj = Syllabus.find_by_id(id)
else
@obj = nil
end

View File

@ -653,12 +653,12 @@ class ProjectsController < ApplicationController
def update
@project.safe_attributes = params[:project]
@project.organization_id = params[:organization_id]
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0
params[:project][:is_public] == "on" ? @project.is_public = 1 : @project.is_public = 0
params[:project][:hidden_repo] == "on" ? @project.hidden_repo = 1 : @project.hidden_repo = 0
# 更新公开私有时同步gitlab公开私有
if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? true : false)
if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? 1 : 0)
g = Gitlab.client
params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
params[:project][:is_public] == "on" ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
end
# end
if validate_parent_id && @project.save

View File

@ -1,8 +1,11 @@
class QualityAnalysisController < ApplicationController
before_filter :find_project_by_project_id#, :except => [:getattachtype]
before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job]
before_filter :authorize
before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job, :index]
layout "base_projects"
include ApplicationHelper
include QualityAnalysisHelper
require 'jenkins_api_client'
require 'nokogiri'
require 'json'
@ -12,72 +15,180 @@ class QualityAnalysisController < ApplicationController
end
# params 说明:{identifier版本库名}
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}
begin
user_name = User.find(params[:user_id]).try(:login)
identifier = params[:identifier]
rep_id = params[:rep_id]
# job_name and sonar_name 前者为job名字后者为jenkins配置名
job_name = "#{user_name}-#{rep_id}"
sonar_name = "#{user_name}:#{rep_id}"
# Checks if the given job exists in Jenkins.
unless @client.job.exists?(job_name)
@g = Gitlab.client
branch = params[:branch]
language = swith_language_type(params[:language])
path = params[:path].blank? ? "./" : params[:path]
qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
version = qa.nil? ? 1 : qa.sonar_version + 1
properties = "sonar.projectKey=#{sonar_name}
sonar.projectName=#{sonar_name}
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"
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)
# 替换配置文件
@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
else
qa.update_attribute(:sonar_version, version)
# jenkins job创建
jenkins_job = @client.job.create("#{job_name}", @doc.to_xml)
logger.info("Jenkins status of create ==> #{jenkins_job}")
# 将地址作为hook值添加到gitlab
@g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}")
# job创建完成后自动运行job,如果运行成功则返回200
code = @client.job.build("#{job_name}")
logger.error("build result ==> #{code}")
# 判断调用sonar分析是否成功
# 等待启动时间处理, 最长时间为30分钟
for i in 0..60 do
sleep(60)
@current_build_status = @client.job.get_current_build_status("#{job_name}")
if (@current_build_status != "not_run" || @current_build_status != "running")
break
if i == 60
@build_console_result = false
break
end
end
end
@console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')
logger.info("@current_build_status is ==> #{@current_build_status}")
logger.info("@console_build is ==> #{@console_build}")
d = @client.job.delete("#{job_name}") if jenkins_job == '200' && code != '201'
logger.error("delete result ==> #{code}")
if qa.blank? && @current_build_status == "success"
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
else
qa.update_attribute(:sonar_version, version)
end
end
rescue => e
puts e
end
respond_to do |format|
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
# format.js{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
end
end
# get language type
def swith_language_type language
if language == "c#"
"cs"
elsif language == "python"
"py"
elsif language == "c"
"c++"
else
language
end
end
def edit
@g = Gitlab.client
gitlab_branches = @g.branches(@project.gpid)
@branch_names = gitlab_branches.map{|b| b.name}
@gitlab_default_branch = @g.project(@project.gpid).default_branch
end
# 更新Jenkins job主要包括相关配置文件参数的更新Trustie平台数据的更新
def update_jenkins_job
begin
rep_id = Repository.where(:project_id => @project.id).first.try(:id)
logger.error("#############################===>666")
sonar_name = @quality_analysis.sonar_name
job_name = "#{@quality_analysis.author_login}-#{rep_id}"
version = @quality_analysis.sonar_version
path = params[:path].blank? ? "./" : params[:path]
language = swith_language_type(params[:language])
branch = params[:branch]
identifier = @quality_analysis.rep_identifier
properties = "sonar.projectKey=#{sonar_name}
sonar.projectName=#{sonar_name}
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.yml
@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
# update成功则返回 200
jenkins_job = @client.job.update("#{job_name}", @doc.to_xml)
get_current_build_status = @client.job.get_current_build_status("Hjqreturn-1280")
logger.error("Failed to update job: ==> #{jenkins_job}") unless jenkins_job == '200'
# 数据更新到Trustie数据库
if jenkins_job == '200'
logger.info("quality_ananlysis will be updated: ==> #{jenkins_job}")
@quality_analysis.path = path
@quality_analysis.language = language
@quality_analysis.branch = branch
@quality_analysis.save
end
rescue Exception => e
logger.error("Update jenkins job: #{e}")
end
respond_to do |format|
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id)}
format.js
end
end
# resource_id: login + @repository.id
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
begin
@branch = params[:branch]
@resource_id = params[:resource_id]
@sonar_address = Redmine::Configuration['sonar_address']
@jenkins_address = Redmine::Configuration['jenkins_address']
if params[:resource_id].nil?
@name_flag = true
projects_date = open(@sonar_address + "/api/projects/index").read
arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
@quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)}
else
if params[:current_build_status] == "failure"
job_name = params[:job_name]
@console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
end
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
rescue => e
puts e
end
end
# Find project of id params[:project_id]
@ -87,6 +198,14 @@ class QualityAnalysisController < ApplicationController
render_404
end
def find_quality_analysis
begin
@quality_analysis = QualityAnalysis.find(params[:id])
rescue
render_404
end
end
# Authorize the user for the requested action
def authorize(ctrl = params[:controller], action = params[:action], global = false)
unless @project.archived? && @project.gpid.nil?
@ -96,4 +215,14 @@ class QualityAnalysisController < ApplicationController
end
end
def connect_jenkins
@gitlab_address = Redmine::Configuration['gitlab_address']
@jenkins_address = Redmine::Configuration['jenkins_address']
# connect jenkins
@client = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => "temp", :password => '123123')
rescue => e
logger.error("failed to connect Jenkins ==> #{e}")
end
end

View File

@ -20,6 +20,8 @@ require 'SVG/Graph/BarHorizontal'
require 'digest/sha1'
require 'redmine/scm/adapters/abstract_adapter'
require 'tempfile'
require 'json'
require 'open-uri'
class ChangesetNotFound < Exception; end
class InvalidRevisionParam < Exception; end
@ -372,7 +374,7 @@ update
@changesets = g.commits(@project.gpid, :ref_name => @rev)
g_project = g.project(@project.gpid)
# 总的提交数
@changesets_all_count = @project.gpid.nil? ? 0 : g_project.commit_count
@changesets_all_count = @project.gpid.nil? ? 0 : commit_count(@project, @rev)
@g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch
# 访问该页面的是会后则刷新
if @project.project_score.nil?

View File

@ -150,4 +150,55 @@ class SchoolController < ApplicationController
format.js
end
end
#申请高校(单位) name:名称 province:省 city:市 address:地址 remarks:备注
def apply_add_school
data = {result:0,name:params[:name],school_id:0}
#0 成功 1参数错误 2名称已存在
data[:result] = 0
#检验参数
if params[:name] == "" || params[:province] == "" || params[:city] == "" || params[:address] == ""
data[:result] = 1
else
school_id = School.find_by_sql("select id from schools where name='#{params[:name]}'").first
if school_id
data[:result] = 2
else
school = School.new
school.name = params[:name].strip
school.pinyin = Pinyin.t(params[:name].strip, splitter: '')
school.save
#status 0未处理 1通过 2拒绝
applyschool = ApplyAddSchools.new
applyschool.school_id = school.id
applyschool.name = school.name
applyschool.province = params[:province]
applyschool.city = params[:city]
applyschool.address = params[:address]
applyschool.remarks = params[:remarks]
applyschool.save
data[:school_id] = school.id
end
end
render :json =>data
end
def search_repeat_schoolname
status = 0
name = params[:name]
if name
school_id = School.find_by_sql("select id from schools where name='#{name}'").first
if school_id
status = 1
end
end
render :json =>status
end
end

View File

@ -1,15 +1,164 @@
# encoding: utf-8
class SyllabusesController < ApplicationController
include ApplicationHelper
helper :attachments
include AttachmentsHelper
include CoursesHelper
before_filter :is_logged, :only => [:index, :show]
before_filter :find_syllabus, :only => [:show]
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus]
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :update_base_info, :delete_syllabus, :delete_des]
def index
user = User.current
@syllabuses = user.syllabuses
end
def show
@courses = @syllabus.courses
#@courses = @syllabus.courses
respond_to do |format|
format.js
format.html{render :layout => 'base_syllabus'}
format.api
end
end
def new
@syllabus = Syllabus.new
render :layout => 'new_base'
end
def create
if User.current.user_extensions.identity
@syllabus = Syllabus.new
@syllabus.title = params[:title]
@syllabus.eng_name = params[:eng_name]
@syllabus.user_id = User.current.id
@syllabus.description = Message.where("id = 19412").first.nil? ? '' : Message.where("id = 19412").first.content
if @syllabus && @syllabus.save
respond_to do |format|
flash[:notice] = l(:notice_successful_create)
format.html {redirect_to syllabus_path(@syllabus)}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'syllabuses', :action => 'show', :id => @syllabus.id) }
end
else
respond_to do |format|
flash[:notice] = l(:notice_create_failed)
format.html { redirect_to new_syllabus_path } #Added by young
format.api { render_validation_errors(@syllabus) }
end
end
end
end
def edit
respond_to do |format|
format.html{render :layout => 'base_syllabus'}
end
end
def delete_syllabus
respond_to do |format|
format.js
end
end
def update
@syllabus.description = params[:syllabus][:description]
@syllabus.des_status = 1
@syllabus.save_attachments(params[:attachments])
if @syllabus.save
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@syllabus.id,OwnerTypeHelper::SYLLABUS
end
redirect_to syllabus_path(@syllabus)
else
redirect_to syllabus_path(@syllabus)
end
end
#删除课程大纲的描述
def delete_des
if @syllabus
@syllabus.description = Message.where("id = 19412").first.nil? ? '' : Message.where("id = 19412").first.content
@syllabus.des_status = 0
@syllabus.attachments.destroy_all
if @syllabus.save
redirect_to syllabus_path(@syllabus)
end
end
end
def destroy
if @syllabus && @syllabus.courses.empty?
@syllabus.destroy
redirect_to user_courselist_user_path(User.current.id)
end
end
#班级列表
def syllabus_courselist
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type
if @order.to_i == @type.to_i
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
else
@c_sort = 2
end
sort_name = "updated_on"
sort_type = @c_sort == 1 ? "asc" : "desc"
@courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
#根据 作业+资源数排序
if @order.to_i == 2
@type = 2
@courses.each do |course|
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
if course[:infocount] < 0
course[:infocount] = 0
end
end
@c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]})
@courses = sortby_time_countcommon_nosticky @courses,sort_name
else
@type = 1
end
#分页
@limit = 10
@is_remote = true
@atta_count = @courses.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@courses = paginateHelper @courses,@limit
respond_to do |format|
format.js
format.html{render :layout => 'base_syllabus'}
end
end
#修改英文名称
def edit_syllabus_eng_name
if @syllabus
@syllabus.update_column("eng_name",params[:eng_name])
end
respond_to do |format|
format.js
end
end
#编辑属性
def update_base_info
if @syllabus
@syllabus.update_attributes(:credit => params[:credit], :hours => params[:hours], :theory_hours => params[:theory_hours], :practice_hours => params[:practice_hours], :applicable_major => params[:applicable_major], :pre_course => params[:pre_course])
@syllabus.update_attributes(:syllabus_type => params[:syllabus_type])
respond_to do |format|
format.js
end
end
end
private

View File

@ -13,6 +13,7 @@ class TagsController < ApplicationController
include ForumsHelper
include AttachmentsHelper
include ContestsHelper
include SyllabusesHelper
include ActsAsTaggableOn::TagsHelper
include TagsHelper
include FilesHelper
@ -529,6 +530,8 @@ class TagsController < ApplicationController
@obj = Course.find_by_id(@obj_id)
when '10'
@obj = Attachment.find_by_id(@obj_id)
when '11'
@obj = Syllabus.find_by_id(@obj_id)
else
@obj = nil
end
@ -619,6 +622,9 @@ class TagsController < ApplicationController
when '9' then
@obj = Course.find_by_id(obj_id)
@obj_pages, @courses_results, @results_count = for_pagination(get_courses_by_tag(selected_tags))
when '11' then
@obj = Syllabus.find_by_id(obj_id)
@obj_pages, @syllabuses_results, @results_count = for_pagination(get_syllabuses_by_tag(selected_tags))
else
@obj = nil
end
@ -684,6 +690,8 @@ class TagsController < ApplicationController
return 'Course'
when '10'
return 'Attachment'
when '11'
return 'Syllabus'
else
render_error :message => e.message
return

View File

@ -90,6 +90,8 @@ class UsersController < ApplicationController
case params[:type]
when 'JournalsForMessage'
@comment = JournalsForMessage.find params[:comment].to_i
when 'Message'
@comment = Message.find params[:comment].to_i
end
end
@ -111,6 +113,13 @@ class UsersController < ApplicationController
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'JournalsForMessage'
when 'Message'
@reply = Message.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@is_course = params[:is_course]
@is_board = params[:is_board]
@type = 'Message'
end
respond_to do |format|
format.js
@ -1248,6 +1257,12 @@ class UsersController < ApplicationController
render :layout=>'new_base_user'
end
#给某人留言
def feedBackTo
end
def user_comments
end
@ -1367,7 +1382,15 @@ class UsersController < ApplicationController
#显示更多用户课程
def user_courses4show
@page = params[:page].to_i + 1
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5)
@type = params[:type]
if @type == 'User'
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5)
@all_count = @user.courses.visible.where("is_delete =?", 0).count
elsif @type == 'Syllabus'
@syllabus = Syllabus.where("id = #{params[:syllabus]}").first
@courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5)
@all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count
end
end
#显示更多用户项目
@ -3176,23 +3199,26 @@ class UsersController < ApplicationController
@c_sort = 2
end
sort_name = "updated_on"
sort_name = "updated_at"
sort_type = @c_sort == 1 ? "asc" : "desc"
# @courses = @user.courses.visible.where("is_delete =?", 0).order("#{sort_name} #{sort_type}")
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
@courses = @user.courses.visible.where("is_delete =?", 0)
syllabus_ids = @courses.empty? ? '(-1)' : "(" + @courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
@syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}")
#根据 作业+资源数排序
if @order.to_i == 2
@type = 2
@courses.each do |course|
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
if course[:infocount] < 0
course[:infocount] = 0
@syllabus.each do |syllabus|
count = 0
courses = @courses.where("syllabus_id = #{syllabus.id}")
courses.each do |c|
count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count)
end
syllabus[:infocount] = count
end
@c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]})
@courses = sortby_time_countcommon_nosticky @courses,sort_name
@c_sort == 1 ? (@syllabus = @syllabus.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabus = @syllabus.sort{|x,y| y[:infocount] <=> x[:infocount]})
@syllabus = sortby_time_countcommon_nosticky @syllabus,sort_name
else
@type = 1
end
@ -3200,10 +3226,10 @@ class UsersController < ApplicationController
#分页
@limit = 10
@is_remote = true
@atta_count = @courses.count
@atta_count = @syllabus.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@courses = paginateHelper @courses,@limit
@syllabus = paginateHelper @syllabus,@limit
respond_to do |format|
format.js
@ -3264,10 +3290,18 @@ class UsersController < ApplicationController
@journals = obj.children.reorder("created_at desc")
when 'Message'
obj = Message.where('id = ?', params[:id].to_i).first
@journals = obj.children.reorder("created_on desc")
@type = 'Message'
@is_course = params[:is_course]
@is_board = params[:is_board]
@user_activity_id = params[:div_id].to_i if params[:div_id]
comments = []
@journals = get_all_children(comments, obj)
when 'News'
obj = News.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")
when 'Syllabus'
obj = Syllabus.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")
when 'JournalsForMessage'
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
journals = []

View File

@ -264,6 +264,28 @@ class WordsController < ApplicationController
end
end
#课程大纲的回复
def leave_syllabus_message
if User.current.logged?
@user = User.current
@syllabus = Syllabus.find(params[:id]);
if params[:comment].size>0 && User.current.logged? && @user
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id])
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
end
redirect_to syllabus_path(@syllabus)
else
flash[:error] = feedback.errors.full_messages[0]
end
end
else
render_403
end
end
#作业的回复
def leave_homework_message
if User.current.logged?
@ -337,6 +359,27 @@ class WordsController < ApplicationController
UserExtensions.introduction(user, message)
redirect_to user_url(user.id)
end
#邮箱激活问题留言 留言成功给出提示框
def leave_email_activation_message
status = 1 #成功
me = User.find(params[:user])
if me
#课程使者id=1
@user = User.find(1)
if params[:text].size>0 && @user
# @user.add_jour(me, params[:text])
#私信
message = "<span style='color:red;'>【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】</span><br>"+params[:text]
@user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1)
else
status = 0
end
render :json => status
else
render_403
end
end
private

View File

@ -803,22 +803,22 @@ module ApplicationHelper
end
# 获取Gitlab版本库提交总数
def commit_count(project)
def commit_count(project, branch)
g = Gitlab.client
#add by hx
if g.commits(project.gpid , :page=>200).count > 0
if g.commits(project.gpid, :ref_name => @rev , :page=>200).count > 0
count = 4020
elsif g.commits(project.gpid , :page=>25).count==0
elsif g.commits(project.gpid , :page=>25, :ref_name => branch).count==0
count = count_commits(project.gpid , 0 , 25)
elsif g.commits(project.gpid , :page=>50).count ==0
elsif g.commits(project.gpid , :page=>50, :ref_name => branch).count ==0
count = count_commits(project.gpid , 25 , 50)+ 25 * 20
elsif g.commits(project.gpid , :page=>75).count ==0
elsif g.commits(project.gpid , :page=>75, :ref_name => branch).count ==0
count = count_commits(project.gpid , 50 , 75)+ 50 * 20
elsif g.commits(project.gpid , :page=>100).count== 0
elsif g.commits(project.gpid , :page=>100, :ref_name => branch).count== 0
count = count_commits(project.gpid , 75 , 100) + 75 * 20
elsif g.commits(project.gpid , :page=>125).count==0
elsif g.commits(project.gpid , :page=>125, :ref_name => branch).count==0
count = count_commits(project.gpid , 100 , 125) + 100 * 20
elsif g.commits(project.gpid , :page=>150).count==0
elsif g.commits(project.gpid , :page=>150, :ref_name => branch).count==0
count = count_commits(project.gpid , 125 , 150) + 125 * 20
else
count = count_commits(project.gpid , 150 ,200) + 150 * 20
@ -832,7 +832,7 @@ module ApplicationHelper
if $g.commits(project_id,:page => page).count == 0
break
else
count = count + $g.commits(project_id,:page => page).count
count = count + $g.commits(project_id, :ref_name => @rev, :page => page).count
end
end
return count
@ -1079,6 +1079,8 @@ module ApplicationHelper
title << @organization.name
elsif @user
title << @user.try(:realname)
elsif @syllabus
title << @syllabus.title
else
title << (User.current.id == 2 ? "未登录" : User.current.try(:realname))
end
@ -3136,9 +3138,9 @@ def get_reply_parents_no_root parents_rely, comment
parents_rely
end
#获取留言的所有子节点
#获取所有子节点
def get_all_children result, jour
if jour.kind_of? JournalsForMessage
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message)
jour.children.each do |jour_child|
result << jour_child
get_all_children result, jour_child

View File

@ -671,6 +671,22 @@ module CoursesHelper
is_current_term || is_next_term
end
#课程大纲下拉框
def syllabus_option
type = []
option1 = []
option1 << "请选择课程"
option1 << 0
type << option1
Syllabus.all.each do |syllabus|
option = []
option << syllabus.title
option << syllabus.id
type << option
end
type
end
#获取课程动态
def get_course_activity courses, activities
@course_ids=activities.keys()
@ -777,6 +793,15 @@ module CoursesHelper
result
end
def visable_course_homework course
if User.current.admin? || User.current.allowed_to?(:as_teacher,course)
homework_num = course.homework_commons.count
else
homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count
end
homework_num
end
def zh_course_role role
if role == "TeachingAsistant"
result = l(:label_TA)

View File

@ -23,7 +23,7 @@ module OrganizationsHelper
when 'activity' then
return '动态'
when 'course' then
return '课程'
return '班级'
when 'project' then
return '项目'
end

View File

@ -7,5 +7,6 @@ module OwnerTypeHelper
BID = 6
JOURNALSFORMESSAGE = 7
HOMEWORKCOMMON = 8
BLOGCOMMENT=9
BLOGCOMMENT = 9
SYLLABUS = 10
end

View File

@ -3,19 +3,19 @@ module QualityAnalysisHelper
def sqale_rating_status val
arr = []
if val.to_i > 0 && val.to_i < 5
if val < 5
arr << "很好"
arr << "b_green2"
elsif val.to_i > 5 && val.to_i < 10
elsif val. > 5 && val < 10
arr << "较好"
arr << "b_slow_yellow"
elsif val.to_i > 10 && val.to_i < 20
elsif val > 10 && val < 20
arr << "中等"
arr << "b_yellow"
elsif val.to_i > 20 && val.to_i < 50
elsif val > 20 && val < 50
arr << "较差"
arr << "b_slow_red"
elsif val.to_i > 20
elsif val > 20
arr << "很差"
arr << "b_red"
end
@ -23,13 +23,13 @@ module QualityAnalysisHelper
def complexity_status val
arr = []
if val.to_i < 10
if val < 10
arr << "良好"
arr << "b_green2"
elsif val.to_i > 10 && val.to_i < 15
elsif val > 10 && val < 15
arr << "较高"
arr << "b_yellow"
elsif val.to_i > 15
elsif val > 15
arr << "很高"
arr << "b_red"
end
@ -37,13 +37,13 @@ module QualityAnalysisHelper
def duplicated_lines_density_status val
arr = []
if val.to_i < 30
if val < 30
arr << "良好"
arr << "b_green2"
elsif val.to_i > 30 && val.to_i < 50
elsif val > 30 && val < 50
arr << "较高"
arr << "b_yellow"
elsif val.to_i > 50
elsif val > 50
arr << "很高"
arr << "b_red"
end
@ -51,28 +51,28 @@ module QualityAnalysisHelper
def comment_lines_density_status val
arr = []
if val.to_i < 20
if val < 20
arr << "较低"
arr << "b_yellow"
elsif val.to_i > 20 && val.to_i < 50
elsif val > 20 && val < 50
arr << "正常"
arr << "b_green2"
elsif val.to_i > 50
elsif val > 50
arr << "较高"
arr << "b_red"
end
end
def score_sqale_rating val
if val.to_i > 0 && val.to_i < 5
if val > 0 && val < 5
"5"
elsif val.to_i > 5 && val.to_i < 10
elsif val > 5 && val < 10
"4"
elsif val.to_i > 10 && val.to_i < 20
elsif val > 10 && val < 20
"3"
elsif val.to_i > 20 && val.to_i < 50
elsif val > 20 && val < 50
"2"
elsif val.to_i > 20
elsif val > 20
"1"
end
end

View File

@ -41,6 +41,11 @@ module RepositoriesHelper
identifiers.include?(iden) ? false :true
end
def quality_analysis login, rep_id
long_rep_id = "#{login}:#{rep_id}"
QualityAnalysis.where(:sonar_name => long_rep_id).first
end
# 获取文件目录的最新动态
def get_trees_last_changes(project_id, rev, ent_name)
g = Gitlab.client

View File

@ -1,2 +1,72 @@
# encoding: utf-8
module SyllabusesHelper
def get_syllabuses_by_tag(tag_name)
Syllabus.tagged_with(tag_name).order('updated_at desc')
end
def teacher_count syllabus
count = 0
courses = syllabus.courses
unless courses.empty?
courses.each do |c|
count += TeacherAndAssistantCount c
end
end
count
end
def student_count syllabus
count = 0
courses = syllabus.courses
unless courses.empty?
courses.each do |c|
count += studentCount c
end
end
count
end
def file_count syllabus
count = 0
courses = syllabus.courses
unless courses.empty?
courses.each do |c|
count += visable_attachemnts_incourse(c).count
end
end
count
end
#课程性质下拉框
def syllabus_type
type = []
option1 = []
option2 = []
option3 = []
option4 = []
option5 = []
option6 = []
option1 << "请选择"
option1 << 0
option2 << "公共必修课"
option2 << 1
option3 << "学科必修课"
option3 << 2
option4 << "专业选修课"
option4 << 3
option5 << "实践必修课"
option5 << 4
option6 << "实践选修课"
option6 << 5
type << option1
type << option2
type << option3
type << option4
type << option5
type << option6
type
end
end

View File

@ -23,6 +23,8 @@ module TagsHelper
@obj= Course.find_by_id(obj_id)
when '10'
@obj = Attachment.find_by_id(obj_id)
when '11'
@obj = Syllabus.find_by_id(obj_id)
else
raise Exception, '[TagsHelper] ===> tag type unknow.'
end

View File

@ -32,7 +32,7 @@ module UsersHelper
def get_resource_type type
case type
when 'Course'
'课程资源'
'班级资源'
when 'Project'
'项目资源'
when 'Issue'
@ -122,11 +122,11 @@ module UsersHelper
when 'homework'
'作业消息'
when 'course_message'
'课程讨论'
'班级讨论'
when 'course_news'
'课程通知'
'班级通知'
when 'poll'
'课程问卷'
'班级问卷'
when 'issue'
'项目任务'
when 'forge_message'

View File

@ -0,0 +1,3 @@
class ApplyAddSchools < ActiveRecord::Base
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
end

View File

@ -24,6 +24,7 @@ class Attachment < ActiveRecord::Base
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'"
belongs_to :organization, foreign_key: 'container_id', conditions: "attachements.container_type = 'Organization'"
belongs_to :syllabus, foreign_key: 'container_id', conditions: "attachements.container_type = 'Syllabus'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"

View File

@ -90,7 +90,8 @@ class Course < ActiveRecord::Base
'description',
'class_period',
'open_student',
'is_delete'
'is_delete',
'syllabus_id'
acts_as_customizable
@ -470,8 +471,7 @@ class Course < ActiveRecord::Base
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
update_attribute(:invite_code, code)
end
code
end

View File

@ -1,5 +1,5 @@
class QualityAnalysis < ActiveRecord::Base
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language, :sonar_name
def user_rep_name
self.author_login+":"+self.rep_identifier

View File

@ -1,5 +1,46 @@
# encoding: utf-8
class Syllabus < ActiveRecord::Base
include Redmine::SafeAttributes
include ApplicationHelper
acts_as_taggable
acts_as_attachable
has_many_kindeditor_assets :assets, :dependent => :destroy
belongs_to :user
has_many :courses
attr_accessible :description, :title
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
attr_accessible :description, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
safe_attributes 'title', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course'
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::SYLLABUS
end
def syllabus_type_str
case self.syllabus_type
when 1
type = "公共必修课"
when 2
type = "学科必修课"
when 3
type = "专业选修课"
when 4
type = "实践必修课"
when 5
type = "实践选修课"
end
type
end
###添加回复
def self.add_syllabus_jour(user, notes, id , options = {})
syllabus = Syllabus.find(id)
if options.count == 0
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
else
jfm = syllabus.journals_for_messages.build(options)
end
jfm.save
jfm
end
end

View File

@ -213,6 +213,7 @@ class CoursesService
#@course.safe_attributes(current_user,params[:course])
#@course.password = params[:course][:password]
@course.tea_id = current_user.id
@course.syllabus_id = params[:syllabus_id].to_i
@course.term = params[:term]
@course.time = params[:time]
@course.end_term = params[:end_term]
@ -271,6 +272,7 @@ class CoursesService
course.send(:safe_attributes=, params[:course], current_user)
#course.safe_attributes = params[:course]
#course.password = params[:course][:password]
course.syllabus_id = params[:syllabus_id].to_i
course.time = params[:time]
course.term = params[:term]
course.end_time = params[:end_time]
@ -322,15 +324,15 @@ class CoursesService
define_error [
0, '加入成功',
1, '密码错误',
2, '课程已过期 请联系课程管理员重启课程。',
3, '您已经加入了课程',
4, '您加入的课程不存在',
2, '班级已过期 请联系班级管理员重启班级。',
3, '您已经加入了班级',
4, '您加入的班级不存在',
5, '您还未登录',
6, '申请成功,请等待审核完毕',
7, '您已经发送过申请了,请耐心等待',
8, '您已经是该课程的教师了',
9, '您已经是该课程的教辅了',
10, '您已经是该课程的管理员了',
8, '您已经是该班级的教师了',
9, '您已经是该班级的教辅了',
10, '您已经是该班级的管理员了',
'未知错误,请稍后再试'
]
end

View File

@ -0,0 +1,58 @@
<div class="new_content">
<div class="email_verify">
<p class="email_verify_prompt"><span class="icons_email_prompt"></span>您的账号尚未激活,请先进入您的注册邮箱,激活您的账号。</p>
<button class="email_verify_btn mt30 ml30" onclick = "resendMail('<%= resendmail_path(@user) %>','<%= @user.id %>');">重新发送激活邮件</button>
<%#= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :class=>"email_verify_btn mt30 ml30", :remote => true, :method => 'get' %>
<ul class="email_prompt_txt ml30 mt30">
<p class="email_prompt_p">如果您尚未收到激活邮件,请按照以下步骤操作:</p>
<li>检查邮箱的“订阅邮件”、“垃圾邮件”,可能会发现激活邮件。 </li>
<li>如果激活邮件已无效,请点击重新发送激活邮件按钮。</li>
<li>如果您无法收到激活邮件,请您直接给我们管理员留言:</li>
<div class=" mt10">
<textarea style="resize: none;" class="email_prompt_mes" placeholder="请管理员尽快帮我解决邮箱激活问题"></textarea>
<button class="email_sub_btn fr" onclick="leave_email_activation_message('<%= leave_email_activation_message_path(1)%>','<%= @user.id %>');">确定</button>
<div class="cl"></div>
</div>
</ul>
</div>
</div>
<script type="text/javascript">
function resendMail(url,id)
{
$.get(
url,
{user: id },
function (data) {
//邮箱@之前用a**b格式显示
var mail = data.email;
var pos = mail.indexOf("@");
var restr = mail.substring(1,pos-1);
if( mail.split("@")[0].length > 2 ){
mail = mail.replace(restr,"***");
}
$(".email_verify_btn").replaceWith("<p class='email_verify_p mt30 ml30'>激活邮件已发送至您的注册邮箱("+mail+"),请及时登录邮箱进行验证。</p>");
}
);
}
function leave_email_activation_message(url,user)
{
if ($(".email_prompt_mes").val().length == 0){
//弹框请他输入文字
var htmlvalue = "</br><div style='width:550px;text-align:center'>您的留言不能为空</div></br><div style='width:67px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn' onclick='hideModal()'>确定</a></div>";
pop_up_box(htmlvalue,580,30,50);
return;
}
$.ajax({
url: url,
data: {user: user, text: $(".email_prompt_mes").val() },
type: "POST",
success: function (data) {
var htmlvalue = "<div class='email_tancon'><h2 class='email_tan_title'>您的留言已发送</h2><p class='email_tan_p'>我们将尽快处理好,并通过邮件通知您。感谢您的反馈!</p></div>"
pop_up_box(htmlvalue, 580, 30, 45);
$(".email_prompt_mes").val("");
}
});
}
</script>

View File

@ -1,127 +0,0 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<!-- end -->
<h3><%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h3>
<%= labelled_form_for @user, :url => register_path do |f| %>
<%= error_messages_for 'user' %>
<div class="box tabular">
<% if @user.auth_source_id.nil? %>
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
<em class="info" style="color: #acaeb1"><%= l(:label_max_number) %></em>
</p>
<p><%= f.password_field :password, :size => 25, :required => true %><span id="valid_user_password"></span>
<em class="info" style="color: #acaeb1"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
</p>
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %><span id="valid_password" style="padding-left: 10px;"></span></p>
<% end %>
<p>
<%= f.text_field :mail,:size => 25, :required => true %>
<span id="valid_user_mail" ></span>
</p>
<p>
<em class="info" style="color: #acaeb1">
<p><%= "#{l(:label_mail_attention)} " %></p>
<p><%= "#{l(:label_mail_attention1)} " %></p>
</em>
</p>
<!-- end -->
</div>
<p>
<table>
<tr>
<td><%= submit_tag l(:button_submit) %></td>
</tr>
</table>
</p>
<% end %>
<% if Setting.openid? %>
<p><%= f.text_field :identity_url %></p>
<% end %>
<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
</div>
<% password_min_length = Setting.password_min_length %>
<script type="text/javascript">
jQuery(document).ready(function () {
var $login = $('#user_login')
var $mail = $('#user_mail')
var $password = $('#user_password')
var $password_confirmation = $('#user_password_confirmation')
$login.blur(function (event) {
if ($(this).is('#user_login')) {
$.get(
'<%=account_valid_ajax_path%>',
{ valid: "login",
value: this.value },
function (data) {
if (data.valid) {
$('#valid_user_login').html('<span class="green">' + data.message + "</span>");
} else {
$('#valid_user_login').html('<span class="red">' + data.message + "</span>");
}
});
}
;
});
$mail.blur(function (event) {
if ($(this).is('#user_mail')) {
$.get('<%=account_valid_ajax_path%>',
{ valid: "mail",
value: this.value },
function (data) {
if (data.valid) {
$('#valid_user_mail').html('<span class="green">' + data.message + "</span>");
} else {
$('#valid_user_mail').html('<span class="red">' + data.message + "</span>");
}
});
}
;
});
$password.blur(function () {
var pas1 = document.getElementById("user_password").value;
var password_min_length = <%= password_min_length %>
if (pas1.length >= password_min_length) {
$('#valid_user_password').html('<span class="green">'+ "</span>");
}
else {
$('#valid_user_password').html('<span class="red">' + "<%= l(:setting_password_min_length_limit, :count => password_min_length) %>" + "</span>");
}
});
$password_confirmation.blur(function () {
var password_min_length = <%= password_min_length %>
var pas1 = document.getElementById("user_password").value;
var pas2 = document.getElementById("user_password_confirmation").value;
if (pas1.length >= password_min_length && pas1 == pas2 ) {
$('#valid_password').html('<span class="green">' + "<%= l(:setting_password_success) %>"+ "</span>");
}
else {
$('#valid_password').html('<span class="red">' + "<%= l(:setting_password_error) %>" + "</span>");
}
});
});
</script>

View File

@ -39,7 +39,7 @@
<%= number_to_human_size(resource.filesize)%>
</td>
<td style=" text-align: center;">
课程资源
班级资源
</td>
<td style=" text-align: center;">
<%= format_date(resource.created_on)%>

View File

@ -2,31 +2,31 @@
<% if defined?(container) && container && container.saved_attachments %>
<% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="sub_btn">
<p id="attachments_<%= i+1 %>" class="sub_btn">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly=>'readonly')%>
<%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<!--<span class="ispublic-label"><%#= l(:field_is_public)%>:</span>-->
<%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "#{i+1}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload', :containerid => "2") %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
</p>
<% end %>
<% else %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<p id="attachments_<%= i+1 %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly=>'readonly')%>
<%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<!--<span class="ispublic-label"><%#= l(:field_is_public)%>:</span>-->
<%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "#{i+1}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload', :containerid => "2") %>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
</p>
<% end %>
<% end %>
<% end %>

View File

@ -91,9 +91,10 @@
</div>
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @article.content.html_safe%>
</div>
<!--<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >-->
<!--<%#= @article.content.html_safe%>-->
<!--</div>-->
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>@article.id, :content=>@article.content} %>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%#= link_to_attachments_course @topic, :author => false %>
@ -192,12 +193,12 @@
</div>
<script type="text/javascript">
$(function(){
var postContent = $("#message_description_<%= @article.id %>").html();
postContent = postContent.replace(/&nbsp;/g," ");
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$("#message_description_<%= @article.id %>").html(postContent);
autoUrl('message_description_<%= @article.id %>');
// var postContent = $("#message_description_<%#= @article.id %>").html();
// postContent = postContent.replace(/&nbsp;/g," ");
// postContent= postContent.replace(/ {2}/g,"&nbsp; ");
// postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
// postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
// $("#message_description_<%#= @article.id %>").html(postContent);
// autoUrl('message_description_<%#= @article.id %>');
});
</script>

View File

@ -22,7 +22,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
课程问答区
班级问答区
</div>
</div>
<div nhname="topic_form">

View File

@ -1,6 +1,6 @@
<script type="text/javascript">
function submit_copy_course() {
if(regex_course_name('new')&&regex_course_class_period('new')&&regex_time_term('new'))
if(regex_syllabus_option('new')&&regex_course_name('new')&&regex_course_class_period('new')&&regex_time_term('new'))
{
$("#new_course").submit();
document.getElementById("submit_copy_course").onclick = "";
@ -51,13 +51,15 @@
<!--</span>-->
<div class="cl"></div>
</li>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
<span class="c_red" id="new_syllabus_notice" style="display: none;">请选择课程大纲</span>
</li>
<li class="ml45">
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="new_course_name" class="courses_input grey_border" maxlength="100" onkeyup="regex_course_name('new');" value="<%=@course.name %>">
<span class="c_red" id="new_course_name_notice" style="display: none;">课程名称不能为空</span>
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空</span>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
@ -76,7 +78,7 @@
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@new_course.end_time),@new_course.end_time), {:id=>"new_end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@new_course.end_term || cur_course_term),{:id=>"new_end_term"} %>
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则与开始学期保持一致。</span>
</li>
<div class="cl"></div>
<!--<li class="ml45 mb10">
@ -96,7 +98,7 @@
<li class=" mb5 ml85">
<label >公开&nbsp;&nbsp;</label>
<input <%= @course.is_public == 1 ? 'checked' : ''%> id="course_is_public" name="course[is_public]" type="checkbox" value="<%=@course.is_public.to_i %>">
<span class="c_grey">(选中后课外用户可见该课程,否则仅对课内成员可见)</span>
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class="ml85">
@ -106,13 +108,13 @@
<label class="fl">
<input name="course_content_type[]" type="checkbox" value="0" class="resourceCopy"/>
作业</label>
<span class="c_red ml5 fl mb10 w490">复制到新中的作业将在1个月后发布、2个月后提交截止请您调整作业的发布时间、截止时间等时间节点。</span>
<span class="c_red ml5 fl mb10 w490">复制到新班级中的作业将在1个月后发布、2个月后提交截止请您调整作业的发布时间、截止时间等时间节点。</span>
</li>
<li class="sendCourseName fl ml5">
<label class="fl">
<input name="course_content_type[]" type="checkbox" value="1" class="resourceCopy"/>
资源</label>
<span class="c_red ml5 fl mb10">复制到新的资源将在1个月后发布请您调整资源的发布时间否则学生可能看不到资源。</span>
<span class="c_red ml5 fl mb10">复制到新班级的资源将在1个月后发布请您调整资源的发布时间否则学生可能看不到资源。</span>
</li>
</ul>
<!--<ul class="fl" id="copyResource2">

View File

@ -2,9 +2,9 @@
<ul class="rankList">
<h4>
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
<%= link_to "课程活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => '' %>
<%= link_to "班级活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => '' %>
<% else %>
课程活跃度
班级活跃度
<% end %>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
</h4>
@ -17,7 +17,7 @@
问答回复:回复数 x 1 <br/>
作业留言:留言数 x 1 <br/>
通知留言:留言数 x 1 <br/>
课程留言:留言数 x 1 <br/>
班级留言:留言数 x 1 <br/>
总得分为以上得分之和</div>
</div>
<% contributor_course_scor(course.id).each do |contributor_score| %>
@ -47,7 +47,7 @@
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
班级留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
<%# end %>

View File

@ -3,9 +3,9 @@
<ul class="rankList">
<h4>
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
<%= link_to "课程英雄榜", course_member_path(course, :role => 2), :class => '' %>
<%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => '' %>
<% else %>
<span>课程英雄榜</span>
<span>班级英雄榜</span>
<% end %>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
<div style="cursor:pointer;" class="numIntro undis">

View File

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>快速进入课程通道</title>
<title>快速进入班级通道</title>
<style>
#popbox{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
#popbox div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
@ -49,8 +49,8 @@
<div id="popbox">
<div class="C" >
<div class="C_top">
<h2>快速加入课程通道</h2>
<p>只要持有课程邀请码,就可以快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!</p>
<h2>快速加入班级通道</h2>
<p>只要持有班级邀请码,就可以快速加入所在班级。班级页面搜索不到的私有班级只能从此通道进入哦!</p>
</div>
<div class="C_form">
<%= form_tag({:controller => 'courses',
@ -62,11 +62,11 @@
<li>
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<span class="tips" style="width: 90px; display: inline-block;">课程邀请码:</span>
<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">课程邀请码是所在课程页面中显示的邀请码</li>
<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%>

View File

@ -15,7 +15,7 @@
问答回帖数 x 1 = 0 x 1 = 0</br>
作业留言数 x 1 = 0 x 1 = 0</br>
通知留言数 x 1 = 0 x 1 = 0</br>
课程留言数 x 1 = 0 x 1 = 0</br>
班级留言数 x 1 = 0 x 1 = 0</br>
总得分0
</div>
<% else %>
@ -30,7 +30,7 @@
问答回帖数 x 1 = <%= act_score.message_reply_num.to_i %> x 1 = <%= act_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= act_score.homework_journal_num.to_i %> x 1 = <%= act_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= act_score.news_reply_num.to_i %> x 1 = <%= act_score.news_reply_num.to_i %></br>
课程留言数 x 1 = <%= act_score.journal_num.to_i %> x 1 = <%= act_score.journal_num.to_i %></br>
班级留言数 x 1 = <%= act_score.journal_num.to_i %> x 1 = <%= act_score.journal_num.to_i %></br>
总得分:<%=total_score %>
</div>
<% end %>

View File

@ -10,12 +10,12 @@ window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/co
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
alert("您已经加入了班级");
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 4 %>
alert("您加入的课程不存在");
alert("您加入的班级不存在");
<% elsif @state == 5 %>
alert("您还未登录");
<% elsif @state == 6 %>
@ -25,15 +25,15 @@ hidden_join_course_form();
alert("您已经发送过申请了,请耐心等待");
hidden_join_course_form();
<% elsif @state == 8%>
alert("您已经是该课程的教师了");
alert("您已经是该班级的教师了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 9%>
alert("您已经是该课程的教辅了");
alert("您已经是该班级的教辅了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 10%>
alert("您已经是该课程的管理员了");
alert("您已经是该班级的管理员了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% else %>

View File

@ -4,12 +4,21 @@
<div class="hwork_new">
<ul>
<%= labelled_form_for @course do |f| %>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<% if @syllabus.nil? %>
<%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
<% else %>
<span><%=@syllabus.title %></span>
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
<% end %>
<span class="c_red" id="new_syllabus_notice" style="display: none;">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
</li>
<div class="cl"></div>
<li class="ml45">
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name('new');">
<span class="c_red" id="new_course_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
</li>
<div class="cl"></div>
<li class="ml45">
@ -29,7 +38,7 @@
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"new_end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"new_end_term"} %>
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则与开始学期保持一致。</span>
</li>
<div class="cl"></div>
<!--<li class="ml45 mb10">
@ -49,19 +58,19 @@
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input id="course_is_public" name="course[is_public]" type="checkbox" value="1">
<span class="c_grey">(选中后课外用户可见该课程,否则仅对课内成员可见)</span>
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生列表公开&nbsp;&nbsp;</label>
<input id="course_open_student" name="course[open_student]" type="checkbox" value="1">
<span class="c_grey">(选中后课外用户可见学生列表,否则仅对课内成员可见)</span>
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生上传资源&nbsp;&nbsp;</label>
<input <%= @course.publish_resource == 1 ? 'checked' : ''%> id="course_publish_resource" name="course[publish_resource]" type="checkbox" />
<span class="c_grey">(选中后允许学生上传课程资源,否则不允许)</span>
<span class="c_grey">(选中后允许学生上传班级资源,否则不允许)</span>
<div class="cl"></div>
</li>
<li class=" ml90" >

View File

@ -9,9 +9,9 @@
}
<% else %>
<% if @course.is_public? %>
$("#show_course_<%= @course.id %>").attr("title","公开课程<%= @course.name %><%= @course.time.to_s+ @course.term %>");
$("#show_course_<%= @course.id %>").attr("title","公开班级<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% else %>
$("#show_course_<%= @course.id %>").attr("title","私有课程<%= @course.name %><%= @course.time.to_s+ @course.term %>");
$("#show_course_<%= @course.id %>").attr("title","私有班级<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% end %>
$("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true},
:id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>');

View File

@ -25,16 +25,19 @@
<div class="hwork_dis" id="tbc_01" style="padding-top: 10px;">
<ul>
<%= labelled_form_for @course do |f| %>
<li class="ml45 mb10">
<li class="ml45 mb10">
<%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %>
<div class="cl"></div>
</li>
<li class="ml45">
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:280px'} %>
<span class="c_red" id="edit_syllabus_notice" style="display: none;">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="edit_course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name('edit');" value="<%= @course.name%>">
<span class="c_red" id="edit_course_name_notice" style="display: none;">课程名称不能为空</span>
<span class="c_red" id="edit_course_name_notice" style="display: none;">班级名称不能为空</span>
<input type="password" style="top: -100000px;position: fixed;">
</li>
<div class="cl"></div>
@ -73,19 +76,19 @@
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input <%= @course.is_public == 1 ? 'checked' : ''%> id="course_is_public" name="course[is_public]" type="checkbox">
<span class="c_grey">(选中后课外用户可见该课程,否则仅对课内成员可见)</span>
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生列表公开&nbsp;&nbsp;</label>
<input <%= @course.open_student == 1 ? 'checked' : ''%> id="course_open_student" name="course[open_student]" type="checkbox" style="margin-left: 1px;"/>
<span class="c_grey">(选中后课外用户可见学生列表,否则仅对课内成员可见)</span>
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生上传资源&nbsp;&nbsp;</label>
<input <%= @course.publish_resource == 1 ? 'checked' : ''%> id="course_publish_resource" name="course[publish_resource]" type="checkbox" style="margin-left: 1px;"/>
<span class="c_grey">(选中后允许学生上传课程资源,否则不允许)</span>
<span class="c_grey">(选中后允许学生上传班级资源,否则不允许)</span>
<div class="cl"></div>
</li>
<li class=" ml90" >
@ -96,11 +99,11 @@
<% end %>
</ul>
<% if @course.is_delete == 1 %>
<div class="mt30"><%=link_to "恢复该课程", renew_course_path(@course) %></div>
<div class="mt30"><%=link_to "恢复该班级", renew_course_path(@course) %></div>
<% else %>
<div class="mt30">
<img src="/images/pic_del.gif" class="mr5"><%=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %>
<span>(友情提示:删除该课程后如果您想恢复该课程,请联系系统管理员!)</span>
<img src="/images/pic_del.gif" class="mr5"><%=link_to "删除该班级", course_path(@course), :method => :delete, :confirm=>"确认要删除该班级吗?" %>
<span>(友情提示:删除该班级后如果您想恢复该班级,请联系系统管理员!)</span>
</div>
<% end %>

View File

@ -9,7 +9,7 @@
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">课程动态</div>
<div class="NewsBannerName">班级动态</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">

View File

@ -17,7 +17,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
@ -50,7 +50,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
@ -61,7 +61,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
@ -72,7 +72,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
@ -83,7 +83,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
@ -94,7 +94,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
@ -105,7 +105,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
@ -116,7 +116,7 @@
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectType fl">班级资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>

View File

@ -1,6 +1,6 @@
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
<div class="upload_con">
<h2>将此课件引入我的课程资源库</h2>
<h2>将此课件引入我的班级资源库</h2>
<% if error == '403' %>
<div class="upload_box">
<div style="color: red;">您没有权限引用此资源</div>

View File

@ -48,7 +48,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户、资源以及帖子"/>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>

View File

@ -16,7 +16,7 @@
<%= f.text_area :subject, :id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();">
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;height:21px" id="" onclick="f_submit();">
<%= l(:label_submit)%>
</a>
<% end %>
@ -25,7 +25,9 @@
<!--<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">-->
<%#= l(:label_technical_support) %>
<!--白&nbsp;&nbsp;&nbsp;羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad-->
<p style="text-align: center"> 请加入师姐师兄答疑群</p> <p style="text-align: center">QQ群号173184401</p>
<!--<p style="text-align: center"> 请加入师姐师兄答疑群</p> <p style="text-align: center"></p>-->
<!--<a href="mqqapi://card/show_pslcard?src_type=internal&version=1&uin=173184401&card_type=group&source=qrcode">QQ群号173184401</a>-->
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Trustie师姐师兄答疑群" title="Trustie师姐师兄答疑群"></a>
</div>
</div>
<div class="side_bottom"></div>

View File

@ -8,36 +8,30 @@
<% end %>
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
</div>
<div class="pr_info_id fl mb5 f14">ID:<%= @course.id %><%= @course.is_public == 0 ? "(私有)" : "(公开)" %>
<div class="pr_info_id fl f14">
<% if @course.syllabus%>
<a class="pr_info_name fb c_dark fl hidden" title="<%=@course.syllabus.title %>" style="max-width: 120px;" href="<%= Setting.protocol%>://<%= Setting.host_name%>/syllabuses/<%= @course.syllabus_id%>" target="_blank">
<%=@course.syllabus.title %>
</a>
<% end %>
<div class="cl"></div>
<span class="hidden fl" style="max-width: 80px;" title="<%= @course.name %><%=@course.is_public == 0 ? '(私有)' : '(公开)' %>"><%= @course.name %></span><span class="fl"><%=@course.is_public == 0 ? '(私有)' : '(公开)' %></span>
</br>
<div class="cl"></div>
<% if is_excellent_course(@course) %>
<img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" />
<% end %>
</div>
<div class="pr_info_id fl f14">
<div class="pr_info_id fl f14" style="margin-top: 0px;">
<% unless is_teacher %>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end %>
</div>
<div class="cl"></div>
<div >
<a class="pr_info_name fl c_dark fb" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<div>
<a class="pr_info_name c_dark fb fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<span id="course_outline_bar">
<% if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<%else %>
<%end %>
</span>
</div>
<span class="f14">邀请码:</span>
<span class="f14 fontBlue2"><%=@course.generate_invite_code %></span>
</div>
<div class="cl"></div>
<div class="pr_info_foot ">
@ -52,7 +46,7 @@
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText boxShadow">
<li><%= link_to "课程配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
<li><%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
</ul>

View File

@ -12,7 +12,7 @@
<% 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>
<% 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>
<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 %>
@ -52,12 +52,12 @@
<% 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>
<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>
<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 %>
@ -70,21 +70,21 @@
<% 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>
<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>
<% 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>
<% 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>
<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>
<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>
<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>
<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 %>

View File

@ -0,0 +1,58 @@
<ul class="syllabus_leftinfo" id="all_syllabus_attr">
<% if User.current.logged? && (User.current == syllabus.user || User.current.admin?) %>
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :class => 'fr', :onclick => "show_edit_base_info();"%>
<% end %>
<div class="cl"></div>
<li><label >创建教师:</label><span><%=syllabus.user.show_name %></span></li>
<% unless syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>
<li><label>课程性质:</label><%=syllabus.syllabus_type_str %></li>
<% end %>
<% unless syllabus.credit.nil? || syllabus.credit == '' %>
<li><label>学分:</label><%=syllabus.credit %></li>
<% end %>
<% unless syllabus.hours.nil? || syllabus.hours == '' %>
<li><label>总学时:</label><%=syllabus.hours %></li>
<% end %>
<% unless syllabus.theory_hours.nil? || syllabus.theory_hours == '' %>
<li><label>理论学时:</label><%=syllabus.theory_hours %></li>
<% end %>
<% unless syllabus.practice_hours.nil? || syllabus.practice_hours == '' %>
<li><label>实践学时:</label><%=syllabus.practice_hours %></li>
<% end %>
<% unless syllabus.applicable_major.nil? || syllabus.applicable_major == '' %>
<li><label>适用专业:</label><%=syllabus.applicable_major %></li>
<% end %>
<% unless syllabus.pre_course.nil? || syllabus.pre_course == '' %>
<li><label>先修课程:</label><%=syllabus.pre_course %></li>
<% end %>
<% if syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>
<li class="none none_attr"><label>课程性质:</label><span class="fontGrey3">空</span></li>
<% end %>
<% if syllabus.credit.nil? || syllabus.credit == '' %>
<li class="none none_attr"><label>学分:</label><span class="fontGrey3">空</span></li>
<% end %>
<% if syllabus.hours.nil? || syllabus.hours == '' %>
<li class="none none_attr"><label>总学时:</label><span class="fontGrey3">空</span></li>
<% end %>
<% if syllabus.theory_hours.nil? || syllabus.theory_hours == '' %>
<li class="none none_attr"><label>理论学时:</label><span class="fontGrey3">空</span></li>
<% end %>
<% if syllabus.practice_hours.nil? || syllabus.practice_hours == '' %>
<li class="none none_attr"><label>实践学时:</label><span class="fontGrey3">空</span></li>
<% end %>
<% if syllabus.applicable_major.nil? || syllabus.applicable_major == '' %>
<li class="none none_attr"><label>适用专业:</label><span class="fontGrey3">空</span></li>
<% end %>
<% if syllabus.pre_course.nil? || syllabus.pre_course == '' %>
<li class="none none_attr"><label>先修课程:</label><span class="fontGrey3">空</span></li>
<% end %>
</ul>
<% if User.current.logged? && (User.current == syllabus.user || User.current.admin?)&&(syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == ''||syllabus.credit.nil? || syllabus.credit == ''||syllabus.hours.nil? || syllabus.hours == ''||syllabus.theory_hours.nil? || syllabus.theory_hours == ''||syllabus.practice_hours.nil? || syllabus.practice_hours == ''||syllabus.applicable_major.nil? || syllabus.applicable_major == ''||syllabus.pre_course.nil? || syllabus.pre_course == '')%>
<span class="homepageLeftMenuMore"><a href="javascript:void(0);" data-init="0" onclick="toggle_all_syllabus_attr();" class="homepageLeftMenuMoreIcon" id="show_all_syllabus_attr"></a></span>
<% end %>
<script>
function show_edit_base_info() {
$("#syllabus_base_info").html("<%=escape_javascript(render :partial => 'layouts/syllabus_edit_info', :locals => {:syllabus => @syllabus}) %>");
}
</script>

View File

@ -0,0 +1,27 @@
<ul class="syllabus_leftinfo" id="all_syllabus_attr">
<%= form_for('syllabus',:url => update_base_info_syllabus_path(syllabus.id),:remote => true) do |f|%>
<a href="javascript:void(0);" onclick="update_syllabus_info();" id="submit_edit_info" class="fr">保存</a>
<!--<a href="javascript:void(0);" onclick="reset_syllabus_info();" id="submit_reset_info" class="fr mr10">取消</a>-->
<div class="cl"></div>
<li><label >创建教师:</label><span><%=syllabus.user.show_name %></span></li>
<li><label>课程性质:</label>
<%= select_tag :syllabus_type,options_for_select(syllabus_type,syllabus.syllabus_type), {:id=>"syllabus_type_input", :class=>"syllabus_select"} %>
<div class="cl"></div>
</li>
<li><label >学分:</label>
<input id="syllabus_credit_input" class="syllabus_input_min fl" name="credit" placeholder="5" value="<%=syllabus.credit %>"> 学分
<span class="none c_red ml5" id="syllabus_credit_notice">请输入正整数</span><div class="cl"></div>
</li>
<li><label>总学时:</label><input id="syllabus_hours_input" class="syllabus_input_min fl" name="hours" placeholder="50" value="<%=syllabus.hours %>"> 学时
<span class="none c_red ml5" id="syllabus_hours_notice">请输入正整数</span><div class="cl"></div>
</li>
<li><label>理论学时:</label><input id="syllabus_theory_hours_input" class="syllabus_input_min fl" name="theory_hours" placeholder="10" value="<%=syllabus.theory_hours %>"> 学时
<span class="none c_red ml5" id="syllabus_theory_hours_notice">请输入正整数</span><div class="cl"></div>
</li>
<li><label>实践学时:</label><input id="syllabus_practice_hours_input" class="syllabus_input_min fl" name="practice_hours" placeholder="5" value="<%=syllabus.practice_hours %>"> 学时
<span class="none c_red ml5" id="syllabus_practice_hours_notice">请输入正整数</span><div class="cl"></div>
</li>
<li><label>适用专业:</label><input id="syllabus_applicable_major_input" class="syllabus_input fl" name="applicable_major" placeholder="UI设计" value="<%=syllabus.applicable_major %>"><div class="cl"></div></li>
<li><label>选修课程:</label><input id="syllabus_pre_course_input" class="syllabus_input fl" name="pre_course" placeholder="工业设计史" value="<%=syllabus.pre_course %>"><div class="cl"></div></li>
<% end %>
</ul>

View File

@ -0,0 +1,8 @@
<% if syllabus.eng_name && !syllabus.eng_name.empty? %>
<span><%= syllabus.eng_name %></span>
<% else%>
<span class="fontGrey">课程英文名称</span>
<% end %>
<% if User.current == syllabus.user %>
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_eng_name();"%>
<% end %>

View File

@ -0,0 +1,22 @@
<% teachers_num = teacher_count @syllabus%>
<% students_num = student_count @syllabus%>
<% files_num = file_count @syllabus%>
<div class="pr_info_logo fl mb5">
<%= image_tag("../images/syllabus.jpg",width:"60px", height: "60px") %>
</div>
<div class="fl ml15">
<p class="homepageSyllabusName mb5" title="<%=@syllabus.title %>"><%=@syllabus.title %></p>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div>
<div class="mb5" id="syllabus_eng_name_show">
<%= render :partial => 'layouts/syllabus_eng_name', :locals => {:syllabus => @syllabus}%>
</div>
<textarea class="homepageSignatureTextarea none" placeholder="请编辑英文名称" id="syllabus_eng_name_edit" onblur="edit_syllabus_eng_name('<%= edit_syllabus_eng_name_syllabus_path(@syllabus.id)%>');"><%= @syllabus.eng_name %></textarea>
</div>
<div class="pr_info_foot ">
教师(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的教师数"><%=teachers_num %></a><span>|</span>
学生(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的学生数"><%=students_num %></a><span>|</span>
资源(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的资源数"><%=files_num %></a></div>
<div class="cl"></div>

View File

@ -52,7 +52,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户、资源以及帖子" onkeypress="search_in_header_I(event,$(this));"/>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子" onkeypress="search_in_header_I(event,$(this));"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>

View File

@ -2,7 +2,7 @@
<li class="homepageLeftMenuCoursesLine pr">
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程")+course.name+""+current_time_and_term(course)+""%>
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级")+course.name+""+current_time_and_term(course)+""%>
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
<% wechat_count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
@ -47,7 +47,13 @@
<%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'fr fb', :title => '发布帖子',:target => '_blank' %>
<div class="cl"></div>
</li>
<% if User.current == @user %>
<% if type=='User' && !course.syllabus.nil? %>
<li class="subNavRow">
<%= link_to "所属课程",syllabus_path(course.syllabus_id), :class => 'fl w48',:target => '_blank' %>
<div class="cl"></div>
</li>
<% end %>
<% if User.current == user %>
<li class="subNavRow">
<% if count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true %>
@ -76,15 +82,15 @@
</li>
<% end %>
<% if courses.size == 5%>
<% if all_count > (page.to_i+1) * 5%>
<li class="homepageLeftMenuMore" id="user_show_more_course">
<input type="hidden" value="<%= page%>" id="course_page_num">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= user_courses4show_user_path(user.id)%>');"></a>
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= type=='User' ? user_courses4show_user_path(user.id,:type=>type) : user_courses4show_user_path(user.id,:type=>type,:syllabus=>@syllabus.id)%>');"></a>
</li>
<% end%>
<script type="text/javascript">
var coursecount = <%= @user.courses.visible.where("is_delete =?", 0).count %>;
var coursecount = <%= all_count %>;
var courseshowcount = document.getElementsByClassName("coursesLineGrey").length;
if((coursecount <= courseshowcount)&&(coursecount > 5) ){

View File

@ -1,11 +1,8 @@
<%# course_model %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<% homework_num = @course.homework_commons.count %>
<% else %>
<% homework_num = @course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
<% end %>
<% homework_num = visable_course_homework @course %>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
@ -57,12 +54,7 @@
<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)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>

View File

@ -0,0 +1,140 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'syllabus','new_user','prettify','share',:media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus'%>
<%= 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 onload="prettyPrint();">
<% is_current_user = User.current.logged?%>
<div class="navContainer">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="homepageLeft">
<div class="homepagePortraitContainer mt15">
<%=render :partial => 'layouts/syllabus_info' %>
</div>
<% update_visiti_count @syllabus %>
<div class="homepageLeftMenuContainer" id="syllabus_base_info">
<%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
</div>
<div class="homepageLeftMenuContainer">
<div class="homepageLeftMenuBlock">
<%=link_to '班级', {:controller => "syllabuses", :action => "syllabus_courselist", :id => @syllabus.id}, :class => 'homepageMenuText' %>
<% if is_current_user%>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<div class="courseMenu" id="courseMenu">
<ul>
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
<ul class="topnav_course_menu" id="topnav_course_menu">
<li>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey", :target => '_blank'%>
</li>
<li>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
</li>
</ul>
</li>
</ul>
</div>
<% else%>
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
<% end%>
<% end%>
</div>
<% courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<% all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count%>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>">
<div class = "leftCoursesList" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => User.current,:all_count => all_count,:type =>'Syllabus',:page => 0} %>
</ul>
</div>
<% if !courses.empty? %>
<div class="homepageLeftMenuMore" id="user_hide_course">
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_courseicon" onclick="leftCourseslistChange();"></a>
</div>
<% end %>
</div>
</div>
<div class="project_Label">
<h4 class="mb5" >标签:</h4>
<div class="tag_h">
<%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%>
</div>
<div class="cl"></div>
</div>
<div class="fontGrey2 mt10 ml20">访问计数 <%=@syllabus.visits %> 自2016年7月</div>
</div><!--left end -->
<div class="homepageRight">
<%= yield %>
</div>
</div>
<%= render :partial => 'layouts/new_feedback' %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<script type="text/javascript">
$(function(){
$('#user_hide_course').hide();
});
$("#courseMenu").mouseenter(function(){
$("#topnav_course_menu").show();
});
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
function leftCourseslistChange(){
$('#homepageLeftMenuCourses').slideToggle();
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_courseicon').toggleClass("homepageLeftMenuMoreIcon");
}
function show_edit_base_info() {
$("#syllabus_base_info").html("<%=escape_javascript(render :partial => 'layouts/syllabus_edit_info', :locals => {:syllabus => @syllabus}) %>");
}
</script>
</body>
</html>

View File

@ -12,7 +12,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify','public', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_include_tag 'prettify' %>
<%= javascript_heads %>

View File

@ -203,7 +203,7 @@
<% end %>
<% end %>
<% if (get_join_course_count(@user) != 0) %>
<li>加入课程&nbsp;:</li>
<li>加入班级&nbsp;:</li>
<% end %>
<% if @user.user_extensions.identity == 1 %>
<li>参加匿评&nbsp;:</li>

View File

@ -13,7 +13,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify', 'org'%>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify', 'org', 'syllabus'%>
<%= javascript_include_tag "course","header",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'share','new_user', 'user_leftside','prettify','users',:media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'share','new_user', 'user_leftside','prettify','users','syllabus',:media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
@ -198,18 +198,21 @@
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
<ul class="topnav_course_menu" id="topnav_course_menu">
<li>
<%= link_to "新建课程", new_course_path(:host=> Setting.host_course), :class => "menuGrey"%>
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :class => "menuGrey"%>
</li>
<li>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :class => "menuGrey"%>
</li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li>
<%= link_to "加入课程",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
</li>
</ul>
</li>
</ul>
</div>
<% else%>
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入课程"%>
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
<% end%>
<% end%>
</div>
@ -227,10 +230,11 @@
end
%>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<% all_count = @user.courses.visible.where("is_delete =?", 0).count%>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" >
<div class = "leftCoursesList" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:type =>'User',:page => 0} %>
</ul>
</div>
<% if !courses.empty? %>

View File

@ -1,2 +1,6 @@
<p><%= l(:mail_body_register) %><br />
<%= link_to h(@url), @url %></p>
<p>如果点击链接无效请复制该链接到浏览器中打开</p>
<br>
<p>感谢您的使用!</p>
<p>Trustie团队</p><p></p>

View File

@ -95,9 +95,10 @@
</span>
</div>
</div>
<% unless @replies.empty? %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @topic) %>
<div class="" id="reply_div_<%= @topic.id %>">
<% @replies.each_with_index do |reply,i| %>
<% comments.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
@ -110,32 +111,41 @@
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%= link_to reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(reply.created_on) %>
</div>
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<% end %>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%= reply.id %>">
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:class => 'fr newsBlue mr10',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<span id="reply_iconup_<%= reply.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr newsGrey mr10',
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
@ -145,7 +155,6 @@
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply">

View File

@ -156,61 +156,65 @@
</span>
</div>
</div>
<% unless @replies.empty? %>
<div class="" id="reply_div_<%= @topic.id %>">
<% @replies.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
autoUrl('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</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 %>
</div>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:class => 'fr newsBlue mr10',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.destroyable_by?(User.current) %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @topic) %>
<div class="" id="reply_div_<%= @topic.id %>">
<% comments.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
autoUrl('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(reply.created_on) %>
</div>
<% end %>
</div>
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<% end %>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%= reply.id %>">
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<span id="reply_iconup_<%= reply.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %>
</span>
<% end %>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="cl"></div>
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply">

View File

@ -4,11 +4,12 @@
<div class="ReplyToMessageInputContainer mb10">
<% 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">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %>
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
<%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %>
<%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@topic.id %>
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="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>

View File

@ -0,0 +1,8 @@
<%if @project%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<% elsif @org_subfield %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");

View File

@ -1,16 +1,8 @@
/*$('#message_subject').val("<%#= raw escape_javascript(@subject) %>");
$('#message_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
//$('#message_content').val("<#%= raw escape_javascript(@content) %>");
$('#quote_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
showAndScrollTo("reply", "message_content");
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;
$("img").removeAttr("align");*/
if($("#reply_message_<%= @message.id%>").length > 0) {
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>");
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message}) %>");
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
/*$('#reply_subject').val("<%#= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%#= raw escape_javascript(@temp.content.html_safe) %>");*/
sd_create_editor_from_data(<%= @message.id%>,null,"100%", "<%=@message.class.to_s%>");
});
}else if($("#reply_to_message_<%= @message.id%>").length >0) {

View File

@ -0,0 +1,337 @@
<h2 class="winbox_h2">添加新的高校(单位)</h2>
<div class="cl"></div>
<ul class="winbox_edit_new">
<li>
<label class="fl"><span class="c_red mr5">*</span>名称:</label>
<input id = "schoolname" type="text" class="winbox_input fl" onBlur = 'ifNameRepeat()' onFocus = '$("#schoolrepeatnotice").text("");$("#schoolrepeatnotice").attr("value",1);$("#schoolrepeatnotice").hide(); '/>
<span class="ml2" id="schoolrepeatnotice" style="color:red;" display="none"></span>
</li>
<li>
<label class="fl">&nbsp;&nbsp;</label>
<span class="fl">例如:</span><span class="icons_right fl mt5 "></span><span class="fl">国防科学技术大学</span>
<span class="icons_error fl mt5 ml10"></span><span class="fl">国防科大计算机1班</span>
</li>
<li>
<label class="fl"><span class="c_red mr5">*</span>地区:</label>
<select onchange="showcity(this.value, document.getElementById('schoolCity'));" name="province" id="schollProvince" class="winbox_select fl" style="height:28px;margin-left:2px;">
<option value="">--请选择省份--</option>
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="广东">广东</option>
<option value="江苏">江苏</option>
<option value="浙江">浙江</option>
<option value="重庆">重庆</option>
<option value="安徽">安徽</option>
<option value="福建">福建</option>
<option value="甘肃">甘肃</option>
<option value="广西">广西</option>
<option value="贵州">贵州</option>
<option value="海南">海南</option>
<option value="河北">河北</option>
<option value="黑龙江">黑龙江</option>
<option value="河南">河南</option>
<option value="湖北">湖北</option>
<option value="湖南">湖南</option>
<option value="江西">江西</option>
<option value="吉林">吉林</option>
<option value="辽宁">辽宁</option>
<option value="内蒙古">内蒙古</option>
<option value="宁夏">宁夏</option>
<option value="青海">青海</option>
<option value="山东">山东</option>
<option value="山西">山西</option>
<option value="陕西">陕西</option>
<option value="四川">四川</option>
<option value="天津">天津</option>
<option value="新疆">新疆</option>
<option value="西藏">西藏</option>
<option value="云南">云南</option>
<option value="香港">香港特别行政区</option>
<option value="澳门">澳门特别行政区</option>
<option value="台湾">台湾</option>
<option value="海外">海外</option>
</select>
<select name="city" id="schoolCity" class="winbox_select fl ml5" style="height:28px;"></select>
<span class="ml2" id="provincenotice" style="color:red;" display="none"></span>
</li>
<li>
<label class="fl"><span class="c_red mr5">*</span>详细地址:</label><input id="address" type="text" class="winbox_input fl" />
<span class="ml2" id="addressnotice" style="color:red;" display="none"></span>
</li>
<li><label class="fl">说明:</label><textarea id = "remarks" class="winbox_textarea fl" placeholder="如果您有特别需要说明的内容请填入"></textarea></li>
<div class="cl"></div>
<li><label class="fl">&nbsp;&nbsp;</label><button class="fl winbox_btn_blue mt10" onclick = "commit_add_school();">确定</button></li>
</ul>
<script type="text/javascript">
function commit_add_school(){
var name,province,city,address,remarks;
name = $("#schoolname").val();
province = $("#schollProvince").val();
address = $("#address").val();
if(name == ""){
$("#schoolname").focus();
return;
}
if($("#schoolrepeatnotice").attr("value") == "1"){
return;
}
if(province == ""){
$("#provincenotice").text("请选择");
$("#provincenotice").show();
return;
}
city = $("#schoolCity").val();
if(city == ""){
return;
}
if(address == ""){
$("#address").focus();
return;
}
remarks = $("#remarks").val();
$.ajax({
url: '/school/apply_add_school',
type: 'get',
data: {name:name,province:province,city:city,address:address,remarks:remarks},
success: function(data){
if(data.result == 0){
$("input[name='province']").val(data.name);
$("input[name='occupation']").val(data.school_id);
var htmlvalue = "</br><div style='width:550px;text-align:center'>添加成功!您可以继续使用了。</div></br><div style='width:550px;text-align:center'>后续我们将对您的高校(单位)进行审核,如有问题我们再联系您。</div></br><div style='width:67px; margin:0 auto; text-align:center'></div>";
pop_up_box(htmlvalue,500,30,50);
}
else if (data.result == 1){
}
else if (data.result == 2){
$("#schoolrepeatnotice").text("名称已存在");
$("#schoolrepeatnotice").show();
$("#schoolrepeatnotice").attr("value",1);
$("#schoolrepeatnotice").attr("style","color:red");
}
return;
}
});
}
function showcity(province, cityField) {
$("#provincenotice").hide();
switch (province) {
case "北京" :
var cityOptions = new Array(
"东城", "西城", "朝阳", "丰台", "石景山", "海淀", "门头沟",
"房山", "通州", "顺义", "昌平", "大兴", "平谷", "怀柔", "密云", "延庆");
break;
case "上海" :
var cityOptions = new Array(
"崇明", "黄浦", "卢湾", "徐汇", "长宁", "静安", "普陀", "闸北", "虹口", "杨浦", "闵行",
"宝山", "嘉定", "浦东", "金山", "松江", "青浦", "南汇", "奉贤");
break;
case "广东" :
var cityOptions = new Array(
"广州", "深圳", "珠海", "东莞", "中山", "佛山", "惠州", "河源", "潮州", "江门", "揭阳", "茂名",
"梅州", "清远", "汕头", "汕尾", "韶关", "顺德", "阳江", "云浮", "湛江", "肇庆");
break;
case "江苏" :
var cityOptions = new Array(
"南京", "常熟", "常州", "海门", "淮安", "江都", "江阴", "昆山", "连云港", "南通",
"启东", "沭阳", "宿迁", "苏州", "太仓", "泰州", "同里", "无锡", "徐州", "盐城",
"扬州", "宜兴", "仪征", "张家港", "镇江", "周庄");
break;
case "重庆" :
var cityOptions = new Array(
"万州", "涪陵", "渝中", "大渡口", "江北", "沙坪坝", "九龙坡", "南岸", "北碚", "万盛",
"双挢", "渝北", "巴南", "黔江", "长寿", "綦江", "潼南", "铜梁", "大足", "荣昌", "壁山",
"梁平", "城口", "丰都", "垫江", "武隆", "忠县", "开县", "云阳", "奉节", "巫山", "巫溪",
"石柱", "秀山", "酉阳", "彭水", "江津", "合川", "永川", "南川");
break;
case "安徽" :
var cityOptions = new Array(
"合肥", "安庆", "蚌埠", "亳州", "巢湖", "滁州", "阜阳", "贵池", "淮北", "淮化", "淮南",
"黄山", "九华山", "六安", "马鞍山", "宿州", "铜陵", "屯溪", "芜湖", "宣城");
break;
case "福建" :
var cityOptions = new Array(
"福州", "厦门", "泉州", "漳州", "龙岩", "南平", "宁德", "莆田", "三明");
break;
case "甘肃" :
var cityOptions = new Array(
"兰州", "白银", "定西", "敦煌", "甘南", "金昌", "酒泉", "临夏", "平凉", "天水",
"武都", "武威", "西峰", "张掖");
break;
case "广西" :
var cityOptions = new Array(
"南宁", "百色", "北海", "桂林", "防城港", "贵港", "河池", "贺州", "柳州", "钦州", "梧州", "玉林");
break;
case "贵州" :
var cityOptions = new Array(
"贵阳", "安顺", "毕节", "都匀", "凯里", "六盘水", "铜仁", "兴义", "玉屏", "遵义");
break;
case "海南" :
var cityOptions = new Array(
"海口", "儋县", "陵水", "琼海", "三亚", "通什", "万宁");
break;
case "河北" :
var cityOptions = new Array(
"石家庄", "保定", "北戴河", "沧州", "承德", "丰润", "邯郸", "衡水", "廊坊", "南戴河", "秦皇岛",
"唐山", "新城", "邢台", "张家口");
break;
case "黑龙江" :
var cityOptions = new Array(
"哈尔滨", "北安", "大庆", "大兴安岭", "鹤岗", "黑河", "佳木斯", "鸡西", "牡丹江", "齐齐哈尔",
"七台河", "双鸭山", "绥化", "伊春");
break;
case "河南" :
var cityOptions = new Array(
"郑州", "安阳", "鹤壁", "潢川", "焦作", "济源", "开封", "漯河", "洛阳", "南阳", "平顶山",
"濮阳", "三门峡", "商丘", "新乡", "信阳", "许昌", "周口", "驻马店");
break;
case "香港" :
var cityOptions = new Array(
"香港", "九龙", "新界");
break;
case "湖北" :
var cityOptions = new Array(
"武汉", "恩施", "鄂州", "黄冈", "黄石", "荆门", "荆州", "潜江", "十堰", "随州", "武穴",
"仙桃", "咸宁", "襄阳", "襄樊", "孝感", "宜昌");
break;
case "湖南" :
var cityOptions = new Array(
"长沙", "常德", "郴州", "衡阳", "怀化", "吉首", "娄底", "邵阳", "湘潭", "益阳", "岳阳",
"永州", "张家界", "株洲");
break;
case "江西" :
var cityOptions = new Array(
"南昌", "抚州", "赣州", "吉安", "景德镇", "井冈山", "九江", "庐山", "萍乡",
"上饶", "新余", "宜春", "鹰潭");
break;
case "吉林" :
var cityOptions = new Array(
"长春", "吉林", "白城", "白山", "珲春", "辽源", "梅河", "四平", "松原", "通化", "延吉");
break;
case "辽宁" :
var cityOptions = new Array(
"沈阳", "鞍山", "本溪", "朝阳", "大连", "丹东", "抚顺", "阜新", "葫芦岛", "锦州",
"辽阳", "盘锦", "铁岭", "营口");
break;
case "澳门" :
var cityOptions = new Array("澳门");
break;
case "内蒙古" :
var cityOptions = new Array(
"呼和浩特", "阿拉善盟", "包头", "赤峰", "东胜", "海拉尔", "集宁", "临河", "通辽", "乌海",
"乌兰浩特", "锡林浩特");
break;
case "宁夏" :
var cityOptions = new Array(
"银川", "固源", "石嘴山", "吴忠");
break;
case "青海" :
var cityOptions = new Array(
"西宁", "德令哈", "格尔木", "共和", "海东", "海晏", "玛沁", "同仁", "玉树");
break;
case "山东" :
var cityOptions = new Array(
"济南", "滨州", "兖州", "德州", "东营", "菏泽", "济宁", "莱芜", "聊城", "临沂",
"蓬莱", "青岛", "曲阜", "日照", "泰安", "潍坊", "威海", "烟台", "枣庄", "淄博");
break;
case "山西" :
var cityOptions = new Array(
"太原", "长治", "大同", "候马", "晋城", "离石", "临汾", "宁武", "朔州", "忻州",
"阳泉", "榆次", "运城");
break;
case "陕西" :
var cityOptions = new Array(
"西安", "安康", "宝鸡", "汉中", "渭南", "商州", "绥德", "铜川", "咸阳", "延安", "榆林");
break;
case "四川" :
var cityOptions = new Array(
"成都", "巴中", "达川", "德阳", "都江堰", "峨眉山", "涪陵", "广安", "广元", "九寨沟",
"康定", "乐山", "泸州", "马尔康", "绵阳", "眉山", "南充", "内江", "攀枝花", "遂宁",
"汶川", "西昌", "雅安", "宜宾", "自贡", "资阳");
break;
case "台湾" :
var cityOptions = new Array(
"台北", "基隆", "台南", "台中", "高雄", "屏东", "南投", "云林", "新竹", "彰化", "苗栗",
"嘉义", "花莲", "桃园", "宜兰", "台东", "金门", "马祖", "澎湖");
break;
case "天津" :
var cityOptions = new Array(
"天津", "和平", "东丽", "河东", "西青", "河西", "津南", "南开", "北辰", "河北", "武清", "红挢",
"塘沽", "汉沽", "大港", "宁河", "静海", "宝坻", "蓟县");
break;
case "新疆" :
var cityOptions = new Array(
"乌鲁木齐", "阿克苏", "阿勒泰", "阿图什", "博乐", "昌吉", "东山", "哈密", "和田", "喀什",
"克拉玛依", "库车", "库尔勒", "奎屯", "石河子", "塔城", "吐鲁番", "伊宁");
break;
case "西藏" :
var cityOptions = new Array(
"拉萨", "阿里", "昌都", "林芝", "那曲", "日喀则", "山南");
break;
case "云南" :
var cityOptions = new Array(
"昆明", "大理", "保山", "楚雄", "大理", "东川", "个旧", "景洪", "开远", "临沧", "丽江",
"六库", "潞西", "曲靖", "思茅", "文山", "西双版纳", "玉溪", "中甸", "昭通");
break;
case "浙江" :
var cityOptions = new Array(
"杭州", "安吉", "慈溪", "定海", "奉化", "海盐", "黄岩", "湖州", "嘉兴", "金华", "临安",
"临海", "丽水", "宁波", "瓯海", "平湖", "千岛湖", "衢州", "江山", "瑞安", "绍兴", "嵊州",
"台州", "温岭", "温州", "余姚", "舟山");
break;
case "海外" :
var cityOptions = new Array(
"美国", "日本", "英国", "法国", "德国", "其他");
break;
default:
var cityOptions = new Array("");
break;
}
cityField.options.length = 0;
for (var i = 0; i < cityOptions.length; i++) {
cityField.options[i] = new Option(cityOptions[i], cityOptions[i]);
/*
if (cityField.options[i].value==city)
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
}
function ifNameRepeat(){
//名称不能为空也不能重复
if($("#schoolname").val() == ""){
return;
}
$.ajax({
url: '/school/search_repeat_schoolname',
type: 'get',
data: {name:$("#schoolname").val()},
success: function(data){
if (data == 1){
$("#schoolrepeatnotice").text("名称已存在");
$("#schoolrepeatnotice").show();
$("#schoolrepeatnotice").attr("value",1);
$("#schoolrepeatnotice").attr("style","color:red");
}
else{
$("#schoolrepeatnotice").text("可用");
$("#schoolrepeatnotice").show();
$("#schoolrepeatnotice").attr("value",0);
$("#schoolrepeatnotice").attr("style","color:green");
}
}
});
}
</script>

View File

@ -15,14 +15,13 @@
<%= error_messages_for 'user',@user.user_extensions %>
<% end %>
<ul class="setting_left">
<li>登录名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>邮箱&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>身份&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(Last Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(First Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;登录名&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;邮箱&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;职业&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><span style="color:red;">*</span>&nbsp;&nbsp;姓名&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">工作单位&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><span style="color:red;">*</span>&nbsp;&nbsp;性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;" ><span style="color:red;">*</span>&nbsp;&nbsp;单位名称&nbsp;:&nbsp;</li>
<li>地区&nbsp;:&nbsp;</li>
<li>邮件通知&nbsp;:&nbsp;</li>
<!--<li>个人签名&nbsp;:&nbsp;</li>-->
@ -65,34 +64,50 @@
<span id="identity_hint" style="display: none"></span>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= f.text_field :firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
<li nhname="tag" nh_tag_2="true" style="display:none;"><%= text_field_tag :enterprise_name,@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<select class="w70" style="height:28px;margin-left:2px;" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select>
<% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
<input type="radio" id="sex" value="0" name="sex" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" checked="checked" class="fl "><label class="fl ">女</label>
<% else %>
<input type="radio" id="sex" value="0" name="sex" checked="checked" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" class="fl "><label class="fl ">女</label>
<% end %>
<select style = "display: none;" class="w70" style="height:28px;margin-left:2px;" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<% if User.current.user_extensions.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;" class="w210" type="text" >
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" />
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" placeholder=" --请选择您所属的单位--"/>
<p class="fl ml10">
<span id="errortip" class="icons_warning fl mt5" style="display: none;"></span>
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;" class="w210" type="text" >
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<p class="fl ml10">
<span id="errortip" class="icons_warning fl mt5" style="display: none;"></span>
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.school.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;" class="w210" type="text" >
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" />
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" placeholder=" --请选择您所属的单位--" />
<p class="fl ml10">
<span id="errortip" class="icons_warning fl mt5" style="display: none;"></span>
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;" class="w210" type="text" value="<%= User.current.user_extensions.school %>" />
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" type="text" style="display: none;" class="w210" value="<%= User.current.user_extensions.school.id %>"/>
<span id="hint" style="color: #7f7f7f;display: none" >平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%#= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>-->
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" value="<%= User.current.user_extensions.school %>" />
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" type="text" style="display: none;" class="w210" value="<%= User.current.user_extensions.school.id %>"/>
<p class="fl ml10">
<span id="errortip" class="icons_warning fl mt5" style="display: none;"></span>
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%#= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>-->
<% end %>
</li>
@ -140,13 +155,13 @@
<li>
<%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %>
<label>不要发送对我自己提交的修改的通知<%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified],:style=>"height:14px;" %></label>
<label class="ml10"><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified],:style=>"height:14px;" %>不要发送对我自己提交的修改的通知</label>
</li>
<!--<li><input name="brief_introduction" class="w450" type="text" maxlength="255" value="<%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.brief_introduction %>"></li>-->
<li style="height:auto;"><textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea></li>
<li style="display:none;"><%= f.select :language, :Chinese => :zh, :English => :en %></li>
<li class="ml2">
<a href="javascript:void(0);" id="my_account_form_link" class="blue_btn fl">确认</a>
<a href="javascript:void(0);" id="my_account_form_link" class="blue_btn fl" style="background: #3b94d6; padding: 0 25px;">确定</a>
<input type="submit" id="my_account_form_btn" style="display:none;"/>
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
</li>
@ -429,6 +444,7 @@
$("*[nh_required='1']",$(this)).attr("required",true);
$(this).show()
});
$("#identity_hint").hide();
}
function init_identity_and_title(pField, identity, cField, title, language) {
for (var i = 0; i < pField.options.length; i++) {
@ -533,6 +549,14 @@
$("input[name='occupation']").val(data);
$("#search_school_result_list").hide();
$("#hint").hide();
$("#errortip").hide();
}
function apply_add_school(){
var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>";
pop_up_box(htmlvalue,580,20,48);
}
function add_school(name){
$.ajax({
@ -619,16 +643,19 @@
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校');
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
$("#errortip").hide();
}else{
$("#hint").hide();
$("#errortip").hide();
}
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
$("#hint").html('没有找到包含"'+str+'"的高校,<a style="color:#64bdd9" onclick="add_school(\''+ e.target.value+'\');" href="javascript:void(0);">创建高校</a>');
$("#hint").html('您输入的名称尚不存在,<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">申请添加</a>');
$("#hint").show();
$("#errortip").show();
}
}
});
@ -638,6 +665,7 @@
{
$("#search_school_result_list").hide();
$("#hint").hide();
$("#errortip").hide();
}
});
$("input[name='province']").on('focus', function (e) {
@ -665,16 +693,19 @@
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校');
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
$("#errortip").hide();
}else{
$("#hint").hide();
$("#errortip").hide();
}
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
$("#hint").html('没有找到包含"'+str+'"的高校,<a style="color:#64bdd9" onclick="add_school(\''+ e.target.value+'\');" href="javascript:void(0);">创建高校</a>');
$("#hint").html('您输入的名称尚不存在,<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">申请添加</a>');
$("#hint").show();
$("#errortip").show();
}
}
});
@ -702,19 +733,41 @@
<% if( !@act.nil? && @act == 'password') %>
$("#users_tb_2").click();
<% end %>
$('#my_account_form_link').click(function(e){
$('#my_account_form_link').on("click",(function(e){
//$('#my_account_form_link').click(function(e){
if($("#userIdentity").val() == -1 ) {
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
e.stopImmediatePropagation();
return;
}
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
$("#hint").html('<span style="color:red">学校必须是从下拉列表中选择的,不能手动修改</span>').show();
$("#hint").html('<span style="color:red">单位名称必须是从下拉列表中选择的,不能手动修改</span>').show();
e.stopImmediatePropagation();
return;
}
//姓名不能为空
if( $("#lastname").val() == '' ){
$("#lastname").focus();
e.stopImmediatePropagation();
return;
}
if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写
$("#hint").html('<span style="color:red">高校(单位)名称不能为空</span>').show();
e.stopImmediatePropagation();
return;
}
if($("#no").is(":visible") == true && $("#no").val() == ""){
$("#no").focus();
e.stopImmediatePropagation();
return;
}
$('#my_account_form_btn').click();
});
}));
$('#my_password_form_link').click(function(){
$('#my_password_form_btn').click();
});

View File

@ -21,7 +21,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
课程通知
班级通知
</div>
</div>
<% if @course && User.current.allowed_to?(:manage_news, @course) %>

View File

@ -24,12 +24,12 @@
<body>
<!--<div class="resourceSharePopup">-->
<div>
<div class="relateText">请选择关联到组织的课程</div>
<div class="c_red">您的私有课程不能被关联到组织</div>
<div class="relateText">请选择关联到组织的班级</div>
<div class="c_red">您的私有班级不能被关联到组织</div>
</div>
<div class="fl">
<%=form_tag url_for(:controller => 'organizations', :action => 'join_courses', :organization_id => organization_id),:method => 'post', :id => 'join_courses_form', :remote => true,:class=>"resourcesSearchBox" do %>
<input type="text" name="courses" placeholder="搜索您已加入的课程的名称" class="searchCourse" />
<input type="text" name="courses" placeholder="搜索您已加入的班级的名称" class="searchCourse" />
<div id="search_courses_result_list" class="mb8 maxHeight100" style="overflow:auto;"></div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" onclick="org_join_courses(<%= organization_id %>);" class="sendSourceText">关联</a>

View File

@ -12,7 +12,7 @@
<%= link_to activity.try(:teacher).try(:realname), user_url_in_org(activity.tea_id), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.name.to_s+" | 课程", course_url_in_org(activity.id), :class => "newsBlue ml15" %>
<%= link_to activity.name.to_s+" | 班级", course_url_in_org(activity.id), :class => "newsBlue ml15" %>
</div>
<div class="homepagePostTitle break_word" >
<%= link_to activity.name, course_url_in_org(activity.id), :class => "postGrey" %>

View File

@ -12,7 +12,7 @@
<% else %>
<%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %>
<% end %> TO <!--+"(课程名称)" -->
<%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_url_in_org(activity.course.id), :class => "newsBlue ml15"%>
<%= link_to activity.course.name.to_s+" | 班级作业", homework_common_index_url_in_org(activity.course.id), :class => "newsBlue ml15"%>
</div>
<div class="homepagePostTitle hidden m_w505 fl"> <!--+"(作业名称)"-->
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :class => "postGrey"%>

View File

@ -12,7 +12,7 @@
<%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_url_in_org(activity.course.id), :class => "newsBlue ml15 mr5"%>
<%= link_to activity.course.name.to_s+" | 班级问答区", course_boards_url_in_org(activity.course.id), :class => "newsBlue ml15 mr5"%>
</div>
<div class="homepagePostTitle hidden m_w530 fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->

View File

@ -11,7 +11,7 @@
<% else %>
<%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <!--+"(课程名称)"-->
<%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_url_in_org(activity.course.id), :class => "newsBlue ml15" %>
<%= link_to activity.course.name.to_s+" | 班级通知", course_news_index_url_in_org(activity.course.id), :class => "newsBlue ml15" %>
</div>
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :class => "postGrey" %>

View File

@ -2,7 +2,7 @@
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<h2 class="por_h2_index clear">课程动态</h2>
<h2 class="por_h2_index clear">班级动态</h2>
<% if @course_acts.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>

View File

@ -63,9 +63,9 @@
<% when 'course' %>
<div style="display:<%= field.hide == 0 ? 'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">班级</a>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联班级"%>
<% end %>
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">

View File

@ -55,6 +55,12 @@
<%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %>
<% end %>
</div>
<!--quality_analysis-->
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<div class="subNav">
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "f14 c_blue02" %>
</div>
<% end %>
<% end %>
<!-- more -->
<div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div>

View File

@ -30,8 +30,8 @@
:remote => true,
:method => :post,
:id => 'new_join_course') do %>
<label>请输入课程密码:</label>
<%= text_field_tag 'course_password', nil, :style=>'width:300px;'%>
<label>请输入班级邀请码:</label>
<%= text_field_tag 'invite_code', nil, :style=>'width:300px;'%>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="$('#new_join_course').submit();" >
确&nbsp;&nbsp;定

View File

@ -48,7 +48,7 @@
var last_name = $.trim($('#last_name').val());
if(last_name.length > 30)
{
$("#valid_email").text("用户姓过长,最长为30个字符");
$("#valid_email").text("用户姓过长,最长为30个字符");
return false;
}
else

View File

@ -0,0 +1,8 @@
<%= javascript_include_tag 'highcharts','highcharts-more' %>
<div class="project_r_h">
<h2 class="project_h2" style="width:180px;">质量分析</h2>
</div>
<div>
<%=h @console_build %>
</div>

View File

@ -0,0 +1,23 @@
<div class="f16 fb fontBlue mb10">代码质量分析</div>
<div>
<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'update_jenkins_job', :project_id => @project.id), :id => 'quality_analyses_edit_form') do %>
<div class="ui form">
<div class="mb10" style="margin-right:13px;">
<textarea id="path_description" name="path" rows="8" style="height: 87px; resize:vertical;" class="analysis-option-box"><%= @quality_analysis.path %></textarea>
</div>
<div class="mb10">
<div>
<%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @quality_analysis.branch), :value => 77, :id => 'branch', :class => "analysis-option-box" %>
</div>
</div>
<div class="mb10">
<div>
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"], "#{@quality_analysis.language}"), :id => 'branch', :class => "analysis-option-box" %>
</div>
</div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="$('#quality_analyses_edit_form').submit();hideModal()">提交</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal()">取消</a></div>
<div class="cl"></div>
</div>
<% end %>
</div>

View File

@ -94,7 +94,7 @@
},
series: [{
name: '代码质量',
data: [<%= @complexity["msr"][9]["val"] %>]
data: [<%= @complexity["msr"][9].nil? ? 0 : @complexity["msr"][9]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }
@ -209,7 +209,7 @@
},
series: [{
name: '复杂度',
data: [<%= @complexity["msr"][6]["val"] %>]
data: [<%= @complexity["msr"][6].nil? ? 0 : @complexity["msr"][6]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }
@ -329,7 +329,7 @@
},
series: [{
name: '重复率',
data: [<%= @complexity["msr"][7]["val"] %>]
data: [<%= @complexity["msr"][7].nil? ? 0 : @complexity["msr"][7]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }
@ -454,7 +454,7 @@
},
series: [{
name: '质量等级',
data: [<%= @complexity["msr"][5]["val"] %>]
data: [<%= @complexity["msr"][5].nil? ? 0 : @complexity["msr"][5]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }

View File

@ -1,22 +1,33 @@
<script type="text/javascript">
// $("#ajax-indicator span").text("载入中...");
$("#ajax-indicator").show();
</script>
<div class="project_r_h">
<h2 class="project_h2">分析结果</h2>
</div>
<ul class="analysis-result-list">
<li class="analysis-result-name fl fontBlue2" >名称</li>
<li class="analysis-result-version fl fontBlue2" >版本</li>
<li class="analysis-result-loc fl fontBlue2" >分支</li>
<li class="analysis-result-debt fl fontBlue2" >语言</li>
<li class="analysis-result-time fl fontBlue2" >时间</li>
<li class="analysis-result-version fl fontBlue2" >分支</li>
<li class="analysis-result-loc fl fontBlue2" >语言</li>
<li class="analysis-result-debt fl fontBlue2" >路径</li>
<li class="analysis-result-time fl fontBlue2" >编辑</li>
<!--<li class="analysis-result-time fl fontBlue2" >bianji</li>-->
<div class="cl"></div>
</ul>
<% if @quality_analyses.count >0 %>
<% @quality_analyses.each do |qa| %>
<ul class="analysis-result-list">
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.author_login+":"+qa.rep_identifier, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %></li>
<li class="analysis-result-version fl fontBlue2" title="版本">1.0</li>
<li class="analysis-result-loc fl fontBlue2" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-debt fl fontBlue2" title="语言"><%= qa.language %></li>
<li class="analysis-result-time fl fontBlue2" title="时间"><%= format_time(qa.created_at) %></li>
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2" %></li>
<li class="analysis-result-version fl fontBlue2" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2" title="语言"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2" title="时间"><%= qa.path %></li>
<% if User.current.try(:login) == qa.author_login %>
<li class="analysis-result-time fl" title="编辑">
<%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %>
</li>
<% else %>
<li class="analysis-result-time fl" style="color: #888" title="编辑">编辑</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %>

View File

@ -1,72 +1,91 @@
<%= javascript_include_tag 'highcharts','highcharts-more' %>
<%= render :partial => "hightchars" %>
<div class="project_r_h">
<h2 class="project_h2" style="width:180px;">质量分析</h2>
</div>
<div class="project_r_h">
<h2 class="project_h2" style="width:180px;">质量分析</h2>
</div>
<div class="button-rep">当前分支:<%= params[:branch] %></div>
<div class="cl"></div>
<div class="tac f20 fb mt35 mb30">项目代码质量分析报告</div>
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">概要信息</span></div>
<div class="analysis-block mt10 mb40 f14">
<div class="flex">
<div class="analysis-genral">
<p id="container_sqale_rating" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">质量等级</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][9]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= sqale_rating_status(@complexity["msr"][9]["val"])[1] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %></span></p>
<% if @complexity["msr"].count > 3 %>
<%= render :partial => "hightchars" %>
<div class="analysis-block mt10 mb40 f14">
<div class="flex mb10">
<div class="analysis-genral">
<p id="container_sqale_rating" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">质量等级</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][9].nil? ? "A" : @complexity["msr"][9]["frmt_val"] %>
<span class="f10 c_white analysis-genral-icon <%=@complexity["msr"][9].nil? ? "" : sqale_rating_status(@complexity["msr"][9]["val"].to_i)[1] %> borderRadius"><%= @complexity["msr"][9].blank? ? "很好" : sqale_rating_status(@complexity["msr"][9]["val"].to_i)[0] %></span></p>
</div>
<div class="analysis-genral" >
<p id="container_function_complexity" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">复杂度</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][6].nil? ? 0 : @complexity["msr"][6]["val"] %>
<span class="f10 c_white analysis-genral-icon <%= @complexity["msr"][6].nil? ? "" : complexity_status(@complexity["msr"][6]["val"].to_i)[1] %> borderRadius"><%= @complexity["msr"][6].nil? ? 0 : complexity_status(@complexity["msr"][6]["val"].to_i)[0] %></span></p>
</div>
</div>
<div class="analysis-genral" >
<p id="container_function_complexity" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">复杂度</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][6]["val"] %><span class="f8 c_white analysis-genral-icon <%= complexity_status(@complexity["msr"][6]["val"])[1] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"])[0] %></span></p>
<div class="flex">
<div class="analysis-genral">
<p id="container_duplicated_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">代码重复度</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][7].nil? ? 0 : @complexity["msr"][7]["frmt_val"] %>
<span class="f10 c_white analysis-genral-icon <%= @complexity["msr"][7].nil? ? "" : duplicated_lines_density_status(@complexity["msr"][7]["val"].to_i)[1] %> borderRadius"><%= @complexity["msr"][7].nil? ? 0 : duplicated_lines_density_status(@complexity["msr"][7]["val"].to_i)[0] %></span></p>
</div>
<div class="analysis-genral">
<p id="container_comment_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">注释率</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][5].nil? ? 0 : @complexity["msr"][5]["frmt_val"] %>
<span class="f10 c_white analysis-genral-icon <%= @complexity["msr"][5].nil? ? "" : comment_lines_density_status(@complexity["msr"][5]["val"].to_i)[1] %> borderRadius"><%= @complexity["msr"][5].nil? ? 0 : comment_lines_density_status(@complexity["msr"][5]["val"].to_i)[0] %></span></p>
</div>
</div>
</div>
<div class="flex">
<div class="analysis-genral">
<p id="container_duplicated_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">代码重复度</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][7]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[1] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[0] %></span></p>
</div>
<div class="analysis-genral">
<p id="container_comment_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">注释率</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][5]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= comment_lines_density_status(@complexity["msr"][5]["val"])[1] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"])[0] %></span></p>
</div>
</div>
</div>
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">质量等级</span><span class="mr10 fontGrey2"><span class="c_red f18" style="margin-top:-5px; display:inline-block;"><%= score_sqale_rating(@complexity["msr"][9]["val"]) %></span>/5分</span><span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %></span></span></div>
<% end %>
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">质量等级</span><span class="mr10 fontGrey2"><span class="c_red f18" style="margin-top:-5px; display:inline-block;"><%=@complexity["msr"][9].nil? ? 0 : score_sqale_rating(@complexity["msr"][9]["val"].to_i) %></span>/5分</span>
<span class="fontGrey2">可定性评价为:<span class="c_red">质量<%=@complexity["msr"][9].nil? ? "很好" : sqale_rating_status(@complexity["msr"][9]["val"])[0] %></span></span></div>
<div class="analysis-block mt10 mb40 f14">
<div><span class="fontGrey3 mr30">技术债务</span><span class="fontBlue2 w70 pInline"><%= @complexity["msr"][8]["frmt_val"] %></span><span class="fontGrey2"><a target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div>
<div><span class="fontGrey3 mr30">质量问题</span>
<span class="fontBlue2 w70 pInline"><a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false"><%= @sonar_issues["msr"][0]["frmt_val"] %></a></span><span class="fontGrey2">问题分类如下:</span></div>
<div><span class="fontGrey3 mr30">技术债务</span><span class="w70 pInline"><%=@complexity["msr"][8].nil? ? 0 : @complexity["msr"][8]["frmt_val"] %></span>
<span class="fontGrey2"><a class="linkBlue2" target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div>
<div><span class="fontGrey3 mr30 fl">质量问题</span>
<span class="fontBlue2 w70 pInline"><a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false"><%=@sonar_issues["msr"][0].nil? ? 0 : @sonar_issues["msr"][0]["frmt_val"] %></a></span><span class="fontGrey2">&nbsp;问题分类如下:</span></div>
<div class="ml90 mt15">
<div class="mb10"><span class="analysis-block-icon mr5"></span><span class="fontGrey3 mr45">阻断</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][1]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][1]["frmt_val"].to_i, 200) %>%;"></span></span></div>
<div class="mb10"><span class="analysis-serious-icon mr5"></span><span class="fontGrey3 mr45">严重</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][2]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][2]["frmt_val"].to_i, 200) %>%;"></span></span></div>
<div class="mb10"><span class="analysis-main-icon mr5"></span><span class="fontGrey3 mr45">主要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][3]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][3]["frmt_val"].to_i, 200) %>%;"></span></span></div>
<div class="mb10"><span class="analysis-secondary-icon mr5"></span><span class="fontGrey3 mr45">次要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][4]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][4]["frmt_val"].to_i, 200) %>%;"></span></span></div>
<div><span class="analysis-info-icon mr5"></span><span class="fontGrey3 mr45">信息</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][5]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][5]["frmt_val"].to_i, 200) %>%;"></span></span></div>
<div class="mb10"><span class="analysis-block-icon mr5"></span><span class="fontGrey3 mr45">阻断</span>
<a target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false|severities=BLOCKER" class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][1].nil? ? 0 : @sonar_issues["msr"][1]["frmt_val"] %></a>
<span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%=@sonar_issues["msr"][1].nil? ? 0 : statistics_result_percentage(@sonar_issues["msr"][1]["frmt_val"].to_i, 1000) %>%;"></span></span></div>
<div class="mb10"><span class="analysis-serious-icon mr5"></span><span class="fontGrey3 mr45">严重</span>
<a target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false|severities=CRITICAL" class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][2].nil? ? 0 : @sonar_issues["msr"][2]["frmt_val"] %></a>
<span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%=@sonar_issues["msr"][2].nil? ? 0 : statistics_result_percentage(@sonar_issues["msr"][2]["frmt_val"].to_i, 1000) %>%;"></span></span></div>
<div class="mb10"><span class="analysis-main-icon mr5"></span><span class="fontGrey3 mr45">主要</span>
<a target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false|severities=MAJOR" class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][3].nil? ? 0 : @sonar_issues["msr"][3]["frmt_val"] %></a>
<span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%=@sonar_issues["msr"][3].nil? ? 0 : statistics_result_percentage(@sonar_issues["msr"][3]["frmt_val"].to_i, 1000) %>%;"></span></span></div>
<div class="mb10"><span class="analysis-secondary-icon mr5"></span><span class="fontGrey3 mr45">次要</span>
<a target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false|severities=MINOR" class="fontBlue2 w70 pInline"><%=@sonar_issues["msr"][4].nil? ? 0 : @sonar_issues["msr"][4]["frmt_val"] %></a>
<span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%=@sonar_issues["msr"][4].nil? ? 0 : statistics_result_percentage(@sonar_issues["msr"][4]["frmt_val"].to_i, 1000) %>%;"></span></span></div>
<div><span class="analysis-info-icon mr5"></span><span class="fontGrey3 mr45">信息</span>
<a target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false|severities=INFO" class="fontBlue2 w70 pInline"><%=@sonar_issues["msr"][5].nil? ? 0 : @sonar_issues["msr"][5]["frmt_val"] %></a>
<span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%=@sonar_issues["msr"][5].nil? ? 0 : statistics_result_percentage(@sonar_issues["msr"][5]["frmt_val"].to_i, 200) %>%;"></span></span></div>
</div>
</div>
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">代码规模</span><span class="fontGrey2">可定性评价为:<span class="c_red"><%= lines_scale(@complexity["msr"][0]["frmt_val"]) %></span></span></div>
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">代码规模</span><span class="fontGrey2">可定性评价为:<span class="c_red"><%=@complexity["msr"][0].nil? ? 0 : lines_scale(@complexity["msr"][0]["frmt_val"].to_i) %></span></span></div>
<div class="analysis-block mt10 mb40 flex f14">
<div class="analysis-genral">
<p class="fontGrey3">代码行数</p>
<p class="fontBlue2"><%= @complexity["msr"][0]["frmt_val"] %></p>
<p class="fontBlue2"><%= @complexity["msr"][0].nil? ? 0 : @complexity["msr"][0]["frmt_val"] %></p>
</div>
<div class="analysis-genral">
<p class="fontGrey3">文件</p>
<p class="fontBlue2"><%= @complexity["msr"][2]["frmt_val"] %></p>
<p class="fontBlue2"><%= @complexity["msr"][2].nil? ? 0 : @complexity["msr"][2]["frmt_val"] %></p>
</div>
<div class="analysis-genral">
<p class="fontGrey3">目录</p>
<p class="fontBlue2"><%= @complexity["msr"][3]["frmt_val"] %></p>
<p class="fontBlue2"><%= @complexity["msr"][3].nil? ? 0 : @complexity["msr"][3]["frmt_val"] %></p>
</div>
<div class="analysis-genral">
<p class="fontGrey3">类</p>
<p class="fontBlue2"><%= @complexity["msr"][1]["frmt_val"] %></p>
<p class="fontBlue2"><%= @complexity["msr"][1].nil? ? 0 : @complexity["msr"][1]["frmt_val"] %></p>
</div>
<div class="analysis-genral">
<p class="fontGrey3">方法</p>
<p class="fontBlue2"><%= @complexity["msr"][4]["frmt_val"] %></p>
<p class="fontBlue2"><%=@complexity["msr"][4].nil? ? 0 : @complexity["msr"][4]["frmt_val"] %></p>
</div>
</div>
<!--<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">贡献统计</span></div>-->

View File

@ -0,0 +1,9 @@
<% if @current_build_status == "success" %>
<%= render :partial => "show", :locals => {:branch => params[:branch]} %>
<% else %>
<% if @build_console_result %>
运行结果超时
<% else %>
<%= render :partial => "console_output" %>
<% end %>
<% end %>

View File

@ -0,0 +1,11 @@
$("#ajax-indicator").hide();
<% if @current_build_status == "success" %>
<%= escape_javascript( render :partial => 'quality_analysis/show', :locals => {:branch => branch}) %>
<% elsif @current_build_status == "failure" %>
<%=h @console_build.html_safe %>
<% elsif @current_build_status == "not_run" %>
alert('任务启动失败');
<% else %>
alert('你已经创建类一个同名job');
<% end %>

View File

@ -0,0 +1,8 @@
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'quality_analysis/edit', :locals => {}) %>');
showModal('ajax-modal', '615px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 580px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","20%").css("left","32%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -1,6 +1,14 @@
<% if @name_flag %>
<%= render :partial => "result_list" %>
<% else %>
<%= render "show" %>
<% if params[:current_build_status].nil? || params[:current_build_status] == "success" %>
<%= render :partial => "show", :locals => {:branch => @branch} %>
<% else %>
<% if params[:build_console_result] %>
运行结果超时
<% else %>
<%= render :partial => "console_output" %>
<% end %>
<% end %>
<% end %>

View File

@ -1,9 +1,9 @@
<div class="f16 fb fontBlue mb10">代码质量分析</div>
<div>
<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier), :remote => true, :id => 'quality_analyses_form') do %>
<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :id => 'quality_analyses_form') do %>
<div class="ui form">
<div class="mb10" style="margin-right:13px;">
<textarea id="path_description" name="path" rows="8" placeholder="目录相对于根目录,用半角逗号隔开。如:src/main/java,libs,res/script" style="height: 87px; resize:vertical;" class="analysis-option-box"></textarea>
<textarea id="path_description" name="path" rows="8" placeholder="目录相对于根目录,不填写则扫描根目录,用半角逗号隔开。如:src/main/java,libs,res/script" style="height: 87px; resize:vertical;" class="analysis-option-box"></textarea>
</div>
<div class="mb10">
<div>
@ -12,10 +12,10 @@
</div>
<div class="mb10">
<div>
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#", "Web"]), :id => 'branch', :class => "analysis-option-box" %>
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"]), :id => 'branch', :class => "analysis-option-box" %>
</div>
</div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="$('#quality_analyses_form').submit();hideModal()">提交</a></div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="$('#ajax-indicator').text('正在分析中…………(大概需要30分钟请耐心等待)').show();$('#quality_analyses_form').submit();hideModal()">提交</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal()">取消</a></div>
<div class="cl"></div>
</div>

View File

@ -1,14 +1,18 @@
<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
<div class="project_r_h">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
<%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<%# if User.current.member_of?(@project) %>
<%#= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %>
<%# end %>
<%# else %>
<% unless @entries.nil? %>
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
<%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<%# if User.current.member_of?(@project) %>
<% if quality_analysis(User.current.try(:login), @repository.id).nil? && User.current.member_of?(@project) && @project.is_public? %>
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
<% end %>
<%# end %>
<%# else %>
<%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %>
<%# end %>
<%# end %>
<% end %>
</div>
<div class="repository_con" style="line-height:1.9;">
<% if @entries.nil? %>

View File

@ -0,0 +1,17 @@
<br>
<div style='width:470px;text-align:center;font-family: "微软雅黑","宋体"' class="f14">
<% if @syllabus.courses.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
<% end %>
</div>
</br>
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.empty? %>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>关闭</a>
<% else %>
<a href='javascript:void(0);' class='Blue-btn' style="margin-left: 50px;" onclick='hideModal()'>关闭</a>
<% end %>
</div>

View File

@ -0,0 +1,72 @@
<div class="listbox" id="course-list">
<h2 class="list-h2">班级列表</h2>
<div class="list_title">
<div class="category2 fl">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
</div>
<p class="fr grayTxt">创建老师:<%=@syllabus.user.show_name %><span class="mr10 "></span> 创建时间:<%=format_date @syllabus.created_at %></p>
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% if @courses.any? %>
<% @courses.each do |course|%>
<ul class="list-file">
<li>
<span class="item_list fl"></span>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "list-title fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+""+current_time_and_term(course)+""%>
<% teacher = User.where("id=?",course.tea_id).first%>
<span class="fr grayTxt">
<%='主讲老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %>
</span>
</li>
<div class="cl"></div>
<li class="ml15">
<!--<span class="grayTxt">创建:<%#= format_time(course.created_at) %></span>-->
<span class="grayTxt">更新:<%= format_time(course.updated_on) %></span>
<span class="grayTxt">
学期:&nbsp;&nbsp;<span><%= current_time_and_term course %></span>
</span>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<% homework_num = course.homework_commons.count %>
<% else %>
<% homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
<% end %>
<p class="list-info fr grayTxt"><span><%= homework_num %></span><span>作业</span><span>|</span><span> <%= visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
</li>
<div class="cl"></div>
</ul>
<% end %>
<div>
<ul class="wlist" id="pages" >
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
<div class="cl"></div>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>
<script type="text/javascript">
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
$(function() {
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight) {
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height() + diffHeight;
$(".listbox").css("height", tmpHeight);
}
});
</script>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%=escape_javascript(render :partial => 'delete_syllabus') %>";
pop_up_box(htmlvalue,500,30,50);

View File

@ -0,0 +1,47 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<% end %>
<div class="RightBanner" >
<p >课程信息</p>
</div>
<div class="HomeWork">
<p class="f16 mb10"><%=@syllabus.title %>课程大纲</p>
<div class="HomeWorkCon">
<%= labelled_form_for @syllabus, :url =>syllabus_path(@syllabus),
:html => {:nhname=>'form',:multipart => true, :id => 'syllabus-form'} do |f| %>
<div>
<div id="syllabus_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description, :editor_id => 'syllabus_description_editor',
:owner_id => @syllabus.nil? ? 0: @syllabus.id,
:owner_type => OwnerTypeHelper::SYLLABUS,
:width => '100%',
:height => 300,
:minHeight=>300,
:class => 'talk_text fl',
:input_html => { :id => 'syllabus_content',
:class => 'talk_text fl',
:maxlength => 5000 }
%>
<div class="cl"></div>
<p id="description_notice_span"></p>
</div>
<div class="mt5">
<div class="fl" id="syllabus_attachments">
<%= render :partial => 'attachments/form_course', :locals => {:container => @syllabus, :isReply => false} %>
</div>
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_syllabus();">发送</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="window.location.href = '<%=syllabus_path(@syllabus)%>';">取消</a>
</div>
<div class="cl"></div>
<% end %>
</div>
</div><!--HomeWork end-->

View File

@ -0,0 +1,3 @@
$("#syllabus_eng_name_show").html("<%= escape_javascript render :partial => 'layouts/syllabus_eng_name', :locals => {:syllabus => @syllabus} %>");
$("#syllabus_eng_name_show").show();
$("#syllabus_eng_name_edit").hide();

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