Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

Conflicts:
	db/schema.rb
	public/stylesheets/css/public.css
This commit is contained in:
huang 2016-08-26 17:55:51 +08:00
commit 803bd9819a
107 changed files with 2043 additions and 416 deletions

View File

@ -287,6 +287,30 @@ module Mobile
end
end
desc "获取课程动态"
params do
requires :id, type: Integer
requires :token, type: String
end
post 'activities' do
authenticate!
user = current_user
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc')
page = params[:page] ? params[:page] : 0
all_count = activities.count
activities = activities.limit(10).offset(page * 10)
count = activities.count
present :data, activities, with: Mobile::Entities::Activity,user: user
present :all_count, all_count
present :count, count
present :page, page
present :status, 0
end
desc "课程作业列表"
params do
requires :token, type: String
@ -558,6 +582,85 @@ module Mobile
end
end
desc "发布班级通知"
params do
requires :id, type: Integer
requires :token, type: String
requires :text, type: String
requires :title, type: String
end
post ':id/publishnotice' do
authenticate!
#老师或教辅才能发通知
c = Course.find("#{params[:id]}")
my_member = c.member_principals.where("users.id=#{current_user.id}").first
roles_ids = []
my_member.roles.each do |role|
roles_ids << role.id
end
if my_member && (roles_ids.include?(7)|| roles_ids.include?(9) || roles_ids.include?(3))
tmpparams = {}
tmpparams['title'] = params[:title]
tmpparams['description'] = params[:text]
tmpparams['sticky'] = 0
news = News.new(:course => c, :author => current_user)
#render :layout => 'base_courses'
news.safe_attributes = tmpparams
news.save!
present :status, 0
else
present :status, -1
present :message,"学生不能发布通知"
end
end
desc "发布班级问题"
params do
requires :id, type: Integer
requires :token, type: String
requires :text, type: String
end
post ':id/publishissue' do
authenticate!
c = Course.find("#{params[:id]}")
boards = c.boards.includes(:last_message => :author).all
if c.boards.empty?
board = c.boards.build
board.name = "班级问答区"
board.description = c.name.to_s
board.project_id = -1
if board.save
boards = c.boards.includes(:last_message => :author).all
end
end
board = boards.first
message = Message.new
message.author = current_user
message.board = board
tmpparams = {}
tmpparams['subject'] = params[:title]
tmpparams['content'] = params[:text]
message.safe_attributes = tmpparams
message.save!
present :status, 0
end
end
end
end

View File

@ -17,11 +17,21 @@ module Mobile
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
issue = Issue.find params[:id]
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
is_public = 1
if type == 0
issue = Issue.find params[:id]
issue.project.is_public
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
else
jour = Journal.find params[:id]
present :data, jour, with: Mobile::Entities::Issue,user: user,type: type,page: page
end
present :type, type
present :page, page
present :is_public, issue.project.is_public
present :is_public,is_public
present :status, 0
rescue Exception=>e
present :status, -1

View File

@ -14,14 +14,19 @@ module Mobile
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
news = News.find params[:id]
is_public = 1
if news.project
is_public = news.project.is_public
elsif news.course
is_public = news.course.is_public
if type == 0
news = News.find params[:id]
if news.project
is_public = news.project.is_public
elsif news.course
is_public = news.course.is_public
end
else
news = Comment.find params[:id]
end
present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page

View File

@ -229,6 +229,45 @@ module Mobile
present :message, result[:message]
end
desc "发布项目帖子"
params do
requires :id, type: Integer
requires :token, type: String
requires :text, type: String
end
post ':id/publishnote' do
authenticate!
project = Project.find("#{params[:id]}")
boards = project.boards.includes(:last_message => :author).all
if project.boards.empty?
board = project.boards.build
board.name = "项目讨论区"
board.description = project.name.to_s
board.course_id = -1
if board.save
boards = project.boards.includes(:last_message => :author).all
end
end
board = boards.first
message = Message.new
message.author = current_user
message.board = board
tmpparams = {}
tmpparams['subject'] = params[:title]
tmpparams['content'] = params[:text]
message.safe_attributes = tmpparams
message.save!
present :status, 0
end
end
end
end

View File

@ -40,6 +40,8 @@ module Mobile
ac.act.subject unless ac.nil? || ac.act.nil?
elsif ac.act_type == "JournalsForMessage"
ac.act.private == 0 ? "留言" : "私信" unless ac.nil? || ac.act.nil?
elsif ac.act_type == "Poll"
ac.act.polls_name unless ac.nil? || ac.act.nil?
end
when :description
if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News"
@ -48,6 +50,8 @@ module Mobile
strip_html(ac.act.content) unless ac.nil? || ac.act.nil?
elsif ac.act_type == "JournalsForMessage"
strip_html(ac.act.notes) unless ac.nil? || ac.act.nil?
elsif ac.act_type == "Poll"
ac.act.polls_description unless ac.nil? || ac.act.nil?
end
when :latest_update
time_from_now ac.updated_at unless ac.nil?
@ -73,15 +77,15 @@ module Mobile
if ac.container_type == "Course"
case ac.act_type
when "HomeworkCommon"
"课程作业"
"班级作业"
when "News"
"课程通知"
"班级通知"
when "Message"
"课程问答"
"班级讨论"
when "Poll"
"课程问卷"
"班级问卷"
when "Course"
"课程"
"班级"
end
elsif ac.container_type == "Project"
case ac.act_type

View File

@ -23,6 +23,8 @@ module Mobile
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
when :coursename
f.course.nil? ? "" : f.course.name
when :course_id
f.course.nil? ? 0 : f.course.id
end
end
@ -38,6 +40,7 @@ module Mobile
attachment_expose :file_dir
attachment_expose :attafile_size
attachment_expose :coursename #所属班级名
attachment_expose :course_id #所属班级名
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user]
current_user_is_teacher = false

View File

@ -36,15 +36,42 @@ module Mobile
issue.id
when :title
issue.subject
when :subject
issue.subject
when :description
issue.description
when :done_ratio
issue.done_ratio
end
end
elsif issue.is_a?(::Journal)
case f
when :content
issue[:notes]
when :lasted_comment
time_from_now issue.created_on
when :act_id
issue.id
end
end
end
end
expose :subject
expose :description
expose :author, using: Mobile::Entities::User
expose :done_ratio
issue_expose :subject
issue_expose :description
expose :author, using: Mobile::Entities::User do |f, opt|
if f.is_a?(::Issue)
f.send(:author)
end
end
expose :user,using: Mobile::Entities::User do |f, opt|
if f.is_a?(::Journal)
f.send(:user)
end
end
issue_expose :content
issue_expose :lasted_comment
issue_expose :done_ratio
issue_expose :title
issue_expose :act_type
issue_expose :act_id
@ -55,11 +82,29 @@ module Mobile
issue_expose :comment_count
issue_expose :project_name
issue_expose :praise_count
expose :issue_journals, using: Mobile::Entities::Journal do |f, opt|
expose :id
# expose :issue_journals, using: Mobile::Entities::Journal do |f, opt|
# if f.is_a?(::Issue)
# f.journals.where("notes is not null and notes != ''").reverse
# end
# end
expose :all_children, using: Mobile::Entities::Issue do |f, opt|
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
if f.is_a?(::Issue)
f.journals.where("notes is not null and notes != ''").reverse
# f.journals_for_messages.reverse
if !opt[:children] && opt[:type] == 0
opt[:children] = true
tStart = opt[:page]*5
tEnd = (opt[:page]+1)*5 - 1
all_comments = f.journals.where("notes is not null and notes != ''").reorder("created_on desc")
all_comments[tStart..tEnd]
end
end
end
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
has_praise = false
current_user = options[:user]
@ -67,6 +112,69 @@ module Mobile
has_praise = obj.empty? ? false : true
has_praise
end
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
if instance.is_a?(::Journal)
parents_reply = []
parents_reply = get_reply_parents(parents_reply, instance)
parents_reply.count
end
end
expose :parents_reply_bottom, using:Mobile::Entities::Issue do |f,opt|
if f.is_a? (::Journal)
#取二级回复的底楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 0 && !opt[:bottom]
if opt[:type] == 1
# opt[:bottom] = true
# parents_reply[opt[:page]..opt[:page]]
else
opt[:bottom] = true
parents_reply[0..0]
end
else
[]
end
end
end
expose :parents_reply_top, using:Mobile::Entities::Issue do |f,opt|
if f.is_a? (::Journal)
#取二级回复的顶楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 2 && !opt[:top]
if opt[:type] == 1
opt[:top] = true
tStart = (opt[:page]-1)*5+2
tEnd = (opt[:page])*5+2 - 1
if tEnd >= parents_reply.count - 1
tEnd = parents_reply.count - 2
end
if tStart <= parents_reply.count - 2
parents_reply = parents_reply.reverse[tStart..tEnd]
parents_reply.reverse
else
[]
end
else
opt[:top] = true
parents_reply = parents_reply.reverse[0..1]
parents_reply.reverse
end
elsif parents_reply.count == 2 && !opt[:top]
opt[:top] = true
parents_reply = parents_reply.reverse[0..0]
parents_reply.reverse
else
[]
end
end
end
end
end
end

View File

@ -28,6 +28,16 @@ module Mobile
f.comments.count
end
end
elsif f.is_a?(::Comment)
case field
when :content
f[:comments]
when :lasted_comment
time_from_now f.created_on
when :act_id
f.id
end
elsif f.is_a?(Hash) && !f.key?(field)
n = f[:news]
comments = f[:comments]
@ -43,14 +53,16 @@ module Mobile
end
end
end
news_expose :id
expose :id
#新闻标题
news_expose :title
expose :author,using: Mobile::Entities::User do |f, opt|
expose :user,using: Mobile::Entities::User do |f, opt|
obj = nil
if f.is_a?(::News) && f.respond_to?(:author)
obj = f.send(:author)
elsif f.is_a?(::Comment) && f.respond_to?(:author)
obj = f.send(:author)
elsif f.is_a?(Hash) && f.key?(:author)
obj = f[:author]
end
@ -73,14 +85,34 @@ module Mobile
news_expose :praise_count
#课程名字
news_expose :course_name
news_expose :lasted_comment
#评论
expose :comments, using: Mobile::Entities::Comment do |f, opt|
if f.is_a?(Hash) && f.key?(:comments)
f[:comments]
elsif f.is_a?(::News) && f.respond_to?(:comments)
f.comments.reverse
# expose :comments, using: Mobile::Entities::Comment do |f, opt|
# if f.is_a?(Hash) && f.key?(:comments)
# f[:comments]
# elsif f.is_a?(::News) && f.respond_to?(:comments)
# f.comments.reverse
# end
# end
news_expose :content
expose :all_children, using: Mobile::Entities::News do |f, opt|
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
if f.is_a?(::News)
# f.journals_for_messages.reverse
if !opt[:children] && opt[:type] == 0
opt[:children] = true
tStart = opt[:page]*5
tEnd = (opt[:page]+1)*5 - 1
all_comments = f.comments.reorder("created_on desc")
all_comments[tStart..tEnd]
end
end
end
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
has_praise = false
current_user = options[:user]
@ -88,6 +120,69 @@ module Mobile
has_praise = obj.empty? ? false : true
has_praise
end
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
if instance.is_a?(::Comment)
parents_reply = []
parents_reply = get_reply_parents(parents_reply, instance)
parents_reply.count
end
end
expose :parents_reply_bottom, using:Mobile::Entities::News do |f,opt|
if f.is_a? (::Comment)
#取二级回复的底楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 0 && !opt[:bottom]
if opt[:type] == 1
# opt[:bottom] = true
# parents_reply[opt[:page]..opt[:page]]
else
opt[:bottom] = true
parents_reply[0..0]
end
else
[]
end
end
end
expose :parents_reply_top, using:Mobile::Entities::News do |f,opt|
if f.is_a? (::Comment)
#取二级回复的顶楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 2 && !opt[:top]
if opt[:type] == 1
opt[:top] = true
tStart = (opt[:page]-1)*5+2
tEnd = (opt[:page])*5+2 - 1
if tEnd >= parents_reply.count - 1
tEnd = parents_reply.count - 2
end
if tStart <= parents_reply.count - 2
parents_reply = parents_reply.reverse[tStart..tEnd]
parents_reply.reverse
else
[]
end
else
opt[:top] = true
parents_reply = parents_reply.reverse[0..1]
parents_reply.reverse
end
elsif parents_reply.count == 2 && !opt[:top]
opt[:top] = true
parents_reply = parents_reply.reverse[0..0]
parents_reply.reverse
else
[]
end
end
end
end
end
end

View File

@ -30,6 +30,8 @@ class AccountController < ApplicationController
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1)
elsif user.identity == 3 && user.occupation.nil?
redirect_to my_account_path(:tip => 1)
else
redirect_to user_path(User.current)
end
@ -357,6 +359,8 @@ class AccountController < ApplicationController
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1)
elsif user.identity == 3 && user.occupation.nil?
redirect_to my_account_path(:tip => 1)
else
redirect_back_or_default User.current
#redirect_to my_account_url

View File

@ -12,11 +12,13 @@ class AvatarController < ApplicationController
@source_id = params[:source_id]
@temp_file = params[:avatar][:image]
@image_file = @temp_file.original_filename
@is_direct = params[:is_direct]
else
unless request.raw_post.nil?
@source_type = params[:source_type]
@source_id = params[:source_id]
@temp_file = request.raw_post
@is_direct = params[:is_direct]
if @temp_file.size > 0
if @temp_file.respond_to?(:original_filename)
@image_file = @temp_file.original_filename
@ -38,7 +40,7 @@ class AvatarController < ApplicationController
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
# 用户头像上传时进行特别处理
if @source_type == 'User'
if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project')
diskfile += "temp"
@urlfile += "temp"
end
@ -105,7 +107,7 @@ class AvatarController < ApplicationController
path = File.dirname(diskfile)
if File.directory?(path) && File.exist?(diskfile)
# 用户头像进行特别处理
if @source_type == 'User'
if @source_type == 'User' || @source_type == 'Course' || @source_type == 'Project'
diskfile1 = diskfile + 'temp'
File.open(diskfile1, "wb") do |f|
buffer = "DELETE"

View File

@ -94,8 +94,10 @@ class HomeworkCommonController < ApplicationController
end
end
status = false
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
homework_detail_manual.comment_status = 1
status = true
end
eval_start = homework_detail_manual.evaluation_start
if eval_start.nil? || (eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1)
@ -145,6 +147,10 @@ class HomeworkCommonController < ApplicationController
@homework_detail_programing.save if @homework_detail_programing
@homework_detail_group.save if @homework_detail_group
if @homework.homework_type != 3 && homework_detail_manual.comment_status == 1 && status
create_works_list @homework
end
if params[:is_manage] == "1"
redirect_to manage_or_receive_homeworks_user_path(User.current.id)
elsif params[:is_manage] == "2"

View File

@ -189,6 +189,15 @@ class IssuesController < ApplicationController
# 给该issue在它所在的项目中所有的issues中所在的位置给一个序号
@issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1
if @issue.save
senduser = User.find(params[:issue][:assigned_to_id])
issue_id = @issue.id
issue_title = params[:issue][:subject]
priority_id = params[:issue][:priority_id]
ps = ProjectsService.new
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
respond_to do |format|
format.html {
@ -581,6 +590,18 @@ class IssuesController < ApplicationController
end
end
@issue.safe_attributes = issue_attributes
senduser = User.find(params[:issue][:assigned_to_id])
if senduser.id != User.current.id
issue_id = @issue.id
issue_title = params[:issue][:subject]
priority_id = params[:issue][:priority_id]
ps = ProjectsService.new
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
end
@priorities = IssuePriority.active
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
true

View File

@ -90,14 +90,34 @@ class MyController < ApplicationController
end
def clear_user_avatar_temp
@user = User.current
diskfile = disk_filename('User', @user.id)
if params[:course]
@course = Course.find params[:course]
diskfile = disk_filename('Course', @course.id)
elsif params[:project]
@project = Project.find params[:project]
diskfile = disk_filename('Project', @project.id)
else
@user = User.current
diskfile = disk_filename('User', @user.id)
end
diskfile1 = diskfile + 'temp'
File.delete(diskfile1) if File.exist?(diskfile1)
end
def save_user_avatar
@user = User.current
diskfile = disk_filename('User', @user.id)
if params[:source_id] && params[:source_type]
case params[:source_type]
when 'User'
@user = User.current
diskfile = disk_filename('User', @user.id)
when 'Course'
@course = Course.find params[:source_id]
diskfile = disk_filename('Course', @course.id)
when 'Project'
@project = Project.find params[:source_id]
diskfile = disk_filename('Project', @project.id)
end
end
diskfile1 = diskfile + 'temp'
begin
FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1
@ -145,8 +165,10 @@ class MyController < ApplicationController
@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
# 如果用户是从业者将单位名称保存至学校id字段
if @user.user_extensions.identity == 3
# @user.firstname = params[:enterprise_name]
@user.user_extensions.school_id = params[:occupation]
end
end
@ -157,7 +179,6 @@ class MyController < ApplicationController
# @se.occupation = params[:occupation]
# end
@se.school_id = params[:occupation]
@se.gender = params[:sex]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@ -180,6 +201,7 @@ class MyController < ApplicationController
@user.login = lg
end
end
# 不管前面是否有异常,如果文件已存在就删除
ensure
File.delete(diskfile1) if File.exist?(diskfile1)
end

View File

@ -734,24 +734,33 @@ class StudentWorkController < ApplicationController
end
def destroy
if @work.destroy
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
pros = @work.student_work_projects.where("is_leader = 0")
pros.each do |pro|
pro.destroy
end
project = @work.student_work_projects.where("is_leader = 1").first
project.update_attributes(:student_work_id => nil)
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
@work.student_work_projects.each do |pro2|
pro2.destroy
if @homework.homework_type == 3
if @work.destroy
if @homework.homework_detail_group.base_on_project == 1
pros = @work.student_work_projects.where("is_leader = 0")
pros.each do |pro|
pro.destroy
end
project = @work.student_work_projects.where("is_leader = 1").first
project.update_attributes(:student_work_id => nil)
elsif @homework.homework_detail_group.base_on_project == 0
@work.student_work_projects.each do |pro2|
pro2.destroy
end
end
end
respond_to do |format|
format.html {
redirect_to student_work_index_url(:homework => @homework.id)
}
end
else
@work.attachments.destroy_all
@work.student_works_scores.destroy_all
@work.course_messages.destroy_all
@work.student_work_tests.destroy_all
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil)
@work.update_column("work_score",nil)
end
respond_to do |format|
format.html {
redirect_to student_work_index_url(:homework => @homework.id)
}
end
end
@ -793,6 +802,8 @@ class StudentWorkController < ApplicationController
end
elsif @homework.homework_type == 1
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil)
@work.attachments.destroy_all
@work.course_messages.destroy_all
end
@student_work = StudentWork.new
respond_to do |format|

View File

@ -42,7 +42,7 @@ class UsersController < ApplicationController
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks]
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
@ -1115,23 +1115,8 @@ class UsersController < ApplicationController
homework_detail_programing.save if homework_detail_programing
homework_detail_group.save if homework_detail_group
if homework.homework_type != 3
students = homework.course.student
if !homework.course.nil? && !students.empty?
name = homework.name
name_str = name + "的作品提交"
str = ""
students.each do |student|
if str != ""
str += ","
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
end
#('#{name}的作品提交',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
#StudentWork.create(:name => "#{name}的作品提交", :homework_common_id => homework.id, :user_id => student.student_id)
ActiveRecord::Base.connection.execute sql
end
if homework.homework_type != 3 && homework_detail_manual.comment_status == 1
create_works_list homework
end
if params[:quotes] && !params[:quotes].blank?
@ -1474,15 +1459,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(10).offset(@page * 10)
@all_count = @user.courses.visible.where("is_delete =?", 0).count
@courses = @user.favorite_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(10).offset(@page * 10)
@all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count
end
#显示更多用户项目
def user_projects4show
@page = params[:page].to_i + 1
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10)
@all_count = @user.projects.visible.count
@projects = @user.favorite_projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10)
@all_count = @user.favorite_projects.visible.count
end
def user_course_activities
@ -3439,6 +3424,28 @@ class UsersController < ApplicationController
end
end
#收藏班级/项目
def cancel_or_collect
if params[:project]
@project = Project.find params[:project]
member = Member.where("user_id = #{@user.id} and project_id = #{@project.id}")
elsif params[:course]
@course = Course.find params[:course]
member = Member.where("user_id = #{@user.id} and course_id = #{@course.id}")
end
unless member.empty?
member.first.update_attribute(:is_collect, member.first.is_collect == 0 ? 1 : 0)
end
if @project
@projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)
elsif @course
@courses = @user.favorite_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(10)
end
respond_to do |format|
format.js
end
end
def user_projectlist
@order, @c_sort, @type, @list_type = 1, 2, 1, 1
#limit = 5

View File

@ -435,8 +435,12 @@ class WechatsController < ActionController::Base
session[:wechat_openid] = open_id
if params[:code]
if params[:userid]
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&userid=#{params[:userid]}" and return
# if params[:state].match("review_class_member") || params[:state].match("review_project_member")
@path = params[:state].split('/')[0]
useridstr = params[:state].split('/')[1]
# end
if useridstr
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return
elsif params[:id]
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
else

View File

@ -3442,8 +3442,26 @@ def course_syllabus_option user = User.current
type
end
def create_works_list homework
students = homework.course.student
if !homework.course.nil? && !students.empty?
name = homework.name
name_str = name + "的作品提交"
str = ""
students.each do |student|
if str != ""
str += ","
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
end
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
# 获取项目动态更新时间
def get_forge_act_message(act, type)
forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first
format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at))
end

View File

@ -131,6 +131,22 @@ class Principal < ActiveRecord::Base
columns.uniq.map {|field| "#{table}.#{field}"}
end
#收藏的课程
def favorite_courses
members = Member.where("user_id = #{self.id} and course_id != -1 and is_collect = 1")
course_ids = members.empty? ? "(-1)" : "(" + members.map{|member| member.course_id}.join(",") + ")"
courses = Course.where("id in #{course_ids}")
return courses
end
#收藏的项目
def favorite_projects
members = Member.where("user_id = #{self.id} and project_id != -1 and project_id != 0 and is_collect = 1")
project_ids = members.empty? ? "(-1)" : "(" + members.map{|member| member.project_id}.join(",") + ")"
projects = Project.where("id in #{project_ids}")
return projects
end
protected
# Make sure we don't try to insert NULL values (see #4632)

View File

@ -1,6 +1,6 @@
#学生提交作品表
class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
belongs_to :homework_common
belongs_to :user

View File

@ -331,4 +331,28 @@ class ProjectsService
{:status => status,:message => message}
end
def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count
if count == 0
title = "您有新的issue需要解决。"
remark = "点击详情查看issue。"
case priority_id
when "1"
priority = ""
when "2"
priority = "正常"
when "3"
priority = ""
when "4"
priority = "紧急"
when "5"
priority = "立刻"
end
ws = WechatService.new
ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark
end
end
end

View File

@ -115,8 +115,8 @@ class WechatService
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
if uid && uid != 0
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
# tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3
end
data = {
touser:openid,
@ -149,8 +149,8 @@ class WechatService
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
if uid && uid != 0
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
# tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3
end
data = {
@ -188,8 +188,8 @@ class WechatService
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
if uid && uid != 0
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
# tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3
end
data = {
@ -417,8 +417,19 @@ class WechatService
end
Rails.logger.info "send over. #{req}"
end
end
def project_issue_notice(user_id, type, id, first, key1, key2,remark="",uid=0)
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark,0
begin
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
rescue Exception => e
Rails.logger.error "[project_issue_notice] ===> #{e}"
end
Rails.logger.info "send over. #{req}"
end
end
end

View File

@ -17,7 +17,8 @@
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s,
:source_id => source.id.to_s
:source_id => source.id.to_s,
:is_direct => 0
} %>
<!--</span>-->
<% content_for :header_tags do %>

View File

@ -1,4 +1,4 @@
<% if @source_type=='User' %>
<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project') %>
var imgSpan = $("img[nhname='avatar_image']");
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% else %>

View File

@ -126,7 +126,7 @@
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">

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

@ -7,7 +7,7 @@
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">

View File

@ -7,7 +7,7 @@
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">

View File

@ -7,7 +7,7 @@
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">

View File

@ -2,7 +2,7 @@
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<li>
<a href="<%=course_boards_path(@course) %>">问答区</a>
<a href="<%=course_boards_path(@course) %>">讨论区</a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li>
<% end %>

View File

@ -17,7 +17,7 @@
<div class="cl"></div>
<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="new_course_name" class="courses_input" maxlength="100" placeholder="例如计算机系A班" onkeyup="regex_course_name('new');">
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如:软件工程计算机系A班" onkeyup="regex_course_name('new');">
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
</li>
<div class="cl"></div>

View File

@ -7,6 +7,9 @@
$("#course_is_public").attr("checked",true);
<% end %>
}
if(document.getElementById("course_list")) {
window.location.href = "<%=course_files_path(@course) %>";
}
<% else %>
<% if @course.is_public? %>
$("#show_course_<%= @course.id %>").attr("title","公开班级:<%= @course.name %><%= @course.time.to_s+ @course.term %>");

View File

@ -27,9 +27,8 @@
<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" id="course_avatar_form">
<%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %>
<div class="cl"></div>
</li>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>

View File

@ -30,7 +30,16 @@
<div class="cl"></div>
<div class="sy_class_logo fl">
<%= image_tag(url_to_avatar(@course), :width => "110", :height => "110", :alt => "班级logo") %>
<div class="pr" style="width: 96px; height:96px;">
<% if User.current.logged? && (User.current == @course.teacher || User.current.admin?)%>
<%=link_to image_tag(url_to_avatar(@course),width:"96", height: "96", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:course => @course.id), :remote => true%>
<div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path(:course => @course.id), :class => 'homepageEditProfileIcon', :title => '点击编辑头像', :remote => true %>
</div>
<% else %>
<%= image_tag(url_to_avatar(@course), :width => "96", :height => "96", :alt => "班级logo") %>
<% end %>
</div>
</div>
<div class="sy_class_id fl">
<p>邀 请 码<br />
@ -54,7 +63,7 @@
</p>
<div class="cl"></div>
</div>
<p class="sy_cgrey mb10">
<p class="sy_cgrey mb5">
<span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span>
<span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span>
<span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span>

View File

@ -0,0 +1,40 @@
<%= javascript_include_tag "feedback" %>
<div class="scrollsidebar" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
<div class="side_title">
<a title="<%= l(:button_hide) %>" class="close_btn">
<span>
</span>
</a>
</div>
<div class="side_center">
<div class="custom_service">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= 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;height:21px" id="" onclick="">
<%= l(:label_submit)%>
</a>
<% end %>
</div>
<div class="mt5" style="color: #269ac9;cursor: default">
<!--<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"></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>
</div>
</div>
<div class="show_btn">
<span><%= l(:label_submit)%></span>
<a href="javascript:void(0)" class="closeSidebar"></a>
</div>
</div>

View File

@ -0,0 +1,17 @@
<% all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count%>
<div id="homepageLeftMenuCourses">
<ul class="user_sub_menu" id="user_courses_li">
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %>
</ul>
</div>
<% if !courses.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_course" onclick="leftCourseslistChange();">
<span id="hide_show_courseicon" class="user_icons_closeclass"></span>
</a>
<% end %>
<script>
$(function() {
$('#user_hide_course').hide();
})
</script>

View File

@ -0,0 +1,17 @@
<% all_count = @user.favorite_projects.visible.count%>
<div id="homepageLeftMenuForge">
<ul class="user_sub_menu" id="user_projects_li">
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :all_count => all_count, :page => 0} %>
</ul>
</div>
<% if !projects.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_project" onclick="leftProjectslistChange();">
<span id="hide_show_projecticon" class="user_icons_closeclass"></span>
</a>
<% end %>
<script>
$(function() {
$('#user_hide_project').hide();
})
</script>

View File

@ -27,7 +27,7 @@
<!--白&nbsp;&nbsp;&nbsp;羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad-->
<!--<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>
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="Trustie师姐师兄答疑群" title="Trustie师姐师兄答疑群"></a>
</div>
</div>
<div class="side_bottom"></div>

View File

@ -0,0 +1,44 @@
<div>
<div><a href="javascript:hideModal();" class="box_close"></a></div>
<div class="cl"></div>
<div class="pro_new">
<h3 class="box_h3 mb10">头像设置</h3>
<div class="uppicBox">
<input type="button" class="uppic_btn" onclick="$('#upload_avatar').click();" value="浏览.."/>
<%= file_field_tag 'avatar[image]',
:id => "upload_avatar",
:style => 'display:none;',#added by young
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s,
:source_id => source.id.to_s,
:is_direct => 1
} %>
<!--<br/>-->
<!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
</div>
<div class="showpicBox">
<p>预览</p>
<%= image_tag(url_to_avatar(source), :style=>"width:96px;height:96px;",:class=>"mb5 mt10",:nhname=>'avatar_image') %>
<br/>
<span >96px*96px</span> <br />
<div class="mb20"></div>
<%= image_tag(url_to_avatar(source), :style=>"width:48px;height:48px;",:class=>"mb5",:nhname=>'avatar_image') %>
<br />
<span>48px*48px</span> <br />
</div>
<div class="cl mb10"></div>
<a href="javascript:hideModal();" class=" fr grey_btn mr15 f14"> 取&nbsp;&nbsp;消</a>
<a href="<%= url_for(:controller => 'my', :action => 'save_user_avatar', :source_id => source.id, :source_type => source.class.to_s) %>" data-remote="true" class="blue_btn fr mr10 f14">确&nbsp;&nbsp;定</a>
</div><!--talknew end-->
<div class="cl"></div>
</div><!--floatbox end-->

View File

@ -52,6 +52,10 @@
</li>
<% end %>
<% if User.current == user %>
<li>
<%= link_to "取消收藏", cancel_or_collect_user_path(user, :course => course.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
<div class="cl"></div>
</li>
<li>
<% if count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post', :class => 'user_navmore_li',:remote => true %>

View File

@ -27,6 +27,10 @@
</li>
<% end %>
<% if User.current == @user %>
<li>
<%= link_to "取消收藏", cancel_or_collect_user_path(user, :project => project.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
<div class="cl"></div>
</li>
<li>
<% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %>

View File

@ -19,7 +19,7 @@
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus'%>
<%= javascript_include_tag "course","header","attachments",'prettify' %>
<%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
@ -66,7 +66,7 @@
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<li id="sy_02" class="sy_icons_boards">
<% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course) %>">问答区<span><%=count %></span></a>
<a href="<%=course_boards_path(@course) %>">讨论区<span><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li>
<% end %>
@ -152,6 +152,9 @@
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @course} %>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
<script>

View File

@ -13,7 +13,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %>
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
@ -50,7 +50,16 @@
<div id="LSide" class="fl">
<div class="project_info">
<div class="pr_info_logo fl mr10 mb5">
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %>
<div class="pr" style="width: 64px; height:64px;">
<% if User.current.logged? && (User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) || User.current.admin?)%>
<%=link_to image_tag(url_to_avatar(@project),width:"60", height: "60", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:project => @project.id), :remote => true%>
<div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path(:project => @project.id), :remote => true, :class => 'homepageEditProfileIcon', :title => '点击编辑Logo' %>
</div>
<% else %>
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60", :alt => "项目logo") %>
<% end %>
</div>
</div>
<div class="pr_info_id fl mb5 f14">
<%= l(:label_project_ivite_code)%>
@ -249,6 +258,9 @@
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @project} %>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -103,11 +103,14 @@
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10">
<% if User.current.logged? && User.current == @user%>
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%>
<% elsif User.current.logged? %>
<a href="javascript:void(0)" style="cursor: default;" class="user_leftinfo_img"><%=image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx') %></a>
<div class="pr" style="width: 80px; margin:0 auto;">
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%>
<div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %>
</div>
</div>
<% else %>
<img src="images/user/male.jpg" width="74" height="74" />
<a href="javascript:void(0)" class="user_leftinfo_img"><%=image_tag(url_to_avatar(@user),width:"74", height: "74")%></a>
<% end %>
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
<span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female' : 'user_leftinfo_male' %> "></span>
@ -159,20 +162,10 @@
<% if !unvisiable %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
<% 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(10) %>
<% all_count = @user.courses.visible.where("is_delete =?", 0).count%>
<div class="<%= courses.empty? ? 'none' : ''%>" >
<div id="homepageLeftMenuCourses">
<ul class="user_sub_menu" id="user_courses_li">
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %>
</ul>
</div>
<% if !courses.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_course" onclick="leftCourseslistChange();">
<span id="hide_show_courseicon" class="user_icons_closeclass"></span>
</a>
<% end %>
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
<% courses = @user.favorite_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(10) %>
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
<%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
</div>
</li>
<% if is_current_user %>
@ -197,19 +190,9 @@
<ul class="users_accordion mb10">
<li id="user_06" class="user_icons_project">
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%>
<% all_count = @user.projects.visible.count%>
<% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
<div class="<%= projects.empty? ? 'none' : ''%>" >
<div id="homepageLeftMenuForge">
<ul class="user_sub_menu" id="user_projects_li">
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :all_count => all_count, :page => 0} %>
</ul>
</div>
<% if !projects.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_project" onclick="leftProjectslistChange();">
<span id="hide_show_projecticon" class="user_icons_closeclass"></span>
</a>
<% end %>
<% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
<div class="<%= projects.empty? ? 'none' : ''%>" id="homepage_left_project_list">
<%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %>
</div>
</li>
<% if is_current_user %>
@ -248,53 +231,10 @@
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<div>
<div><a href="javascript:hideModal();" class="box_close"></a></div>
<div class="cl"></div>
<div class="pro_new">
<h3 class="box_h3 mb10">头像设置</h3>
<div class="uppicBox">
<input type="button" class="uppic_btn" onclick="$('#upload_user_image').click();" value="浏览.."/>
<%= file_field_tag 'avatar[image]',
:id => "upload_user_image",
:style => 'display:none;',#added by young
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => @user.class.to_s,
:source_id => @user.id.to_s
} %>
<!--<br/>-->
<!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
</div>
<div class="showpicBox">
<p>预览</p>
<%= image_tag(url_to_avatar(@user), :style=>"width:96px;height:96px;",:class=>"mb5 mt10",:nhname=>'avatar_image') %>
<br/>
<span >96px*96px</span> <br />
<div class="mb20"></div>
<%= image_tag(url_to_avatar(@user), :style=>"width:48px;height:48px;",:class=>"mb5",:nhname=>'avatar_image') %>
<br />
<span>48px*48px</span> <br />
</div>
<div class="cl mb10"></div>
<a href="javascript:hideModal();" class=" fr grey_btn mr15 f14"> 取&nbsp;&nbsp;消</a>
<a href="<%= url_for(:controller => 'my', :action => 'save_user_avatar') %>" data-remote="true" class="blue_btn fr mr10 f14">确&nbsp;&nbsp;定</a>
</div><!--talknew end-->
<div class="cl"></div>
</div><!--floatbox end-->
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
<script type="text/javascript">
$(function(){
$('#user_hide_course').hide();
$('#user_hide_project').hide();
autoUrl("user_brief_introduction_show");
if(<%= @is_course == 1 %>) {

View File

@ -233,7 +233,7 @@
<%= yield %>
</div>
</div>
<%= render :partial => 'layouts/new_feedback' %>
<%= render :partial => 'layouts/forbidden_new_feedback' %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer_show' %>

View File

@ -60,7 +60,7 @@
</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>
<li><label class="fl">&nbsp;&nbsp;</label><button id="apply_school" class="fl winbox_btn_blue mt10">确定</button></li>
</ul>
<script type="text/javascript">
@ -103,8 +103,9 @@
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>";
//$('#province').onload();
//$('#my_account_form_link').click();
pop_up_box(htmlvalue,500,30,50);
}
else if (data.result == 1){
@ -119,7 +120,32 @@
}
});
}
function pop_up_box(value,tWidth,tTop,tLeft){
if(!tWidth){
var tWidth = 580;
}
if(!tTop){
var tTop = 30;
}
if(!tLeft){
var tLeft = 50;
}
$("#ajax-modal").html(value);
showModal('ajax-modal', tWidth + "px");
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal(); my_account_form_submit();' style='margin-right: 5px; margin-top:-10px;right:0;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top", tTop+"%").css("left", tLeft+"%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
function hideModal(){
$('#ajax-modal').hide();
}
}
function ifNameRepeat(){
//名称不能为空也不能重复
@ -147,4 +173,8 @@
}
});
}
$('#apply_school').on("click",(function(e){
commit_add_school();
}));
</script>

View File

@ -78,7 +78,7 @@
<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;"><%= 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;"><%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %><span id="last_name_notice" class="none c_red">姓名不能为空</span>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
@ -99,8 +99,13 @@
</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" 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 %>" />
<% if User.current.user_extensions.school_id.nil? %>
<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 %>" />
<% else %>
<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" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% end %>
<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" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
@ -169,13 +174,13 @@
<li>
<%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %>
<label class="ml10"><%= 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" style="background: #3b94d6; padding: 0 25px;">确定</a>
<a href="javascript:void(0);" id="my_account_form_link" class="blue_btn fl" onclick="my_account_form_submit();" 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>
@ -560,44 +565,80 @@
$("#users_tb_2").click();
<% end %>
$('#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();
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_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();
// e.stopImmediatePropagation();
// return;
// }
//
// //姓名不能为空
// if( $("#lastname").val() == '' ){
// $("#lastname").focus();
// $("#last_name_notice").show();
// 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').submit();
// }));
$('#my_password_form_link').click(function(){
$('#my_password_form_btn').click();
});
});
function my_account_form_submit(){
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();
e.stopImmediatePropagation();
return;
}
//姓名不能为空
if( $("#lastname").val() == '' ){
$("#lastname").focus();
$("#last_name_notice").show();
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').submit();
}
</script>
<script type="text/javascript">
function g(o){return document.getElementById(o);}

View File

@ -1,4 +1,4 @@
$("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src'));
$("img[nhname='avatar_image']").attr('src',$("#nh_source_tx").attr('src'));
$('#ajax-modal').html($("#nh_tx_dialog_html").html());
showModal('ajax-modal','460px');
$('#ajax-modal').siblings().hide();

View File

@ -1,3 +1,14 @@
$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>');
<% if @user %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_source_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>');
$("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>');
<% elsif @course %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@course), :id=>'nh_source_tx',:style=>"width:96px;height:96px;overflow:hidden",:alt=>"班级logo") %>');
if($("#course_avatar_form").length > 0) {
window.location.href = "<%=settings_course_path(@course) %>";
}
<% elsif @project %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@project), :id=>'nh_source_tx',:style=>"width:60px;height:60px;overflow:hidden",:alt=>"项目logo") %>');
if($("#project_avatar_form").length > 0) {
window.location.href = "<%=settings_project_path(@project) %>";
}<% end %>
hideModal();

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

@ -1,9 +1,8 @@
<%= error_messages_for 'project' %>
<%= labelled_form_for @project do |f| %>
<ul class="newpro_box ">
<li class="ml45 mb10">
<li class="ml45 mb10" id="project_avatar_form">
<%= render :partial=>"avatar/new_avatar_form",:locals=> {source:@project} %>
<div class="cl"></div>
</li>
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;项目名称&nbsp;&nbsp;</label>

View File

@ -52,7 +52,7 @@
<span title ="该项目是私有的"><%=work.project.name %></span>
<% end %>
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<span class="ml5">(综合评分:<font class="c_red"><%=work.project.project_score.score.to_i %></font>)</span>
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
</li>
<% end %>
<% end%>

View File

@ -0,0 +1,10 @@
<% member = Member.where("user_id = #{@user.id} and course_id = #{course.id}").first %>
<% if User.current == @user %>
<% if member %>
<%= link_to "", cancel_or_collect_user_path(@user, :course => course.id), :class => "#{member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从个人主页的班级列表中移除' : '点击将其添加至个人主页的班级列表中'}" %>
<% end %>
<% else %>
<% if member %>
<span class="<%= member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'%>"></span>
<% end %>
<% end %>

View File

@ -0,0 +1,10 @@
<% member = Member.where("user_id = #{@user.id} and project_id = #{project.id}").first %>
<% if User.current == @user %>
<% if member %>
<%= link_to "", cancel_or_collect_user_path(@user, :project => project.id), :class => "#{member.is_collect == 1 ? 'icons_project_favorite mt3' : 'icons_project_star mt3'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从个人主页的班级列表中移除' : '点击将其添加至个人主页的班级列表中'}" %>
<% end %>
<% else %>
<% if member %>
<span class="<%= member.is_collect == 1 ? 'icons_project_favorite mt3' : 'icons_project_star mt3'%>"></span>
<% end %>
<% end %>

View File

@ -1,7 +1,7 @@
<div class = "cl"> </div>
<div id="course-boardlist">
<div class="listbox mt10" >
<h2 class="list-h2">问答区列表</h2>
<h2 class="list-h2">讨论区列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>

View File

@ -8,7 +8,7 @@
<div class="homepagePostTo break_word">
<%= link_to activity.author.show_name, user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %>
TO
<%= link_to activity.course.name.to_s+" | 班级问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
<%= link_to activity.course.name.to_s+" | 班级讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
</div>
<div class="homepagePostTitle hidden m_w530 fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->

View File

@ -1,30 +1,44 @@
<% unless courses.nil? %>
<% courses.each_with_index do |course, i| %>
<li class="syllabus_class_list <%=i > 2 ? 'none' : '' %>">
<li class="syllabus_class_list <%= i > 2 ? 'none' : '' %>">
<% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %>
<a href="<%= allow_visit ? course_path(course.id) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>">
<span class="icons_sy_cir "></span>
<div class="fl">
<div class="syllabus_class_w ">
<p class="syllabus_class_title fl"><%=course.name %></p>
<span class="<%= course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl"></span>
<span class="fr sy_p_grey hidden" style="max-width: 120px;">主讲老师:<%=course.teacher.show_name %></span>
<div class="cl"></div>
</div>
<div class="">
<p class="fl grayTxt ">更新:<%=format_date Time.at(course.updatetime) %><span class="mr10"></span>学期:<%=current_time_and_term(course) %></p>
<p class="list-info fr grayTxt"><span><%=studentCount course %></span><span>学生</span><span>|</span><span><%=visable_course_homework course %></span><span>作业</span><span>|</span><span><%=visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
<div class="cl"></div>
</div>
<span id="collect_course_icon_<%=course.id %>">
<%=render :partial => 'collect_course', :locals => {:course => course} %>
</span>
<div class="fl">
<div class="syllabus_class_w ">
<a href="<%= allow_visit ? course_path(course.id) : "javascript:void(0)" %>" class="syllabus_class_title fl" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= course.name %></a>
<span class="<%= course.is_public == 0 ? 'syllabus_class_private' : 'syllabus_class_open' %> fl ml10 mt3 syllabus_class_property"><%= course.is_public == 0 ? '私有' : '公开' %></span>
<span class="fr sy_p_grey hidden" style="max-width: 120px;">主讲老师:<%= link_to course.teacher.show_name, user_path(course.teacher) %></span>
<div class="cl"></div>
</div>
<span class="icons_sy_arrow fl mt19 ml10" ></span>
<div class="cl"></div>
</a>
<div class="">
<p class="fl grayTxt ">更新:<%= format_date Time.at(course.updatetime) %><span class="mr10"></span>
学期:<%= current_time_and_term(course) %></p>
<p class="list-info fr grayTxt">
<% student_link = (User.current.logged? && course.open_student == 1 && course.is_public == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
<span><a href="<%= student_link ? course_member_path(course, :role => 2) : "javascript:void(0)" %>" target="_blank" title="<%= student_link ? "" : "学生列表不对外公开" %>"><%= studentCount course %></a></span><span>学生</span>
<span>|</span>
<span><a href="<%= allow_visit ? homework_common_index_path(:course => course.id) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_course_homework course %></a></span><span>作业</span>
<span>|</span>
<span><a href="<%= allow_visit ? course_files_path(course) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_attachemnts_incourse(course).count %></a></span><span>资源</span>
</p>
<div class="cl"></div>
</div>
</div>
<span class="icons_sy_arrow fl mt19 ml10"></span>
<div class="cl"></div>
</li>
<% end %>
<% if courses.count > 3 %>
<li class="syllabus_class_list_more" id="syllabus_class_list_more_<%=syllabus.id %>">
<a href="javascript:void(0);" id="expand_list_<%=syllabus.id %>" data-init="0" onclick="expand_course_list(<%=syllabus.id %>,'#syllabus_course_ul_<%=syllabus.id %> li','#expand_list_<%=syllabus.id %>',<%=courses.count %>)">共<%=courses.count %>个班级,点击全部展开</a>
<li class="syllabus_class_list_more" id="syllabus_class_list_more_<%= syllabus.id %>">
<a href="javascript:void(0);" id="expand_list_<%= syllabus.id %>" data-init="0" onclick="expand_course_list(<%=syllabus.id %>,'#syllabus_course_ul_<%=syllabus.id %> li','#expand_list_<%=syllabus.id %>',<%=courses.count %>)">共<%= courses.count %>
个班级,点击全部展开</a>
</li>
<% end %>
<% end %>

View File

@ -32,10 +32,12 @@
<% projects.each_with_index do |project, i| %>
<div class="syllabus_courses_list <%= i > 4 ? 'none' : ''%>" style="cursor: default;">
<div class="sy_courses_open">
<span class="icons_project_list fl mt5 mr10"></span>
<span id="collect_project_icon_<%=project.id %>">
<%=render :partial => 'collect_project', :locals => {:project => project} %>
</span>
<h3><%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%></h3>
<% unless project.is_public? %>
<span class="hw_icon_private fl"></span>
<span class="syllabus_class_private fl ml10 mt3 syllabus_class_property">私有</span>
<% end %>
<% projectUser = User.where("id=?",project.user_id).first %>
<%=link_to "<span class='fr grayTxt'>创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}</span>".html_safe, user_path(projectUser) %>

View File

@ -0,0 +1,11 @@
<% if @course %>
$("#homepage_left_course_list").html("<%= escape_javascript(render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => @courses}) %>");
if($("#collect_course_icon_<%=@course.id %>").length > 0){
$("#collect_course_icon_<%=@course.id %>").html("<%= escape_javascript(render :partial => 'users/collect_course', :locals => {:course => @course}) %>");
}
<% elsif @project %>
$("#homepage_left_project_list").html("<%= escape_javascript(render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => @projects}) %>");
if($("#collect_project_icon_<%=@project.id %>").length > 0){
$("#collect_project_icon_<%=@project.id %>").html("<%= escape_javascript(render :partial => 'users/collect_project', :locals => {:project => @project}) %>");
}
<% end %>

View File

@ -27,8 +27,9 @@
} else if(count > 0) {
var str = div.next().children().eq(0).attr('id');
var id = str.substring(19);
var user_id = <%= @user.id%>;
$.get(
'/users/expand_courses?syllabus_id=' + id
'/users/'+user_id+'/expand_courses?syllabus_id=' + id
);
}
}

View File

@ -621,7 +621,7 @@ zh:
label_homework_info: 提交情况 #huang
label_course_news_description: '课程必须是高校正式开设的课程,或是围绕特定主题定期发布课程资料的公共开放课程;<br/>如果您想创建一个协作研究空间,请您前往“我的项目”页面创建项目,谢谢!'
label_course_board: 问答
label_course_board: 讨论
label_version: 版本
label_version_new: 新建版本
@ -1743,7 +1743,7 @@ zh:
label_newbie_faq: '新手指引 & 问答'
label_hot_project: '热门项目'
label_borad_project: 项目讨论区
label_borad_course: 班级问答
label_borad_course: 班级讨论
label_borad_org_subfield: 资源栏目讨论区
view_borad_course: 课程讨论
label_memo_create_succ: 发布成功
@ -2143,7 +2143,7 @@ zh:
#微信模板消息
label_new_homework_template: 您有新作业了。
label_update_homework_template: 您的作业已被修改。
label_course_topic_template: 课程问答区有新帖子发布了。
label_course_topic_template: 班级讨论区有新帖子发布了。
label_topic_comment_template: 您的帖子有新回复了。
label_project_topic_template: 项目讨论区有新帖子发布了。
label_issue_comment_template: 您的缺陷有新回复了。

View File

@ -8,7 +8,7 @@ button:
sub_button:
-
type: "view"
name: "我的课程"
name: "我的班级"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
-
type: "view"

View File

@ -8,7 +8,7 @@ button:
sub_button:
-
type: "view"
name: "我的课程"
name: "我的班级"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
-
type: "view"

View File

@ -8,7 +8,7 @@ button:
sub_button:
-
type: "view"
name: "我的课程"
name: "我的班级"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
-
type: "view"

View File

@ -567,7 +567,6 @@ RedmineApp::Application.routes.draw do
post 'user_select_homework'
post 'check_homework'
get 'all_journals'
get 'expand_courses'
end
member do
@ -667,6 +666,8 @@ RedmineApp::Application.routes.draw do
post 'apply_for_resource'
match 'manage_or_receive_homeworks', :to => 'users#manage_or_receive_homeworks', :via => :get
get 'search_m_r_homeworks'
get 'expand_courses'
get 'cancel_or_collect'
# end
end
#resources :blogs

View File

@ -24,6 +24,7 @@ default: &default
create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs"
project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E"
join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg"
project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI"
auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities"
auto_openid_url_2: "&response_type=code&scope=snsapi_base&state="

View File

@ -24,6 +24,7 @@ default: &default
create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig"
project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc"
join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M"
project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8"
auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities"
auto_openid_url_2: "&response_type=code&scope=snsapi_base&state="

View File

@ -0,0 +1,5 @@
class AddIsCollectToMembers < ActiveRecord::Migration
def change
add_column :members, :is_collect, :integer, :default => 1
end
end

View File

@ -8,6 +8,22 @@ namespace :homework_publishtime do
homework_detail_manual = homework.homework_detail_manual
if homework_detail_manual.comment_status == 0
homework_detail_manual.update_column('comment_status', 1)
if homework.homework_type != 3
students = homework.course.student
if !homework.course.nil? && !students.empty?
name = homework.name
name_str = name + "的作品提交"
str = ""
students.each do |student|
if str != ""
str += ","
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
end
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
course = homework.course
course.members.each do |m|
homework.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => nil)

View File

@ -127,6 +127,78 @@
</div>
</div>
<div ng-if="act.act_type=='Poll'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【问卷】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--</div>-->
<!--<div class="fr mr25 f13">-->
<!--<a ng-if="!act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>-->
<!--<a ng-if="act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>-->
<!--</div>-->
<div class="cl"></div>
</div>
</div>
</div>
</div>
<!--<div ng-if="act.act_type=='JournalsForMessage'">-->
<!--<div class="post-container">-->
<!--<div class="post-wrapper">-->
<!--<div class="post-main">-->
<!--<div dataID = "{{act.act_id}}" ng-click="goDetail('journal_for_message',act.act_id, act.id)" id="act_{{act.id}}">-->
<!--<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>-->
<!--<div class="post-dynamic-author hidden fl">-->
<!--<span>{{act.author.real_name}}</span>-->
<!--<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />-->
<!--<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />-->
<!--</div>-->
<!--<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>-->
<!--<div class="cl"></div>-->
<!--<div class="post-dynamic-title c-grey3 hidden mt12 fb">【班级留言】{{act.subject|safeHtml}}</div>-->
<!--<div class="post-content c-grey3 mt10 mb10">-->
<!--<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>-->
<!--</div>-->
<!--&lt;!&ndash;<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>&ndash;&gt;-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--</div>-->
<!--<div class="fr mr25 f13">-->
<!--<a ng-if="!act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>-->
<!--<a ng-if="act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>-->
<!--</div>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div ng-if="act.act_type=='Course'">
<div class="post-container">

View File

@ -39,6 +39,7 @@
<script src="/javascripts/wechat/directives/ellipsis.js"></script>
<script src="/javascripts/wechat/directives/input_focus.js"></script>
<script src="/javascripts/wechat/directives/at_delete_link.js"></script>
<script src="/javascripts/wechat/directives/iphone_recognize.js"></script>
<script src="/javascripts/wechat/controllers/reg.js"></script>
<script src="/javascripts/wechat/controllers/login.js"></script>
<script src="/javascripts/wechat/controllers/activity.js"></script>

View File

@ -69,7 +69,7 @@
</div>
</div>
<div ng-if="!blog.locked" id="post_input_1" class="post-input-wrap post-box-shadow">
<div ng-if="!blog.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>

View File

@ -16,7 +16,214 @@
<!--<div class="slice3 fl"></div>-->
<!--<div class="cl"></div>-->
<div class="class-search-wrap">
<div ng-class="{'undis': !showActivities,'mb50':!course_has_more}">
<div ng-repeat="act in course_activities">
<div ng-if="act.container_type=='Course' ">
<div ng-if="act.act_type=='HomeworkCommon'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" ng-click="goDetail('homework',act.act_id, act.id)" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【作业】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
<span class="mr15 f12 c-grey2">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评开启时间:{{act.homework_common_detail.evaluation_start}}</span><br />
<span ng-if="!act.homework_common_detail.anonymous_comment" class="mr15 f12 c-grey2">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评关闭时间:{{act.homework_common_detail.evaluation_end}}</span>
</div>
<div class="cl"></div>
</div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!act.reply_count" ng-click="goDetail('homework',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="act.reply_count" ng-click="goDetail('homework',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='News'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_notice',act.act_id, act.id)" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【通知】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<div class="cl"></div>
</div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!act.reply_count" ng-click="goDetail('course_notice',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="act.reply_count" ng-click="goDetail('course_notice',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='Message'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_discussion',act.act_id, act.id)" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【帖子】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='Poll'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【问卷】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--</div>-->
<!--<div class="fr mr25 f13">-->
<!--<a ng-if="!act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>-->
<!--<a ng-if="act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>-->
<!--</div>-->
<div class="cl"></div>
</div>
</div>
</div>
</div>
<!--<div ng-if="act.act_type=='JournalsForMessage'">-->
<!--<div class="post-container">-->
<!--<div class="post-wrapper">-->
<!--<div class="post-main">-->
<!--<div dataID = "{{act.act_id}}" ng-click="goDetail('journal_for_message',act.act_id, act.id)" id="act_{{act.id}}">-->
<!--<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>-->
<!--<div class="post-dynamic-author hidden fl">-->
<!--<span>{{act.author.real_name}}</span>-->
<!--<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />-->
<!--<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />-->
<!--</div>-->
<!--<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>-->
<!--<div class="cl"></div>-->
<!--<div class="post-dynamic-title c-grey3 hidden mt12 fb">【班级留言】{{act.subject|safeHtml}}</div>-->
<!--<div class="post-content c-grey3 mt10 mb10">-->
<!--<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>-->
<!--</div>-->
<!--<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--</div>-->
<!--<div class="fr mr25 f13">-->
<!--<a ng-if="!act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>-->
<!--<a ng-if="act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>-->
<!--</div>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div ng-if="act.act_type=='Course'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.real_name}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 班级</span></div>
<div class="post-title hidden"><span class="mr10">{{act.latest_update}}</span></div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div ng-if="course_has_more" class="mb50">
<div id="more_course_activities" class="more-events mt10" ng-click="getClassActivities(course_activities_page+1);">更多</div>
</div>
<div class="bottom-tab-wrap mt10">
<a ng-show="isTeacher" ng-click="goPublishNotice()" class="weixin-tab link-blue2 border-top">发布通知</a>
<a ng-click="goPublishIssue()" class="weixin-tab link-blue2 border-top">发起讨论</a>
</div>
</div>
<div ng-class="['class-search-wrap',{'undis': current_tab != 1}]">
<div class="class-search-inner"> <img src="/images/wechat/search.png" width="18" class="class-search-icon" />
<input class="class-detail-search" ng-model="searchText" placeholder="输入关键词进行搜索" />
</div>
@ -54,7 +261,7 @@
</div>
<div ng-class="{'undis': !showHomework}">
<div ng-repeat="r in homeworks|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2 " ng-click="sendFile(r,2)">发送</a><div class="cl"></div></div>
<div ng-repeat="r in homeworks|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span ng-click="goHomeworkDetail(r.id)" class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2 " ng-click="sendFile(r,2)">发送</a><div class="cl"></div></div>
<p ng-show="homeworks_tag == true && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
请登录Trustie网站在PC浏览器中上传作业。</p>
@ -66,7 +273,5 @@
请登录Trustie网站在PC浏览器中上传测验。</p>
</div>
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
</div>

View File

@ -0,0 +1,14 @@
<div class="post-container">
<div loading-spinner></div>
<div class="blue-title">{{current_course.name}}</div>
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="issuetitle" placeholder="发起讨论,请先输入标题(限128字符)" maxlength="128"></div>
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="issue" placeholder="请输入您的讨论内容~"></textarea></div>
<div class="bottom-tab-wrap mt10">
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
<a ng-click="publishIssue()" class="weixin-tab link-blue2 border-top">确定</a>
</div>
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
</div>

View File

@ -0,0 +1,14 @@
<div class="post-container">
<div loading-spinner></div>
<div class="blue-title">{{current_course.name}}</div>
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="noticetitle" placeholder="发布通知,请先输入标题(限64字符)" maxlength="64"></div>
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="notice" placeholder="请输入您的通知内容~"></textarea></div>
<div class="bottom-tab-wrap mt10">
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
<a ng-click="publishNotice()" class="weixin-tab link-blue2 border-top">确定</a>
</div>
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
</div>

View File

@ -16,7 +16,7 @@
<div class="cl"></div>
<div class="ml40">
<div class="post-dynamic-title c-black fb">{{discussion.subject}}<img ng-if="discussion.locked" src="/images/locked.png" style="display:inline-block;" /></div>
<div class="c-grey4 f13 mt5"><span class="mr10">{{discussion.course_project_name}} - 课程问答</span><span>{{discussion.created_on}}</span></div>
<div class="c-grey4 f13 mt5"><span class="mr10">{{discussion.course_project_name}} - 班级讨论</span><span>{{discussion.created_on}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="discussion.content|safeHtml"></div>
<div class="cl"></div>
<div class="fr f13">
@ -66,7 +66,7 @@
</div>
</div>
<div ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow">
<div ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>

View File

@ -6,11 +6,11 @@
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == 0 || is_public == false" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{news.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-avatar fl mr10"><img ng-src="{{news.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{news.author.real_name}}
<img ng-if="news.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="news.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
{{news.user.real_name}}
<img ng-if="news.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="news.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="cl"></div>
<div class="ml40">
@ -30,23 +30,58 @@
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_news_reply" at-delete-link>
<div ng-if="news.comments == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="comments in news.comments">
<!--<div class="mb50" id="all_news_reply" at-delete-link>-->
<!--<div ng-if="news.comments == ''" style="border-top:1px solid #ccc;"></div>-->
<!--<div class="post-reply-wrap" ng-repeat="comments in news.comments">-->
<!--<div class="post-reply-row">-->
<!--<div class="post-avatar fl mr10"><img ng-src="{{comments.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>-->
<!--<div class="post-reply-author hidden fl">-->
<!--{{comments.author.real_name}}-->
<!--</div>-->
<!--<div class="post-reply-time fr f12">{{comments.created_on}}</div>-->
<!--<div class="cl"></div>-->
<!--<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="comments.comments|safeHtml"></div>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="mb50" id="all_course_message_reply" at-delete-link>
<div ng-if="news.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in news.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{comments.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{comments.author.real_name}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{comments.created_on}}</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="comments.comments|safeHtml"></div>
<div ng-show="journal.parents_count > 0" class="mult-reply-container ml40 mb5">
<!--<ul ng-if="journal.parents_reply_top[0]" ng-include="'comment_reply'" ng-init="i=0;journal=journal"></ul>-->
<comment-reply i="0" journal="journal" ></comment-reply>
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-reply-author hidden fl ng-binding">
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="reply_bottom.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="journal.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div ng-if="has_more">
<div id="more_reply" class="more-events mt10" ng-click="showMoreReply(0,news);">更多</div>
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow">
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>

View File

@ -70,7 +70,7 @@
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow">
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>

View File

@ -36,23 +36,58 @@
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_issue_reply" at-delete-link>
<div ng-if="issue.issue_journals == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in issue.issue_journals">
<!--<div class="mb50" id="all_issue_reply" at-delete-link>-->
<!--<div ng-if="issue.issue_journals == ''" style="border-top:1px solid #ccc;"></div>-->
<!--<div class="post-reply-wrap" ng-repeat="journal in issue.issue_journals">-->
<!--<div class="post-reply-row">-->
<!--<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>-->
<!--<div class="post-reply-author hidden fl">-->
<!--{{journal.user.real_name}}-->
<!--</div>-->
<!--<div class="post-reply-time fr f12">{{journal.created_on}}</div>-->
<!--<div class="cl"></div>-->
<!--<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="journal.notes|safeHtml"></div>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="mb50" id="all_course_message_reply" at-delete-link>
<div ng-if="issue.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in issue.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.created_on}}</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="journal.notes|safeHtml"></div>
<div ng-show="journal.parents_count > 0" class="mult-reply-container ml40 mb5">
<!--<ul ng-if="journal.parents_reply_top[0]" ng-include="'comment_reply'" ng-init="i=0;journal=journal"></ul>-->
<comment-reply i="0" journal="journal" ></comment-reply>
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-reply-author hidden fl ng-binding">
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="reply_bottom.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="journal.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div ng-if="has_more">
<div id="more_reply" class="more-events mt10" ng-click="showMoreReply(0,issue);">更多</div>
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow">
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>

View File

@ -65,7 +65,7 @@
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow">
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>

View File

@ -23,7 +23,7 @@
</div>
<div ng-class="{'undis': currentTab!=2}">
<div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,2)" class="fr mr10 link-blue2 ">发送</a><div class="cl"></div>
<div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span ng-click="goHomeworkDetail(r.id)" class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,2)" class="fr mr10 link-blue2 ">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl other-from-width hidden">作业来源:{{r.coursename}}</span><div class="cl"></div>
</div>
<div ng-if="homework_has_more">

View File

@ -5,7 +5,7 @@
<a ng-click="tab($index+1)" ng-repeat="menu in menus" id="class_tab_1" href="javascript:void(0);" ng-class="['weixin-tab', {'class-tab-active': currentTab == $index+1}]">{{menu}}</a>
</div>
<div ng-show="project" ng-class="{'undis': currentTab != 1}">
<div ng-show="project" ng-class="{'undis': currentTab != 1,'mb50':!project_has_more}">
<div ng-repeat="act in project_activities">
<div ng-if="act.container_type=='Project' ">
<div ng-if="act.act_type=='Issue'">
@ -95,9 +95,12 @@
</div>
</div>
</div>
<div ng-if="project_has_more">
<div ng-if="project_has_more" class="mb50">
<div id="more_project_activities" class="more-events mt10" ng-click="getActivities(project_activities_page+1);">更多</div>
</div>
<div class="bottom-tab-wrap mt10">
<a ng-click="goPublishNote()" class="weixin-tab link-blue2 border-top">发布新帖</a>
</div>
</div>
<div ng-show="project" ng-class="{'undis': currentTab != 2}">

View File

@ -65,7 +65,7 @@
<div id="more_reply" class="more-events mt10" ng-click="showMoreReply(0,discussion);">更多</div>
</div>
</div>
<div ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow">
<div ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>

View File

@ -0,0 +1,14 @@
<div class="post-container">
<div loading-spinner></div>
<div class="blue-title">{{current_project.name}}</div>
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="notetitle" placeholder="发布帖子,请先输入帖子标题(限128字符)" maxlength="128"></div>
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="note" placeholder="请输入您的帖子内容~"></textarea></div>
<div class="bottom-tab-wrap mt10">
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
<a ng-click="publishNote()" class="weixin-tab link-blue2 border-top">确定</a>
</div>
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
</div>

View File

@ -8,7 +8,7 @@
<div ng-show="syllabus.can_setting && syllabus.courses.length > 0" ng-repeat="syllabus in syllabuses">
<div ng-click="syllabus.show_plus = !syllabus.show_plus" class="course-list-row f13 c-grey3 mt10"><img src="/images/wechat/plus.png" ng-show="syllabus.show_plus" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" ng-show="!syllabus.show_plus" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">{{syllabus.title}}</span></div>
<ul ng-show="!syllabus.show_plus" class="class-list f13 c-grey3">
<li ng-show="course.can_setting" ng-click="selectCourse(course)" ng-class="{'border-bottom-none': $last }" ng-repeat="course in syllabus.courses"><img src="/images/wechat/dot.png" width="15px" class="class-list-dot" /><span class="fl ml10 class-list-name hidden">{{course.name}}</span><span ng-class="['login-box', 'fr', 'mr5', 'mt12', {'checked': course.checked}]"></span></li>
<li ng-show="course.can_setting && course_id != course.id" ng-click="selectCourse(course)" ng-class="{'border-bottom-none': $last }" ng-repeat="course in syllabus.courses"><img src="/images/wechat/dot.png" width="15px" class="class-list-dot" /><span class="fl ml10 class-list-name hidden">{{course.name}}</span><span ng-class="['login-box', 'fr', 'mr5', 'mt12', {'checked': course.checked}]"></span></li>
</ul>
</div>

View File

@ -4,7 +4,7 @@
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="ml5 mr5">
<div class="post-reply-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
{{journal.parents_reply_top[i].user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>
@ -19,7 +19,7 @@
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="ml5 mr5">
<div class="post-reply-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
{{journal.parents_reply_top[i].user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1453,7 +1453,7 @@ function description_showwords_ellipsis(id,num){
});
//去掉空格
str = str.replace(/\s/gi,'');
str = str.replace(/[\f\n\r\t\v]/gi,'');
if(str.length > num){
str = str.substring(0,num)+"...";
@ -2099,3 +2099,15 @@ function throttle_me(method, context, e, condition, url){
},500);
}
//头像、logo编辑图标显隐
function edit_img(){
$(".homepageEditProfile").parent().mouseover(function(){
$(".homepageEditProfile").show();
});
$(".homepageEditProfile").parent().mouseout(function(){
$(".homepageEditProfile").hide();
});
}
$(document).ready(edit_img);

View File

@ -39,7 +39,7 @@
ajaxUpload.uploading++;
uploadBlob(file, $(inputEl).data('upload-path'),$(inputEl).data('source-type'), $(inputEl).data('source-id'),{
uploadBlob(file, $(inputEl).data('upload-path'),$(inputEl).data('source-type'), $(inputEl).data('source-id'),$(inputEl).data('is-direct'),{
loadstartEventHandler: onLoadstart.bind(progressSpan),
progressEventHandler: onProgress.bind(progressSpan)
})
@ -82,14 +82,14 @@
return false;
}
function uploadBlob(blob, uploadUrl, source_type,source_id, options) {
function uploadBlob(blob, uploadUrl, source_type,source_id,is_direct, options) {
var actualOptions = $.extend({
loadstartEventHandler: $.noop,
progressEventHandler: $.noop
}, options);
uploadUrl = uploadUrl + '?source_type=' + source_type + '&source_id=' + source_id;
uploadUrl = uploadUrl + '?source_type=' + source_type + '&source_id=' + source_id + '&is_direct=' + is_direct;
if (blob instanceof window.File) {
uploadUrl += '&filename=' + encodeURIComponent(blob.name);
}

View File

@ -10,7 +10,7 @@ app.controller('ActivityController',
return url;
};
$scope.menus = ['所有动态', '课程动态', '项目动态'];
$scope.menus = ['所有动态', '班级动态', '项目动态'];
$scope.alertService = alertService.create();
console.log("ActivityController load");

View File

@ -1,10 +1,47 @@
app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common){
app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout){
// common.checkLogin();
$scope.replaceUrl = function(url){
return url;
};
var vm = $scope;
var courseid = $routeParams.id;
var tag = $routeParams.tag;
vm.course_activities_page = rms.get('course_activities_page') || 0;
vm.course_activities = rms.get("course_activities") || [];
vm.course_has_more = rms.get("course_has_more");
vm.course = rms.get("course") || null;
vm.getClassActivities = function(page){
$http({
method: 'POST',
url: apiUrl + "courses/activities?id=" + courseid,
data:{token:auth.token(),page:page}
}).then(function successCallback(response) {
console.log(response.data);
if(response.data.status == 0){
vm.class_activities_page = response.data.page;
if(response.data.page > 0)
{
vm.course_activities = vm.course_activities.concat(response.data.data);
}
else{
vm.course_activities = response.data.data;
vm.course_activities_page = 0;
vm.course_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
}
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
}, function errorCallback(response) {
});
};
var getUsers = function(){
if(vm.teachers.length<=0){
@ -35,7 +72,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
}
)
}
}
};
var getResources = function(){
if(vm.resources.length<=0){
@ -46,7 +83,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.resources_tag = true;
});
}
}
};
var getHomeworks = function(){
if(vm.homeworks.length <=0){
@ -56,7 +93,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.homeworks_tag = true;
});
}
}
};
var getExercises = function(){
if(vm.exercises.length <=0){
@ -66,15 +103,19 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.exercises_tag = true;
});
}
}
};
vm.isTeacher = false;
vm.currentTab = 1;
// vm.currentTab = 1;
vm.currentTab = rms.get('tab_num');
vm.tab = function(index){
vm.currentTab = index;
vm.searchText = '';
vm.showActivities = false;
vm.showClassMate = false;
vm.showResources = false;
vm.showHomework = false;
@ -84,35 +125,47 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.exercises_tag = false;
if(vm.isTeacher){
if(index == 1){ //课件
if(index == 1){
if(vm.course_activities.length <= 0){
vm.getClassActivities(0);
}
vm.showActivities = true;
}
else if(index == 2){ //课件
getResources();
vm.showResources = true;
} else if(index==2){ //作业
}
else if(index==3){ //作业
getHomeworks();
vm.showHomework = true;
} else if(index==3){ //小测验
getExercises();
vm.showTestcase = true;
} else if(index==4){ //学生管理
}
else if(index==4){ //学生管理
getUsers();
vm.showClassMate = true;
}
} else {
if(index == 2){
if(index == 1){
if(vm.course_activities.length <= 0){
vm.getClassActivities(0);
}
vm.showActivities = true;
}
else if(index == 3){
getUsers();
vm.showClassMate = true;
} else if(index==1){
}
else if(index==2){
getResources();
vm.showResources = true;
}
}
rms.save("tab_num",index);
}
rms.save("tab_num",vm.currentTab);
};
vm.tabRecord = rms.get('tab_num') || 1;
// vm.tabRecord = rms.get('tab_num') || 1;
vm.course = {};
// vm.course = {};
vm.students = [];
vm.teachers = [];
vm.reviewers = []; //待审批
@ -126,60 +179,150 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.alertService = alertService.create();
vm.invite = function(){
rms.save('course_activities_page',vm.course_activities_page);
rms.save("course_activities",vm.course_activities);
rms.save("course_has_more",vm.course_has_more);
rms.save("course",vm.course);
$location.path("/invite_code").search({id: courseid});
};
vm.sendFile = function(r,index){
vm.myresource_sendIndex = index;
rms.save('course_activities_page',vm.course_activities_page);
rms.save("course_activities",vm.course_activities);
rms.save("course_has_more",vm.course_has_more);
rms.save("course",vm.course);
rms.save('myresource_sendIndex',index);
$location.path("/send_class_list").search({id: r.id});
}
$location.path("/send_class_list").search({id: r.id,course_id: courseid});
};
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if(!vm.currentTab){
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.course = response.data.data;
resetMenu(vm.course.current_user_is_teacher,vm.tabRecord);
if(tag){
vm.tab(4);
tag = null;
if (response.data.status == 0){
vm.course = response.data.data;
resetMenu(vm.course.current_user_is_teacher,vm.currentTab);
if(tag){
vm.tab(4);
tag = null;
vm.currentTab = 4;
}
else{
vm.currentTab = 1;
vm.tab(vm.currentTab);
}
}
else{
vm.tab(vm.tabRecord);
vm.alertService.showMessage('提示', response.data.message);
}
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
);
}else {
$timeout(function(){
window.scrollTo(0, rms.get("yoffset"));
});
}
}
);
var resetMenu = function(is_teacher){
var resetMenu = function(is_teacher,index){
vm.isTeacher = is_teacher;
if(is_teacher){
vm.menus = ["课件", "作业", "测验", "成员管理"];
vm.menus = ["动态", "课件", "作业", "成员管理"];
} else {
vm.menus = ['课件', "我的同学"];
vm.menus = ['动态','课件', "我的同学"];
}
vm.tab(index);
};
if(vm.course){
resetMenu(vm.course.current_user_is_teacher,vm.currentTab);
}
vm.onSetting = function(user){
rms.save('current_edit_member', user);
rms.save("tab_num",vm.currentTab);
$location.path("/edit_class_member").search({id: courseid,user_id: user.id});
};
vm.review = function(user){
rms.save('current_review_member', user);
rms.save('current_course', vm.course);
rms.save("tab_num",vm.currentTab);
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
};
//跳到详情页
vm.goDetail = function(type, act_id,id){
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
rms.save('course_activities_page',vm.course_activities_page);
rms.save("course_activities",vm.course_activities);
rms.save('course_has_more', vm.course_has_more);
rms.save("tab_num",vm.currentTab);
rms.save("course",vm.course);
// $location.path('/'+type+'/'+act_id);
$location.path("/"+type).search({id: act_id});
};
vm.addPraise = function(act){
for(var i in vm.course_activities){
if(vm.course_activities[i].act_id == act.act_id){
vm.course_activities[i].praise_count += 1;
vm.course_activities[i].has_praise = true;
break;
}
}
common.addCommonPraise(act);
};
vm.decreasePraise = function(act){
for(var i in vm.course_activities){
if(vm.course_activities[i].act_id == act.act_id){
vm.course_activities[i].praise_count -= 1;
vm.course_activities[i].has_praise = false;
break;
}
}
common.decreaseCommonPraise(act);
};
vm.goPublishNotice = function(){
if(!vm.isTeacher){
return;
}
rms.save('course_activities_page',vm.course_activities_page);
rms.save("course_activities",vm.course_activities);
rms.save('course_has_more', vm.course_has_more);
rms.save("tab_num",vm.currentTab);
rms.save("course",vm.course);
rms.save('current_course', vm.course);
$location.path("/class_publishnotice").search({id:courseid});
};
vm.goPublishIssue = function(){
rms.save('course_activities_page',vm.course_activities_page);
rms.save("course_activities",vm.course_activities);
rms.save('course_has_more', vm.course_has_more);
rms.save("tab_num",vm.currentTab);
rms.save("course",vm.course);
rms.save('current_course', vm.course);
$location.path("/class_publishissue").search({id:courseid});
};
vm.goHomeworkDetail = function(id){
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
rms.save('course_activities_page',vm.course_activities_page);
rms.save("course_activities",vm.course_activities);
rms.save('course_has_more', vm.course_has_more);
rms.save("tab_num",vm.currentTab);
rms.save("course",vm.course);
// $location.path('/'+type+'/'+act_id);
$location.path("/homework").search({id: id});
}
}]);

View File

@ -49,6 +49,11 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo
}
vm.goClass = function (course_id) {
rms.save('course_activities_page',0);
rms.save("course_activities",[]);
rms.save("course_has_more",false);
rms.save("course",null);
rms.save("tab_num",null);
console.log(course_id);
$location.path("/class").search({id: course_id});
}

View File

@ -0,0 +1,73 @@
app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
// common.checkLogin();
var vm = $scope;
vm.current_course = rms.get('current_course');
vm.issuetitle = "";
vm.issue = "";
var course_id = $routeParams.id;
vm.alertService = alertService.create();
if(!vm.current_course){
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.current_course = response.data.data;
console.log("courses");
console.log(response.data.data);
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
if(!vm.current_course){
vm.tip_1 = "该班级不存在或已被删除";
}
}
);
}
vm.cancel = function(){
window.history.back();
};
//发布问题 即项目讨论区
vm.publishIssue = function(){
if(vm.issuetitle.length == 0)
{
vm.alertService.showMessage('提示', '标题不能为空');
return;
}
if(vm.issue.length == 0)
{
vm.alertService.showMessage('提示', '内容不能为空');
return;
}
var text = vm.issue.replace(/\n/g,'<br/>');
$http.post(config.apiUrl + "courses/"+course_id+"/publishissue",
{token: auth.token(),title: vm.issuetitle, text: text}
).then(function(response){
if(response.data.status == 0)
{
vm.alertService.showMessage('提示', '您已成功发布问题',function(){
rms.save('course_activities_page',0);
rms.save("course_activities",[]);
rms.save("course_has_more",false);
$location.path("/class").search({id: course_id});
});
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
});
};
}] );

View File

@ -0,0 +1,72 @@
app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
// common.checkLogin();
var vm = $scope;
vm.current_course = rms.get('current_course');
var course_id = $routeParams.id;
vm.alertService = alertService.create();
vm.noticetitle = "";
vm.notice = "";
if(!vm.current_course){
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.current_course = response.data.data;
console.log("courses");
console.log(response.data.data);
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
if(!vm.current_course){
vm.tip_1 = "该班级不存在或已被删除";
}
}
);
}
vm.cancel = function(){
window.history.back();
};
//发布通知 只有老师能发布
vm.publishNotice = function(){
if(vm.noticetitle.length == 0)
{
vm.alertService.showMessage('提示', '标题不能为空');
return;
}
if(vm.notice.length == 0)
{
vm.alertService.showMessage('提示', '内容不能为空');
return;
}
var text = vm.notice.replace(/\n/g,'<br/>');
$http.post(config.apiUrl + "courses/"+course_id+"/publishnotice",
{token: auth.token(),title: vm.noticetitle, text: text}
).then(function(response){
if(response.data.status == 0)
{
vm.alertService.showMessage('提示', '您已成功发布通知',function(){
rms.save('course_activities_page',0);
rms.save("course_activities",[]);
rms.save("course_has_more",false);
$location.path("/class").search({id: course_id});
});
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
});
};
}] );

View File

@ -8,8 +8,37 @@ app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'au
replyType: 'News',
urlName: 'course_notice',
loadCallback: function(data){
$scope.news = data.data;
$scope.is_public = data.is_public;
console.log(data.data);
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
if (replytype == 0){
if (page == 0){
$scope.news = data.data;
$scope.page = 0;
$scope.is_public = data.is_public;
}
else{
$scope.news.all_children = $scope.news.all_children.concat(data.data.all_children);
}
$scope.has_more = $scope.news.all_children.length < $scope.news.comment_count;
console.log($scope.has_more);
}
else{
comment_id = data.data.id;
for (var i in $scope.news.all_children) {
var comment = $scope.news.all_children[i];
if(comment.id == comment_id){
// comment.parents_reply_top = comment.parents_reply_top.concat(data.data.parents_reply_top);
comment.parents_reply_top = data.data.parents_reply_top.concat(comment.parents_reply_top);
}
}
}
},
replyCallback: function(){
}

View File

@ -7,9 +7,34 @@ app.controller('IssueController', ['$scope', '$http', '$routeParams', 'auth', 'c
replyType: 'Issue',
urlName: 'issues',
loadCallback: function(data){
console.log(data);
$scope.issue = data.data;
$scope.is_public = data.is_public;
console.log(data.data);
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
if (replytype == 0){
if (page == 0){
$scope.issue = data.data;
$scope.page = 0;
$scope.is_public = data.is_public;
}
else{
$scope.issue.all_children = $scope.issue.all_children.concat(data.data.all_children);
}
$scope.has_more = $scope.issue.all_children.length < $scope.issue.comment_count;
console.log($scope.has_more);
}
else{
comment_id = data.data.id;
for (var i in $scope.issue.all_children) {
var comment = $scope.issue.all_children[i];
if(comment.id == comment_id){
// comment.parents_reply_top = comment.parents_reply_top.concat(data.data.parents_reply_top);
comment.parents_reply_top = data.data.parents_reply_top.concat(comment.parents_reply_top);
}
}
}
},
replyCallback: function(){
}

View File

@ -35,10 +35,14 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
vm.sendFile = function(r,index){
vm.myresource_sendIndex = index;
rms.save("has_more",vm.has_more);
rms.save("homework_has_more",vm.homework_has_more);
rms.save('myresource_sendIndex',index);
$location.path("/send_class_list").search({id: r.id});
}
// $location.path("/send_class_list").search({id: r.id});
$location.path("/send_class_list").search({id: r.id,course_id: r.course_id});
};
vm.loadResourceData = function (index,page){
if(index == 1){
@ -147,4 +151,11 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
vm.tab(currentTab);
vm.goHomeworkDetail = function(id){
rms.save("has_more",vm.has_more);
rms.save("homework_has_more",vm.homework_has_more);
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
$location.path("/homework").search({id: id});
}
}] );

View File

@ -114,6 +114,7 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
//跳到详情页
vm.goDetail = function(type, act_id,id){
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
rms.save('project_activities_page',vm.project_activities_page);
rms.save("project_activities",vm.project_activities);
rms.save('project_has_more', vm.project_has_more);
rms.save("project",vm.project);
@ -237,4 +238,19 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
$location.path("/review_project_member").search({id: projectid,user_id: user.id});
}
vm.goPublishNote = function(){
rms.save('project_activities_page',vm.project_activities_page);
rms.save("project_activities",vm.project_activities);
rms.save("project_has_more",vm.project_has_more);
rms.save("project",vm.project);
rms.save("project_master_members",vm.project_master_members);
rms.save("project_develop_members",vm.project_develop_members);
rms.save("project_report_members",vm.project_report_members);
rms.save("review_master_members",vm.review_master_members);
rms.save("review_develop_members",vm.review_develop_members);
rms.save('current_project', vm.project);
$location.path("/project_publishnote").search({id:projectid});
};
}]);

View File

@ -0,0 +1,74 @@
app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
// common.checkLogin();
var vm = $scope;
vm.current_project = rms.get('current_project');
var project_id = $routeParams.id;
vm.alertService = alertService.create();
vm.notetitle = "";
vm.note = "";
if(!vm.current_project){
$http.get(config.apiUrl+ 'projects/'+project_id+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.current_project = response.data.data;
console.log("projects");
console.log(response.data.data);
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
if(!vm.current_project){
vm.tip_1 = "该项目不存在或已被删除";
}
}
);
}
vm.cancel = function(){
window.history.back();
};
//发布通知 只有老师能发布
vm.publishNote = function(){
if(vm.notetitle.length == 0)
{
vm.alertService.showMessage('提示', '标题不能为空');
return;
}
if(vm.note.length == 0)
{
vm.alertService.showMessage('提示', '内容不能为空');
return;
}
var text = vm.note.replace(/\n/g,'<br/>');
$http.post(config.apiUrl + "projects/"+project_id+"/publishnote",
{token: auth.token(),title: vm.notetitle, text: text}
).then(function(response){
if(response.data.status == 0)
{
vm.alertService.showMessage('提示', '您已成功发布帖子',function(){
rms.save('project_activities_page',0);
rms.save("project_activities",[]);
rms.save("project_has_more",false);
rms.save('tab_num',null);
$location.path("/project").search({id: project_id});
});
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
});
};
}] );

View File

@ -3,6 +3,7 @@ app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'co
var vm = $scope;
var send_id = $routeParams.id;
vm.course_id = $routeParams.course_id;
//发送类别 1课件 2作业 3测验
vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1;

View File

@ -0,0 +1,28 @@
/**
* Created by ttang on 2016/8/22.
*/
app.directive('iphoneRecognize',["$timeout",function(timer){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
timer(function(){
var userAgent = navigator.userAgent;
var contentHeight = $(".post-container").height();
if (/ipad|iphone|mac/i.test(navigator.userAgent)){
$("#postInput1").bind('focus',function(){
element.css({"position":"relative","padding":"1px 0"});
$(".post-wrapper").css("margin-bottom","0");
$("#all_homework_reply").css("margin-bottom","0");
window.scrollTo(0,contentHeight);
});
$("#postInput1").bind('blur',function(){
element.css("position","fixed");
$(".post-wrapper").css("margin-bottom","10px");
$("#all_homework_reply").css("margin-bottom","50px");
});
}
})
}
}
}]);

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