diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 25e731754..456306c64 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -34,6 +34,12 @@ class AtController < ApplicationController find_homework(id) when 'Topic' find_topic(id) + when 'JournalsForMessage' + find_journals_for_message(id) + when 'Principal' + find_principal(id) + when 'All' + nil else nil end @@ -120,7 +126,11 @@ class AtController < ApplicationController #JournalsForMessage def find_journals_for_message(id) jounrnal = JournalsForMessage.find(id) - find_at_users(jounrnal.jour_type, jounrnal.jour_id) + if jounrnal.jour_type == 'Principal' + [jounrnal.user] + (JournalsForMessage.where(m_reply_id: id).map(&:user) || []) + else + find_at_users(jounrnal.jour_type, jounrnal.jour_id) + end end #Poll @@ -129,8 +139,6 @@ class AtController < ApplicationController #Journal def find_journal(id) - journal = Journal.find(id) - find_at_users(journal.journalized_type, journal.journalized_id) end #Document @@ -145,7 +153,6 @@ class AtController < ApplicationController #Principal def find_principal(id) - end #BlogComment diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 87bbcb2f3..f5e3314bb 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -55,8 +55,8 @@ class BlogCommentsController < ApplicationController if params[:in_act] redirect_to user_path(params[:user_id]) else - if params[:is_homepage] - redirect_to user_blogs_path(params[:user_id]) + if @article.id.eql?(User.find(params[:user_id]).blog.homepage_id) + redirect_to user_path(params[:user_id]) else redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 43a49c7d9..97dacb178 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -321,11 +321,12 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") + @homeworks = @course.homework_commons.order("created_at desc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; respond_to do |format| format.xls { - send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", + send_data(member_to_xls(@homeworks,@course,@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition("#{filename}.xls")) } end @@ -441,7 +442,10 @@ class CoursesController < ApplicationController @course = cs.create_course(params,User.current)[:course] if params[:copy_course] copy_course = Course.find params[:copy_course].to_i - @course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource) + @course.is_copy = 1 + @course.open_student = copy_course.open_student + @course.publish_resource = copy_course.publish_resource + @course.save if params[:checkAll] attachments = copy_course.attachments attachments.each do |attachment| @@ -903,6 +907,17 @@ class CoursesController < ApplicationController return 404 end end + #搜索作业 + def homework_search + @search = "%#{params[:search].strip.downcase}%" + @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + @page = params[:page] ? params[:page].to_i + 1 : 0 + if @is_teacher + @homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end + end private def update_quotes attachment @@ -960,7 +975,7 @@ class CoursesController < ApplicationController sql_select = "" if groupid == 0 sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -972,7 +987,7 @@ class CoursesController < ApplicationController WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" else sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -1006,16 +1021,54 @@ class CoursesController < ApplicationController end - def member_to_xls members,groups + def member_to_xls homeworks, course, members,groups xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "student" - blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 - sheet1.row(0).default_format = blue + #sheet1.row(0).default_format = blue + #sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)]) + sheet1[0,0] = "课程编号" + sheet1[0,1] = course.id + sheet1[1,0] = "课程学期" + sheet1[1,1] = course.time.to_s+"年"+course.term + sheet1[2,0] = "课程名称" + sheet1[2,1] = course.name + sheet1[3,0] = "教师团队" + sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') + sheet1[4,0] = "主讲教师" + sheet1[4,1] = course.teacher.show_name + sheet1[5,0] = "排名" + sheet1[5,1] = "学生姓名" + sheet1[5,2] = "昵称" + sheet1[5,3] = "学号" + for i in 0 ... homeworks.count + sheet1[5,i+4] = "第"+(i+1).to_s+"次" + end + sheet1[5,homeworks.count+4] = "总成绩" + sheet1[5,0] = "排名" + sheet1[5,0] = "排名" + count_row = 6 + members.each_with_index do |member, i| + sheet1[count_row,0]= i+1 + sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s + sheet1[count_row,2] = member.user.login + sheet1[count_row,3] = member.user.user_extensions.student_id + homeworks.each_with_index do |homework, j| + student_works = homework.student_works.where("user_id = #{member.user.id}") + if student_works.empty? + sheet1[count_row,j+4] = format("%0.2f",0) + else + final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score + score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty + sheet1[count_row,j+4] = format("%0.2f",score <0 ? 0:score) + end + end + sheet1[count_row,homeworks.count+4] = format("%0.2f",member.score.nil? ? 0:member.score.to_s) + count_row += 1 + end - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_score)]) - count_row = 1 +=begin group0 = CourseGroup.new(); group0.id = 0; group0.name = l(:excel_member_with_out_class) @@ -1037,6 +1090,7 @@ class CoursesController < ApplicationController end end end +=end book.write xls_report xls_report.string end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d345fba5f..398b385a4 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -15,8 +15,12 @@ class HomeworkCommonController < ApplicationController @new_homework.homework_detail_manual = HomeworkDetailManual.new @new_homework.course = @course @page = params[:page] ? params[:page].to_i + 1 : 0 - @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + if @is_teacher + @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_new = params[:is_new] diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index d051a91f7..bae0232a5 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -109,7 +109,8 @@ class OrgSubfieldsController < ApplicationController if SubfieldSubdomainDir.find_by_sql(sql).count == 0 if @org_subfield.subfield_subdomain_dir @sub_dir = @org_subfield.subfield_subdomain_dir - @sub_dir.update_attribute(:name, params[:sub_dir_name]) + @sub_dir = SubfieldSubdomainDir.update(@sub_dir.id, :name => params[:sub_dir_name]) + #@sub_dir.update_attribute(:name, params[:sub_dir_name]) else @sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name]) end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 85fc42f66..6e2da311f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -302,7 +302,7 @@ class OrganizationsController < ApplicationController def org_resources_subfield @org = Organization.find(params[:id]) - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @subfield = @org.org_subfields.where("field_type = 'Post'") else @subfield = @org.org_subfields.where('field_type = "Resource" ') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b155e9f90..22b58fe49 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -403,8 +403,47 @@ class UsersController < ApplicationController #导入作业 def user_import_homeworks + @user = User.current @select_course = params[:select_course] ? 1 : 0 - @user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") + @type = params[:type] + @limit = 15 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,15 + respond_to do |format| + format.js + end + end + + def user_homework_type + @user = User.current + if(params[:type].blank? || params[:type] == "1") #公共题库 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") + elsif params[:type] == "2" #我的题库 + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") + end + @type = params[:type] + @limit = 15 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,15 + respond_to do |format| + format.js + end + end + + def show_homework_detail + @homework = HomeworkCommon.find params[:homework].to_i respond_to do |format| format.js end @@ -412,7 +451,22 @@ class UsersController < ApplicationController #用户主页过滤作业 def user_search_homeworks - @user_homeworks = HomeworkCommon.where("user_id = '#{@user.id}' and lower(name) like '%#{params[:name].to_s.downcase}%'").order("created_at desc") + @user = User.current + search = params[:name].to_s.strip.downcase + if(params[:type].blank? || params[:type] == "1") #全部 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'} and (name like '%#{search}%')").order("created_at desc") + elsif params[:type] == "2" #课程资源 + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") + end + @type = params[:type] + @limit = 15 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,15 respond_to do |format| format.js end @@ -426,6 +480,7 @@ class UsersController < ApplicationController @homework = HomeworkCommon.new @select_course = params[:select_course] || 0 if homework + @ref_homework = homework @homework.name = homework.name @homework.description = homework.description @homework.end_time = homework.end_time @@ -583,13 +638,15 @@ class UsersController < ApplicationController homework_detail_manual.save if homework_detail_manual homework_detail_programing.save if homework_detail_programing homework_detail_group.save if homework_detail_group - + if params[:quotes] && !params[:quotes].blank? + homework = HomeworkCommon.find params[:quotes].to_i + homework.update_attribute(:quotes, homework.quotes+1) + end if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => homework.course_id) else redirect_to user_homeworks_user_path(User.current.id) end - end end else @@ -755,23 +812,17 @@ class UsersController < ApplicationController if params[:type].present? case params[:type] when "public" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC') when "private" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC') else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) @@ -1633,6 +1684,10 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, + Project.find(project_id).project_score.attach_num + 1) + end end end elsif params[:send_ids].present? @@ -1668,6 +1723,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end end @@ -1796,16 +1854,6 @@ class UsersController < ApplicationController def share_news_to_project news = News.find(params[:send_id]) project_ids = params[:project_ids] - # project_ids.each do |project_id| - # if Project.find(project_id).news.map(&:id).exclude?(news.id) - # project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now) - # news.attachments.each do |attach| - # project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, - # :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, - # :is_public => attach.is_public, :quotes => 0) - # end - # end - # end project_ids.each do |project_id| project = Project.find(project_id) if project.news.map(&:id).exclude?(news.id) @@ -1831,6 +1879,53 @@ class UsersController < ApplicationController OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id) end + def share_message_to_course + @message = Message.find(params[:send_id]) + course_ids = params[:course_ids] + course_ids.each do |course_id| + course = Course.find(course_id) + if course.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_project + @message = Message.find(params[:send_id]) + project_ids = params[:project_ids] + project_ids.each do |project_id| + project = Project.find(project_id) + if project.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_org + field_id = params[:subfield] + @message = Message.find(params[:send_id]) + @message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1) + @message.save + board = OrgSubfield.find(field_id).boards.first + mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id) + end + def change_org_subfield end @@ -2072,9 +2167,9 @@ class UsersController < ApplicationController end elsif params[:type] == "4" #附件 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc") end elsif params[:type] == "5" #用户资源 if User.current.id.to_i == params[:id].to_i @@ -2180,7 +2275,7 @@ class UsersController < ApplicationController @user = User.current if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} else @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index d24427a9d..351be4e64 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -62,6 +62,7 @@ class WordsController < ApplicationController update_forge_activity('JournalsForMessage',parent_id) update_org_activity('JournalsForMessage',parent_id) update_principal_activity('JournalsForMessage',parent_id) + (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) end respond_to do |format| # format.html { @@ -73,7 +74,6 @@ class WordsController < ApplicationController # render 'test/index' # } format.js { - @reply_type = params[:reply_type] @user_activity_id = params[:user_activity_id] @activity = JournalsForMessage.find(parent_id) @is_activity = params[:is_activity] @@ -95,6 +95,9 @@ class WordsController < ApplicationController @user = User.find(@journal_destroyed.jour_id) @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count @is_user = true + @user_activity_id = params[:user_activity_id] if params[:user_activity_id] + @is_activity = params[:is_activity].to_i if params[:is_activity] + @activity = @journal_destroyed.parent if @journal_destroyed.parent elsif @journal_destroyed.jour_type == 'HomeworkCommon' @homework = HomeworkCommon.find @journal_destroyed.jour_id if params[:user_activity_id] diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4e90fc106..1e4cedf14 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -697,17 +697,16 @@ module CoursesHelper def join_in_course_header(course, user, options=[]) if user.logged? joined = course.members.map{|member| member.user_id}.include? user.id - text = joined ? ("".html_safe + l(:label_course_exit_student)) : ("".html_safe + l(:label_course_join_student)) + 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) method = joined ? 'delete' : 'post' if joined - link = "#{l(:label_course_join_student)}" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) + link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) else - link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "#{l(:label_course_exit_student)}".html_safe + link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") end else - link = "#{l(:label_course_join_student)}" + - "#{l(:label_course_exit_student)}" + link = "#{l(:label_course_join_student)}" end link.html_safe end @@ -796,7 +795,7 @@ module CoursesHelper # 学生按作业总分排序,取前8个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{course.id} diff --git a/app/models/at_message.rb b/app/models/at_message.rb index 3d20ffafb..bca2c7ba4 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -47,7 +47,11 @@ class AtMessage < ActiveRecord::Base "回复帖子: " end + at_message.subject when 'JournalsForMessage' - "作业: #{at_message.jour.name} 中留言" + if at_message.jour_type == 'Principal' + "留言: 在#{at_message.at_user.show_name}主页中留言" + else + "作业: #{at_message.jour.name} 中留言" + end else logger.error "error type: #{at_message_type}" end @@ -92,7 +96,12 @@ class AtMessage < ActiveRecord::Base when 'Message' {controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board} when 'JournalsForMessage' - {controller: :homework_common, action: :index, course: at_message.jour.course_id} + if at_message.jour_type == 'Principal' + {controller: :users, action: :user_messages, id: at_message.at_user} + else + {controller: :homework_common, action: :index, course: at_message.jour.course_id} + end + else logger.error "error type: #{at_message_type}" end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 9e0ce2dd2..cdcf9d19e 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :reset_counters! - after_update :update_ativity + #after_update :update_activity after_destroy :reset_counters! after_save :be_user_score after_destroy :down_user_score diff --git a/app/models/subfield_subdomain_dir.rb b/app/models/subfield_subdomain_dir.rb index 9897e19ac..2ec93fe05 100644 --- a/app/models/subfield_subdomain_dir.rb +++ b/app/models/subfield_subdomain_dir.rb @@ -1,4 +1,5 @@ class SubfieldSubdomainDir < ActiveRecord::Base # attr_accessible :title, :body belongs_to :org_subfield + validates_exclusion_of :name, :in => %w(setting members org_document_comments) end diff --git a/app/views/courses/_user_homework_search_list.html.erb b/app/views/courses/_user_homework_search_list.html.erb new file mode 100644 index 000000000..585d8761a --- /dev/null +++ b/app/views/courses/_user_homework_search_list.html.erb @@ -0,0 +1,46 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> +<% end %> + + +
+ <% homework_commons.each do |homework_common|%> + + <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %> + <% end%> + <% if homework_commons.count == 10%> + <%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> + <% end%> +
\ No newline at end of file diff --git a/app/views/courses/homework_search.js.erb b/app/views/courses/homework_search.js.erb new file mode 100644 index 000000000..3c644ad9e --- /dev/null +++ b/app/views/courses/homework_search.js.erb @@ -0,0 +1,5 @@ +<% if @page == 0 %> + $("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% else %> + $("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% end %> \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 8cb547b13..d4d12232e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -185,20 +185,6 @@ } - - function org_id_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - $(".orgDirection").text(orgDirection + sendText); - } - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - - function course_attachmenttypes_change(id, type) { <% if @course%> $.ajax({ diff --git a/app/views/homework_common/_homework_search_form.html.erb b/app/views/homework_common/_homework_search_form.html.erb new file mode 100644 index 000000000..aa3eef59e --- /dev/null +++ b/app/views/homework_common/_homework_search_form.html.erb @@ -0,0 +1,6 @@ +<%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id), + :remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> + + <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> + +<% end %> \ No newline at end of file diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index bc960154e..5c91a37fc 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -36,6 +36,9 @@
作业
+
+ <%= render :partial => 'homework_search_form',:locals => {:course=>@course} %> +
@@ -50,8 +53,8 @@ <% end%>
<% end%> - <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %> +
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 48cd4ab53..2fa627c73 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -5,7 +5,7 @@
-
<%= @course.is_public == 0 ? "私有课程" : "公开课程" %> +
ID:<%= @course.id%><%= @course.is_public == 0 ? "(私有)" : "(公开)" %> <% if is_excellent_course(@course) %> 精品课程 <% end %>
-ID:<%= @course.id%> + <% unless is_teacher %> + +
<%= join_in_course_header(@course, User.current) %>
+ <% end %>
@@ -204,4 +205,4 @@ postContent = postContent.replace(/ /g," "); $("#message_description_<%= @topic.id %>").html(postContent); }); - \ No newline at end of file + diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 187e1670e..a0e9db171 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -115,7 +115,7 @@ ) if @message.destroyable_by?(User.current) %> <% end %> -
  • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
  • diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb index 82203b4de..7d3a2b969 100644 --- a/app/views/org_subfields/show.html.erb +++ b/app/views/org_subfields/show.html.erb @@ -178,20 +178,6 @@ } - - function org_id_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - $(".orgDirection").text(orgDirection + sendText); - } - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - - function course_attachmenttypes_change(id, type) { <% if @course%> $.ajax({ diff --git a/app/views/org_subfields/update_sub_dir.js.erb b/app/views/org_subfields/update_sub_dir.js.erb index 7960ca26c..3d42c260b 100644 --- a/app/views/org_subfields/update_sub_dir.js.erb +++ b/app/views/org_subfields/update_sub_dir.js.erb @@ -1,11 +1,6 @@ -<% if @exist == false %> +<% if @exist == false and @sub_dir.valid? %> $('#sub_dir_show_<%= @org_subfield.id %>').html('<%= @sub_dir.name %>'); $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @sub_dir.name %>'); -// $('#sub_dir_show_<%= @org_subfield.id %>').show(); -// $('#sub_dir_edit_<%= @org_subfield.id %>').hide(); <% else %> $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @org_subfield.subfield_subdomain_dir.nil? ? '': @org_subfield.subfield_subdomain_dir.name %>'); -// alert("该目录已存在,请重新输入"); -// $('#sub_dir_edit_<%#= @org_subfield.id %>').find('input').val('<%#= @org_subfield.subfield_subdomain_dir.nil? ? "未设置":@org_subfield.subfield_subdomain_dir.name %>'); -// $('#sub_dir_edit_<%#= @org_subfield.id %>').focus(); <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 349f7c86e..a14138903 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -13,7 +13,6 @@ <% end %> TO <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%> -
    <% if activity.parent_id.nil? %> @@ -44,6 +43,31 @@
    <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
    +
    + +
    diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index ea7fbbb30..e12bf3849 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -30,14 +30,15 @@
  • - + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
  • - + (打钩为允许游客下载文件) +
  • diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 9ec118bec..b9b2f9b4c 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -63,11 +63,12 @@
    公开 : - class="ml3" /> + class="ml3" />
    下载支持 : - class="ml3" /> + name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />  允许游客下载 + <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %>
    保存 <% end %> @@ -187,4 +188,13 @@ $("#apply_hint").text("子域名命名不规范,只能包含字母、数字和下划线,请重新输入"); } } + +// $(document).ready(function(){ +// if ( $("#is_public").attr("checked") != true){ +// alert($(this).attr("checked")); +// $("#allow_download").attr("checked", false); +// $("#allow_download").attr("disabled", true); +// $("#allow_down_hint").html(""); +// } +// }); \ No newline at end of file diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index d98a9fe0f..d6977325c 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -1,139 +1,140 @@ -
    -
    - - -
    - <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
    -
    - -
    - <%student_work_scores.each do |student_score|%> -
    - <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
    - <% end%> -
    - - 收起 -
    -
    - +
    +
    + + +
    + <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
    +
    + +
    + <%student_work_scores.each do |student_score|%> +
    + <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> +
    + <% end%> +
    +
    + + 收起 +
    +
    + diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 662ddece4..d66a30718 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,139 +1,140 @@ -
    -
    - <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> - <% if @homework.homework_type != 3 %> - <% is_my_work = work.user == User.current%> - <% else %> - <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> - <% is_my_work = pro && pro.student_work_id == work.id%> - <% end %> - - -
    - <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
    -
    - -
    - <%student_work_scores.each do |student_score|%> -
    - <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
    - <% end%> -
    - - 收起 -
    -
    - \ No newline at end of file diff --git a/app/views/student_work/_work_attachments_status.html.erb b/app/views/student_work/_work_attachments_status.html.erb index c4b2a795e..6a8591197 100644 --- a/app/views/student_work/_work_attachments_status.html.erb +++ b/app/views/student_work/_work_attachments_status.html.erb @@ -1,7 +1,7 @@ <% attachments.each_with_index do |attachment,i| %>
    - + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%> diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index de8c0a4d2..c8e91c1a2 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -3,7 +3,7 @@ <% if @tags.size > 0 %> <% @tags.each do |tag| %> <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> - <%= tag %> + <%= tag %> <% case object_flag %> <% when '10' %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index dbc9c3041..8487a44d9 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -79,9 +79,7 @@ ) if activity.course_destroyable_by?(User.current) %>
  • <% end %> -
  • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb new file mode 100644 index 000000000..d650cd084 --- /dev/null +++ b/app/views/users/_homework_detail_information.html.erb @@ -0,0 +1,31 @@ +
    题目信息
    +
    + <% if homework.nil? %> + 请先在左侧选择作业 + <% else %> +
    标题:<%=homework.name %>
    + 来源:<%=homework.course.name %>
    + <% if homework.homework_type == 2 && homework.homework_detail_programing %> + 编程语言:<%=homework.language_name %>
    + <% end %> + 贡献者:<%=homework.user.show_name %> + <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %> + ,<%=homework.user.user_extensions.occupation%> + <% end %> +
    + 描述如下: +
    +
    + <%=homework.description.html_safe %> +
    + <% if homework.homework_type == 2 %> +
    + 测试集:<%=homework.homework_tests.count %>组 +
    + <% elsif homework.homework_type ==3 && homework.homework_detail_group %> +
    + 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人 +
    + <% end %> + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb new file mode 100644 index 000000000..ba85f0d09 --- /dev/null +++ b/app/views/users/_homework_search_input.html.erb @@ -0,0 +1,29 @@ + + \ No newline at end of file diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb index 4ad9fef54..d36d9cee0 100644 --- a/app/views/users/_jour_form.html.erb +++ b/app/views/users/_jour_form.html.erb @@ -12,7 +12,8 @@ :minHeight=>100, :input_html => { :id => 'jour_content', :class => 'talk_text fl', - :maxlength => 5000 }%> + :maxlength => 5000 } + %>

    diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 1e9f1bb68..c5d93e0a5 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -52,7 +52,7 @@ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> - <% if is_project_manager?(User.current, activity.project) %> + <% if User.current.member_of?(activity.project) %> <% unless params[:action] == "index" %>
    <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index b682a74ea..1235b4e53 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -1,115 +1,115 @@ - -
    -
    - - - - - + +
    +
    +
      + <%#= labelled_fields_for :issue, @issue do |f| %> + <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> + <%# end %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> +
    • +

       状态  : 

      +

      <%= activity.status.name %>

      + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit",:style=>"white-space:nowrap; overflow:hidden;"} + ) + %> +
    • + <% end %> +
      + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> +
    • +

       指派  : 

      + + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:100px; display:inline-block;" %> + + <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), + { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, + {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"undis issueEdit", :style => "width:130px;"}) %> +
    • + <% end %> +
      +
    +
      + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> +
    • +

       优先级  : 

      + <%= activity.priority.name %> + <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), + {:include_blank => false,:selected=>@priority_id ? @priority_id : 0}, + {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %> +
    • + <% end %> +
      + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> +
    • +

       完成度  : 

      + <%= activity.done_ratio %>% + <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, + {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %> + <% end %> +
    • + +
      +
    +
      +
    • +

       开始  : 

      +

      <%= format_date(activity.start_date) %>

      +
    • +
      +
    • +

       周期  : 

      + <%= l_hours(activity.estimated_hours) %>
    • +
      +
    +
      +
    • +

       计划完成  : 

      + <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
    • +
      +
    • +

       目标版本  : 

      + <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
    • +
      +
    +
    \ No newline at end of file diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index d4a7a9e60..ec36854cb 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -71,9 +71,7 @@ ) if activity.destroyable_by?(User.current) %> <% end %> -
  • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • diff --git a/app/views/users/_share_message_to_course.html.erb b/app/views/users/_share_message_to_course.html.erb new file mode 100644 index 000000000..eda4a9b97 --- /dev/null +++ b/app/views/users/_share_message_to_course.html.erb @@ -0,0 +1,56 @@ + + +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_course_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_message_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !courses.empty? %> + <% courses.each do |course| %> +
      +
    • + +
    • +
    • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb new file mode 100644 index 000000000..da3c7a072 --- /dev/null +++ b/app/views/users/_share_message_to_org.html.erb @@ -0,0 +1,59 @@ +
    +
    发送到
    +
    + +
    + <%= form_tag search_user_org_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_org_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + <% end %> +
    +
    +<%= form_tag share_message_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + +
      + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
    • + +
    • + <%end%> + <%end%> +
    +
    +
    +
      + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
    +
    +
    +
    目标地址:
    +
    + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
    +
    + 取消 +
    +
    +<%end %> \ No newline at end of file diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb new file mode 100644 index 000000000..4b79a779c --- /dev/null +++ b/app/views/users/_share_message_to_project.html.erb @@ -0,0 +1,53 @@ +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_project_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> +
    + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !projects.empty? %> + <% projects.each do |project| %> +
      +
    • + +
    • +
    • <%= project.name%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index dc6599884..9de431336 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -6,11 +6,16 @@
    - + <% if (user.user_extensions && (user.user_extensions.identity != 2) ) %> + + <% end %> +

    - <%= user.user_extensions.technical_title %> + <% if user.user_extensions && user.user_extensions.identity %> + <%= get_user_roll(user) %> + <% end %>

    diff --git a/app/views/users/_show_user_homework_form.html.erb b/app/views/users/_show_user_homework_form.html.erb index ef0265683..43d204508 100644 --- a/app/views/users/_show_user_homework_form.html.erb +++ b/app/views/users/_show_user_homework_form.html.erb @@ -1,13 +1,35 @@ -<% user_homeworks.each do |homework|%> -