diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index b9824976b..117d022d6 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -2,43 +2,63 @@ class AppliedProjectController < ApplicationController #申请加入项目 def applied_join_project - @user_id = params[:user_id] - @project = Project.find_by_id(params[:project_id]) - if params[:project_join] - if @project - user = User.find @user_id - if user.member_of?(@project) - @status = 3 - else - @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) - if @applieds.count == 0 - appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) - Mailer.run.applied_project(appliedproject) - @status = 2 - else - @status = 1 - end - end - else - @status = 0 - end - respond_to do |format| - format.js - end - return - end - - @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) - if @applieds.count == 0 - appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) - Mailer.run.applied_project(appliedproject) - end + @project = Project.find_by_id(params[:object_id]) + # @user_id = params[:user_id] + # if params[:project_join] + # if @project + # user = User.find @user_id + # if user.member_of?(@project) + # @status = 3 + # else + # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + # if @applieds.count == 0 + # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + # Mailer.run.applied_project(appliedproject) + # @status = 2 + # else + # @status = 1 + # end + # end + # else + # @status = 0 + # end + # respond_to do |format| + # format.js + # end + # return + # end + # + # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + # if @applieds.count == 0 + # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + # Mailer.run.applied_project(appliedproject) + # end + # + # #redirect_to project_path(params[:project_id]) + # #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true} + # respond_to do |format| + # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} + # format.js { render :partial => 'set_applied'} + # end + end - #redirect_to project_path(params[:project_id]) - #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true} - respond_to do |format| - format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_applied'} + # @flage:提示语标志(1:邀请码错误;2:已经是项目成员; 3:角色没有选择; 4:申请成功) + # role:成员角色 => 0(1:管理人员;2:开发人员;3:报告人员) + # 申请成功则发送消息 + def applied_project_info + @project = Project.find(params[:project_id]) + if params[:invite_code].to_s != @project.invite_code + @flag = 1 + elsif User.current.member_of?(@project) + @flag = 2 + elsif params[:member].nil? + @flag = 3 + else + @flag = 4 + role = params[:member] == "member_manager" ? 1 : (params[:member] = "member_developer" ? 2 : 3) + applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => params[:project_id], :role => role) + # 申请成功则给项目管理员发送邮件及发送消息 + Mailer.run.applied_project(applied_project) end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a38cc8d34..2614b6271 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -23,7 +23,7 @@ class CoursesController < ApplicationController before_filter :can_show_course, :except => [] before_filter :logged_user_by_apptoken,:only => [:show,:feedback] - before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses] + before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses, :join_course_multi_role] before_filter :authorize_course, :only => [:show, :settings, :update, :course] before_filter :authorize_course_global, :only => [:new,:create] before_filter :toggleCourse, :only => [:finishcourse, :restartcourse] @@ -81,6 +81,22 @@ class CoursesController < ApplicationController end + def join_course_multi_role + if User.current.logged? + cs = CoursesService.new + @user = User.current + join = cs.join_course_roles params,@user + @state = join[:state] + @course = join[:course] + else + @state = 5 #未登录 + end + @object_id = @course.id if @course + respond_to do |format| + format.js + end + end + def unjoin if User.current.logged? cs = CoursesService.new @@ -1136,6 +1152,21 @@ class CoursesController < ApplicationController end end + #切换身份 + def switch_role + members = @course.members.where("user_id = #{params[:user_id]}") + unless members.blank? + #role = MemberRole.where("member_id = #{members.first.id} and role_id = #{params[:role]}").first + curr_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:curr_role]) + tar_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:tar_role]) + unless (curr_role.nil? || tar_role.nil?) + curr_role.update_column('is_current', 0) + tar_role.update_column('is_current', 1) + end + end + redirect_to course_path(@course) + end + private def update_quotes attachment if attachment.copy_from diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 4dc2c52f5..fe0da8d78 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -154,9 +154,11 @@ class MembersController < ApplicationController user_ids = attrs.delete(:user_ids) user_ids.each do |user_id| member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id) - role = Role.find_by_id(params[:membership][:role_ids]) + + role_ids = attrs.delete(:role_ids) + #role = Role.find(params[:membership][:role_ids]) # 这里的判断只能通过角色名,可以弄成常量 - if role && (role.name == "学生" || role.name == "Student") + if role_ids && role_ids.include?("10") StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id) end @@ -252,7 +254,10 @@ class MembersController < ApplicationController if (params[:membership][:role_ids]) role = Role.find(params[:membership][:role_ids][0]) # 这里的判断只能通过角色名,可以弄成常量 - if role.name == "学生" || role.name == "Student" + attrs = params[:membership].dup + role_ids = attrs.delete(:role_ids) + + if role_ids && role_ids.include?("10") StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id) else joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5e968e854..2f1d6a4db 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -41,7 +41,7 @@ class UsersController < ApplicationController :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :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] + :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -133,6 +133,7 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @homepage = params[:homepage] + @user_id = params[:user_id] @type = 'BlogComment' when 'OrgDocumentComment' @reply = OrgDocumentComment.find params[:reply_id] @@ -149,6 +150,9 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @type = 'Issue' + when 'Syllabus' + @reply = JournalsForMessage.find params[:reply_id] + @type = 'Syllabus' end respond_to do |format| format.js @@ -351,15 +355,21 @@ class UsersController < ApplicationController case params[:agree] when 'Y' apply_user = User.find(@msg.course_message_id) - + ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色 + integer_ids = [] + ids.each do |role_id| + integer_ids << role_id.to_i + end if apply_user.member_of_course?(Course.find(@msg.course_id)) #将角色改为老师或者教辅 member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0] - member.role_ids = [@msg.content] # msg content保存的是申请的职位角色 - #删除为学生的记录 - joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id) - joined.each do |join| - join.delete + member.role_ids = integer_ids + #删除为学生的记录 + unless member.role_ids.include?(10) + joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id) + joined.each do |join| + join.delete + end end member.course_group_id = 0 @@ -368,7 +378,7 @@ class UsersController < ApplicationController @msg.update_attributes(:status=>1,:viewed=>1) else members = [] - members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id) + members << Member.new(:role_ids => integer_ids, :user_id => @msg.course_message_id) Course.find(@msg.course_id).members << members CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1) @msg.update_attributes(:status=>1,:viewed=>1) @@ -3225,7 +3235,35 @@ class UsersController < ApplicationController end def user_courselist - @order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 + @order, @c_sort, @type, @list_type = 1, 2, 1, 1 + + @my_syllabuses = @user.syllabuses + + sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id) + syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" + @join_syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}") + + @my_syllabuses = syllabus_course_list_sort @my_syllabuses + @join_syllabuses = syllabus_course_list_sort @join_syllabuses + @my_syllabuses = @my_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]} + @join_syllabuses = @join_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]} + + #分页 + # @limit = 10 + # @is_remote = true + # @atta_count = @syllabus.count + # @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + # @offset ||= @atta_pages.offset + # @syllabus = paginateHelper @syllabus,@limit + + respond_to do |format| + format.html {render :layout => 'new_base_user'} + end + end + + #课程列表的排序 + def sort_syllabus_list + @order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1 #确定 sort_type if @order.to_i == @type.to_i @@ -3235,40 +3273,48 @@ class UsersController < ApplicationController end sort_name = "updated_at" - sort_type = @c_sort == 1 ? "asc" : "desc" - @courses = @user.courses.visible.where("is_delete =?", 0) - syllabus_ids = @courses.empty? ? '(-1)' : "(" + @courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" - @syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}") + if @list_type.to_i == 1 + @syllabuses = @user.syllabuses.order("updated_at desc") + else + sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id) + syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" + @syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}").order("updated_at desc") + end - #根据 作业+资源数排序 - if @order.to_i == 2 + if @order.to_i == 1 #根据 班级更新时间排序 + @syllabuses = syllabus_course_list_sort @syllabuses + @c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:last_update] <=> y[:last_update] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}) + @type = 1 + elsif @order.to_i == 2 #根据 作业+资源数排序 @type = 2 - @syllabus.each do |syllabus| + @syllabuses.each do |syllabus| count = 0 - courses = @courses.where("syllabus_id = #{syllabus.id}") + courses = syllabus.courses.not_deleted courses.each do |c| count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count) end syllabus[:infocount] = count end - @c_sort == 1 ? (@syllabus = @syllabus.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabus = @syllabus.sort{|x,y| y[:infocount] <=> x[:infocount]}) - @syllabus = sortby_time_countcommon_nosticky @syllabus,sort_name + @c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]}) + @syllabuses = sortby_time_countcommon_nosticky @syllabuses,sort_name else @type = 1 end - #分页 - @limit = 10 - @is_remote = true - @atta_count = @syllabus.count - @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 - @offset ||= @atta_pages.offset - @syllabus = paginateHelper @syllabus,@limit - respond_to do |format| format.js - format.html {render :layout => 'new_base_user'} + end + end + + #展开课程下的班级 + def expand_courses + @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first + unless @syllabus.nil? + @courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + respond_to do |format| + format.js + end end end @@ -3342,6 +3388,8 @@ class UsersController < ApplicationController when 'Syllabus' obj = Syllabus.where('id = ?', params[:id].to_i).first @journals = obj.journals_for_messages.reorder("created_on desc") + @type = 'Syllabus' + @user_activity_id = params[:div_id].to_i if params[:div_id] when 'JournalsForMessage' obj = JournalsForMessage.where('id = ?', params[:id].to_i).first journals = [] @@ -3358,6 +3406,7 @@ class UsersController < ApplicationController @user_activity_id = params[:div_id].to_i if params[:div_id] @homepage = params[:homepage].to_i @type = 'BlogComment' + @user_id = obj.author_id comments = [] @journals = get_all_children(comments, obj) when 'HomeworkCommon' diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 828739cc4..499272706 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -112,6 +112,10 @@ class WordsController < ApplicationController end @is_in_course = params[:is_in_course].to_i @course_activity = params[:course_activity].to_i + elsif @journal_destroyed.jour_type == 'Syllabus' + @syllabus = Syllabus.find @journal_destroyed.jour_id + @count = @syllabus.journals_for_messages.count + @comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) end respond_to do |format| format.js @@ -352,6 +356,35 @@ class WordsController < ApplicationController render_403 end end + + #课程大纲的二级回复 + def reply_to_syllabus + if User.current.logged? + @user = User.current + reply = JournalsForMessage.find params[:id].to_i + @syllabus = Syllabus.find reply.jour_id + if params[:reply_message].size>0 && User.current.logged? && @user + options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i} + feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options) + if (feedback.errors.empty?) + if params[:asset_id] + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE + end + @syllabus.update_column('updated_at', Time.now) + @count = @syllabus.journals_for_messages.count + @comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) + respond_to do |format| + format.js + end + else + flash[:error] = feedback.errors.full_messages[0] + end + end + else + render_403 + end + end def add_brief_introdution user = User.current diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index e1dda3554..b3e946f95 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -274,14 +274,19 @@ module CoursesHelper #searchPeopleByRoles(project, TeacherRoles) members = [] project.members.includes(:user).each do |m| - members << m if m && m.user && m.user.allowed_to?(:as_teacher,project) + #members << m if m && m.user && m.user.allowed_to?(:as_teacher,project) + members << m if m && m.user && m.user.has_teacher_role(project) end members end def TeacherAndAssistantCount course - students_count = course.student.count - number = course.members.count - students_count + #students_count = course.student.count + #number = course.members.count - students_count + member_ids = course.members.includes(:user).blank? ? "(-1)" : "(" + course.members.includes(:user).map { |mem| mem.id}.join(",") + ")" + role_ids = "(3, 7, 9)" + number = MemberRole.where("member_id in #{member_ids} and role_id in #{role_ids}").count + #number = (searchTeacherAndAssistant course).count end def search_student_in_group(project, course_group_id) @@ -789,7 +794,7 @@ module CoursesHelper if user.logged? joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) - url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) + url = joined ? join_path(:object_id => course.id) : join_private_courses_courses_path() method = joined ? 'delete' : 'post' if joined link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) @@ -831,6 +836,10 @@ module CoursesHelper result = l(:label_student) elsif role == "Manager" result = l(:field_admin) + elsif role.include?("TeachingAsistant") && role.include?("Student") + result = l(:label_TA) + " " + l(:label_student) + elsif role.include?("Teacher") && role.include?("Student") + result = l(:label_teacher) + " " + l(:label_student) end result end @@ -914,5 +923,15 @@ module CoursesHelper resource_num*5 + journal_num + homework_journal_num ) desc limit 3;") end + #用户在该课程是否具有某个角色 + def get_user_member_roles_course course, user, role + members = course.members.where("user_id = #{user.id}") + result = false + unless members.blank? + m_roles = MemberRole.where("member_id = #{members.first.id} and role_id = #{role}") + end + result = !m_roles.blank? + result + end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 98b993183..ad8bc4377 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -54,6 +54,18 @@ module UsersHelper end end + # 获取消息角色 + def applied_project_message_type role + case role + when 1 + "管理员" + when 2 + "开发人员" + when 3 + "报告人员" + end + end + def get_resource_origin attach type = attach.container_type content = attach.container @@ -690,4 +702,18 @@ module UsersHelper end result_ids end + + #课程的班级列表最近更新时间 + def syllabus_course_list_sort syllabuses + syllabuses.each do |sy| + updated_at = sy.updated_at + courses = sy.courses.not_deleted + unless courses.empty? + course_ids = "(" + courses.map { |course| course.id}.join(",") + ")" + updated_at = CourseActivity.where("course_id in #{course_ids}").order("updated_at desc").first.updated_at + end + sy[:last_update] = updated_at + end + syllabuses + end end diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 52f2ea119..d846071b5 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -364,22 +364,29 @@ module WatchersHelper :class => "pr_join_a" ,:id=>id end - #申请加入项目 + # 申请加入项目 def join_in_project_link(project, user, options=[]) - return '' unless user && user.logged? applied = project.applied_projects.find_by_user_id(user.id) text = applied ? l(:label_unapply_project) : l(:label_apply_project) - @applied_flag = project.instance_of?(Project) + url = applied_join_project_path(:object_id => project.id) + method = 'post' + @applied_flag = project.instance_of?(Project) if applied - appliedid = applied.id + link = "#{text}" + else + link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "pr_join_a") end - id = applied_css(project) - url = appliedproject_path( - :id=>appliedid, - :user_id => user.id, - :project_id => project.id) - method = applied ? 'delete' : 'post' - link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id + link.html_safe + # if applied + # appliedid = applied.id + # end + # id = applied_css(project) + # url = appliedproject_path( + # :id=>appliedid, + # :user_id => user.id, + # :project_id => project.id) + # method = applied ? 'delete' : 'post' + # link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id end def paginateHelper obj, pre_size=20 diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb index fb8bf90af..8dbed9cda 100644 --- a/app/models/applied_project.rb +++ b/app/models/applied_project.rb @@ -1,18 +1,16 @@ class AppliedProject < ActiveRecord::Base - attr_accessible :project_id, :user_id + attr_accessible :project_id, :user_id, :role belongs_to :user belongs_to :project - has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy + has_many :applied_messages, :class_name => 'AppliedMessage', :as => :applied, :dependent => :destroy after_create :send_appliled_message + # 仅仅给项目管理人员发送消息 def send_appliled_message - # if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? - self.project.members.each do |m| - if m.roles.first.to_s.include?("Manager") - self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false) - end + self.project.managers.each do |member| + self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false) end # end end diff --git a/app/models/member.rb b/app/models/member.rb index 3cb70a8fe..cb15e067b 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -53,7 +53,15 @@ class Member < ActiveRecord::Base new_role_ids = ids - role_ids # Add new roles - new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) } + if new_role_ids.include?(7) && new_role_ids.include?(10) + member_roles << MemberRole.new(:role_id => 7) + member_roles << MemberRole.new(:role_id => 10, :is_current => 0) + elsif new_role_ids.include?(9) && new_role_ids.include?(10) + member_roles << MemberRole.new(:role_id => 9) + member_roles << MemberRole.new(:role_id => 10, :is_current => 0) + else + new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) } + end # Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy) member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)} if member_roles_to_destroy.any? diff --git a/app/models/member_role.rb b/app/models/member_role.rb index 4d493cb27..799720833 100644 --- a/app/models/member_role.rb +++ b/app/models/member_role.rb @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MemberRole < ActiveRecord::Base + # multi_role 课程中的多重角色 0:单角色/学生,1:管理员&学生,2:教师&学生,3:教辅&学生 belongs_to :member belongs_to :role diff --git a/app/models/project.rb b/app/models/project.rb index aa70084d2..cb2efd64a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -269,6 +269,11 @@ class Project < ActiveRecord::Base notified.collect(&:mail) end + # 返回为member类型数组 + def managers + self.members.includes(:roles).select{|member| member.roles[0].try(:name) == "Manager"} + end + def initialize(attributes=nil, *args) super @@ -905,6 +910,24 @@ class Project < ActiveRecord::Base User.find(self.user_id) end + # 延迟生成邀请码 + def invite_code + return generate_invite_code + end + + # 生成邀请码 + # 如果已有改邀请码,则重新生成 + CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) + def generate_invite_code + code = read_attribute(:invite_code) + if !code || code.size <5 + code = CODES.sample(5).join + return generate_invite_code if Project.where(invite_code: code).present? + update_attribute(:invite_code, code) + end + code + end + private def after_parent_changed(parent_was) diff --git a/app/models/user.rb b/app/models/user.rb index 996aa9be7..afd45e08b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -823,7 +823,7 @@ class User < Principal # Find course membership membership = coursemembership(course) if membership - roles = membership.roles + roles = membership.roles.where("is_current = 1") else @role_non_member ||= Role.non_member roles << @role_non_member @@ -918,6 +918,12 @@ class User < Principal end end + #是否具有老师角色 + def has_teacher_role(course) + member = course.members.where("user_id = #{self.id}").first + role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)") + !role.blank? + end # Return true if the user is allowed to do the specified action on a specific context # Action can be: diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 811d73f55..f60021e71 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -391,6 +391,101 @@ class CoursesService {:state => @state,:course => course} end + #多个角色加入课程 + def join_course_roles params,current_user + course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code] + + @state = 10 + if course + if course_endTime_timeout? course + @state = 2 + else + if current_user.member_of_course?(course) #如果已经是成员 + @state = 3 + # member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0] + # role_ids = params[:role] + # #roleName = member.roles[0].name if member + # #roleName = member.roles.map{|role| role.name}.join(",") if member + # if params[:invite_code].present? + # #如果加入角色为学生 并且当前是学生 + # if role_ids == "10" && roleName.include?("Student") && !roleName.include?("Teacher") && !roleName.include?("TeachingAsistant")&& !roleName.include?("Manager") + # @state = 3 + # #如果加入的角色为老师,并且当前已经是老师 + # elsif role_ids == "9" && roleName.include?("Teacher") && !roleName.include?("Student") + # @state = 8 + # #如果加入的角色教辅并且当前为教辅 + # elsif role_ids == "7" && roleName.include?("TeachingAsistant") && !roleName.include?("Student") + # @state = 9 + # elsif roleName.include?("Manager") + # @state = 10 + # #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求 + # elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" ) + # #如果已经发送过消息了,那么就要给个提示 + # if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0 + # @state = 7 + # else + # Mailer.run.join_course_request(course, User.current, params[:role]) + # CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) + # @state = 6 + # end + # #如果加入角色是学生,但是是当前课程的教师或者教辅 + # elsif params[:role] == "10" && roleName != "Student" + # member.role_ids = [params[:role]] + # member.save + # StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) + # @state = 0 + # end + # else + # @state = 1 + # end + else + if params[:invite_code].present? + role_ids = params[:role] + role_str = role_ids.join(",") + if role_ids.include?("10") && !role_ids.include?("7") && !role_ids.include?("9") + members = [] + members << Member.new(:role_ids => [10], :user_id => current_user.id) + course.members << members + StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) + @state = 0 + else + is_stu = false + if role_ids.include?("10") + members = [] + members << Member.new(:role_ids => [10], :user_id => current_user.id) + course.members << members + StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id) + is_stu = true + end + #如果已经发送过消息了,那么就要给个提示 + if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = '#{role_str}' and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0 + if is_stu + @state = 12 + else + @state = 7 + end + else + Mailer.run.join_course_request(course, User.current, params[:role]) + CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) + if is_stu + @state = 13 + else + @state = 6 + end + end + end + else + @state = 1 + end + end + end + else + @state = 4 + end + {:state => @state,:course => course} + end + + #作业列表 #已提交的作业数量获取 bid.homeworks.count #学生提问数量获取 bid.commit.nil? ? 0 : bid.commit diff --git a/app/views/applied_project/_applied_join_project.html.erb b/app/views/applied_project/_applied_join_project.html.erb new file mode 100644 index 000000000..ad2d020c2 --- /dev/null +++ b/app/views/applied_project/_applied_join_project.html.erb @@ -0,0 +1,29 @@ +
+

欢迎加入项目

+ +
+
+
+ <%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => @project.id), :remote => true, :id => 'project_applied_form') do %> + + <% end %> +
diff --git a/app/views/applied_project/_applied_project_tip.js.erb b/app/views/applied_project/_applied_project_tip.js.erb new file mode 100644 index 000000000..56e5270d6 --- /dev/null +++ b/app/views/applied_project/_applied_project_tip.js.erb @@ -0,0 +1,25 @@ +
+
+

提示

+ +
+
+
+ +
+
\ No newline at end of file diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb index ae9d3f467..6aa4481a4 100644 --- a/app/views/applied_project/applied_join_project.js.erb +++ b/app/views/applied_project/applied_join_project.js.erb @@ -1,14 +1,3 @@ -// @status: 0 该项目不存在;1 不重复加入;2 成功加入; 3 已是项目成员;其它 加入失败 -<% if @status == 0%> - alert("<%= l('project.join.tips.notexist') %>"); -<% elsif @status == 1%> - alert("<%= l('project.join.tips.repeat') %>"); -<% elsif @status == 2%> - alert("<%= l('project.join.tips.success') %>"); - hideModal($("#popbox")); - $("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>"); -<% elsif @status == 3%> - alert("<%= l('project.join.tips.has') %>"); -<%else%> - alert("<%= l('project.join.tips.fail') %>"); -<%end%> \ No newline at end of file +var htmlvalue = "<%= escape_javascript(render :partial => 'applied_join_project', locals: {:project_id => @project.id}) %>"; +pop_box_new(htmlvalue,460,40,50); + diff --git a/app/views/applied_project/applied_project_info.js.erb b/app/views/applied_project/applied_project_info.js.erb new file mode 100644 index 000000000..1ac627b3e --- /dev/null +++ b/app/views/applied_project/applied_project_info.js.erb @@ -0,0 +1,3 @@ +var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip', locals: {:project_id => @project.id}) %>"; +pop_box_new(htmlvalue,380,40,50); +//$("#join_in_project").attr('href','<%#= join_in_project_link(@project, User.current) %>'); diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index 0f7e8a012..759a9a735 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -92,7 +92,7 @@ <% end %> <% if options[:author] %> - <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>, <%= format_time(attachment.created_on) %> <% end %> diff --git a/app/views/blog_comments/destroy.js.erb b/app/views/blog_comments/destroy.js.erb index c34986977..52ecbb925 100644 --- a/app/views/blog_comments/destroy.js.erb +++ b/app/views/blog_comments/destroy.js.erb @@ -1,5 +1,5 @@ <% if @in_user_homepage %> - <% homepage = BlogComment.find(User.current.blog.homepage_id) %> + <% homepage = BlogComment.find(@user.blog.homepage_id) %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => @blog_comment, :user_activity_id => homepage.id}) %>"); <% else%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>"); diff --git a/app/views/blogs/_homepage.html.erb b/app/views/blogs/_homepage.html.erb index a16547836..a076ed15c 100644 --- a/app/views/blogs/_homepage.html.erb +++ b/app/views/blogs/_homepage.html.erb @@ -1,6 +1,5 @@
-
<% if activity.author.id == User.current.id%> <%end%> -
<% all_comments = []%> @@ -57,7 +54,7 @@ <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
- <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1, :user_id => activity.author_id}%>
<% end %> diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index 55217017b..9f45172bc 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -114,7 +114,7 @@ - 复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生可能看不到资源。 + 复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生将看不到资源。 \ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index ec5d18c7e..f95129903 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -1,100 +1,52 @@ - - - - - 快速进入班级通道 - - - +
+ +
  • + + 确  定 + 取  消 - -
    -
    -
    -

    快速加入班级通道

    -

    只要持有班级邀请码,就可以快速加入所在班级。班级页面搜索不到的私有班级只能从此通道进入哦!

    -
    -
    - <%= form_tag({:controller => 'courses', - :action => 'join'}, - :remote => true, - :method => :post, - :id => 'new-watcher-form') do %> -
      -
    • - - - 班级邀请码: - - -
    • -
    • 班级邀请码是所在班级页面中显示的邀请码
    • -
    • - - <% if User.current.logged? && User.current.extensions && User.current.extensions.identity == 0%> - - <%else%> - - <%end%> -
    • -
    • - - <%= l(:label_new_join) %> - - - <%= l(:button_cancel)%> - -
    • -
    - <% end%> -
    -
    +
    +
  • + + <% end %> +
    - - - + \ No newline at end of file diff --git a/app/views/courses/_member.html.erb b/app/views/courses/_member.html.erb index 95177c92c..9e6abcf4f 100644 --- a/app/views/courses/_member.html.erb +++ b/app/views/courses/_member.html.erb @@ -10,7 +10,7 @@ ) do |f| %> <% @roles.each do |role| %> @@ -35,4 +35,25 @@ :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %> <% end%> -<% end%> \ No newline at end of file + + +<% end%> diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index c41edf680..5f9e512d7 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -29,7 +29,7 @@ <% if show_nav?(course_feedback_count) %>
  • 留言 - <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%> + <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
  • <% end %> <% if show_nav?(course_poll_count) %> diff --git a/app/views/courses/join.js.erb b/app/views/courses/join.js.erb index ac8b717d1..52c1347a5 100644 --- a/app/views/courses/join.js.erb +++ b/app/views/courses/join.js.erb @@ -36,6 +36,10 @@ window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/co alert("您已经是该班级的管理员了"); hidden_join_course_form(); window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 11%> +alert("该班级已被删除"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" <% else %> alert("未知错误,请稍后再试"); <% end %> diff --git a/app/views/courses/join_course_multi_role.js.erb b/app/views/courses/join_course_multi_role.js.erb new file mode 100644 index 000000000..97d6b33ce --- /dev/null +++ b/app/views/courses/join_course_multi_role.js.erb @@ -0,0 +1,52 @@ +<% if @object_id && @state != 6 && @state !=4 %> +$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>"); +<% end %> +<% if @state %> +<% if @state == 0 %> +alert("加入成功"); +hideModal(); +$("#try_join_course_link").replaceWith(" 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 1 %> +alert("密码错误"); +<% elsif @state == 2 %> +alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)"); +<% elsif @state == 3 %> +alert("您已经加入了班级"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 4 %> +alert("您加入的班级不存在"); +<% elsif @state == 5 %> +alert("您还未登录"); +<% elsif @state == 6 %> +alert("申请成功,请等待审核"); +hidden_join_course_form(); +<% elsif @state == 7%> +alert("您已经发送过申请了,请耐心等待"); +hidden_join_course_form(); +<% elsif @state == 8%> +alert("您已经是该班级的教师了"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 9%> +alert("您已经是该班级的教辅了"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 10%> +alert("您已经是该班级的管理员了"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 11%> +alert("该班级已被删除"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 12 %> +alert("您已经发送过申请了,请耐心等待"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 13 %> +alert("申请成功,请等待审核"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% else %> +alert("未知错误,请稍后再试"); +<% end %> +<% end %> diff --git a/app/views/courses/join_private_courses.js.erb b/app/views/courses/join_private_courses.js.erb index 199cfb5ae..14402a9ff 100644 --- a/app/views/courses/join_private_courses.js.erb +++ b/app/views/courses/join_private_courses.js.erb @@ -1,11 +1,2 @@ -$('#topnav_course_menu').hide(); -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>'); -showModal('ajax-modal', '540px'); -$('#ajax-modal').css('height','390px'); -//$('#ajax-modal').siblings().remove(); -$('#ajax-modal').siblings().hide(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); -$('#ajax-modal').parent().addClass("alert_box"); +var htmlvalue = "<%= escape_javascript(render :partial => 'join_private_course') %>"; +pop_box_new(htmlvalue,460,40,50); diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index fe6b3e596..f53c8c716 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -17,13 +17,13 @@
  • - +
  • - +
  • diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb index ec9a0bc54..ac912a71c 100644 --- a/app/views/issues/_detail.html.erb +++ b/app/views/issues/_detail.html.erb @@ -20,7 +20,7 @@ <%= get_issue_priority(@issue.priority_id)[1] %>


    - 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %> + 由<%=link_to @issue.author, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %> diff --git a/app/views/layouts/_base_course_old.html.erb b/app/views/layouts/_base_course_old.html.erb deleted file mode 100644 index 4b2077cf8..000000000 --- a/app/views/layouts/_base_course_old.html.erb +++ /dev/null @@ -1,278 +0,0 @@ -<%# course_model %> -<% course_file_num = visable_attachemnts_incourse(@course).count%> -<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> -<% homework_num = visable_course_homework @course %> - - - - - - - <%= h html_title %> - - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= 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'%> - <%= javascript_include_tag "course","sy_public", "syllabus","header","attachments",'prettify' %> - - <%= yield :header_tags -%> - - - - - - - - - - - -
    -
    -
    -
    -
    - <%=render :partial=>'layouts/project_info' %> -
    - -
    -
      -
    • <%= l(:label_main_teacher)%> :  <%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %>
    • -
    • <%= l(:label_class_period)%> :  <%= @course.class_period %> <%= l(:label_class_hour) %>
    • -
    • <%= l(:label_main_term)%> :  <%= current_time_and_term @course %>
    • - <% if @course.school%> -
    • <%= l(:label_course_organizers)%> :  <%= @course.school%>
    • - <% end%> -
    -
    - - <%# 更新访问数,刷新的时候更新访问次数 %> - <% update_visiti_count @course %> - <%# over %> - - - <%# 课程活跃度 %> -
    - <%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %> - <%# 课程英雄榜 %> - <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %> - - <% if @course.description && !@course.description.blank? %> -
    -
    -

    <%= l(:label_course_brief_introduction)%>:

    -
    - <%= textilizable(@course.description) if @course.description && !@course.description.blank? %> -
    -
    -
    - - - - -
    -
    - <% end %> -
    -

    <%= l(:label_tag)%>:

    -
    - <%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %> -
    -
    -
    - - <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> -
    访问计数 <%= @course.visits.to_i %> (自2016年5月)
    -
    - -
    - <%= yield %> - <%#= render_flash_messages %> - <%#= call_hook :view_layouts_base_content %> -
    - -
    - -
    -
    - -
    -<%= render :partial => 'layouts/footer' %> -
    - -<%= render :partial => 'layouts/new_feedback' %> - - -<%= call_hook :view_layouts_base_body_bottom %> - - - - \ No newline at end of file diff --git a/app/views/layouts/_base_syllabus_old.html.erb b/app/views/layouts/_base_syllabus_old.html.erb deleted file mode 100644 index 45e77dbad..000000000 --- a/app/views/layouts/_base_syllabus_old.html.erb +++ /dev/null @@ -1,151 +0,0 @@ - - - - - <%= h html_title %> - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'syllabus','css/common','css/public','css/structure','css/courses','css/popup','prettify',:media => 'all' %> - <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> - <%= javascript_heads %> - <%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus'%> - <%= heads_for_theme %> - <%= call_hook :view_layouts_base_html_head %> - <%= yield :header_tags -%> - - - - - - - -<% is_current_user = User.current.logged?%> - -
    -
    -
    -
    -
    - <%=render :partial => 'layouts/syllabus_info' %> -
    - <% update_visiti_count @syllabus %> - -
    - <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %> -
    - -
    -
    - <%=link_to '班级', {:controller => "syllabuses", :action => "syllabus_courselist", :id => @syllabus.id}, :class => 'homepageMenuText' %> - <% if is_current_user%> - <% if User.current == @syllabus.user && User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> -
    -
      -
    • -
        -
      • - <%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey", :target => '_blank'%> -
      • -
      • - <%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%> -
      • -
      -
    • -
    -
    - <% else%> - <%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%> - <% end%> - <% end%> -
    - <% if User.current == @syllabus.user || User.current.admin? - all_courses = @syllabus.courses.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") - else - all_courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") - end %> - <% courses = all_courses.limit(5) %> - <% all_count = all_courses.count%> -
    -
    -
      - <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => User.current,:all_count => all_count,:type =>'Syllabus',:page => 0} %> -
    -
    - <% if !courses.empty? %> -
    - -
    - <% end %> -
    -
    - -
    -

    标签:

    -
    - <%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%> -
    -
    -
    -
    访问计数 <%=@syllabus.visits %> (自2016年7月)
    - -
    -
    - <%= yield %> -
    -
    - <%= render :partial => 'layouts/new_feedback' %> -
    -
    -<%= render :partial => 'layouts/footer' %> -
    - - - - - - diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 546b27421..1a14d904c 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -3,24 +3,19 @@ <% student_num = studentCount(@course) %> <% course_file_num = visable_attachemnts_incourse(@course).count %>

    - <% if @course.syllabus %> - <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %> -  >  - <% end %> + <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %> +  >  <%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %>

    <% if is_teacher %> -
    +
    - <%= l(:label_project_id)%><%= @project.id %> + <%= l(:label_project_ivite_code)%> + <%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %>
    diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index f280f6506..562b35ecc 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -192,7 +192,7 @@ <%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %> <% if is_current_user%> - <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> + <%# if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
    • @@ -211,9 +211,9 @@
    - <% else%> - <%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%> - <% end%> + <%# else%> + <%#=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%> + <%# end%> <% end%>
    <% end %> diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb index cdb566412..4384ba2ee 100644 --- a/app/views/syllabuses/_syllabus_course_list.html.erb +++ b/app/views/syllabuses/_syllabus_course_list.html.erb @@ -24,7 +24,7 @@ <%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "sy_classlist_title fl", :style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%> <% end %> - <%=course.is_public? ? '公开' : '私有' %> +

    主讲老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue' %> diff --git a/app/views/syllabuses/new.html.erb b/app/views/syllabuses/new.html.erb index 3c0a39bf1..ced8a3d66 100644 --- a/app/views/syllabuses/new.html.erb +++ b/app/views/syllabuses/new.html.erb @@ -6,13 +6,13 @@ <%= labelled_form_for @syllabus do |f| %>

  • - +
  • - +
  • diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb index 9b1bdafc5..e39d538ce 100644 --- a/app/views/syllabuses/show.html.erb +++ b/app/views/syllabuses/show.html.erb @@ -53,7 +53,7 @@ <% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %> <% if count > 0 %>
    - <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> + <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus', :activity_id => @syllabus.id} %>
    <% end %>
    diff --git a/app/views/users/_all_replies.html.erb b/app/views/users/_all_replies.html.erb deleted file mode 100644 index a74acc77c..000000000 --- a/app/views/users/_all_replies.html.erb +++ /dev/null @@ -1,39 +0,0 @@ - \ No newline at end of file diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb new file mode 100644 index 000000000..1abe77b81 --- /dev/null +++ b/app/views/users/_courses_list.html.erb @@ -0,0 +1,30 @@ +<% unless courses.nil? %> + <% courses.each_with_index do |course, i| %> +
  • + <% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %> + " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>"> + +
    +
    +

    <%=course.name %>

    + + +
    +
    +
    +

    更新:<%=format_date Time.at(course.updatetime) %>学期:<%=current_time_and_term(course) %>

    +

    <%=studentCount course %>学生|<%=visable_course_homework course %>作业|<%=visable_attachemnts_incourse(@course).count %>资源

    +
    +
    +
    + +
    +
    +
  • + <% end %> + <% if courses.count > 3 %> +
  • + 共<%=courses.count %>个班级,点击全部展开 +
  • + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb index 933de0b0d..cecbe2755 100644 --- a/app/views/users/_join_course_course_message.html.erb +++ b/app/views/users/_join_course_course_message.html.erb @@ -5,7 +5,7 @@
  • - <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id), + <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content.include?('9') ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> @@ -18,7 +18,7 @@

    真实姓名:<%= User.find(ma.course_message_id).realname %>

    申请课程:<%= Course.find(ma.course_id).name%>

    课程描述:
    -
    <%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %>

    申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>

    +
    <%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %>

    申请职位:<%= ma.content.include?('9') ? "教师" : "教辅"%>

  • diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb index 9ef2d146d..994c5c64e 100644 --- a/app/views/users/_message_replies.html.erb +++ b/app/views/users/_message_replies.html.erb @@ -82,7 +82,7 @@ <%= link_to( l(:button_reply), - {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage}, + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage, :user_id => user_id}, :remote => true, :method => 'get', :title => l(:button_reply)) if !comment.root.locked? %> @@ -91,7 +91,7 @@ <% if comment.author == User.current %> <%= link_to( l(:button_delete), - {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage}, + {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage, :user_id => user_id}, :method => :delete, :remote => true, :class => 'fr mr20', diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index a4732af8c..1da4bc85e 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -76,6 +76,20 @@ :class => 'fr mr20', :title => l(:button_delete) ) if comment.user_id == User.current.id %> + <% elsif type == 'Syllabus' %> + + <%= link_to( + l(:button_reply), + {:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + <% if User.current.admin? || User.current == Syllabus.find(activity_id).user || comment.user == User.current%> + <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> + <% end %> <% end %>
    diff --git a/app/views/users/_reply_banner.html.erb b/app/views/users/_reply_banner.html.erb index 43aebb89c..4f2094899 100644 --- a/app/views/users/_reply_banner.html.erb +++ b/app/views/users/_reply_banner.html.erb @@ -1,4 +1,4 @@ -
    +
    diff --git a/app/views/users/_syllabus_course_list.html.erb b/app/views/users/_syllabus_course_list.html.erb new file mode 100644 index 000000000..993192978 --- /dev/null +++ b/app/views/users/_syllabus_course_list.html.erb @@ -0,0 +1,61 @@ +
    + <% if @type.to_i == 2 %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %> + <% else %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %> + <% end %> + <%= link_to "人气", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %> + <% if @type.to_i == 1 %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %> + <% else %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %> + <% end %> + <%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %> + <%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "加入"%>的课程 +
    +
    + +<% if syllabuses.any? %> + <% syllabuses.each_with_index do |syllabus, index|%> +
    + <% course_count = syllabus.courses.not_deleted.count %> +
    +
    + +

    <%=syllabus.title %>

    +
    +

    更新时间:<%=format_date syllabus.updated_at %> + 创建老师:<%=syllabus.user.show_name %> + 班级:<%=course_count %> +

    +
    +
    + +
    +
      + <% if index == 0 %> + <% courses = syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> + <%= render :partial => 'users/courses_list', :locals => {:courses => courses, :syllabus => syllabus}%> + <% end %> +
    +
    + +
    +
      +
    • +
        +
      • + <%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %> +
      • + <% if User.current == syllabus.user %> +
      • <%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%>
      • + <% end %> +
      +
    • +
    +
    +
    + <% end %> +<% else %> +

    <%= l(:label_no_data) %>

    +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index b6cd9ebc3..5361a37ad 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -50,7 +50,7 @@ <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0, :user_id => activity.author_id}%>
    <% end %> diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 669e7aa91..6051d8de9 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -70,7 +70,7 @@
    上传附件 - <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作品的附件", :remote => true %> + <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作业的附件", :remote => true %> <% if defined?(has_program) && has_program %>
    编程 diff --git a/app/views/users/_user_join_syllabus_list.html.erb b/app/views/users/_user_join_syllabus_list.html.erb new file mode 100644 index 000000000..7faab0017 --- /dev/null +++ b/app/views/users/_user_join_syllabus_list.html.erb @@ -0,0 +1,3 @@ +
    + <%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @join_syllabuses, :list_type => 2} %> +
    diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index 0a4924c27..3b6bf5bac 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -30,5 +30,22 @@ <% end %>
  • + <% elsif ma && ma.applied_type == "AppliedProject" %> + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index fa2be7ae1..98ed3d1dc 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -586,9 +586,9 @@
  • <%= link_to ma.status == 1 ? - '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过' + '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'申请已通过' : - '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)), + '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb index 9fa93c76e..b6c767771 100644 --- a/app/views/users/_user_syllabus_list.html.erb +++ b/app/views/users/_user_syllabus_list.html.erb @@ -1,132 +1,3 @@ -
    -

    课程列表

    -
    - 排序: - <%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fl", :remote => true %> - <% if @type.to_i == 1 %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %> - <% else %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fl", :remote => true %> - <% end %> - <%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fl", :remote => true %> - <% if @type.to_i == 2 %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %> - <% else %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fl", :remote => true %> - <% end %> -
    -
    - - <% if @syllabus.any? %> - <% @syllabus.each_with_index do |syllabus, index|%> -
    - <% end %> -
    -
      - <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> -
    -
    -
    - <% else %> -

    <%= l(:label_no_data) %>

    - <% end %> -
    - - \ No newline at end of file +
    + <%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @my_syllabuses, :list_type => 1} %> +
    \ No newline at end of file diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb index cc36ef3b3..a5fca2a60 100644 --- a/app/views/users/all_journals.js.erb +++ b/app/views/users/all_journals.js.erb @@ -5,11 +5,9 @@ $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :part <% elsif params[:type] == 'Message' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>'); <% elsif params[:type] == 'BlogComment' %> -$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>'); +$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage, :user_id => @user_id}) %>'); <% elsif params[:type] == 'OrgDocumentComment' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>'); -<% elsif params[:type] == 'News' || params[:type] == 'Issue' %> +<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>'); -<% else %> -$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>'); <% end %> diff --git a/app/views/users/expand_courses.js.erb b/app/views/users/expand_courses.js.erb new file mode 100644 index 000000000..3b2291e1d --- /dev/null +++ b/app/views/users/expand_courses.js.erb @@ -0,0 +1,5 @@ +<% unless @courses.empty? %> + $("#syllabus_course_ul_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/courses_list', :locals => {:courses => @courses, :syllabus => @syllabus}) %>"); + $("#syllabus_course_ul_<%=@syllabus.id %>").parent().show(); + $("#syllabus_course_ul_<%=@syllabus.id %>").parent().prev().children(":first-child").children(":first-child").toggleClass("icons_sy_close").toggleClass("icons_sy_open"); +<% end %> \ No newline at end of file diff --git a/app/views/users/sort_syllabus_list.js.erb b/app/views/users/sort_syllabus_list.js.erb new file mode 100644 index 000000000..e353109f4 --- /dev/null +++ b/app/views/users/sort_syllabus_list.js.erb @@ -0,0 +1,5 @@ +<% if @list_type.to_i == 1 %> +$("#user_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 1}) %>'); +<% else %> +$("#user_join_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 2}) %>'); +<% end %> \ No newline at end of file diff --git a/app/views/users/user_courselist.html.erb b/app/views/users/user_courselist.html.erb index 148cc1703..25bf2354d 100644 --- a/app/views/users/user_courselist.html.erb +++ b/app/views/users/user_courselist.html.erb @@ -1 +1,35 @@ -<%= render :partial => 'users/user_syllabus_list'%> +
    +

    课程列表

    + + <%= render :partial => 'users/user_syllabus_list'%> +
    + <%= render :partial => 'users/user_join_syllabus_list'%> +
    + + + \ No newline at end of file diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index c527474cd..00be899cc 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -1,6 +1,6 @@ <% if @journal_destroyed.nil? %> alert('<%=l(:notice_failed_delete)%>'); -<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%> +<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon','Syllabus'].include? @journal_destroyed.jour_type)%> <% if @is_user%> <% if @activity %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); @@ -18,12 +18,15 @@ <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); + <% elsif @syllabus %> + $("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>"); + $("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :user_activity_id => @syllabus.id, :activity_id => @syllabus.id}) %>"); <% elsif @course && @jours_count%> <% if @user_activity_id %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity"); <% else %> - $('#course_jour_count').html("(<%= @jours_count %>)"); + $('#course_jour_count').html("<%= @jours_count %>"); <% end %> <% elsif @user && @jours_count%> $('#jour_count').html("<%= @jours_count %>"); diff --git a/app/views/words/reply_to_syllabus.js.erb b/app/views/words/reply_to_syllabus.js.erb new file mode 100644 index 000000000..ece0843d4 --- /dev/null +++ b/app/views/words/reply_to_syllabus.js.erb @@ -0,0 +1,2 @@ +$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>"); +$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus'}) %>"); diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 076b905c3..91cc96791 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -48,6 +48,7 @@ zh: # 左边栏 # label_project_id: "项目ID:" + label_project_ivite_code: "邀请码:" label_agree_join_project: 同意加入 label_apply_project: "+申请加入" @@ -55,7 +56,7 @@ zh: label_exit_project: 退出项目 label_apply_project_waiting: 已处理申请,请等待管理员审核 label_member_of_project: 该用户已经是项目成员了! - label_unapply_project: 取消申请 + label_unapply_project: 等待审批 lable_sure_exit_project: 是否确认退出该项目 label_friend_organization: 圈子模式 label_research_group: 研讨模式 diff --git a/config/routes.rb b/config/routes.rb index 2cc2bd906..42b005e27 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -563,6 +563,7 @@ RedmineApp::Application.routes.draw do post "user_commit_homework" post 'user_select_homework' get 'all_journals' + get 'expand_courses' end member do @@ -619,6 +620,8 @@ RedmineApp::Application.routes.draw do match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist" match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist" + match 'sort_syllabus_list', :to => 'users#sort_syllabus_list', :via => :get, :as => "sort_syllabus_list" + get 'edit_brief_introduction' get "user_resource" get "import_resources" @@ -721,8 +724,9 @@ RedmineApp::Application.routes.draw do post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' - post 'appliedproject/applied', :to => 'applied_project#applied_join_project', :as => 'appliedproject' - delete 'appliedproject/applied', :to => 'applied_project#unapplied_join_project' + post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project' + post 'applied_project/applied_project_info', :to => 'applied_project#applied_project_info', :as => 'applied_project_info' + delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project' resources :projects do member do @@ -1155,9 +1159,12 @@ RedmineApp::Application.routes.draw do get "homework_search" get "show_comparecode" get "statistics_course" + get "switch_role" end collection do match 'join_private_courses', :via => [:get, :post] + post "join_course_multi_role" + end match '/member', :to => 'courses#member', :as => 'member', :via => :get @@ -1239,6 +1246,7 @@ RedmineApp::Application.routes.draw do post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message" post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message" post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework" + post 'words/:id/reply_to_syllabus', :to => 'words#reply_to_syllabus', :as => "reply_to_syllabus" post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' diff --git a/db/migrate/20160725062343_add_invite_code_to_project.rb b/db/migrate/20160725062343_add_invite_code_to_project.rb new file mode 100644 index 000000000..5eb8beace --- /dev/null +++ b/db/migrate/20160725062343_add_invite_code_to_project.rb @@ -0,0 +1,5 @@ +class AddInviteCodeToProject < ActiveRecord::Migration + def change + add_column :projects, :invite_code, :string + end +end diff --git a/db/migrate/20160727065357_add_column_to_member_role.rb b/db/migrate/20160727065357_add_column_to_member_role.rb new file mode 100644 index 000000000..861a32e27 --- /dev/null +++ b/db/migrate/20160727065357_add_column_to_member_role.rb @@ -0,0 +1,5 @@ +class AddColumnToMemberRole < ActiveRecord::Migration + def change + add_column :member_roles, :is_current, :integer, :default => 1 + end +end diff --git a/db/migrate/20160728041943_add_qrcode_to_project.rb b/db/migrate/20160728041943_add_qrcode_to_project.rb new file mode 100644 index 000000000..fea91e225 --- /dev/null +++ b/db/migrate/20160728041943_add_qrcode_to_project.rb @@ -0,0 +1,5 @@ +class AddQrcodeToProject < ActiveRecord::Migration + def change + add_column :projects, :qrcode, :string + end +end diff --git a/db/migrate/20160728075947_add_role_to_applied_project.rb b/db/migrate/20160728075947_add_role_to_applied_project.rb new file mode 100644 index 000000000..964af6f19 --- /dev/null +++ b/db/migrate/20160728075947_add_role_to_applied_project.rb @@ -0,0 +1,5 @@ +class AddRoleToAppliedProject < ActiveRecord::Migration + def change + add_column :applied_projects, :role, :integer, :default => 0 + end +end diff --git a/public/images/sy/icons_sy.png b/public/images/sy/icons_sy.png index 09cdd32cb..645dc4e35 100644 Binary files a/public/images/sy/icons_sy.png and b/public/images/sy/icons_sy.png differ diff --git a/public/images/sy/sy_icons_close02.png b/public/images/sy/sy_icons_close02.png new file mode 100644 index 000000000..456f2ea67 Binary files /dev/null and b/public/images/sy/sy_icons_close02.png differ diff --git a/public/images/syllabus/icons_syllabus.png b/public/images/syllabus/icons_syllabus.png index 7f6c4987c..4afdb729f 100644 Binary files a/public/images/syllabus/icons_syllabus.png and b/public/images/syllabus/icons_syllabus.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b7468366a..d2cd50d0e 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1492,6 +1492,24 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } } +// 公共弹框样式 +function pop_box_new(value, Width, Top, Left){ + $("#ajax-modal").html(value); + showModal('ajax-modal', Width + 'px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().css({"top": Top+"%","left": Left+"%","transform":"translate(-50%,-50%)","padding":"0","border":"none"}); + $('#ajax-modal').css({"padding":"0"}); +} + +// 公共提示弹框样式 +//function pop_box_tip_new(value, Width, Top, Left){ +// $("#ajax-modal").html(value); +// showModal('ajax-modal', Width + 'px'); +// $('#ajax-modal').siblings().remove(); +// $('#ajax-modal').parent().css({"top": Top+"%","left": Left+"%","transform":"translate(-50%,-50%)","padding":"0","border":"none"}); +// $('#ajax-modal').css({"padding":"0"}); +//} + //显示的时候根据当前网址是http 还是https 选择视频显示方式直接显示还是弹框 function autoMedia(id){ var rootPath = getRootPath(); diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index b72a8ef56..7db3c4370 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -51,6 +51,10 @@ a.btn_message_free{ background:#ff5722; display:block; text-align:center; color .break_word{word-break: break-all;word-wrap: break-word;} .break_word_firefox{white-space: pre-wrap !important;word-break: break-all;} +/*显隐*/ +.undis {display:none;} +.dis {display:inline-block;} + /* font & color */ h2{ font-size:18px;} /*color:#269ac9;*/ h3{ font-size:14px;}/* color:#e8770d;*/ @@ -520,7 +524,6 @@ a:hover.bgreen_n_btn{background:#08a384;} .upbtn{ margin:40px 0 0 15px; display:block; padding:2px 5px; border:1px solid #eaeaea;} .upbtn:hover{color:#64bdd9;cursor: pointer;} .upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer} -.undis{display:none;} .red_btn_cir{ background:#e74c3c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} .green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} .green_homework_btn_cir{ background:#28be6c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} @@ -542,6 +545,38 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .borderRadius {border-radius:5px;} a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.Blue-btn{ background:#3598db; color:#fff;} + +/*20160725 项目申请按钮*/ +a.sy_btn_grey{ + display:inline-block; + color: #333; + background: #e1e1e1; + text-align: center; + font-size: 12px; + padding:0 15px; + height: 30px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.sy_btn_grey{ background: #c3c3c3;} +a.sy_btn_blue{ + display:inline-block; + color: #fff; + background: #3b94d6; + text-align: center; + font-size: 12px; + padding:0 15px; + height: 30px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.sy_btn_blue{ background: #2788d0;} /* commonpic */ .pic_date{ display:block; background:url(/images/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; } .pic_add{ display:block; background:url(/images/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; } diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index ccf161725..7a1a0dabb 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -54,8 +54,6 @@ a:hover.UsersApBtn{border:1px solid #888888; } /* 代码查重弹框 */ a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.Blue-btn{ background:#3598db; color:#fff;} -.fl{ float:left;} -.fr{ float:right;} .blue-border-box{ width:500px; padding:20px; margin:0 auto; background:#fff;} .box-con h4{ font-size:14px; font-weight: bold; width:450px; text-align:center;} .box-con{ width:450px; margin:0 auto; text-align:center;} @@ -138,10 +136,6 @@ span.author { font-size: 0.9em; color: #888; } .ReplyToMessageInputContainer {width: 582px;float: left;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} -/*课程列表界面样式*/ -a.course-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:590px;} -a:hover.course-title{ color:#269ac9;} - /*我的课程*/ .courses_top{ height:27px; border-bottom:3px solid #ebebeb;} .courses_h2{ font-size:16px; font-weight:bold; color:#64bddb; border-bottom:3px solid #64bddb; padding-bottom:3px; padding-right:3px;} diff --git a/public/stylesheets/css/org.css b/public/stylesheets/css/org.css index 028254e04..3677c8bd8 100644 --- a/public/stylesheets/css/org.css +++ b/public/stylesheets/css/org.css @@ -27,8 +27,6 @@ a.saveBtn:hover {background-color:#297fb8;} .orgMemContainer {width:268px;} .orgMemberAdd {float:right;} .orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;} -.undis {display:none;} -.dis {display:inline-block;} a.org_member_btn{ padding:1px 5px; background:#15bccf; color:#fff;} diff --git a/public/stylesheets/css/popup.css b/public/stylesheets/css/popup.css index ea2034a5e..2aa4ae3be 100644 --- a/public/stylesheets/css/popup.css +++ b/public/stylesheets/css/popup.css @@ -332,4 +332,97 @@ a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: no .relatePWrap{max-height: 210px;overflow:hidden;} /*20160622代码分析弹窗*/ -.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} \ No newline at end of file +.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} + +/*公共弹框*/ +/* 按钮*/ + + + + + +/* 加入班级弹窗 */ +#sy_popup_box{ + width:460px; + background:#fff; + padding-bottom:30px; + -webkit-border-radius:5px; + -moz-border-radius:5px; + -o-border-radius:5px; + border-radius:5px; + box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); +} +.sy_popup_top{ + background:#3b94d6; + height:40px; + -webkit-border-radius: 5px 5px 0px 0px; + -moz-border-radius: 5px 5px 0px 0px; + -o-border-radius: 5px 5px 0px 0px; + border-radius: 5px 5px 0px 0px; +} +.sy_popup_top h3{ + font-size:18px; + color:#fff; + font-weight:normal; + line-height:40px; + padding-left:10px; +} +a.sy_icons_close{ + width:20px; + height:20px; + display:block; + background: url(/images/sy/sy_icons_close.png) 0 0px no-repeat; + margin:8px 10px 0 0; +} +a:hover.sy_icons_close{ + background: url(/images/sy/sy_icons_close.png) -40px 0px no-repeat; +} +.sy_popup_con{ + margin:30px auto 0; + font-size:14px; + width:330px; +} +.sy_popup_add label{ + display:block; + float:left; + width:85px; + text-align:right; + line-height:40px; +} +.sy_popup_add li{ + line-height:40px; +} +.sy_input_txt{ + border:1px solid #dedede; + height:36px; + background:#fff; + padding:0 5px; + width:220px; +} +.sy_popup_con02{ + margin:30px auto 0; + font-size:14px; + text-align:center; + width:360px; +} +.sy_popup_con02 ul li p{ + margin-bottom:15px; + text-align:center; + font-size:14px; + color:#616161; +} +.sy_popup_con02 a{ margin:0 auto;} +.sy_popup_top_tishi{ background:#ededed; } +.sy_popup_top_tishi h3{color:#616161; font-size:16px;} +a.sy_icons_close02{ + width:20px; + height:20px; + display:block; + background: url(/images/sy/sy_icons_close02.png) 0 0px no-repeat; + margin:8px 10px 0 0; + border: none; + outline: none; +} +a:hover.sy_icons_close02{ + background: url(/images/sy/sy_icons_close02.png) -40px 0px no-repeat; +} \ No newline at end of file diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 82e27aa1f..cc27955d5 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -471,8 +471,6 @@ a:hover.AnnexBtn{background: url(../images/homepage_icon2.png) -90px -343px no-r a.postRouteLink {font-weight:bold; color:#484848;} a.postRouteLink:hover {text-decoration:underline;} -.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;} -.homepagePostSetting ul li:hover ul {display:block;} .resourceSendO {width:65px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-48px; top:20px; padding:2px 0px; display:none;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} @@ -499,7 +497,6 @@ ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;} .wlist_select a{background-color: #64bdd9;cursor: default;} /*博客列表界面样式*/ -a{text-decoration:none} .listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } /*.bloglistbox{ min-height:690px;}*/ .list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;} @@ -517,12 +514,24 @@ a:hover.list-title{ color:#269ac9;} .list-file{ padding:10px 0; border-bottom:1px dashed #ddd;} .list-file li{ line-height:1.9;} .list-info span{ margin-left:5px;} -.pages a{ display:block; border:1px solid #d1d1d1; color:#000; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; } -.pages a:hover{ background-color:#269ac9; color:#fff;} + /*20160727大纲新增样式*/ +.list_title{padding:10px 0; border-bottom:1px solid #ddd;} +.sortTxt{ color:#000;} +.sortTxt:hover{ color:#28be6c;} +a.sort_no{ background: url(/images/syllabus/icons_syllabus.png) -16px -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } +a.list-title{ font-size:14px; font-weight: bold; color:#000; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block;} + +/*翻页*/ +.pages a{ display:block; border:1px solid #d1d1d1; color:#888; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; } +.pages a:hover{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} a.pages-big{ width:50px;} -.pages .active{ background-color:#269ac9; color:#fff;} +.pages .active{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} .pages{width:330px; margin:20px auto 10px;} +/*课程列表界面样式*/ +a.course-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:590px;} +a:hover.course-title{ color:#269ac9;} + /*视频播放默认图标*/ .mediaIco{margin: 30px 0 30px 20px;width: 200px;} a.st_img { display:block;width:32px; height:32px; border:1px solid #CCC; padding:1px;} @@ -543,8 +552,6 @@ a:hover.st_img { border:1px solid #1c9ec7; } .searchCourseImage {width:75px; margin-right:10px;} .searchContentDes {width:883px;} .searchTag {font-size:12px; color:#ffffff; background-color:#7ec8e4; height:16px; min-height:16px; max-height:16px; float:left; line-height:16px; padding:0px 3px;} -.undis {display:none;} -.dis {display:inline-block;} .numRed {color:#FF6600;} .pageRoll {float:right; border-left:1px solid #dddddd; margin-top:15px;} .pageCell {border:1px solid #dddddd; padding:5px 12px; float:left; margin-left:-1px; position:relative;} @@ -938,10 +945,10 @@ a:hover.member_btn{ background:#329cbd;} .search_form_course{margin-top:8px;margin-left:8px;} /*信息*/ -.project_info{ background:#fff; padding:10px; padding-right:0px;width:222px; padding-right:8px; margin-bottom:10px;} +.project_info{ background:#fff; padding:10px 8px; width:224px; margin-bottom:10px;} .pr_info_id{ width:137px; color:#5a5a5a; font-size:14px; margin-top:5px;} .pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;} -.pr_info_logo:hover{ border:1px solid #64bdd9; } +.pr_info_logo:hover{ border:1px solid #297fb8; } .pr_info_join{} a.pr_join_a{ color:#fff; display:block; padding:0 5px 0 3px; padding-top:2px; height:20px; margin-right:5px; float:left; text-align:center; background-color:#269ac9; float:left; } a.pr_join_a_quit{ color:#fff; display:block; padding:0 2px 0 3px; padding-top:2px; height:20px; margin-right:5px; float:left; text-align:center; background-color:#269ac9; float:left; } @@ -977,6 +984,8 @@ a:hover.pr_join_a{ background:#298fbd;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} /****标签(和资源库的tag样式一致)***/ .project_Label{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px;} +/*.project_Label{ width:218px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px; border:1px solid #dddddd;}*/ +.project_Label_New {width:218px; padding-left:10px; background:#fff; margin-top:15px; margin-bottom:10px;} a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} .submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } .isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index be8bbc65b..fa55e1282 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -103,8 +103,11 @@ div#menu ul ul ul li a{ width:185px; overflow:hidden; white-space: nowrap; text- .homepageNewsPubTypeHomework {width:270px; font-size:12px; color:#888888; display: block; white-space:nowrap;} .homepageNewsContent {width:355px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageSystenMessageContent {width:281px; max-width:291px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden;text-overflow:ellipsis;max-height: 49px; } + .homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageHomeworkContent {width:235px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContentWarn2 {width:60px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContent2 {width:285px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;} .loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;} @@ -239,9 +242,9 @@ a.postReplyCancel:hover {color:#ffffff;} .whiteSettingIcon {background:url(/images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} .whiteSettingIcon:hover {background:url(/images/homepage_icon.png) -93px -44px no-repeat;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;} -a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} +a.postOptionLink:hover {color:#ffffff; background-color:#3b94d6;} a.postOptionLink2 {color:#616060; display:block; width:35px; padding:0px 15px;} -a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} +a.postOptionLink2:hover {color:#ffffff; background-color:#3b94d6;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} .homepagePostReplyDes {float:left; width:642px; margin-left:15px;} @@ -337,7 +340,6 @@ a.projectsLineGrey:hover {color:#ffffff;} a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} a.homepageMenuControl {float:left; width:180px;} .homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;} -.project_Label_New {width:218px; padding-left:10px; background:#fff; margin-top:15px; margin-bottom:10px;} .homepageLabelText {color:#484848; font-size:16px; margin-left:10px; margin-bottom:12px; display:block;} .homepageRightBanner {width:718px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px; border:1px solid #dddddd;} .homepageRightBannerImg{width:1000px; margin:0px auto; height: 60px; margin-top: 10px; background:url(/images/TeachersDay.jpg)} diff --git a/public/stylesheets/sy_public.css b/public/stylesheets/sy_public.css index 7c79bf6e6..f52fc6699 100644 --- a/public/stylesheets/sy_public.css +++ b/public/stylesheets/sy_public.css @@ -15,6 +15,7 @@ a.sy_cmore{ font-size:12px; color:#888; font-weight:normal;} a:hover.sy_cmore{color: #ee4a1f;} /* 按钮*/ a.btn_orange_big{ + display:inline-block; border: 1px solid #ee4a1f; color: #ee4a1f; text-align: center; @@ -32,6 +33,7 @@ a:hover.btn_orange_big{ color: #fff; } a.btn_green_big{ + display:inline-block; border: 1px solid #60b25e; color: #60b25e; text-align: center; @@ -49,6 +51,7 @@ a:hover.btn_green_big{ color: #fff; } a.sy_btn_green{ + display:inline-block; color: #fff; background: #60b25e; text-align: center; @@ -62,34 +65,35 @@ a.sy_btn_green{ border-radius:3px; } a:hover.sy_btn_green{ background: #51a74f;} -a.sy_btn_grey{ - color: #333; - background: #e1e1e1; - text-align: center; - font-size: 12px; - padding:0 15px; - height: 30px; - line-height: 30px; - -webkit-border-radius:3px; - -moz-border-radius:3px; - -o-border-radius:3px; - border-radius:3px; -} -a:hover.sy_btn_grey{ background: #c3c3c3;} -a.sy_btn_blue{ - color: #fff; - background: #3b94d6; - text-align: center; - font-size: 12px; - padding:0 15px; - height: 30px; - line-height: 30px; - -webkit-border-radius:3px; - -moz-border-radius:3px; - -o-border-radius:3px; - border-radius:3px; -} -a:hover.sy_btn_blue{ background: #2788d0;} + +/*a.sy_btn_grey{*/ + /*color: #333;*/ + /*background: #e1e1e1;*/ + /*text-align: center;*/ + /*font-size: 12px;*/ + /*padding:0 15px;*/ + /*height: 30px;*/ + /*line-height: 30px;*/ + /*-webkit-border-radius:3px;*/ + /*-moz-border-radius:3px;*/ + /*-o-border-radius:3px;*/ + /*border-radius:3px;*/ +/*}*/ +/*a:hover.sy_btn_grey{ background: #c3c3c3;}*/ +/*a.sy_btn_blue{*/ + /*color: #fff;*/ + /*background: #3b94d6;*/ + /*text-align: center;*/ + /*font-size: 12px;*/ + /*padding:0 15px;*/ + /*height: 30px;*/ + /*line-height: 30px;*/ + /*-webkit-border-radius:3px;*/ + /*-moz-border-radius:3px;*/ + /*-o-border-radius:3px;*/ + /*border-radius:3px;*/ +/*}*/ +/*a:hover.sy_btn_blue{ background: #2788d0;}*/ /* 排序 */ .sy_category{ height: 50px; @@ -98,51 +102,7 @@ a:hover.sy_btn_blue{ background: #2788d0;} border-bottom:1px solid #ddd; } .sy_category span{ float: left;} -a.sortupbtn{ - background: url(../images/sy/liststyle.png) 0 3px no-repeat; - width:12px; - height:17px; - display:block; - margin-right:10px; - cursor:pointer; -} -a.sortdownbtn{ - background: url(../images/sy/liststyle.png) 0 -12px no-repeat; - width:12px; - height:17px; - display:block; - cursor:pointer; -} -/* 翻页 */ -.pages a{ - display:block; - border:1px solid #d1d1d1; - color:#888; - float:left; - width:30px; - text-align:center; - padding:3px 0; - line-height:1.9; - margin-right:5px; -} -.pages a:hover{ - background-color:#3b94d6; - border:1px solid #3b94d6; - color:#fff; -} -a.pages-big{ - width:50px; -} -.pages .active{ - background-color:#3b94d6; - border:1px solid #3b94d6; - color:#fff; -} -.pages{ - width:330px; - margin:20px auto 10px; -} /* 输入框 */ .sy_right_box input,.sy_right_box select{ border:1px solid #ccc; diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 3b856ad67..dad467c68 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -1,19 +1,3 @@ -/****标签(和资源库的tag样式一致)***/ -.project_Label{ width:218px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px; border:1px solid #dddddd;} -.project_Label_New {width:218px; padding-left:10px; background:#fff; margin-top:15px; margin-bottom:10px;} -a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} -.submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } -.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} -.re_tag{ width: auto; padding:0 5px; padding-top:2px; border:1px solid #f8df8c; background:#fffce6; margin-right:5px; } -.re_tag a{ color:#0d90c3;} -.tag_h{ } -.tag_h span,.tag_h a{ margin-bottom:5px;} -/*信息*/ -.project_info{ background:#fff; padding:10px 8px; width:222px; margin-bottom:10px; border:1px solid #dddddd;} -.pr_info_id{ width:130px; color:#5a5a5a; font-size:14px; margin-top:5px;} -.pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;} -.pr_info_logo:hover{ border:1px solid #297fb8; } - /*课程大纲*/ input.syllabus_input{ border:none; @@ -110,38 +94,9 @@ input.syllabus_input_min{ .syllabus_class_list_more{padding:8px; text-align:center;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;} .syllabus_class_list_more:hover{ background:#ececec;} .syllabus_class_list_more a{ color:#ff7e00;} -.syllabus_class_title{ font-size:14px; color:#333; width:500px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .syllabus_class_w{ width:650px;} -.dis {display:block;} -.undis {display:none;} -/*班级列表界面(用的博客列表的样式)*/ -.listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } -.bloglistbox{ min-height:690px;} -.list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;} -.category2{ } -.list_title{padding:10px 0; border-bottom:1px solid #ddd;} -.category2 a,.category2 span{ float:left; margin-right:5px;} -.grayTxt{ color:#9093a6;} -.sortTxt{ color:#000;} -.sortTxt:hover{ color:#28be6c;} -a.sortupbtn{ background: url(../images/syllabus/icons_syllabus.png) 0 3px no-repeat; width:12px; height:17px; display:block; margin-right:10px; cursor:pointer;} -a.sortdownbtn{ background: url(../images/syllabus/icons_syllabus.png) 0 -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } -a.sort_no{ background: url(../images/syllabus/icons_syllabus.png) -16px -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } -.item_list{ display:block; width:5px; height:5px;-webkit-border-radius: 25px;border-radius:25px; background-color:#adadad; margin:10px 10px 0 0;} -a.list-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block;} -a:hover.list-title{ color:#269ac9;} -.c_red{ font-weight:normal; font-size:12px;} -.list-file{ padding:10px 0; border-bottom:1px dashed #ddd;} -.list-file li{ line-height:1.9;} -.list-info span{ margin-left:5px;} -.pages a{ display:block; border:1px solid #d1d1d1; color:#888; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; } -.pages a:hover{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} -a.pages-big{ width:50px;} -.pages .active{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} -.pages{width:330px; margin:20px auto 10px;} -a.course-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:590px;} -a:hover.course-title{ color:#269ac9;} /*新建页面*/ .name_input{ border:1px solid #64bdd9; height:16px; width:310px; background:#fff; margin-bottom:10px; padding:5px;} @@ -208,12 +163,6 @@ a:hover.course-title{ color:#269ac9;} .sy_tab_nomal { border-bottom:none; } -.undis { - display:none; -} -.dis { - display:block; -} /* 课程大纲 */ .icons_tishi{ width: 110px; @@ -324,22 +273,22 @@ a:hover.sy_teachers_name{ border:1px solid #e5e5e5; position: relative; } -.homepagePostSetting { +.sy_class_setting { position:absolute; width:20px; height:20px; right:10px; top:10px; } -.homepagePostSetting ul li:hover ul { +.sy_class_setting ul li:hover ul { display:block; } -.homepagePostSettingIcon { - background:url(../images/sy/icons_sy.png) 1px -408px no-repeat; +.sy_class_setting_icon { + background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px; } -.homepagePostSettiongText { +.sy_class_setting_text { width:75px; text-align: center; line-height:2; @@ -355,16 +304,16 @@ a:hover.sy_teachers_name{ display:none; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); } -.homepagePostSettingIcon:hover { - background:url(../images/sy/icons_sy.png) -28px -408px no-repeat; +.sy_class_setting_icon:hover { + background:url(../images/homepage_icon.png) -93px -44px no-repeat; } -a.postOptionLink { +a.sy_class_option { color:#616060; display:block; width:55px; padding:0px 10px; } -a.postOptionLink:hover { +a.sy_class_option:hover { color:#fff; background-color:#3b94d6; } @@ -403,6 +352,27 @@ a.postOptionLink:hover { padding-left:10px; line-height: 22px; } +.hw_icon_private{ + display:block; + width:30px; + height:22px; + background:url(../images/sy/icons_sy.png) 0 -458px no-repeat; + color:#fff; + font-size:12px; + padding-left:10px; + line-height: 22px; +} +.hw_icon_open{ + display:block; + width:30px; + height:22px; + background:url(../images/sy/icons_sy.png) 0 -436px no-repeat; + color:#fff; + font-size:12px; + padding-left:10px; + line-height: 22px; +} + .sy_class_titbox{margin-bottom:5px; padding-top:10px; } a.sy_btn_orange{ display:block;