diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 076e0b1c7..591a4e288 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -272,7 +272,7 @@ module Mobile params do requires :token,type:String requires :course_id,type:Integer,desc: '课程id' - optional :name,type:String,desc:'学生的姓名或者昵称或者学号可能包含的字符' + optional :name,type:String,desc:'学生的姓名或者登录名或者学号可能包含的字符' end get ":course_id/members" do cs = CoursesService.new diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 583a130d1..6ce3cacbb 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -82,7 +82,7 @@ module Mobile desc "用户搜索" params do requires :name, type: String, desc: '用户名关键字' - requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' + requires :search_by, type: String,desc: '搜索依据:0 登录名,1 用户名,2 邮箱,3 登录名和姓名' optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教' optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户' optional :user_id,type:Integer,desc:'用户id' diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 9e935ae40..68386de44 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -461,8 +461,8 @@ class AdminController < ApplicationController scope = User.order('last_login_on desc') scope = scope.where("last_login_on>= '#{params[:startdate]} 00:00:00'") if params[:startdate].present? scope =scope.where("last_login_on <= '#{params[:enddate]} 23:59:59'") if params[:enddate].present? - @user = scope - @user = paginateHelper @user,30 + @users = scope + @users = paginateHelper @users,30 @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cbf2c30bb..d6470ce51 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -312,7 +312,8 @@ class ApplicationController < ActionController::Base elsif @course allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @courses, :global => global) else - allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global) + # allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global) + allowed = true end allowed end @@ -769,6 +770,7 @@ class ApplicationController < ActionController::Base end def api_request? + return false if params[:controller] == 'at' %w(xml json).include? params[:format] end 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/attachments_controller.rb b/app/controllers/attachments_controller.rb index fd43977ee..cf4e6a8e9 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -74,6 +74,45 @@ class AttachmentsController < ApplicationController :disposition => 'attachment' #inline can open in browser end + def direct_download_history + @attachment_history = AttachmentHistory.find(params[:id]) + @attachment_history.increment_download + send_file @attachment_history.diskfile_history, :filename => filename_for_content_disposition(@attachment_history.filename), + :type => detect_content_type(@attachment_history), + :disposition => 'attachment' #inline can open in browser + end + + def download_history + @attachment_history = AttachmentHistory.find(params[:id]) + candown = attachment_history_candown @attachment_history + if candown || User.current.admin? || User.current.id == @attachment_history.author_id + if stale?(:etag => @attachment_history.digest) + if params[:preview] == 'true' + convered_file = @attachment_history.diskfile_history + #如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化 + unless pdf?(convered_file) + convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf") + unless File.exist?(convered_file) + office = Trustie::Utils::Office.new(@attachment_history.diskfile) + office.conver(convered_file) + end + end + if File.exist?(convered_file) && pdf?(convered_file) + send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline' + else + direct_download_history + end + else + direct_download_history + end + end + else + render_403 :message => :notice_not_authorized + end + rescue => e + redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html" + end + def download # modify by nwb # 下载添加权限设置 @@ -212,7 +251,7 @@ class AttachmentsController < ApplicationController @history.version = @old_history.nil? ? 1 : @old_history.version + 1 @history.save #历史记录保存完毕 #将最新保存的记录 数据替换到 需要修改的文件记录 - @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public") + @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads") @old_attachment.save #删除当前记录 @attachment.delete @@ -600,7 +639,7 @@ private def has_login unless @attachment && @attachment.container_type == "PhoneAppVersion" - render_403 unless User.current.logged? + render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download) end end end diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index ae6aff794..f5e3314bb 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -52,10 +52,14 @@ class BlogCommentsController < ApplicationController render_attachment_warning_if_needed(@article) else end - if params[:is_homepage] - redirect_to user_blogs_path(params[:user_id]) + if params[:in_act] + 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]) + 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 end end def destroy @@ -123,6 +127,7 @@ class BlogCommentsController < ApplicationController @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] @article.children << @blogComment @article.save + # @article.update_attribute(:updated_on, @blogComment.updated_on) @user_activity_id = params[:user_activity_id] user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first if user_activity diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 0202224ed..842433ec6 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -2,7 +2,6 @@ class BlogsController < ApplicationController before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage] before_filter :find_user def index - @articls = @user.blog.articles @article = BlogComment.new respond_to do |format| format.html {render :layout=>'new_base_user'} diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index c8dcf0b8e..5966b310f 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -25,7 +25,9 @@ class CommentsController < ApplicationController def create raise Unauthorized unless @news.commentable? - + if !@news.org_subfield_id.nil? + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + end @comment = Comment.new #@project ? @comment.comments = params[:comment][:comments] : @comment.comments = params[:comment] if params[:user_activity_id] diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 279975c77..36060d41c 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,14 @@ 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 = params[:copy_course].to_i + @course.open_student = copy_course.open_student + @course.publish_resource = copy_course.publish_resource + @course.save + + #copy avatar + copy_avatar(@course, copy_course) + if params[:checkAll] attachments = copy_course.attachments attachments.each do |attachment| @@ -509,7 +517,7 @@ class CoursesController < ApplicationController if @course respond_to do |format| flash[:notice] = l(:notice_successful_create) - format.html {redirect_to settings_course_url(@course, :course_type => 1)} + format.html {redirect_to course_url(@course)} format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } end else @@ -903,6 +911,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 +979,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 +991,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 +1025,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 +1094,7 @@ class CoursesController < ApplicationController end end end +=end book.write xls_report xls_report.string end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c4932b1b2..ca37e445c 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -26,7 +26,7 @@ class FilesController < ApplicationController before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project, :search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment, :search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache, - :search_files_in_subfield,:upload_files_menu] + :search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file] helper :sort include SortHelper @@ -96,6 +96,33 @@ class FilesController < ApplicationController end end + def file_hidden + @file = Attachment.find params[:id] + @course = Course.find params[:course_id] + respond_to do |format| + format.js + end + end + + def republish_file + @file = Attachment.find params[:id] + @course = Course.find params[:course_id] + if params[:publish_time] + unless params[:publish_time] == "" + @file.publish_time = params[:publish_time] + end + end + if @file.publish_time > Date.today + @file.is_publish = 0 + else + @file.is_publish = 1 + end + @file.save + respond_to do |format| + format.js + end + end + def search_project sort = "" @sort = "" @@ -488,6 +515,23 @@ class FilesController < ApplicationController if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') Mailer.run.attachments_added(attachments[:files]) end + if !attachments.empty? && attachments[:files] + attachments[:files].each do |attachment| + if params[:publish_time] + if params[:publish_time] == "" + attachment.publish_time = Date.today + else + attachment.publish_time = params[:publish_time] + end + else + attachment.publish_time = Date.today + end + if attachment.publish_time > Date.today + attachment.is_publish = 0 + end + attachment.save + end + end if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) params[:course_attachment_type].each do |type| tag_name = get_tag_name_by_type_number type diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d345fba5f..a891d3354 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] @@ -340,7 +344,7 @@ class HomeworkCommonController < ApplicationController #当前用户是不是课程的成员 def member_of_course - render_403 unless @course.is_public || User.current.member_of_course?(@course) || User.current.admin? + render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin? end def get_assigned_homeworks(student_works, n, index) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index af8990f37..eb78c4c5b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -81,6 +81,7 @@ class IssuesController < ApplicationController @priority_id = params[:priority_id] @status_id = params[:status_id] @subject = params[:subject] + @done_ratio = params[:done_ratio] @issue_count = @query.issue_count @issue_pages = Paginator.new @issue_count, @limit, params['page'] params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 @@ -220,19 +221,27 @@ class IssuesController < ApplicationController end def update - return unless update_issue_from_params - @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) - saved = false - begin - @saved = @issue.save_issue_with_child_records(params, @time_entry) - rescue ActiveRecord::StaleObjectError - @conflict = true - if params[:last_journal_id] - @conflict_journals = @issue.journals_after(params[:last_journal_id]).all - @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) + if params[:issue_detail] + issue = Issue.find(params[:id]) + issue = update_user_issue_detail(issue, params) + @saved = update_user_issue_detail(issue, params) + return + else + return unless update_issue_from_params + @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) + saved = false + begin + @saved = @issue.save_issue_with_child_records(params, @time_entry) + rescue ActiveRecord::StaleObjectError + @conflict = true + if params[:last_journal_id] + @conflict_journals = @issue.journals_after(params[:last_journal_id]).all + @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) + end end end + if @saved #修改界面增加跟踪者 watcherlist = @issue.watcher_users @@ -278,6 +287,19 @@ class IssuesController < ApplicationController end end + def update_user_issue_detail(issue, params) + case params[:type] + when "status" + issue.update_attribute(:status_id, params[:status_id]) + when "assigned" + issue.update_attribute(:assigned_to_id, params[:assigned_to_id]) + when "ratio" + issue.update_attribute(:done_ratio, params[:done_ratio]) + when "prior" + issue.update_attribute(:priority_id, params[:priority_id]) + end + end + # Updates the issue form when changing the project, status or tracker # on issue creation/update def update_form diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d3ac71b99..0962deb10 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -46,15 +46,16 @@ class NewsController < ApplicationController @course = Course.find(params[:course_id]) end if @project + @page = params[:page] ? params[:page].to_i + 1 : 0 scope = @project ? @project.news.visible : News.visible @news_count = scope.count - @news_pages = Paginator.new @news_count, @limit, params['page'] - @offset ||= @news_pages.offset + #@news_pages = Paginator.new @news_count, @limit, params['page'] + #@offset ||= @news_pages.offset @newss = scope.all(:include => [:author, :project], :order => "#{News.table_name}.created_on DESC", - :offset => @offset, - :limit => @limit) + :offset => @page * 10, + :limit => 10) respond_to do |format| format.html { @@ -63,6 +64,7 @@ class NewsController < ApplicationController render :layout => false if request.xhr? } + format.js format.api format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end @@ -144,6 +146,10 @@ class NewsController < ApplicationController if @course render :layout => 'base_courses' end + elsif @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + @organization = @org_subfield.organization + render :layout => 'base_org' end end @@ -151,6 +157,21 @@ class NewsController < ApplicationController #modify by nwb if @project @news = News.new(:project => @project, :author => User.current) + @news.safe_attributes = params[:news] + @news.save_attachments(params[:attachments]) + if @news.save + if params[:asset_id] + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS + end + render_attachment_warning_if_needed(@news) + #flash[:notice] = l(:notice_successful_create) + redirect_to project_news_index_url(@project) + else + redirect_to project_news_index_url(@project) + #layout_file = 'base_courses' + #render :action => 'new', :layout => layout_file + end elsif @course @news = News.new(:course => @course, :author => User.current) #render :layout => 'base_courses' @@ -221,8 +242,14 @@ class NewsController < ApplicationController end def edit + if @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + @organization = @org_subfield.organization + end if @course render :layout => "base_courses" + elsif @org_subfield + render :layout => 'base_org' end end @@ -240,12 +267,17 @@ class NewsController < ApplicationController end def destroy + if @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + end @news.destroy # modify by nwb if @project redirect_to project_news_index_url(@project) elsif @course redirect_to course_news_index_url(@course) + elsif @org_subfield + redirect_to organization_path(@org_subfield.organization, :org_subfield_id => @org_subfield.id) end end diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 9f1d964ef..2a4bcf9c8 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -27,7 +27,12 @@ class OrgSubfieldsController < ApplicationController @sort = "" @order = "" @is_remote = false - @organization = Organization.find(params[:id]) + if params[:id] + @organization = Organization.find(params[:id]) + else + domain = Secdomain.where("subname=?", request.subdomain).first + @organization = Organization.find(domain.pid) + end @org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+ "subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+ " org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first @@ -105,7 +110,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 b431678af..f225e7f50 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -55,6 +55,7 @@ class OrganizationsController < ApplicationController @organization.name = params[:organization][:name] @organization.description = params[:organization][:description] @organization.is_public = params[:organization][:is_public] + @organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0 @organization.creator_id = User.current.id member = OrgMember.new(:user_id => User.current.id) @@ -116,6 +117,7 @@ class OrganizationsController < ApplicationController @organization.description = params[:organization][:description] # @organization.domain = params[:organization][:domain] @organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0 + @organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0 #@organization.name = params[:organization][:name] @organization.save respond_to do |format| @@ -136,6 +138,10 @@ class OrganizationsController < ApplicationController end end + def check_uniq_domain + @is_exist = (Secdomain.where("subname=?",params[:org_domain]).count > 0) + end + def find_organization @organization = Organization.find(params[:id]) end @@ -296,7 +302,11 @@ class OrganizationsController < ApplicationController def org_resources_subfield @org = Organization.find(params[:id]) - @subfield = @org.org_subfields.where('field_type = "Resource" ') + 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" ') + end respond_to do | format| format.js end @@ -312,7 +322,12 @@ class OrganizationsController < ApplicationController def agree_apply_subdomain @organization = Organization.find(params[:organization_id]) OrgMessage.find(params[:act_id]).update_attribute(:viewed, 1) - @organization.update_attribute(:domain, params[:org_domain]) + if Secdomain.where("pid=? and sub_type=2",@organization.id).count > 0 + domain = Secdomain.where("pid=? and sub_type=2",params[:organization_id]).first + Secdomain.update(domain.id, :subname => params[:org_domain]) + else + Secdomain.create(:sub_type => 2, :pid => params[:organization_id], :subname => params[:org_domain]) + end if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0 OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain]) end diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index ec54ae8a4..1d7b4117d 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -2,6 +2,7 @@ class PollController < ApplicationController before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll] before_filter :find_container, :only => [:new,:create, :index] + before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result] before_filter :is_member_of_course, :only => [:index,:show,:poll_result] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll] include PollHelper @@ -213,6 +214,7 @@ class PollController < ApplicationController def publish_poll @poll.polls_status = 2 @poll.published_at = Time.now + @poll.show_result = params[:show_result] if @poll.save if params[:is_remote] redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) @@ -503,6 +505,10 @@ class PollController < ApplicationController end end + def is_logged + redirect_to signin_path unless User.current.logged? + end + def is_member_of_course render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?)) end diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index b99963e2f..96eeab884 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -24,7 +24,7 @@ class PraiseTreadController < ApplicationController end return end - #@horizontal = params[:horizontal].downcase == "false" ? false:true + @horizontal = params[:horizontal].downcase == "false" ? false:true if params[:horizontal] if @obj.respond_to?("author_id") author_id = @obj.author_id elsif @obj.respond_to?("user_id") @@ -103,30 +103,36 @@ class PraiseTreadController < ApplicationController def find_object_by_type_and_id(type,id) @obj = nil case type - when 'User' - @obj = User.find_by_id(id) - when 'Issue' - @obj = Issue.find_by_id(id) - when 'Project' - @obj = Project.find_by_id(id) - when 'Bid' - @obj = Bid.find_by_id(id) - when 'Contest' - @obj = Contest.find_by_id(id) - when 'Memo' - @obj = Memo.find_by_id(id) - when 'Message' - @obj = Message.find_by_id(id) - when 'HomeworkCommon' - @obj = HomeworkCommon.find_by_id(id) - when 'JournalsForMessage' - @obj = JournalsForMessage.find_by_id(id) - when 'News' - @obj = News.find_by_id(id) - when 'Comment' - @obj = Comment.find_by_id(id) - when 'Journal' - @obj = Journal.find_by_id(id) + when 'Memo' + @obj = Memo.find_by_id(id) + when 'Message' + @obj = Message.find_by_id(id) + when 'HomeworkCommon' + @obj = HomeworkCommon.find_by_id(id) + when 'JournalsForMessage' + @obj = JournalsForMessage.find_by_id(id) + when 'News' + @obj = News.find_by_id(id) + when 'Comment' + @obj = Comment.find_by_id(id) + when 'Journal' + @obj = Journal.find_by_id(id) + when 'BlogComment' + @obj = BlogComment.find_by_id(id) + when 'OrgDocumentComment' + @obj = OrgDocumentComment.find_by_id(id) + when 'User' + @obj = User.find_by_id(id) + when 'Issue' + @obj = Issue.find_by_id(id) + when 'Project' + @obj = Project.find_by_id(id) + when 'Bid' + @obj = Bid.find_by_id(id) + when 'Contest' + @obj = Contest.find_by_id(id) + else + @obj = nil end return @obj end @@ -143,7 +149,8 @@ class PraiseTreadController < ApplicationController # end #再创建或更新praise_tread_cache表 - @ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type) + #@ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type) + @ptc = PraiseTreadCache.where("object_id = ? and object_type = ?",id.to_i,type).first @ptc = @ptc.nil? ? PraiseTreadCache.new : @ptc @ptc.object_id = id.to_i @ptc.object_type = type diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f2de6085f..2d1f8d771 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -112,7 +112,6 @@ class ProjectsController < ApplicationController @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10) else @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) - @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) end @projects = @project_pages.order("created_on desc") @limit = 10#per_page_option diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index cafec1c62..707e87fd1 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -360,6 +360,9 @@ update end # end @changesets_latest_coimmit = @changesets[0] + unless @changesets[0].blank? + update_commits_date(@project, @changesets_latest_coimmit) + end @properties = @repository.properties(@path, @rev) @repositories = @project.repositories @course_tag = params[:course] @@ -589,6 +592,11 @@ update project.project_score.update_attribute(:changeset_num, count) end + # 更新项目提交次数时间 + def update_commits_date project, date + project.project_score.update_attribute(:commit_time, date.created_at) + end + def find_repository @repository = Repository.find(params[:id]) @project = @repository.project diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e0afc38ae..7ccb3177c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -98,14 +98,22 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + @stundet_works = [] + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.where(:id => pro.student_work_id) + end else my_work = @homework.student_works.where(:user_id => User.current.id) end @@ -113,7 +121,11 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end @@ -134,14 +146,22 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + @stundet_works = [] + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.where(:id => pro.student_work_id) + end else my_work = @homework.student_works.where(:user_id => User.current.id) end @@ -149,7 +169,11 @@ class StudentWorkController < ApplicationController elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 if @homework.homework_type == 3 pro = @homework.student_work_projects.where(:user_id => User.current.id).first - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + if pro.nil? + my_work = [] + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + end else my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) end @@ -1031,4 +1055,4 @@ class StudentWorkController < ApplicationController end end end -end \ No newline at end of file +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 449d8b9de..fb35d8495 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -93,6 +93,11 @@ class UsersController < ApplicationController end end + # 更新issue状态 + def user_act_issue_assign_to + + end + # 用户消息 # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验 # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment) @@ -187,11 +192,13 @@ class UsersController < ApplicationController forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0) user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0) forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0) + org_querys = OrgMessage.where("user_id=? and viewed=0", user) if User.current.id == @user.id course_querys.update_all(:viewed => true) forge_querys.update_all(:viewed => true) user_querys.update_all(:viewed => true) forum_querys.update_all(:viewed => true) + org_querys.update_all(:viewed => true) end end @@ -398,8 +405,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 @@ -407,7 +453,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}' and (name like '%#{search}%')").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 @@ -421,6 +482,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 @@ -578,13 +640,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 @@ -746,14 +810,28 @@ class UsersController < ApplicationController end end # end - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @page = params[:page] ? params[:page].to_i + 1 : 0 + if params[:type].present? + case params[:type] + when "public" + 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('updated_on DESC') + else + 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('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) jours.each do |journal| fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) end end - @jour = paginateHelper jours,10 @state = false render :layout=>'new_base_user' end @@ -1608,6 +1686,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? @@ -1643,6 +1725,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 @@ -1753,6 +1838,96 @@ class UsersController < ApplicationController end end + def share_news_to_course + news = News.find(params[:send_id]) + course_ids = params[:course_ids] + course_ids.each do |course_id| + if Course.find(course_id).news.map(&:id).exclude?(news.id) + course_news = News.create(:course_id => course_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1) + news.attachments.each do |attach| + course_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 + end + + def share_news_to_project + news = News.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?(news.id) + message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id) + news.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_news_to_org + news = News.find(params[:send_id]) + field_id = params[:subfield] + org_news = News.create(:org_subfield_id => field_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1) + news.attachments.each do |attach| + org_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 + 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 @@ -1969,22 +2144,22 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ - "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and is_publish = 1 " + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + - "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc") end elsif params[:type] == "2" #课程资源 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 - @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+ - "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and is_publish = 1)"+ + "or (container_type = 'Course' and is_public = 1 and is_publish = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "3" #项目资源 if User.current.id.to_i == params[:id].to_i @@ -1994,9 +2169,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 @@ -2102,9 +2277,17 @@ class UsersController < ApplicationController @user = User.current if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + 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} + end else - @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') + @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} + else + @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + end end @search = params[:search] #这里仅仅是传递需要发送的资源id diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index ebd46caa7..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,9 +74,9 @@ 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] } end @@ -94,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] @@ -225,11 +229,11 @@ class WordsController < ApplicationController def leave_user_message if User.current.logged? @user = User.find(params[:id]) - if params[:new_form][:user_message].size>0 && User.current.logged? && @user + if params[:new_form][:content].size>0 && User.current.logged? && @user if params[:private] && params[:private] == '1' - @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:user_message], :reply_id => 0, :status => true, :is_readed => false, :private => 1) + @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:content], :reply_id => 0, :status => true, :is_readed => false, :private => 1) else - @user.add_jour(User.current, params[:new_form][:user_message]) + @user.add_jour(User.current, params[:new_form][:content]) end end redirect_to feedback_path(@user) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index d66c6a30d..386e5733d 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -134,8 +134,11 @@ class ZipdownController < ApplicationController homework_common.student_works.each do |work| unless work.attachments.empty? out_file = zip_student_work_by_user(work) - bid_homework_path << out_file.file_path - digests << out_file.file_digest + + bid_homework_path << out_file.file_path + digests << out_file.file_digest + + end end homework_id = homework_common.id @@ -172,7 +175,11 @@ class ZipdownController < ApplicationController } end - def zip_student_work_by_user work + def make_zip_name(work) + "#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}" + end + + def zip_student_work_by_user(work) homeworks_attach_path = [] not_exist_file = [] # 需要将所有homework.attachments遍历加入zip @@ -186,10 +193,23 @@ class ZipdownController < ApplicationController digests << 'not_exist_file' end end - out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){ - zipping("#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", - homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) - } + + #单个文件的话,不需要压缩,只改名 + out_file = nil + if homeworks_attach_path.size == 1 + out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){ + des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}" + FileUtils.cp homeworks_attach_path.first, des_path + des_path + } + else + out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){ + zipping("#{make_zip_name(work)}.zip", + homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) + } + end + out_file + end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 07f7a0ed8..9d08be378 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,10 +49,25 @@ module ApplicationHelper end end + def link_to_user_version(version, options = {}) + return '' unless version && version.is_a?(Version) + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue" + end + + # 判断课程是否为精品课程 + def is_excellent_course course + (course.is_excellent? or course.excellent_option?) ? true : false + end + + # 判断课程对成员是否可见 + def visible_course?(course) + (course.is_delete? or (!course.is_public? && !User.current.member_of_course?(course))) ? false : true + end + # 获取项目/课程总分 # 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分 def static_project_score obj - score = obj.issue_num * 4 + obj.issue_journal_num + obj.changeset_num * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5 + score = obj.issue_num * 4 + obj.issue_journal_num + (obj.changeset_num||0) * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5 end # 获取组织成员中文名字 @@ -959,7 +974,17 @@ module ApplicationHelper first_page = FirstPage.find_by_page_type('project') if args.empty? title = @html_title || [] - title << @project.name if @project + if @project + title << @project.name + elsif @course + title << @course.name + elsif @organization + title << @organization.name + elsif @user + title << @user.login + else + title << User.current.login + end if first_page.nil? || first_page.web_title.nil? title << Setting.app_title unless Setting.app_title == title.last else @@ -1972,6 +1997,18 @@ module ApplicationHelper courses_doing end + def attachment_history_candown attachment_history + if attachment_history.container_type == "Course" + course = Course.find(attachment_history.container_id) + candown = User.current.member_of?(course) || (course.is_public && attachment_history.is_public == 1) + elsif attachment_history.container_type == "Project" + project = Project.find(attachment_history.container_id) + candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1) + elsif attachment_history.container_type == "OrgSubfield" + org = OrgSubfield.find(attachment_history.container_id) + candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1) + end + end def attachment_candown attachment candown = false @@ -1996,6 +2033,8 @@ module ApplicationHelper candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) elsif attachment.container.is_a?(OrgSubfield) candown = true + elsif attachment.container.is_a?(OrgDocumentComment) + candown = true elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board && attachment.container.board.course course = attachment.container.board.course @@ -2781,19 +2820,12 @@ int main(int argc, char** argv){ end if opt[:init_activity] - ss += javascript_include_tag "init_activity_KindEditor" + ss += javascript_include_tag "create_kindeditor" end ss.html_safe end - #代码提交数量 - def changesets_num project - g = Gitlab.client - project.gpid.nil? ? 0 : g.project(project.gpid).commit_count - # project.changesets.count -end - #课程动态的更新 def update_course_activity type, id course_activity = CourseActivity.where("course_act_type=? and course_act_id =?", type.to_s, id).first @@ -2834,4 +2866,13 @@ end principal_activity.save end end + + #项目按更新时间排序 + def project_sort_update projects + unless projects.empty? + project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')' + sort_projects = ForgeActivity.find_by_sql("SELECT MAX(updated_at) AS updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} GROUP BY project_id ORDER BY MAX(updated_at) DESC") + return sort_projects + end + end end diff --git a/app/helpers/avatar_helper.rb b/app/helpers/avatar_helper.rb index 3f6802f59..5c3ffd950 100644 --- a/app/helpers/avatar_helper.rb +++ b/app/helpers/avatar_helper.rb @@ -1,9 +1,24 @@ module AvatarHelper AVATAR_SIZE="50x50" + + def copy_avatar(des, src) + src_file = disk_filename(src.class,src.id) + des_file = disk_filename(des.class,des.id) + + FileUtils.cp(src_file, des_file) if File.exist?(src_file) + end - def avatar_image(source) - File.join(relative_path, avatar_directory(source.class), source.id.to_s) + def avatar_image(source, copyed=false) + source_type = source.class + source_id = source.id + + course = Course.find(source_id) rescue nil + if course && copyed + source_id = course.is_copy + end + + File.join(relative_path, avatar_directory(source_type), source_id.to_s) end def relative_path @@ -23,7 +38,18 @@ module AvatarHelper end def disk_filename(source_type,source_id,image_file=nil) - File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file)) + File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file)) + end + + def copy_course?(source_type, source_id) + file= disk_filename(source_type, source_id) + if source_type == Course && !File.exist?(file) + course = Course.find(source_id) rescue nil + if course && course.is_copy>0 + return true + end + end + false end def file_extension(filename=nil) @@ -35,7 +61,9 @@ module AvatarHelper return File.join(relative_path,'AnonymousUser','0') end if source.class && source.id && File.exist?(disk_filename(source.class,source.id)) - avatar_image(source) + avatar_image(source, false) + elsif copy_course?(source.class, source.id) + get_avatar(Course.find(source.is_copy)) rescue nil else File.join(relative_path,avatar_directory(source.class),'0') end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 097a3c1a4..2cdb277be 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -11,6 +11,59 @@ module CoursesHelper #StudentRoles = [5, 10] #AllPeople = StudentRoles+TeacherRoles ## return people count + + + # 推荐的精品课程 + def excellent_course_recommend new_course + q = "%#{new_course.name.strip}%" + result = find_excelletn_course(q, new_course) + end + + # 查询符合条件的精品课程 + # 用新课程名去匹配精品课程中按课程名和Tag名 + def find_excelletn_course keywords, current_course + # 获取tag匹配结果ID + a_tags = [] + # kc = keywords.to_a + Course.visible.where("is_excellent =?", 1).each do |ec| + if ec.tags.any?{|value| current_course.name.include?(value.to_s)} + a_tags << ec.id + end + end + # sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and + # ts.taggable_type = 'Course' and t.name like '%#{keywords}%'" + # a_tags = Course.find_by_sql(sql).select{|course| course.is_public ==1 unless User.current.member_of_course?(course)} + # 通过elastic结果获取精品课程 + a_courses = [] + #courses = Course.search(keywords) + #courses.each do |c| + # a_courses << c.id + #end + a_courses << a_tags unless a_tags.length == 0 + # 课程本身不能搜索显示自己 + excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id} + limit = 5 - excellent_ids.length.to_i + sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id + and c.is_excellent =1 and c.id != #{current_course.id} order by cs.updated_at desc;" + default_ecourse_ids = Course.find_by_sql(sql).flatten + # REDO:时间紧,待优化 + default_ids =[] + default_ecourse_ids.each do |de| + default_ids << de.id + end + default_ids = default_ids - excellent_ids + #default_ecourse = Course.where("id is not in (?)", ids).find_by_sql(sql).flatten.delete_if{|i| i == current_course.id}.flatten + arr_result = excellent_ids << default_ids + arr_result = arr_result.flatten.first(5) + return arr_result + # 过滤条件:精品课程、本身不在搜索范围 + #e_courses = Course.where("is_excellent =? and id in (?)",1, arr_result).where("id !=?", current_course.id) + end + + # 判断精品课程是否可见,非课程成员无法查看私有课程 + def visible_excellent_course obj + # if course.is_pu + end # 返回x项目成员数量,即roles表中定义的所有成员 def projectCount project @@ -63,6 +116,34 @@ module CoursesHelper @course.journals_for_messages.where('m_parent_id IS NULL').count end + #当前学期 + def current_time_and_term course + str = "" + term = cur_course_term + if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year + str = course.time.to_s + course.term.to_s + elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term) + str = course.time.to_s + course.term.to_s + elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term)) + str = course.end_time.to_s + course.end_term.to_s + else + str = Time.now.year.to_s + cur_course_term.to_s + end + str + end + + def set_term_value term + val = 0 + if term == "春季学期" + val = 1 + elsif term == "夏季学期" + val = 2 + elsif term == "秋季学期" + val = 3 + end + val + end + # 返回学生数量,即roles表中定义的Reporter #def studentCount project # searchStudent(project).count @@ -509,7 +590,7 @@ module CoursesHelper type = [] month = Time.now.month now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year) - year = month < 3 ? now_year - 1 : now_year + year = month < 2 && now_year >=Time.now.year ? now_year - 1 : now_year for i in (year..year + 10) option = [] option << i @@ -539,8 +620,10 @@ module CoursesHelper def cur_course_term month = Time.now.month - if month >= 9 || month < 3 + if month >= 9 || month < 2 term = "秋季学期" + elsif (month >= 7 && Time.now.day >= 15) || month == 8 + term = "夏季学期" else term = "春季学期" end @@ -550,7 +633,7 @@ module CoursesHelper def course_in_current_or_next_term course is_current_term = false is_next_term = false - year_now = Time.now.month < 3 ? Time.now.year - 1:Time.now.year + year_now = Time.now.month < 2 ? Time.now.year - 1:Time.now.year if course.time == year_now && course.term == cur_course_term is_current_term = true end @@ -559,6 +642,7 @@ module CoursesHelper elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "夏季学期" is_next_term = true elsif cur_course_term == "夏季学期" && course.time == year_now && course.term == "秋季学期" + is_next_term = true end is_current_term || is_next_term end @@ -644,17 +728,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 @@ -663,7 +746,7 @@ module CoursesHelper return[] unless course result = [] course.attachments.each do |attachment| - if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin? + if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin? result << attachment end end @@ -743,7 +826,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/helpers/files_helper.rb b/app/helpers/files_helper.rb index bd023f6d0..6b748649b 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -123,7 +123,8 @@ module FilesHelper attachments.each do |attachment| if attachment.is_public? || (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) || - (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| + (attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))|| + (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)|| attachment.author_id == User.current.id || attachment.container_type == "OrgSubfield" result << attachment diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index bfc01a102..4edfed578 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -89,10 +89,11 @@ module UsersHelper def unviewed_message(user) course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count + org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count at_count = user.at_messages.where(viewed: false).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count end def user_mail_notification_options(user) 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/attachment_history.rb b/app/models/attachment_history.rb index 2160d242d..fb4e762ba 100644 --- a/app/models/attachment_history.rb +++ b/app/models/attachment_history.rb @@ -1,3 +1,14 @@ class AttachmentHistory < ActiveRecord::Base belongs_to :attachment,foreign_key: 'attachment_id' + cattr_accessor :storage_history_path + @@storage_history_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files") + + # Returns file's location on disk + def diskfile_history + File.join(self.class.storage_history_path, disk_directory.to_s, disk_filename.to_s) + end + + def increment_download + increment!(:downloads) + end end diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index db28e55d6..2b31af604 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base after_save :add_user_activity after_update :update_activity + after_create :update_parent_time before_destroy :destroy_user_activity scope :like, lambda {|arg| @@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base (user && user.logged? && (self.author == user) ) || user.admin? end + def update_parent_time + if !self.parent.nil? + self.root.update_attribute(:updated_on, self.updated_on) + end + end def project end end diff --git a/app/models/course.rb b/app/models/course.rb index 24e955d15..69dbec5d0 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -1,7 +1,6 @@ require 'elasticsearch/model' class Course < ActiveRecord::Base include Redmine::SafeAttributes - include ApplicationHelper STATUS_ACTIVE = 1 STATUS_CLOSED = 5 @@ -71,7 +70,7 @@ class Course < ActiveRecord::Base validates_length_of :description, :maximum => 10000 before_save :self_validate # 公开课程变成私有课程,所有资源都变成私有 - after_update :update_files_public,:update_course_ealasticsearch_index,:update_activity + after_update :update_files_public,:update_course_ealasticsearch_index after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index before_destroy :delete_all_members,:delete_course_ealasticsearch_index @@ -145,6 +144,26 @@ class Course < ActiveRecord::Base ) end + def self.e_search(query) + __elasticsearch__.search( + { + query: { + multi_match: { + query: query, + type:"most_fields", + operator: "or", + fields: ['name', 'description^0.5'] + } + }, + sort: { + _score:{order: "desc" }, + updated_at:{order:"desc"} + + } + } + ) + end + def visible?(user=User.current) user.allowed_to?(:view_course, self) end @@ -384,6 +403,7 @@ class Course < ActiveRecord::Base def act_as_course_message self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false) end + #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #def name # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) @@ -405,6 +425,7 @@ class Course < ActiveRecord::Base self.__elasticsearch__.index_document end end + def update_course_ealasticsearch_index if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性 begin @@ -428,13 +449,11 @@ class Course < ActiveRecord::Base end end + + end -#动态的更新 -def update_activity - update_course_activity(self.class, self.id) - update_user_activity(self.class, self.id) - update_org_activity(self.class, self.id) -end + + # Delete the previous articles index in Elasticsearch # Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index e1f9ab9f5..9c1431d5d 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -6,6 +6,7 @@ class CourseActivity < ActiveRecord::Base belongs_to :user has_many :user_acts, :class_name => 'UserAcivity',:as =>:act after_save :add_user_activity, :add_course_activity + after_create :add_course_lead before_destroy :destroy_user_activity, :destroy_org_activity #在个人动态里面增加当前动态 @@ -60,4 +61,19 @@ class CourseActivity < ActiveRecord::Base org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'") org_activity.destroy_all end + + # 发布新课导语 + # 导语要放置在课程创建信息之后 + # 导语 + def add_course_lead + if self.course_act_type == "Course" + lead_message = Message.find(12440) + name = lead_message.subject + content = lead_message.content + # message的status状态为0为正常,为1表示创建课程时发送的message + message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) + # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直 + message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first + end + end end diff --git a/app/models/journal.rb b/app/models/journal.rb index 2da815a44..b184c82e6 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -52,6 +52,7 @@ class Journal < ActiveRecord::Base # fq after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message + after_create :update_issue_time # end #after_destroy :down_user_score #before_save :be_user_score @@ -230,4 +231,12 @@ class Journal < ActiveRecord::Base project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1) end end + + # 回复issue的时候,更新issue的时候 + def update_issue_time + if self.journalized_type == "Issue" + forge_activity = ForgeActivity.where("forge_act_id =? and forge_act_type =?", self.issue, "Issue").first + forge_activity.update_attribute(:created_at, self.created_on) unless forge_activity.nil? + end + end 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/mailer.rb b/app/models/mailer.rb index 318de2942..05b0349ec 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -379,6 +379,24 @@ class Mailer < ActionMailer::Base end + # issue截止时间提醒 + def issue_due_date(issue) + recipients ||= [] + if issue.author.id != issue.assigned_to_id + recipients << issue.author.mail + end + + # 被指派人邮箱地址加入数组 + recipients << issue.assigned_to.mail + # cc = wiki_content.page.wiki.watcher_recipients - recipients + @author = issue.author + @issue_name = issue.subject + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) + @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} " + mail :to => recipients, + :subject => @subject + end + # Builds a Mail::Message object used to email recipients of the added issue. # # Example: diff --git a/app/models/member.rb b/app/models/member.rb index ed7ee81e6..413fedc07 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -150,7 +150,7 @@ class Member < ActiveRecord::Base #当前学生在指定作业内的得分 def homework_common_score homework_common - StudentWork.select("final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) + StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) end def student_work_score_avg @@ -158,7 +158,12 @@ class Member < ActiveRecord::Base end def student_work_score_sum - StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").sum(:final_score).try(:round, 2).to_f + sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score + FROM student_works,homework_commons + WHERE student_works.homework_common_id = homework_commons.id + AND homework_commons.course_id = #{self.course_id} + AND student_works.user_id = #{self.user_id}" + score = StudentWork.find_by_sql(sql_select) end protected diff --git a/app/models/news.rb b/app/models/news.rb index 7c44f7e8a..fee5d2801 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -22,6 +22,7 @@ class News < ActiveRecord::Base has_many_kindeditor_assets :assets, :dependent => :destroy #added by nwb belongs_to :course,:touch => true + belongs_to :org_subfield, :touch => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :comments, :as => :commented, :dependent => :destroy, :order => "created_on" # fq @@ -57,7 +58,7 @@ class News < ActiveRecord::Base after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count after_update :update_activity - after_destroy :delete_kindeditor_assets, :decrease_news_count + after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities scope :visible, lambda {|*args| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) @@ -187,4 +188,8 @@ class News < ActiveRecord::Base Mailer.run.news_added(self) if Setting.notified_events.include?('news_added') end + def delete_org_activities + OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all + end + end \ No newline at end of file diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index b109ba042..c62cbf4f8 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -6,6 +6,7 @@ class OrgSubfield < ActiveRecord::Base has_many :org_subfield_messages, :dependent => :destroy has_many :messages, :through => :org_subfield_messages has_many :boards, :dependent => :destroy + has_many :news, :dependent => :destroy acts_as_attachable after_create :create_board_sync # 创建资源栏目讨论区 diff --git a/app/models/secdomain.rb b/app/models/secdomain.rb new file mode 100644 index 000000000..4d0abe5db --- /dev/null +++ b/app/models/secdomain.rb @@ -0,0 +1,18 @@ +class Secdomain < ActiveRecord::Base + attr_accessible :pid, :subname, :sub_type, :desc + + validates_presence_of :subname, :sub_type + validates_uniqueness_of :subname + + def controller + return 'organizations' if sub_type == 2 + return 'users' if sub_type == 3 + nil + end + + def action + return 'show' if sub_type == 2 + return 'show' if sub_type == 3 + nil + end +end 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/models/user.rb b/app/models/user.rb index 502f521d1..42acbb539 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -346,7 +346,8 @@ class User < Principal user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count end # 查询指派给我的缺陷记录 @@ -826,6 +827,9 @@ class User < Principal end def admin_of_org?(org) + if self.admin? + return true + end if OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count == 0 return false end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 6f2819f53..ef0c2eb16 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -254,6 +254,8 @@ class CoursesService #course.safe_attributes = params[:course] course.time = params[:time] course.term = params[:term] + course.end_time = params[:end_time] + course.end_term = params[:end_term] course.class_period = params[:class_period].to_i params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0 params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0 diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 3d07f69b2..f2b43c9a3 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -224,7 +224,7 @@ <%= back_url_hidden_field_tag %>
<%= text_field_tag 'username', params[:username], :tabindex => '1' , - :class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%> + :class=>'loginSignBox',:placeholder=>'请输入邮箱地址或登录名', :onkeypress => "user_name_keypress(event);"%>
<% if Setting.openid? %> @@ -283,8 +283,8 @@
- <%= f.text_field :login, :size => 25,:placeholder=>"请输入用户昵称",:class=>'loginSignBox'%> - + <%= f.text_field :login, :size => 25,:placeholder=>"请输入用户登录名",:class=>'loginSignBox'%> +
diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index 28ef8091e..594f554b4 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -38,7 +38,7 @@ 用户姓名 - 用户昵称 + 用户登录名 用户身份 @@ -47,7 +47,7 @@ <% @count=@page * 30 %> - <% for user in @user do %> + <% for user in @users do %> <% @count +=1 %> diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb index 9bd7d9d2f..32e796382 100644 --- a/app/views/attachments/_activity_attach.html.erb +++ b/app/views/attachments/_activity_attach.html.erb @@ -3,7 +3,7 @@
- <%= link_to_short_attachment attachment,:length=> 58, :class => 'mw400 hidden link_file_a fl newsBlue', :download => true -%> + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> ( diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index aac365a15..6786a06a7 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -31,7 +31,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/attachments/_form_project.html.erb b/app/views/attachments/_form_project.html.erb index a9cb068ad..f97bd8bea 100644 --- a/app/views/attachments/_form_project.html.erb +++ b/app/views/attachments/_form_project.html.erb @@ -109,7 +109,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index 3b76689f5..0f7e8a012 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -37,7 +37,7 @@ <% if options[:length] %> <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%> <% else %> - <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%> + <%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> <% end %> <%if is_float%> diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb index c1a6464e8..fb2afd308 100644 --- a/app/views/attachments/_show_attachment_history.html.erb +++ b/app/views/attachments/_show_attachment_history.html.erb @@ -1,54 +1,57 @@ - -更新资源版本 - -
-
-
当前版本 - - - -
- <% unless @attachment_histories.empty? %> - -
历史版本
-
- <% @attachment_histories.each do |history| %> - - - 版本号:<%= history.version %> - - - <% end %> -
- <% end %> - -
- <%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %> - <%= hidden_field_tag :old_attachment_id,@attachment.id %> -
- - -
-
- - <%= render :partial => 'attachments/upload_attachment_new_version' %> -
- - -
-
-
(未选择文件)
-
您可以上传小于50MB的文件
-
-
-
-
-
- - <%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> -
- -
- <% end %> -
+ +更新资源版本 + +
+
+
当前版本 + + + +
+ <% unless @attachment_histories.empty? %> + +
历史版本
+
+ <% @attachment_histories.each do |history| %> + + <%= link_to truncate(history.filename,length: 35, omission: '...'), + download_history_attachment_path(history.id, history.filename), + :title => history.filename+"\n"+history.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f_14 f_b link_file_a2 fl" %> + 版本号:<%= history.version %> +
+
+ + <% end %> +
+ <% end %> + +
+ <%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %> + <%= hidden_field_tag :old_attachment_id,@attachment.id %> +
+ + +
+
+ + <%= render :partial => 'attachments/upload_attachment_new_version' %> +
+ + +
+
+
(未选择文件)
+
您可以上传小于50MB的文件
+
+
+
+
+
+ + <%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> +
+ +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb index 4f3bf41c3..a5bb6672b 100644 --- a/app/views/attachments/attachment_versions.js.erb +++ b/app/views/attachments/attachment_versions.js.erb @@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","40%").css("left","46%"); +$('#ajax-modal').parent().css("top","40%").css("left","50%"); $('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index c3a6cc9d0..936bdd9b6 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -28,7 +28,7 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); - $('#ajax-modal').parent().css("top","").css("left","").css("width","511"); + $('#ajax-modal').parent().css("top","").css("left","").css("width","511").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("alert_praise"); <% end %> diff --git a/app/views/bids/alert_anonymous_comment.js.erb b/app/views/bids/alert_anonymous_comment.js.erb index 66c36e223..04f99980c 100644 --- a/app/views/bids/alert_anonymous_comment.js.erb +++ b/app/views/bids/alert_anonymous_comment.js.erb @@ -1,8 +1,8 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>'); -showModal('ajax-modal', '500px'); -//$('#ajax-modal').css('height','180px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>'); +showModal('ajax-modal', '500px'); +//$('#ajax-modal').css('height','180px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("anonymos"); \ No newline at end of file diff --git a/app/views/blog_comments/_simple_ke_reply_form.html.erb b/app/views/blog_comments/_simple_ke_reply_form.html.erb index 61669058b..e222d8e56 100644 --- a/app/views/blog_comments/_simple_ke_reply_form.html.erb +++ b/app/views/blog_comments/_simple_ke_reply_form.html.erb @@ -1,16 +1,3 @@ - -
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
@@ -21,8 +8,8 @@ <% end %> +
-

diff --git a/app/views/blog_comments/edit.html.erb b/app/views/blog_comments/edit.html.erb index 43a8aae92..704342fc0 100644 --- a/app/views/blog_comments/edit.html.erb +++ b/app/views/blog_comments/edit.html.erb @@ -1,5 +1,5 @@ <% if User.current.logged? && User.current.id == @user.id %> - <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage]},:method=>'PUT', + <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT', :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %> <% end %> diff --git a/app/views/blog_comments/quote.js.erb b/app/views/blog_comments/quote.js.erb index cd53707d5..9bd226ce1 100644 --- a/app/views/blog_comments/quote.js.erb +++ b/app/views/blog_comments/quote.js.erb @@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>"); + sd_create_editor_from_data(<%= @blogComment.id%>,null,"100%", "<%=@blogComment.class.to_s%>"); }); }else if($("#reply_to_message_<%= @blogComment.id%>").length >0) { $("#reply_to_message_<%= @blogComment.id%>").replaceWith("

"); diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb index 2a4e71f1c..915ab892d 100644 --- a/app/views/blog_comments/reply.js.erb +++ b/app/views/blog_comments/reply.js.erb @@ -5,4 +5,4 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); //init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); <% end %> -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity'); \ No newline at end of file diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 02f1ad1ad..c80274db4 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -1,6 +1,7 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor",'blog' %> + <%#= javascript_include_tag "init_activity_KindEditor",'blog' %> + <%= javascript_include_tag "create_kindeditor",'blog' %> <% end %> @@ -45,7 +46,7 @@
  • <%= link_to( l(:button_edit), - {:action => 'edit', :id => @article.id}, + {:action => 'edit', :id => @article.id,:in_act => params[:in_act]}, :class => 'postOptionLink' ) if User.current && User.current.id == @article.author.id %>
  • @@ -94,7 +95,7 @@
    <%= format_time( @article.created_on)%>
    -
    +
    <%= @article.content.html_safe%>
    @@ -116,9 +117,18 @@ <% count=@article.children.count%> <% end %>
    - <% unless count == 0 %> + <%# unless count == 0 %>
    -
    回复(<%=count %>)
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if @article.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%> + <% end %> + +
  • + diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index 1b0d5330d..d65c0b3ab 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -38,54 +38,6 @@ }) <% course_activities.each do |activity| if course_activities %> <% if activity && activity.course_act%> diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 0c4f4c1e0..c7e4a7428 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -32,9 +32,9 @@
    <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> +

    -
    取消 留言 <% end %> diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb new file mode 100644 index 000000000..f26c5fd41 --- /dev/null +++ b/app/views/courses/_recommendation.html.erb @@ -0,0 +1,25 @@ +<% unless excellent_course_recommend(course).length == 0 %> +
      +

      <%= l(:label_homework_recommendation) %>:

      + <% excellent_course_recommend(course).each do |e_course| %> + <% e_course = Course.find(e_course) %> + +
    • <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %> +
      +

      <%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %>

      +

      + <% if e_course.attachments.count > 0 %> + <%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>) + <% end %> + <% if e_course.homework_commons.count > 0 %> + <%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>) + <% end %> +

      +
      +
      +
    • + <% end %> +
      +
    +<% end %> + diff --git a/app/views/courses/_searchmembers.html.erb b/app/views/courses/_searchmembers.html.erb index 1956f34c4..b864bfd8f 100644 --- a/app/views/courses/_searchmembers.html.erb +++ b/app/views/courses/_searchmembers.html.erb @@ -1,5 +1,5 @@ <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生昵称、姓名、学号进行搜索'%> + <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生登录名、姓名、学号进行搜索'%> <% if @group %> <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %> diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb index 2d08e853e..612f408d7 100644 --- a/app/views/courses/_show_member_score.html.erb +++ b/app/views/courses/_show_member_score.html.erb @@ -28,7 +28,7 @@
  • <% end %> -
  • 作业积分(总分)<%= @member_score.student_work_score_sum %>
  • +
  • 作业积分(总分)<%= (@member_score.student_work_score_sum).first.score %>
  • 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..750e7537c --- /dev/null +++ b/app/views/courses/_user_homework_search_list.html.erb @@ -0,0 +1,34 @@ +<%= 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/courses/join_private_courses.js.erb b/app/views/courses/join_private_courses.js.erb index 0c44770bd..199cfb5ae 100644 --- a/app/views/courses/join_private_courses.js.erb +++ b/app/views/courses/join_private_courses.js.erb @@ -7,5 +7,5 @@ $('#ajax-modal').siblings().hide(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("alert_box"); diff --git a/app/views/courses/new_join.js.erb b/app/views/courses/new_join.js.erb index 00245f8cb..cb17ed619 100644 --- a/app/views/courses/new_join.js.erb +++ b/app/views/courses/new_join.js.erb @@ -1,8 +1,8 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', locals: { :course => @course}) %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').css('height','100px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("anonymos"); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', locals: { :course => @course}) %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').css('height','100px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + +""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("anonymos"); diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 23d0a2a3f..b0c4a067f 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -46,14 +46,15 @@
  • - <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time_selected"} %> - <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term_selected"} %> + <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time"} %> + <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term"} %>
  • - <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time_selected"} %> - <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term_selected"} %> + <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time"} %> + <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term"} %> +
  • @@ -109,7 +110,7 @@
    <%= form_tag(search_member_course_path,:id => "course_member_search_form", :method => :get, :class => "search_form_course",:remote => true) do %> - <%= text_field_tag 'name', params[:name], :placeholder => "昵称、学号、姓名搜索", :class => "search_text fl" %> + <%= text_field_tag 'name', params[:name], :placeholder => "登录名、学号、姓名搜索", :class => "search_text fl" %> <%= l(:label_search)%> @@ -135,11 +136,9 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("anonymos"); } - $("#time_selected").click(select); - $("#term_selected").click(select); - $("#end_time_selected").click(select); - $("#end_term_selected").click(select); + //$("#time").click(select); + //$("#term").click(select); diff --git a/app/views/courses/show_member_score.js.erb b/app/views/courses/show_member_score.js.erb index 013b478fc..d30c69f03 100644 --- a/app/views/courses/show_member_score.js.erb +++ b/app/views/courses/show_member_score.js.erb @@ -9,5 +9,5 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); //$('#ajax-modal').parent().removeClass(); -$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed"); +$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("new-watcher"); diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index 9d20b5adb..e12876ce9 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -4,18 +4,6 @@ <%= javascript_include_tag 'blog' %> <% end %> - @@ -94,7 +83,7 @@
    <%= format_time( @article.created_on)%>
    -
    +
    <%= @article.content.html_safe%>
    @@ -201,8 +190,8 @@ +
    -

    @@ -214,4 +203,16 @@
    <% end %>
  • -
    \ No newline at end of file +
    + \ No newline at end of file diff --git a/app/views/exercise/_exercise_submit.html.erb b/app/views/exercise/_exercise_submit.html.erb index 8e2ad74a2..02a5b7b2c 100644 --- a/app/views/exercise/_exercise_submit.html.erb +++ b/app/views/exercise/_exercise_submit.html.erb @@ -1,37 +1,37 @@ -<%= form_for('', - :html => { :multipart => true }, - :url => {:controller => 'exercise', - :action => 'commit_exercise', - :id => exercise.id - },:remote=>true ) do |f| %> -
    - 提交 -
    - <%= f.check_box 'show_result', :value => exercise.show_result%> - <%= label_tag '_show_result', '允许学生查看测验结果' %> - -
    -
    -<% end %> - - \ No newline at end of file diff --git a/app/views/exercise/commit_exercise.js.erb b/app/views/exercise/commit_exercise.js.erb index ac8c242d1..8b6e9f00c 100644 --- a/app/views/exercise/commit_exercise.js.erb +++ b/app/views/exercise/commit_exercise.js.erb @@ -1,8 +1,8 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>'); -showModal('ajax-modal', '270px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>'); +showModal('ajax-modal', '270px'); +$('#ajax-modal').siblings().remove(); +$('#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"); \ No newline at end of file diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index 9b6961e6c..8637273f1 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -25,7 +25,7 @@ $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } @@ -57,7 +57,7 @@ $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } } diff --git a/app/views/exercise/publish_exercise.js.erb b/app/views/exercise/publish_exercise.js.erb index c1c4a4fd5..004ca9625 100644 --- a/app/views/exercise/publish_exercise.js.erb +++ b/app/views/exercise/publish_exercise.js.erb @@ -1,10 +1,10 @@ -$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>"); -$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); -showModal('ajax-modal', '250px'); -//$('#ajax-modal').css('height','111px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>"); +$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); +showModal('ajax-modal', '250px'); +//$('#ajax-modal').css('height','111px'); +$('#ajax-modal').siblings().remove(); +$('#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("poll_alert_form"); \ No newline at end of file diff --git a/app/views/exercise/republish_exercise.js.erb b/app/views/exercise/republish_exercise.js.erb index 2b4e67606..a55cefbde 100644 --- a/app/views/exercise/republish_exercise.js.erb +++ b/app/views/exercise/republish_exercise.js.erb @@ -1,10 +1,10 @@ -$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>"); -$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); -showModal('ajax-modal', '250px'); -//$('#ajax-modal').css('height','80px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>"); +$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); +showModal('ajax-modal', '250px'); +//$('#ajax-modal').css('height','80px'); +$('#ajax-modal').siblings().remove(); +$('#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("poll_alert_form"); \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 9513baab0..cf91b7814 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -40,7 +40,7 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } @@ -126,4 +126,4 @@ <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
    -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index f1d96d22c..7724bb861 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,79 +1,8 @@ - -<% delete_allowed = User.current.allowed_to?(:manage_files, course) %> <% curse_attachments.each do |file| %> <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %> -
    -
    -
    - <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> -
    -
    -
    - <%= link_to truncate(file.filename,length: 35, omission: '...'), - download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %> - <%= file_preview_eye(file, class: 'preview') %> - - <% if file.is_public? == false%> - 私有 - <%end %> - -
    -
    - 上传时间:<%= format_time(file.created_on)%> - <% if file.tag_list.length > 0%> - 上传类型:<%= file.tag_list[0] %> - <% end %> -

    文件大小:<%= number_to_human_size(file.filesize) %>

    -

    下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

    -
    -
    -
    - - <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> - <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> -
    -
    - -
      -
    • - <% if User.current.logged? %> - - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> -
        - -
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
      • -
      • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
      • - <% if @course.is_public? %> -
      • - - <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> - -
      • - <%end%> -
      • - <%= link_to( '删除资源', attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %> -
      • -
      - - <% end %> - <%else%> -
        -
      • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
      • -
      - <% end %> - <% end %> -
    • -
    - -
    -
    -
    -
    -
    -
    +
    + <%=render :partial=>'files/resource_detail',:locals => {:file => file} %> +
    <% else %>
    <%= file.filename %>是私有资源
    <% end %> diff --git a/app/views/files/_file_tools.html.erb b/app/views/files/_file_tools.html.erb index df4d9d738..91b475600 100644 --- a/app/views/files/_file_tools.html.erb +++ b/app/views/files/_file_tools.html.erb @@ -2,7 +2,7 @@ <% if (is_project_manager?(User.current, @project) || file.author_id == User.current.id) && project_contains_attachment?(@project,file) %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" %>
    -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_project_file_new.html.erb b/app/views/files/_project_file_new.html.erb index 4ee1ccede..b66c470e3 100644 --- a/app/views/files/_project_file_new.html.erb +++ b/app/views/files/_project_file_new.html.erb @@ -6,7 +6,7 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb new file mode 100644 index 000000000..fd0a165aa --- /dev/null +++ b/app/views/files/_resource_detail.html.erb @@ -0,0 +1,77 @@ +<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> +
    +
    +
    + <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %> + <%= file_preview_eye(file, class: 'preview') %> + + <% if file.is_public? == false%> + 私有 + <%end %> + + <% if file.is_publish == 0 %> + <%=file.publish_time %>  0点发布 + <% end %> +
    +
    + 上传时间:<%= format_time(file.created_on)%> + <% if file.tag_list.length > 0%> + 上传类型:<%= file.tag_list[0] %> + <% end %> +

    文件大小:<%= number_to_human_size(file.filesize) %>

    +

    下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

    +
    +
    +
    + + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> +
    +
    + +
      +
    • + <% if User.current.logged? %> + + <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> + <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> +
        + +
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
      • +
      • <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
      • +
      • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
      • + <% if @course.is_public? %> +
      • + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> + +
      • + <%end%> +
      • + <%= link_to( '删除资源', attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %> +
      • +
      + + <% end %> + <%else%> +
        +
      • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
      • +
      + <% end %> + <% end %> +
    • +
    + +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index 31fb38cce..1de0e8dc2 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -19,7 +19,7 @@
    -
    +
    <%= org_subfield.name %>
        @@ -74,7 +74,7 @@
    -<% html_title(l(:label_attachment_plural)) -%> +<%# html_title(l(:label_attachment_plural)) -%>

    <%= l(:label_upload_files)%>

    @@ -21,10 +22,20 @@ <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
    - - <%= l(:button_cancel)%> - - <%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %> + <% if User.current.allowed_to?(:as_teacher,course) %> +
    + +
    + + <%#= calendar_for('attachment_publish_time')%> +
    + +
    +
    + <% end %> + <%= l(:button_cancel)%> + <%= l(:button_confirm)%> + <%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %> <% end %>
    @@ -35,8 +46,39 @@
    \ No newline at end of file diff --git a/app/views/files/file_hidden.js.erb b/app/views/files/file_hidden.js.erb new file mode 100644 index 000000000..b95ab5104 --- /dev/null +++ b/app/views/files/file_hidden.js.erb @@ -0,0 +1,6 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>'); +showModal('ajax-modal', '311px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index b702d5872..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({ @@ -245,105 +231,7 @@ }); } - function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) { - $('#'+fieldId).each(function() { - var $this = $(this); - $this.addClass('autocomplete'); - $this.attr('data-value-was', $this.val()); - var check = function() { - var val = $this.val(); - if ($this.attr('data-value-was') != val){ - $this.attr('data-value-was', val); - $.ajax({ - url: url, - type: 'get', - data: {search: $this.val(),send_id:send_id,send_ids:send_ids}, - success: function(data){ }, - beforeSend: function(){ $this.addClass('ajax-loading'); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); - } - }; - var reset = function() { - if (timer) { - clearInterval(timer); - timer = setInterval(check, 300); - } - }; - var timer = setInterval(check, 300); - $this.bind('keyup click mousemove', reset); - }); - } - function check_des(event){ - if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ - event.preventDefault(); - $(".orgDirection").text('目标地址组织不能为空') - return false; - }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ - event.preventDefault(); - $(".orgDirection").text('目标地址栏目不能为空') - return false; - }else{ - return true; - } - } - - <% if User.current.logged? %> - var sendType = '1'; - var lastSendType ;//初始为发送到我的课程 - function show_send(id){ - if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id - }); - }else if(lastSendType == '1'){ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id - }); - }else if( lastSendType == '3'){//组织 - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id - }); - }else{ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id - }); - } - } - //id 发送的id - //发送的id数组 - function chooseSendType(res_id,res_ids){ - - sendType = $(".resourcesSendType").val(); - if (sendType === lastSendType) { - return; - } else if(lastSendType != null) { //不是第一次点击的时候 - if (sendType == '1') { - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id - }); - } else if(sendType == '2') { - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id - }); - }else if(sendType == '3'){ - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id - }); - } - } - - lastSendType = sendType; - } - <% end %> <% if @course %> var tagNameHtml; //当前双击的链接的父节点的html var tagName; //标签的值 diff --git a/app/views/files/quote_resource_show.js.erb b/app/views/files/quote_resource_show.js.erb index 76025fbd2..12b6ea241 100644 --- a/app/views/files/quote_resource_show.js.erb +++ b/app/views/files/quote_resource_show.js.erb @@ -7,5 +7,5 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/quote_resource_show_org_subfield.js.erb b/app/views/files/quote_resource_show_org_subfield.js.erb index fe34e9624..a9207f7f4 100644 --- a/app/views/files/quote_resource_show_org_subfield.js.erb +++ b/app/views/files/quote_resource_show_org_subfield.js.erb @@ -1,11 +1,11 @@ -<% if @can_quote %> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>'); -<% else %> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>'); -<% end %> - -showModal('ajax-modal', '513px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","").css("left",""); +<% if @can_quote %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>'); +<% else %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>'); +<% end %> + +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/quote_resource_show_project.js.erb b/app/views/files/quote_resource_show_project.js.erb index 41dc19fc5..22a47fda9 100644 --- a/app/views/files/quote_resource_show_project.js.erb +++ b/app/views/files/quote_resource_show_project.js.erb @@ -7,5 +7,5 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","30%").css("left","35%"); +$('#ajax-modal').parent().css("top","30%").css("left","35%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/republish_file.js.erb b/app/views/files/republish_file.js.erb new file mode 100644 index 000000000..e85e5eb50 --- /dev/null +++ b/app/views/files/republish_file.js.erb @@ -0,0 +1,2 @@ +hideModal(); +$("#resource_detail_<%=@file.id %>").html("<%= escape_javascript(render :partial=>'files/resource_detail',:locals => {:file => @file}) %>") \ No newline at end of file diff --git a/app/views/files/subfield_upload_file.js.erb b/app/views/files/subfield_upload_file.js.erb index fc3afc0ff..340a2890f 100644 --- a/app/views/files/subfield_upload_file.js.erb +++ b/app/views/files/subfield_upload_file.js.erb @@ -1,6 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); -showModal('ajax-modal', '513px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/upload_files_menu.js.erb b/app/views/files/upload_files_menu.js.erb index e083fac85..deec53ea3 100644 --- a/app/views/files/upload_files_menu.js.erb +++ b/app/views/files/upload_files_menu.js.erb @@ -3,13 +3,13 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); <% elsif @course %> $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'); showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); <% end %> \ No newline at end of file diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index c82a729de..2696bf9ec 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -20,7 +20,7 @@ <%= link_to l(:label_export_excel), get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_batch_homeworks%> <%= link_to l(:label_export_excel), get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if not_batch_homework%> <%= link_to l(:label_export_excel), get_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_all_homeworks%> - + 搜索 diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb index 953d8bab2..98742e03e 100644 --- a/app/views/homework_attach/show.js.erb +++ b/app/views/homework_attach/show.js.erb @@ -1,10 +1,10 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>'); -showModal('ajax-modal', '513px'); -$('#ajax-modal').css('height','569px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("alert_box"); - +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>'); +showModal('ajax-modal', '513px'); +$('#ajax-modal').css('height','569px'); +$('#ajax-modal').siblings().remove(); +$('#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"); + 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..f71cec9a5 --- /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/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb index 1c354aa45..96e958648 100644 --- a/app/views/homework_common/alert_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_anonymous_comment.js.erb @@ -1,6 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed"); \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + +""); +$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file diff --git a/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb b/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb index 5177f4d92..1e81df9e7 100644 --- a/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_forbidden_anonymous_comment.js.erb @@ -1,6 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed"); \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index ac772171d..f95739f26 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -5,7 +5,11 @@ $("#homework_end_time").val(""); $("#course_id").val($("#option_select").val()); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>"); - homework_description_editor.html(""); + //homework_description_editor.html(""); + $("#homework_name_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_course_id_span").text(""); $("#homework_editor").toggle(); } function cancel_edit(){ @@ -26,7 +30,7 @@
    -
    +
    <%= form_for @homework do |f| %> diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index bc960154e..ac4ac9853 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -6,7 +6,11 @@ document.getElementById("anonymous_comment").checked = true; $("#course_id").val($("#option_select").val()); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>"); - homework_description_editor.html(""); + //homework_description_editor.html(""); + $("#homework_name_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_course_id_span").text(""); $("#homework_editor").toggle(); } @@ -36,12 +40,15 @@
    作业
    +
    + <%= render :partial => 'homework_search_form',:locals => {:course=>@course} %> +
    <% if @is_teacher%> -
    +
    <%= labelled_form_for @new_homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
    <%= render :partial => 'users/user_homework_form', :locals => { :homework => @new_homework,:f => f,:edit_mode => false,:select_course => false } %> @@ -50,8 +57,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/homework_common/score_rule_set.js.erb b/app/views/homework_common/score_rule_set.js.erb index da685b758..f83b51b55 100644 --- a/app/views/homework_common/score_rule_set.js.erb +++ b/app/views/homework_common/score_rule_set.js.erb @@ -3,4 +3,4 @@ showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); \ No newline at end of file +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb index 73436750c..987abd351 100644 --- a/app/views/homework_common/set_evaluation_attr.js.erb +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -1,8 +1,8 @@ clickCanel(); <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% end %> \ No newline at end of file diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index 8b2e9ed04..91a68011e 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -3,11 +3,11 @@ <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); $("#evaluation_start_time_<%=@homework.id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); $("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% end %> /*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/ <% elsif @statue == 2 %> diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb index 659441ce8..6ed74d0f0 100644 --- a/app/views/homework_common/start_evaluation_set.js.erb +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -4,7 +4,7 @@ showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions); }); \ No newline at end of file diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index 2f8d8c6d6..874374476 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -2,11 +2,11 @@ alert('关闭成功'); <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); $("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); $("#evaluation_end_time_<%=@user_activity_id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity'); <% end %> /* $("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/ diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index af498b83a..4c5c922f0 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -70,12 +70,11 @@
    -
    +
    <%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
    -
    - +
    <% end %>
    @@ -83,4 +82,5 @@
    +
    \ No newline at end of file diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 2a1ae56d4..3ee20ee2a 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -18,7 +18,7 @@ } $(function () { - init_activity_KindEditor_data(<%= issue.id%>, null, "87%", "<%= issue.class.name %>"); + sd_create_editor_from_data(<%= issue.id%>, null, "100%", "<%= issue.class.name %>"); }); <%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index eca7685cb..21519d5a1 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -2,7 +2,7 @@ $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') - sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); + sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%=@issue.class.name%>"); issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", "resizeType":0, @@ -18,9 +18,10 @@ "fileManagerJson":"/kindeditor/filemanager"}); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') - sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); + sd_create_editor_from_data(<%= @issue.id %>, null, "100%","<%=@issue.class.name%>"); <%else%> - $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); + $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); + sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity"); +//init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> diff --git a/app/views/issues/add_journal_in_org.js.erb b/app/views/issues/add_journal_in_org.js.erb index 34e874f13..ed4666d0c 100644 --- a/app/views/issues/add_journal_in_org.js.erb +++ b/app/views/issues/add_journal_in_org.js.erb @@ -1,3 +1,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/issues/add_reply.js.erb b/app/views/issues/add_reply.js.erb index 0ee9d30e7..500451781 100644 --- a/app/views/issues/add_reply.js.erb +++ b/app/views/issues/add_reply.js.erb @@ -1,3 +1,3 @@ $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)') -sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); \ No newline at end of file diff --git a/app/views/issues/delete_journal.js.erb b/app/views/issues/delete_journal.js.erb index 63a1a5f96..7c7f25c1c 100644 --- a/app/views/issues/delete_journal.js.erb +++ b/app/views/issues/delete_journal.js.erb @@ -1,3 +1,3 @@ $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') -sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); \ No newline at end of file diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index cf0428c27..b63897951 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1,18 +1,7 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: true,init_activity: true) %> <% end %> - + \ No newline at end of file diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 2007aec5a..6062d760b 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -43,20 +43,15 @@ <%#= link_to '首页', organization_path(@organization, :show_homepage => 1),:class=>"linkGrey8 f14" %> <% if User.current.logged? %> - - <% else %> - - + + <% end %>
    - <% if User.current.logged? %> -
    - <%= link_to '文章', organization_org_document_comments_path(@organization) %>  - <% if User.current.logged? %> - ( - <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> - ) - <% end %> -  |  - <%= link_to '成员', members_organization_path(@organization.id) %>  - <% if User.current.logged? %> - (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) - <% end %> -
    - <% end %> +
    + <%= link_to '文章', organization_org_document_comments_path(@organization) %>  + <%# if User.current.logged? %> + ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) + <%# end %> + <% if User.current.logged? %> +  |  + <%= link_to '成员', members_organization_path(@organization.id) %>  + (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) + <% end %> +
    <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 58289b352..657873f8b 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -150,7 +150,7 @@
    -

    <%= l(:label_tag)%>:

    +

    <%= l(:label_tag)%>:

    <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> @@ -242,9 +242,13 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","36%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } + + $("#expand_tools_expand").click(function(){ + $("#navContent").toggle(); + });
    diff --git a/app/views/mailer/issue_due_date.html.erb b/app/views/mailer/issue_due_date.html.erb new file mode 100644 index 000000000..f0ac2907a --- /dev/null +++ b/app/views/mailer/issue_due_date.html.erb @@ -0,0 +1,10 @@ +
    +
      +
    • <%= l(:mail_issue_content)%> + +

      <%=link_to @author.login, user_url(@author) %> 发布的问题跟踪:<%=link_to @issue_name, @issue_url %> 截止时间快到了,请您关注!

      +
      +
    • +
    +
    +
    \ No newline at end of file diff --git a/app/views/mailer/issue_due_date.text.erb b/app/views/mailer/issue_due_date.text.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index b7cc1a0c2..16bc5c742 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -3,19 +3,6 @@ <%= javascript_include_tag 'forum' %> <% end %> - - \ No newline at end of file diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index c3278a209..49207d5c5 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -27,14 +27,18 @@ } } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); });
    - <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> + <% if @topic.status == 1 %> + <%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %> + <% else %> + <%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50,:alt=>'图像' ), user_path(@topic.author) %> + <% end %>
    <% if User.current.logged? %> @@ -60,7 +64,7 @@ ) if @message.course_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" %>
  • @@ -72,20 +76,24 @@
    - <% if @topic.try(:author).try(:realname) == ' ' %> - <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% if @topic.status == 1 %> + 确实团队 <% else %> - <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% if @topic.try(:author).try(:realname) == ' ' %> + <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> <% end %>
    <%= format_time( @topic.created_on)%>
    -
    +
    <%= @topic.content.html_safe%>
    -
    - <%= link_to_attachments_course @topic, :author => false %> +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
    @@ -168,4 +176,16 @@
    <% end %>
    -
    \ No newline at end of file +
    + diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 304694b39..4d5af61dd 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -58,7 +58,8 @@ } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + //init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); @@ -68,7 +69,7 @@ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
    - <% if @message.org_subfield_editable_by?(User.current) %> + <% if User.current.logged? %>
    <%= format_time( @topic.created_on)%>
    -
    +
    <%= @topic.content.html_safe%>
    -
    - <%= link_to_attachments_course @topic, :author => false %> +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
    @@ -197,4 +199,16 @@
    <% end %>
    -
    \ 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 e5aba7c02..3a306ba74 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -88,7 +88,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); @@ -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' %>
  • @@ -135,12 +135,12 @@
    <%= format_time( @topic.created_on)%>
    -
    +
    <%= @topic.content.html_safe%>
    -
    - <%= link_to_attachments_course @topic, :author => false %> +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
    @@ -225,3 +225,15 @@
    + diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb index a859a088a..2d957dbda 100644 --- a/app/views/messages/_reply_message.html.erb +++ b/app/views/messages/_reply_message.html.erb @@ -1,15 +1,3 @@ -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    @@ -18,8 +6,8 @@ <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> +
    -

    diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index b0e8ecb85..89f953bb9 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -11,7 +11,7 @@ if($("#reply_message_<%= @message.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @message.id%>,null,"85%", "<%=@message.class.to_s%>"); + sd_create_editor_from_data(<%= @message.id%>,null,"100%", "<%=@message.class.to_s%>"); }); }else if($("#reply_to_message_<%= @message.id%>").length >0) { $("#reply_to_message_<%= @message.id%>").replaceWith("

    "); diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index f61de74f0..385a49a82 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -5,4 +5,4 @@ <% elsif @org_subfield %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); <%end%> -init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", "UserActivity"); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/my/clear_user_avatar_temp.js.erb b/app/views/my/clear_user_avatar_temp.js.erb index 788678673..8795177fc 100644 --- a/app/views/my/clear_user_avatar_temp.js.erb +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -1,8 +1,8 @@ - $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); - $('#ajax-modal').html($("#nh_tx_dialog_html").html()); - showModal('ajax-modal','460px'); - $('#ajax-modal').siblings().hide(); - $('#ajax-modal').parent().removeClass("alert_praise"); - //$('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("alert_box"); - $('#ajax-modal').parent().css("border", "2px solid #15bccf").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ No newline at end of file + $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); + $('#ajax-modal').html($("#nh_tx_dialog_html").html()); + showModal('ajax-modal','460px'); + $('#ajax-modal').siblings().hide(); + $('#ajax-modal').parent().removeClass("alert_praise"); + //$('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("alert_box"); + $('#ajax-modal').parent().css("border", "3px solid #269ac9").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ No newline at end of file diff --git a/app/views/news/_course_news_detail.html.erb b/app/views/news/_course_news_detail.html.erb index 954f7dbf1..bd3215fb3 100644 --- a/app/views/news/_course_news_detail.html.erb +++ b/app/views/news/_course_news_detail.html.erb @@ -1,20 +1,8 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> + <%= javascript_include_tag "create_kindeditor" %> <% end %> - <% if newss%> <% newss.each do |news| %> diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 914b1a6a1..3236aa6a0 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -41,6 +41,7 @@
    + <% elsif User.current.logged? %> + <%end%>
    通知: <%= @news.title%> @@ -74,12 +85,12 @@
    <%= format_time( @news.created_on)%>
    -
    +
    <%= @news.description.html_safe%>
    -
    - <%= link_to_attachments_course @news, :author => false %> +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %>
    @@ -171,3 +182,15 @@ <% end %>
    + diff --git a/app/views/news/_edit_for_org_subfield.html.erb b/app/views/news/_edit_for_org_subfield.html.erb new file mode 100644 index 000000000..75f24e6b7 --- /dev/null +++ b/app/views/news/_edit_for_org_subfield.html.erb @@ -0,0 +1,49 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +
    +
    +
    +
    + +

    +
    + +
    +
    +
    \ No newline at end of file diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb new file mode 100644 index 000000000..0a7770ac0 --- /dev/null +++ b/app/views/news/_organization_show.html.erb @@ -0,0 +1,186 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + + + + +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %> +
    +
    + <% if User.current.logged? %> + + <%end%> + +
    + +
    + <% if @news.try(:author).try(:realname) == ' ' %> + <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
    +
    <%= format_time( @news.created_on)%>
    +
    +
    + <%= @news.description.html_safe%> +
    +
    +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %> +
    +
    +
    +
    +
    +
    + <% unless @comments.empty? %> +
    +
    回复(<%=@comments.count %>)
    +
    +
    +
    + <% @comments.each_with_index do |reply,i| %> + +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
    +
    + <%= reply.comments.html_safe%> +
    +
    + <%= format_time(reply.created_on) %> + +
    +

    +
    +
    +
    + <% end %> +
    + + <% end %> +
    + <% if @news.commentable? %> +
    + +
    +
    + <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> +
    + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :comments, :editor_id => 'comment_editor', + :owner_id => @comment.nil? ? 0: @comment.id, + :owner_type => OwnerTypeHelper::COMMENT, + :width => '99%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'comment_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
    +

    +

    + + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> + +

    + <% end %> +
    +
    +
    + <% end %> +
    +
    + diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index efbb74e46..1b4c51cd0 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -1,77 +1,36 @@ - -<% - btn_tips = l(:label_news_new) - label_tips = l(:label_news) -%> -
    -

    <%= label_tips %>

    -
    -
    -

    <%= l(:label_total_news) %><%= @news_count %><%= l(:label_project_new_list) %>

    - <% if @project && User.current.allowed_to?(:manage_news, @project) %> - <%= link_to(btn_tips, new_project_news_path(@project), - :class => 'problem_new_btn fl c_dorange') %> -
    - - <% end %> -
    -
    -
    - <% if @newss.empty? %> -

    - <%= l(:label_no_data) %> -

    - <% else %> - <% @newss.each do |news| %> -
    - <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
    - <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - <%= l(:label_add_news) %>:<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w_news" %>
    -
    -

    <%=textAreailizable news.description %>

    - - <%= l(:label_create_time) %> :<%= format_time(news.created_on) %> -
    -
    -
    + +
    +
    +
    + 新闻 +
    +
    + <% if @project && User.current.allowed_to?(:manage_news, @project) %> + <%= labelled_form_for @news, :url =>{:controller=>'news',:action => 'new', :project_id => @project.id}, + :html => {:nhname=>'form',:multipart => true, :id => 'news-form'} do |f| %> + <%= render :partial => 'project_news_new', :locals => {:f => f, :news => @news, :edit_mode => false} %> <% end %> <% end %> + <%= render :partial=> 'project_news_detail',:locals =>{:all_news => @newss, :page => 0} %>
    - - - - <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> - <% end %> - - <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> - <%= stylesheet_link_tag 'scm' %> - <% end %> - - <% html_title(l(:label_news_plural)) -%> - - diff --git a/app/views/news/_project_news_detail.html.erb b/app/views/news/_project_news_detail.html.erb new file mode 100644 index 000000000..b3e6de5cf --- /dev/null +++ b/app/views/news/_project_news_detail.html.erb @@ -0,0 +1,44 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "create_kindeditor" %> +<% end %> + +<% if all_news %> + <% all_news.each do |news| %> + + <% if news %> + <%= render :partial => 'users/project_news', :locals => {:activity => news, :user_activity_id => news.id} %> + <% end %> + <% end %> + + <% if all_news.count == 10 %> + <%= link_to "点击展开更多",news_index_path(:project_id => @project.id ,:page => page),:id => "show_more_project_news",:remote => "true",:class => "loadMore mt10 f_grey"%> + <% end %> +<% end%> + diff --git a/app/views/news/_project_news_new.html.erb b/app/views/news/_project_news_new.html.erb new file mode 100644 index 000000000..e3d63ba9c --- /dev/null +++ b/app/views/news/_project_news_new.html.erb @@ -0,0 +1,60 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +
    +
    +
    +
    + +

    +
    + +
    +
    +
    \ No newline at end of file diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 463b0f489..74378e3fd 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -1,72 +1,196 @@ -
    -

    <%= l(:label_news) %>

    -
    +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + + + -<% if authorize_for('news', 'edit') %> - <% end %> - diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 7956af6d1..ffd86baa3 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -71,7 +71,11 @@
    <% if field.field_type == "Post" %> <% if !field.subfield_subdomain_dir.nil? %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% if !request.local? and !organization.domain.nil? and Organization.where("domain is not null").map(&:domain).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> <% else %> <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <% end %> @@ -80,7 +84,11 @@ <% end %> <% else %> <% if !field.subfield_subdomain_dir.nil? %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% if !request.local? and !organization.domain.nil? and Organization.where("domain is not null").map(&:domain).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> <% else %> <%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> <% end %> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 9c1863992..2495e0044 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -38,13 +38,7 @@
    -
    -
    - <% if activity.description? %> - <%= textAreailizable activity, :description, :attachments => activity.attachments %> - <% end %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
    @@ -62,7 +56,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -103,7 +97,7 @@ <%= format_time(reply.created_on) %> <% if reply.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> @@ -131,8 +125,8 @@
    <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%> +
    -

    @@ -145,6 +139,3 @@
    - diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 901c2ecf4..55f03a367 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -12,8 +12,7 @@ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%> - + <%= 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? %> @@ -31,15 +30,12 @@ 更新时间:<%= format_time(OrgActivity.where("org_act_type='#{activity.class}' and org_act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
    -
    + <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
    @@ -47,6 +43,33 @@
    <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
    +
    +
      +
    • + <% if User.current.logged? %> +
        +
      • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'message')") %>
      • +
      • + <%= link_to( + l(:button_edit), + {:controller => 'messages', :action => 'edit', :id => activity, :board_id => activity.board_id}, + :class => 'postOptionLink' + ) if activity.org_subfield_editable_by?(User.current) %> +
      • +
      • + <%= link_to( + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id}, + :method => 'post', + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if activity.org_subfield_editable_by?(User.current) %> +
      • +
      + <% end %> +
    • +
    +
    @@ -62,7 +85,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -99,7 +122,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> @@ -122,8 +145,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
    -

    @@ -136,6 +159,3 @@ - diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb new file mode 100644 index 000000000..891ad14a7 --- /dev/null +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -0,0 +1,146 @@ +
    +
    +
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
    +
    +
    + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %> +
    + + +
    +
    + 发布时间:<%= format_time(activity.created_on) %> +
    +
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> +
    + + +
    +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %> +
    +
    +
      +
    • + <% if User.current.logged? %> +
        +
      • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
      • +
      • + <%= link_to( + l(:button_edit), + {:controller => 'news', :action => 'edit', :id => activity}, + :class => 'postOptionLink' + ) if activity.author == User.current %> +
      • +
      • + <%= delete_link( + news_path(activity), + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if activity.author == User.current %> +
      • +
      + <% end %> +
    • +
    +
    +
    +
    +
    + <% count=activity.comments.count %> +
    +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
    +
    <%#= format_date(activity.updated_on) %>
    + <%if count>3 %> + + <% end %> +
    + + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% activity.comments.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> +
      +
      +
      + <% if comment.try(:author).try(:realname) == ' ' %> + <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> + + <% if comment.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + +
      +
      + <%= comment.comments.html_safe %>
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + +
    + + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    +
    + diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index 6b45a2a13..b68b7ceeb 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -19,13 +19,9 @@
    <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
    -
    +
    创建时间:<%= format_time(project.created_on) %>
    -
    - 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %> -
    -
    -
    -
    - <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
    -
    + <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
    @@ -62,7 +59,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -100,7 +97,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> @@ -123,8 +120,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
    -

    @@ -137,6 +134,3 @@
    - diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index 7178cfe1d..63eb1808b 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -1,71 +1,78 @@ -
    -
    - -
    - <% if User.current.logged? %> -
    <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
    - <% end %> - <% unless document.content.blank? %> -
    - <%= document.content.html_safe %> -
    - <% end %> - <% if params[:show_homepage].nil? and User.current.logged? %> -
    - 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %> -
    -
    -
    - 最后编辑:<%= User.find(EditorOfDocument.where("org_document_comment_id =?", document.id).order("created_at desc").first.editor_id).realname %> -
    - <% end %> - - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %> -
    -
      -
    • -
        -
      • - <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'cancel_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %> - 取消首页 - <% end %> -
      • -
      • - <%= link_to "编辑首页", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 2), :class => "postOptionLink" %> -
      • -
      • - <%= link_to "删除首页", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', - :data => {:confirm => l(:text_are_you_sure)}, - :remote => true, :class => 'postOptionLink' %> -
      • -
      -
    • -
    -
    -
    - <% end %> -
    -
    - -
    - - \ No newline at end of file diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 14eb8ef74..da458636a 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -20,12 +20,14 @@
    <% unless document.content.blank? %> -
    - <%= document.content.html_safe %> -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>document.id, :content=>document.content} %> <% end %> -
    - <%= link_to_attachments_course document, :author => false %> +
    + + +
    +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => document} %>
    公开 : - class="ml3" /> + class="ml3" /> +
    +
    下载支持 : + name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" /> +  允许游客下载 + <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %>
    保存 <% end %> @@ -83,7 +94,7 @@

    添加成员

    <%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%> - + <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %>
    <%= find_user_not_in_current_org_by_name(@project) %> @@ -117,8 +128,8 @@

    域名目录(用户自定义url,可选)

    - <% if @organization.domain %> - <%= @organization.domain %>.trustie.net/ + <% if domain %> + <%= domain.subname %>.trustie.net/ <% else %> 您还没有子域名,请先在左侧信息栏申请子域名 <% end %> @@ -149,18 +160,33 @@ if ($("#subfield_name").val().trim() != "") $("#add_subfield_form").submit(); } + var $is_exist = false; function apply_subdomain(id, domain){ var reg = new RegExp("^[a-zA-Z0-9_]{1,}$"); if (reg.exec(domain)){ $.ajax({ - url:"<%= apply_subdomain_organization_path %>", - type:'post', + url: "<%= check_uniq_domain_organizations_path %>", + type: 'get', data:{ - id:id, - domain:domain + org_domain:domain }, success:function(){ - $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); + if(!$is_exist){ + $.ajax({ + url:"<%= apply_subdomain_organization_path %>", + type:'post', + data:{ + id:id, + domain:domain + }, + success:function(){ + $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); + } + }); + } + else{ + $("#apply_hint").text("您申请的子域名已存在,请重新输入"); + } } }); } @@ -168,4 +194,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/organizations/show.html.erb b/app/views/organizations/show.html.erb index 78fb12279..f217f006e 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -4,18 +4,6 @@ <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> <% end %> - <% if params[:show_homepage].nil? and User.current.logged? %>
    <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
    @@ -61,7 +49,7 @@ <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index c03570072..b04f96db5 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -58,4 +58,11 @@ <%end%> <% end%>
  • <%= format_date poll.created_at.to_date%>
  • + <% if poll.show_result == 1 %> + <% if has_commit%> +
  • <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%>
  • + <%else%> +
  • 统计结果
  • + <%end%> + <% end %> <% end%> \ No newline at end of file diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index c5c016583..e08b13033 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -1,397 +1,401 @@ -<%= stylesheet_link_tag 'polls', :media => 'all' %> - - -
    - - - -
    - <%= render :partial => 'edit_head', :locals => {:poll => @poll}%> -
    - - -
    - <%= render :partial => 'poll_content', :locals => {:poll => @poll}%> -
    - - - - -
    -
    - -
    - - <%= l(:label_memo_create)%> - -
    - - -
    -
    -
    - - -
    +<%= stylesheet_link_tag 'polls', :media => 'all' %> + + +
    + + + +
    + <%= render :partial => 'edit_head', :locals => {:poll => @poll}%> +
    + + +
    + <%= render :partial => 'poll_content', :locals => {:poll => @poll}%> +
    + + + + +
    +
    + +
    + + <%= l(:label_memo_create)%> + +
    + + +
    +
    +
    + + +
    diff --git a/app/views/poll/_poll_submit.html.erb b/app/views/poll/_poll_submit.html.erb index af3ca2d42..41e402dca 100644 --- a/app/views/poll/_poll_submit.html.erb +++ b/app/views/poll/_poll_submit.html.erb @@ -15,7 +15,7 @@ 是否确定发布该问卷?

    - <%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote), :class => "upload_btn", :onclick => "clickCanel();" %> + <%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote,:show_result => show_result), :class => "upload_btn", :onclick => "clickCanel();" %> 取  消 diff --git a/app/views/poll/commit_poll.js.erb b/app/views/poll/commit_poll.js.erb index 76e5e53df..a5c7f74cd 100644 --- a/app/views/poll/commit_poll.js.erb +++ b/app/views/poll/commit_poll.js.erb @@ -5,5 +5,5 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb index 92a42cbac..e9deff3f4 100644 --- a/app/views/poll/index.html.erb +++ b/app/views/poll/index.html.erb @@ -1,91 +1,91 @@ -<%= stylesheet_link_tag 'polls', :media => 'all' %> - -
    - <%= render :partial => 'poll_list'%> +<%= stylesheet_link_tag 'polls', :media => 'all' %> + +
    + <%= render :partial => 'poll_list'%>
    \ No newline at end of file diff --git a/app/views/poll/other_poll.js.erb b/app/views/poll/other_poll.js.erb index eee4ed4a1..26ec89046 100644 --- a/app/views/poll/other_poll.js.erb +++ b/app/views/poll/other_poll.js.erb @@ -1,13 +1,13 @@ - -<% if @polls.empty? %> - alert('您目前还没有自己新建的问卷'); -<% else %> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); - - - showModal('ajax-modal', '513px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("popbox_polls"); + +<% if @polls.empty? %> + alert('您目前还没有自己新建的问卷'); +<% else %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); + + + showModal('ajax-modal', '513px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("popbox_polls"); <% end %> \ No newline at end of file diff --git a/app/views/poll/publish_poll.js.erb b/app/views/poll/publish_poll.js.erb index 516e32f34..91dcdc882 100644 --- a/app/views/poll/publish_poll.js.erb +++ b/app/views/poll/publish_poll.js.erb @@ -6,5 +6,5 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/app/views/poll/republish_poll.js.erb b/app/views/poll/republish_poll.js.erb index 3b5c5bd3b..1d025a5b2 100644 --- a/app/views/poll/republish_poll.js.erb +++ b/app/views/poll/republish_poll.js.erb @@ -6,5 +6,5 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/app/views/praise_tread/_praise.html.erb b/app/views/praise_tread/_praise.html.erb index 4fd961251..63b57f8a6 100644 --- a/app/views/praise_tread/_praise.html.erb +++ b/app/views/praise_tread/_praise.html.erb @@ -1,7 +1,13 @@ <% if PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",activity.id,activity.class.to_s,User.current.id).empty? %> + + <% num = get_praise_num(activity) %> + <%= num > 0 ? "(#{num})" : "" %> + <% else %> + 已赞 + <% num = get_praise_num(activity) %> + <%= num > 0 ? "(#{num})" : "" %> + <% end %> \ No newline at end of file diff --git a/app/views/projects/_attachment_acts.html.erb b/app/views/projects/_attachment_acts.html.erb index adc21fdcc..de0820bff 100644 --- a/app/views/projects/_attachment_acts.html.erb +++ b/app/views/projects/_attachment_acts.html.erb @@ -22,18 +22,14 @@ 发布时间:<%= format_time(activity.created_on) %>

    <%= textAreailizable activity, :description %>

    -
    +
    - -
    - \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 95d0fccf6..2c7d36fb5 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -47,6 +47,9 @@ <% else %> <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "f14 c_blue02" %> <% end %> + <% unless @project.project_score.changeset_num == 0 %> + <%= link_to "(#{@project.project_score.changeset_num})", ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> + <% end %> <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %> <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> @@ -54,7 +57,7 @@
    <% end %> - + diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index deb0af842..c036633a5 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -35,18 +35,7 @@ }) }) - + <% unless forge_acts.empty? %> <% forge_acts.each do |activity| -%> diff --git a/app/views/projects/_project_create.html.erb b/app/views/projects/_project_create.html.erb index f7319f466..ef0c7c4c3 100644 --- a/app/views/projects/_project_create.html.erb +++ b/app/views/projects/_project_create.html.erb @@ -19,13 +19,9 @@
    <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
    -
    +
    创建时间:<%= format_time(project.created_on) %>
    -
    - 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %> -
    -
    -
    -
    - <%= activity.description.html_safe %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
    @@ -49,7 +45,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -90,7 +86,7 @@ <%= format_time(comment.created_on) %> <% if comment.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> @@ -112,8 +108,8 @@
    <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> - -
    +
    +

    @@ -124,7 +120,4 @@
    -
    - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/projects/join_project.js.erb b/app/views/projects/join_project.js.erb index 92cdfcf2c..679e86d3f 100644 --- a/app/views/projects/join_project.js.erb +++ b/app/views/projects/join_project.js.erb @@ -1,10 +1,10 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); -showModal('ajax-modal', '540px'); -$('#ajax-modal').css('height','260px'); -//$('#ajax-modal').siblings().remove(); -$('#ajax-modal').siblings().hide(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("alert_box"); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); +showModal('ajax-modal', '540px'); +$('#ajax-modal').css('height','260px'); +//$('#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"); diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index afe4740eb..76d5745df 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -36,12 +36,12 @@ <% if @changesets && !@changesets.empty? %> <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %> <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> -
    <%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %>
    +
    提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
    <%= @changesets_latest_coimmit.message %>
    <% else %> -
    <%=@changesets_latest_coimmit.author_email %>
    +
    提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
    <%= @changesets_latest_coimmit.message %>
    diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 052443155..9d747790f 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -23,13 +23,17 @@ <% end%> \ 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 @@ -
    -
    -
      -
    • - 上交时间: - <%=format_time work.created_at %> -
    • - - <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> - -
    • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> -
    • -
    • - <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> -
    • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> - -
    • - <%= render :partial => 'student_work_praise' %> -
    • - <% end%> -
      - -
    • - 编程代码: -
      -
      -
      -
      -
    • - -
    • - - 测试结果: - -
      - <% work.student_work_tests.each_with_index do |test, index| %> -
      -

      - 第<%= work.student_work_tests.count - index%>次测试 -

      - - <%= test.created_at.to_s(:db) %> - -
      -
      - <% if test.status.to_i == -2 %> -
      - <%= test.results.first %> -
      - <% else %> -
      -
        - <% test.results.each_with_index do |x, i| %> -
      • - 测试<%=i+1%> - <% if x["status"].to_i != 0 %> - 测试错误! - 您的输出: - <%=x["result"]%> - 正确输出: - <%=x["output"]%> -
        - <% else %> - 测试正确! -
        - <% end %> -
      • - <% end %> -
      -
      - <% end %> - <% end %> -
      -
    • - -
    • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> - -
      - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
      - <% 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%> -
    - - 收起 -
    -
    - +
    +
    +
      +
    • + 上交时间: + <%=format_time work.created_at %> +
    • + + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> + +
    • + <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> +
    • +
    • + <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> +
    • + <% end%> + <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> + +
    • + <%= render :partial => 'student_work_praise' %> +
    • + <% end%> +
      + +
    • + 编程代码: +
      +
      +
      +
      +
    • + +
    • + + 测试结果: + +
      + <% work.student_work_tests.each_with_index do |test, index| %> +
      +

      + 第<%= work.student_work_tests.count - index%>次测试 +

      + + <%= test.created_at.to_s(:db) %> + +
      +
      + <% if test.status.to_i == -2 %> +
      + <%= test.results.first %> +
      + <% else %> +
      +
        + <% test.results.each_with_index do |x, i| %> +
      • + 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: +
        <%=x["result"]%>
        + 正确输出: +
        <%=x["output"]%>
        +
        + <% else %> + 测试正确! +
        + <% end %> +
      • + <% end %> +
      +
      + <% end %> + <% end %> +
      +
    • + +
    • + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> + +
      + <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> +
      + <% 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 %> -
      -
    • - 上交时间: - <%=format_time work.created_at %> -
    • - - <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> - -
    • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %> -
    • -
    • - <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%> -
    • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %> - -
    • - <%= render :partial => 'student_work_praise' %> -
    • - <% end%> -
      - - - - <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> -
      -
    • - 参与人员: - <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> - <% members = work.student_work_projects.where("is_leader = 0") %> - <% members.each do |member| if !members.empty? %> - 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> - <% end %> - <% end %> -
    • - <% if @homework.homework_detail_group.base_on_project == 1 %> -
    • - 关联项目: - <% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> - <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - <% else %> - <%=work.project.name %> - <% end %> - <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - (综合评分:<%=work.project.project_score.score.to_i %>) -
    • - <% end %> - <% end%> - -
    • - 内容: -
      - <%= text_format(work.description) if work.description%> -
      -
      -
    • -
    • - 附件: - <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> - <% if com_attachments.empty?%> - 尚未提交附件 - <% else%> -
      - <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %> -
      - <% end%> -
      -
    • -
    • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%> - -
      - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
      - <% 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/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb index d82aea7f9..21928492e 100644 --- a/app/views/student_work/_student_work_attachment_form.html.erb +++ b/app/views/student_work/_student_work_attachment_form.html.erb @@ -3,7 +3,7 @@
    - <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn mb0' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn mb0' %> <%= file_field_tag 'attachments[dummy][file]', :id => "_file#{work.id}", :class => 'file_selector', diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 371334be1..df89f31eb 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -80,8 +80,8 @@ $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>"); <% end %> <% end %> + $('#score_<%= work.id%>').peSlider({range: 'min'}); <% end %> - $('#score_<%= work.id%>').peSlider({range: 'min'}); <% 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 e8d4f144b..6a8591197 100644 --- a/app/views/student_work/_work_attachments_status.html.erb +++ b/app/views/student_work/_work_attachments_status.html.erb @@ -1,8 +1,16 @@ <% attachments.each_with_index do |attachment,i| %>
    - <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + + + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%> + + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author && status != 2 %> - (<%= number_to_human_size attachment.filesize %>) + (<%= number_to_human_size attachment.filesize %>) + + <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= format_time(attachment.created_on) %> +
    <% end -%> \ No newline at end of file diff --git a/app/views/student_work/_work_edit_information.html.erb b/app/views/student_work/_work_edit_information.html.erb index 38670d9e4..1934d15eb 100644 --- a/app/views/student_work/_work_edit_information.html.erb +++ b/app/views/student_work/_work_edit_information.html.erb @@ -13,7 +13,15 @@ <%= "无附件"%> <% else %>
    - <%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %> + <% @student_work.attachments.each_with_index do |attachment,i| %> +
    + <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %> + (<%= number_to_human_size attachment.filesize %>) +
    +
    + <% end -%> + <%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
    <% end %>

    diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb index bc728ca71..d23f21c4d 100644 --- a/app/views/student_work/_work_information.html.erb +++ b/app/views/student_work/_work_information.html.erb @@ -13,7 +13,15 @@ <%= "无附件"%> <% else %>
    - <%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %> + <% @student_work.attachments.each_with_index do |attachment,i| %> +
    + <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %> + (<%= number_to_human_size attachment.filesize %>) +
    +
    + <% end -%> + <%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
    <% end %>

    diff --git a/app/views/student_work/cancel_relate_project.js.erb b/app/views/student_work/cancel_relate_project.js.erb index 3aa853a00..f5caf2e8f 100644 --- a/app/views/student_work/cancel_relate_project.js.erb +++ b/app/views/student_work/cancel_relate_project.js.erb @@ -1,7 +1,7 @@ <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); <% else%> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%"); <% end %> \ No newline at end of file diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index 67a1ccb50..1dea5965f 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -1,24 +1,24 @@ -<% if @has_commit %> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>'); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("anonymos"); -<% elsif @submit_result%> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("anonymos"); -<% else %> - window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>'; -<% end %> - -function clickCanel() { - hideModal('#popbox02'); - window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; +<% if @has_commit %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("anonymos"); +<% elsif @submit_result%> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("anonymos"); +<% else %> + window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>'; +<% end %> + +function clickCanel() { + hideModal('#popbox02'); + window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; } \ No newline at end of file diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index cb8e7edf9..f72faaac2 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -1,118 +1,118 @@ -
    -
    编辑作品
    -
    -
    - -
    - -
    -
    - - - 截止时间:<%= @homework.end_time%> - -
    - - <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> - -
    -
    - <%= @homework.description.html_safe %> -
    -
    -
    -
    - -
    - <%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%> -
    - 提示:作品名称和描述中不要出现真实的姓名信息 -
    -
    - <% if @homework.homework_type == 3 %> - - - <% str = User.current.id.to_s%> - <% @work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> - <% str += ','+pro.user_id.to_s %> - <% end %> - <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %> - <% end %> -
    - -
    -

    -
    -
    - - -
    -

    -
    - -
    - <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %> -
    - - <% if @homework.homework_type == 3 %> - - <% end %> - -
    - 确定 - - <%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%> -
    -
    - <% end%> -
    -
    - +
    +

    + + +
    + <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %> +
    + + <% if @homework.homework_type == 3 %> + + <% end %> + +
    + 确定 + + <%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%> +
    +
    + <% end%> + + + \ No newline at end of file diff --git a/app/views/student_work/forbidden_anonymous_comment.js.erb b/app/views/student_work/forbidden_anonymous_comment.js.erb index 47dfb4b51..d869cba58 100644 --- a/app/views/student_work/forbidden_anonymous_comment.js.erb +++ b/app/views/student_work/forbidden_anonymous_comment.js.erb @@ -1,7 +1,7 @@ <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% end %> \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index b314bcf6d..41ec2b61b 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -30,7 +30,7 @@ $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); - $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); + $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); } $(function(){ @@ -166,7 +166,7 @@
    - <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @homework} %>
    diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index bd13fb7c1..99c317314 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,177 +1,177 @@ - - - -
    -
    提交作品
    -
    -
    - -
    - -
    -
    - - - 截止时间:<%= @homework.end_time%> - -
    - - <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> - -
    -
    - <%= @homework.description.html_safe %> -
    -
    - <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> -
    -
    -
    -
    -
    - -
    - <%= form_for(@student_work, - :html => { :multipart => true }, - :url => {:controller => 'student_work', - :action => 'create', - :homework => @homework.id - },:remote=>true ) do |f| %> -
    - 提示:作品名称和描述中不要出现真实的姓名信息 -
    -
    - <% if @homework.homework_type == 3 %> - - - <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> - <% end %> -
    - <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %> -
    -

    -
    -
    - <%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%> - -
    -

    -
    - -
    - <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %> -
    -
    -
    -
    -
    - - <% if @homework.homework_type == 3 %> - - <% end %> - - - - - -
    - 提交 - - <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%> -
    -
    - <% end%> -
    + + + +
    +
    提交作品
    +
    +
    + +
    + +
    +
    + + + 截止时间:<%= @homework.end_time%> + +
    + + <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> + +
    +
    + <%= @homework.description.html_safe %> +
    +
    + <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> +
    +
    +
    +
    +
    + +
    + <%= form_for(@student_work, + :html => { :multipart => true }, + :url => {:controller => 'student_work', + :action => 'create', + :homework => @homework.id + },:remote=>true ) do |f| %> +
    + 提示:作品名称和描述中不要出现真实的姓名信息 +
    +
    + <% if @homework.homework_type == 3 %> + + + <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> + <% end %> +
    + <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %> +
    +

    +
    +
    + <%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%> + +
    +

    +
    + +
    + <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %> +
    +
    +
    +
    +
    + + <% if @homework.homework_type == 3 %> + + <% end %> + + + + + +
    + 提交 + + <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%> +
    +
    + <% end%> +
    \ No newline at end of file diff --git a/app/views/student_work/set_score_rule.js.erb b/app/views/student_work/set_score_rule.js.erb index 52a13f632..fa1308873 100644 --- a/app/views/student_work/set_score_rule.js.erb +++ b/app/views/student_work/set_score_rule.js.erb @@ -1,8 +1,8 @@ clickCanel(); <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% end %> diff --git a/app/views/student_work/student_work_project.js.erb b/app/views/student_work/student_work_project.js.erb index 405dccca4..217a68422 100644 --- a/app/views/student_work/student_work_project.js.erb +++ b/app/views/student_work/student_work_project.js.erb @@ -1,8 +1,8 @@ hideModal("#popbox02"); <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); <% else%> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%"); <% end %> \ No newline at end of file diff --git a/app/views/student_work/update.js.erb b/app/views/student_work/update.js.erb index f485cb8cc..9dc381e42 100644 --- a/app/views/student_work/update.js.erb +++ b/app/views/student_work/update.js.erb @@ -1,16 +1,16 @@ -<% if @submit_result%> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("anonymos"); -<% else %> -window.location.href = '<%= edit_student_work_url(@work)%>'; -<% end %> - -function clickCanel() { - hideModal('#popbox02'); - window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; +<% if @submit_result%> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("anonymos"); +<% else %> +window.location.href = '<%= edit_student_work_url(@work)%>'; +<% end %> + +function clickCanel() { + hideModal('#popbox02'); + window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; } \ No newline at end of file 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_create.html.erb b/app/views/users/_course_create.html.erb index a5544ab07..dc1e0ee81 100644 --- a/app/views/users/_course_create.html.erb +++ b/app/views/users/_course_create.html.erb @@ -17,13 +17,9 @@
    <%= link_to activity.name, course_path(activity.id,:host=>Setting.host_course), :class => "postGrey" %>
    -
    +
    创建时间:<%= format_time(activity.created_at) %>
    -
    - 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %> -
    -
    -
    -
    - <%= activity.description.html_safe %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> +
    @@ -130,58 +127,88 @@ <% if activity.student_works.count != 0 %> <% sw = activity.student_works.reorder("created_at desc").first %>
    - <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 + # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
    <% end %>
    <% if activity.student_works.count != 0 %> <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> - <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> <% unless student_work_scores.empty? %> <% last_score = student_work_scores.first %> -
    - <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品 +
    +

    # <%=time_from_now last_score.created_at %> + <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行: +

    + <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %> + <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %> + <% student_works.each_with_index do |sw, i| %> +
    + <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> + + + <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> +

    分数:<%=format("%.1f",score<0 ? 0 : score) %>分

    +
    + <% if i == 4 %> + <% break %> + <% end %> + <% end %> + <% if student_works.count > 5 %> + <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> + <% end %> +
    <% end %> <% end %>
    <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %> -
    <% projects = activity.student_work_projects.where("is_leader = 1") %> -
    - 已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> -
    -
    - <% projects.each do |pro| %> - <% project = Project.find pro.project_id %> - + -
    - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> +
    + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> + <% end %> + <% com_time = project.project_score.commit_time %> + <% time=project.updated_on %> + <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> +

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>  <%= project.project_score.changeset_num %>提交

    +
    + 项目名称:<%=project.name %>
    + 创建者:<%=(User.find project.user_id).show_name %>(组长)
    + 更新时间:<%=time_from_now time %> +
    +
    + <% if i == 9 && projects.count > 10 %> + 更多>> + <% end %> + <% if i > 9 && i == (projects.count - 1) %> + 收回<< + <% end %> <% end %> - <% time=project.updated_on %> - <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

    <%=(User.find project.user_id).show_name %>(组长)

    -

    <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

    -
    - 项目名称:<%=project.name %>
    - 创建者:<%=(User.find project.user_id).show_name %>(组长)
    - 更新时间:<%=time_from_now time %> -
    <% end %> -
    <% end %>
    <% if is_teacher%> @@ -228,7 +255,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -269,7 +296,7 @@ <%= format_time(comment.created_on) %> <% if comment.user == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> @@ -299,8 +326,8 @@ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %> +
    -

    @@ -313,5 +340,13 @@
    diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index affc4cf36..6b28fb568 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -94,8 +94,8 @@ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> +
    -

    diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index d8268d698..7e8a24bb2 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,15 +1,23 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> - <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> + <% if activity.status == 1 %> + <%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %> + <% else %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> + <% end %>
    - <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% if activity.status == 1 %> + 确实团队 <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% end %> <% end %> TO <%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%> @@ -35,15 +43,20 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
    -
    + <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %> + <% if activity.status == 1 %> + <%= activity.created_on.year %> + + <%= activity.created_on.month %> + + <%= activity.created_on.day %> + + <% end %>
    @@ -74,9 +87,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" %>
  • @@ -97,7 +108,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -139,7 +150,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> @@ -165,8 +176,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%> +
    -

    @@ -180,6 +191,4 @@ <% end %>
    - + diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index ddad08279..15dd486ec 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -27,11 +27,7 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <%= activity.description.html_safe %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
    @@ -39,6 +35,31 @@
    <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
    +
    +
      +
    • + <% if User.current.logged? %> +
        +
      • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
      • +
      • + <%= link_to( + l(:button_edit), + {controller:'news', :action => 'edit', :id => activity.id}, + :class => 'postOptionLink' + ) if User.current.allowed_to?(:manage_news, activity.course) %> +
      • +
      • + <%= delete_link( + news_path(activity), + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if User.current.allowed_to?(:manage_news, activity.course) %> +
      • +
      + <% end %> +
    • +
    +
    @@ -49,7 +70,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -90,7 +111,7 @@ <%= format_time(comment.created_on) %> <% if comment.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> @@ -112,8 +133,8 @@
    <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> +
    -

    @@ -125,6 +146,3 @@
    - diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index c3eda8303..970fb516e 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -34,11 +34,7 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <%= activity.polls_description.html_safe %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.polls_description} %>
    @@ -59,6 +55,3 @@ <% end %> - 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/_homework_type_notice.html.erb b/app/views/users/_homework_type_notice.html.erb new file mode 100644 index 000000000..4dda65e49 --- /dev/null +++ b/app/views/users/_homework_type_notice.html.erb @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb new file mode 100644 index 000000000..c18e520ba --- /dev/null +++ b/app/views/users/_intro_content.html.erb @@ -0,0 +1,18 @@ +
    +
    + <%= content.to_s.html_safe%> +
    +
    + \ No newline at end of file diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb new file mode 100644 index 000000000..d36d9cee0 --- /dev/null +++ b/app/views/users/_jour_form.html.erb @@ -0,0 +1,20 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + +<%= error_messages_for 'message' %> +
  • + <%= text_area :quote,:quote,:style => 'display:none' %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :content, :editor_id => 'jour_content_editor', + :width => '99.7%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'jour_content', + :class => 'talk_text fl', + :maxlength => 5000 } + %> +
    +

    +
  • +
    diff --git a/app/views/users/_project_create.html.erb b/app/views/users/_project_create.html.erb index ae25312f3..0e35bca25 100644 --- a/app/views/users/_project_create.html.erb +++ b/app/views/users/_project_create.html.erb @@ -19,13 +19,9 @@
    <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
    -
    +
    创建时间:<%= format_time(project.created_on) %>
    -
    - 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %> -
    -
    -
    -
    - <% if activity.description? %> - <%= textAreailizable activity, :description, :attachments => activity.attachments %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> + <%# 局部刷新:修改xissue属性 %> + <% if User.current.member_of?(activity.project) %> + <% unless params[:action] == "index" %> +
    + <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> +
    <% end %> -
    -
    + <% end %>
    @@ -67,96 +69,7 @@
    - <% count = activity.journals.count %> -
    -
    -
    回复 - <%= count>0 ? "(#{count})" : "" %> - - <% if activity.author == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> - <% end %> - -
    -
    <%#= format_date(activity.updated_on) %>
    - <% if count > 3 %> - - <% end %> -
    - - <% replies_all_i = 0 %> - <% if count > 0 %> -
    -
      - <% activity.journals.reorder("created_on desc").each do |reply| %> - - <% replies_all_i=replies_all_i + 1 %> -
    • -
      - <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> -
      -
      -
      - <% if reply.try(:user).try(:realname) == ' ' %> - <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= format_time(reply.created_on) %> - - <% if reply.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> - <% end %> - -
      -
      - <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -

      <%= string %>

      - <% end %> - <% end %> -

      <%= reply.notes.html_safe %>

      -
      -
      -
      -
    • - <% end %> -
    -
    - <% end %> - -
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    -
    -
    - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> - - -
    - -
    -

    - <% end%> -
    -
    -
    -
    -
    - +
    + <%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
    - diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb new file mode 100644 index 000000000..1235b4e53 --- /dev/null +++ b/app/views/users/_project_issue_detail.html.erb @@ -0,0 +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_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb new file mode 100644 index 000000000..adebd74ad --- /dev/null +++ b/app/views/users/_project_issue_reply.html.erb @@ -0,0 +1,89 @@ +<% count = activity.journals.count %> +
    +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
    +
    <%#= format_date(activity.updated_on) %>
    + <% if count > 3 %> + + <% end %> +
    + + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% activity.journals.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i + 1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> +
      +
      +
      + <% if reply.try(:user).try(:realname) == ' ' %> + <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> + + <% if reply.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> + <% end %> + +
      +
      + <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

      <%= string %>

      + <% end %> + <% end %> +

      <%= reply.notes.html_safe %>

      +
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %> + +
    + + +
    +

    + <% end%> +
    +
    +
    +
    +
    + +
    \ 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 75940b32c..30183c4d1 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -36,15 +36,12 @@ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
    -
    + <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
    @@ -74,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" %>
  • @@ -96,7 +91,7 @@ <%= count>0 ? "(#{count})" : "" %> <% if activity.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> <% end %> @@ -134,7 +129,7 @@ <%= format_time(reply.created_on) %> <% if reply.author == User.current %> - + <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %> @@ -157,8 +152,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
    -

    @@ -170,6 +165,3 @@ - diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 3ea1479c5..9e02c4cf4 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -1,29 +1,145 @@ -
    -
    +
    +
    - 用户头像
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
    - - -
    - -
    截止时间:2015-08-20
    +
    + <% if @ctivity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %> +
    + + <% if activity.sticky == 1%> + 置顶 + <% end%> +
    +
    + 发布时间:<%= format_time(activity.created_on) %>
    -
    (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    -
    -
    \ No newline at end of file + <% count=activity.comments.count %> +
    +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
    +
    <%#= format_date(activity.updated_on) %>
    + <%if count>3 %> + + <% end %> +
    + + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% activity.comments.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> +
      +
      +
      + <% if comment.try(:author).try(:realname) == ' ' %> + <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> + + <% if comment.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + +
      +
      + <%= comment.comments.html_safe %>
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + +
    + + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    +
    diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 5a712b857..792db7546 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -1,7 +1,7 @@
    发送到
    - @@ -13,7 +13,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <% end %>
    diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index f15c29e90..33fa03061 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -2,7 +2,7 @@
    发送到
    - @@ -18,7 +18,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index af7bd5bd3..74265cabb 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -4,7 +4,7 @@
    发送到
    - @@ -20,7 +20,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> 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/_share_news_to_course.html.erb b/app/views/users/_share_news_to_course.html.erb new file mode 100644 index 000000000..144792201 --- /dev/null +++ b/app/views/users/_share_news_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_news_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_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb new file mode 100644 index 000000000..794c6db89 --- /dev/null +++ b/app/views/users/_share_news_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_news_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_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb new file mode 100644 index 000000000..37bac105a --- /dev/null +++ b/app/views/users/_share_news_to_project.html.erb @@ -0,0 +1,54 @@ +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= 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_news_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..004c8fec4 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|%> -
      -
    • - -
    • - -
    -
    - 创建时间:<%= format_date homework.created_at%> -
    -<% end%> \ No newline at end of file +<% homeworks.each do |homework| %> +
      + +
    • + <% case homework.homework_type %> + <% when 1 %> + 普通 + <% when 2 %> + 编程 + <% when 3 %> + 分组 + <% end %> +
    • +
    • <%= homework.quotes %>
    • + +
    • <%=format_date homework.publish_time %>
    • +
    +<% end %> + \ No newline at end of file diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index 935cc4513..d2b3f286d 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -1,27 +1,52 @@ -
    -
    -
    导入作业
    +
    +
    选用题库中的题目
    +
    + 公共题库 + 我的题库 +
    + <%=render :partial=>'homework_search_input', :locals=>{:type=>@type} %> +
    +
    +
    +
      + +
    • 类型
    • +
    • 引用数
    • +
    • 贡献者
    • +
    • 发布时间
    • +
    +
    + <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %> + +
    + <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%> +
    + <% end %> +
    + 选用 +
    +
    + 取消 +
    +
    +
      + <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%> +
    +
    +
    - -
    - <%= form_tag user_search_homeworks_user_path(User.current.id), :multipart => true, :remote => true, :class => "coursesSearchBox" do%> - - - <% end%> +
    + <%=render :partial=>'homework_detail_information', :locals=>{:homework=>nil} %>
    - <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %> - -
    - <%= render :partial => 'users/show_user_homework_form', :locals => {:user_homeworks => @user_homeworks}%> -
    -
    -
    - 确定 -
    -
    - 取消 -
    -
    - <% end%>
    -
    \ No newline at end of file +
    + diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 62752bdf5..0e55c246c 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -16,6 +16,7 @@ $(this).children(".userCard").css("display","none"); }) $(".userCard").mouseover(function(){ + $(this).css("display","block"); }) $(".userCard").mouseout(function(){ @@ -37,18 +38,7 @@ }) }) - + <% user_activities.each do |user_activity| if user_activities %> <% unless user_activity.act_type == "ProjectCreateInfo" %> @@ -111,7 +101,7 @@ <% case user_activity.act_type.to_s %> <% when 'JournalsForMessage' %> <% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %> - <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>1} %> <% end %> <% end %> <% end %> diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 3ce0926a8..244951dfa 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -15,7 +15,7 @@
    - <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id), :class => "postGrey" %> + <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
    <% if activity.sticky == 1%> 置顶 @@ -33,11 +33,7 @@ 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <%= activity.content.html_safe %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
    @@ -50,10 +46,16 @@
    <% count=activity.children.count %>
    -
    -
    -
    - 回复(<%= count %>) +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> +
    <%#= format_date(activity.updated_on) %>
    <%if count>3 %> @@ -88,6 +90,13 @@ <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> + + <% if comment.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> +
    <%= comment.content.html_safe %>
    @@ -111,8 +120,8 @@ +
    -

    @@ -126,5 +135,13 @@
    diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index a815d85e7..48c303a29 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -16,7 +16,7 @@

    提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计。

    取消 diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 5f4cb4a8e..673cee0e1 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -72,11 +72,15 @@ 上传附件 <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%> <% if defined?(has_program) && has_program %> - 编程 - +
    + 编程 + +
    <% end %> <% if defined?(has_group) && has_group %> - 分组 +
    + 分组 +
    <% end %>
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index af48e2a21..01673d164 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -1,318 +1,354 @@ -<% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %> -
    -
    -
    - <%=link_to image_tag(url_to_avatar(homework_common.user),width:"50px", height: "50px"), user_activities_path(homework_common.user.id)%> -
    -
    -
    - <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%> - TO - <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%> -
    - - - <% if homework_common.homework_detail_manual%> - <% if homework_common.homework_detail_manual.comment_status == 0 %> - 未发布 - <% elsif homework_common.homework_detail_manual.comment_status == 1%> - <% if homework_common.anonymous_comment == 0%> - 未开启匿评 - <% else %> - 匿评已禁用 - <% end %> - <% if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%> - 作品提交中 - <% elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %> - 作品补交中 - <% end %> - <% elsif homework_common.homework_detail_manual.comment_status == 2%> - <% if homework_common.anonymous_comment == 0%> - 匿评中 - <% else %> - 匿评已禁用 - <% end %> - 教师评阅中 - <% elsif homework_common.homework_detail_manual.comment_status == 3%> - <% if homework_common.anonymous_comment == 0%> - 匿评已结束 - <% else %> - 匿评已禁用 - <% end %> - 教师评阅中 - <% end%> - <% end%> -
    - <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%> - 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! - <% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%> - 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! - <% end %> -
    - <% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(homework_common.course) %> - <% projects = cur_user_projects_for_homework homework_common %> - <% works = cur_user_works_for_homework homework_common %> - <% if works.nil? && projects.nil? %> -
    - <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %> - <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %> -
    - <% elsif works.nil? %> -
    - <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %> -
    - <% end %> - <% end %> -
    - <%= user_for_homework_common homework_common,is_teacher %> -
    - <% if homework_common.homework_type == 2 && is_teacher%> -
    - <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> -
    - <% end %> - <% if homework_common.homework_type == 2%> -
    - 语言: - <%= homework_common.language_name%> -
    - <% end %> - <% if homework_common.homework_type == 3 && homework_common.homework_detail_group%> -
    - 分组人数:<%=homework_common.homework_detail_group.min_num %>-<%=homework_common.homework_detail_group.max_num %> 人 -
    - <% end %> - <% if homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status < 2 %> -
    提交截止时间:<%= homework_common.end_time.to_s %> 23:59
    - <% elsif homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status >= 2 %> -
    匿评截止时间:<%= homework_common.homework_detail_manual.evaluation_end.to_s %> 23:59
    - <% end %> - <% if homework_common.homework_detail_manual.comment_status == 0 %> -
    - <%= l(:label_publish_time)%>:<%= homework_common.publish_time%> 00:00 -
    - <% end %> -
    -
    -
    - <%= homework_common.description.html_safe %> -
    -
    -
    - - -
    -
    - <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => homework_common} %> -
    -
    -
    - 迟交扣分:<%= homework_common.late_penalty%>分 -
    - <% if homework_common.anonymous_comment == 0%> -
    - 匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%> 00:00 -
    - <% end %> -
    -
    -
    -
    - 缺评扣分:<%= homework_common.homework_detail_manual.absence_penalty%>分/作品 -
    - <% if homework_common.anonymous_comment == 0%> -
    - 匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%> 23:59 -
    - <% end %> -
    -
    - <% if homework_common.student_works.count != 0 %> - <% sw = homework_common.student_works.reorder("created_at desc").first %> -
    - <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 -
    - <% end %> -
    - <% if homework_common.student_works.count != 0 %> - <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %> - <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> - <% unless student_work_scores.empty? %> - <% last_score = student_work_scores.first %> -
    - <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品 -
    - <% end %> - <% end %> -
    - <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %> -
    - <% projects = homework_common.student_work_projects.where("is_leader = 1") %> -
    - 已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> -
    -
    - <% projects.each do |pro| %> - <% project = Project.find pro.project_id %> - -
    - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %> - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %> - <% end %> - <% time=project.updated_on %> - <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

    <%=(User.find project.user_id).show_name %>(组长)

    -

    <%=time_from_now time %>  <%= project.project_score.changeset_num %>提交

    -
    - 项目名称:<%=project.name %>
    - 创建者:<%=(User.find project.user_id).show_name %>(组长)
    - 更新时间:<%=time_from_now time %> -
    -
    - <% end %> -
    - <% end %> -
    - <% if is_teacher%> - <% comment_status = homework_common.homework_detail_manual.comment_status%> -
    -
      -
    • -
        -
      • - <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%> -
      • -
      • - <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> -
      • -
      • - <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %> -
      • - <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%> -
      • - <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%> -
      • - <% end %> - <% if homework_common.anonymous_comment == 0%> -
      • - <%= homework_anonymous_comment(homework_common, is_in_course) %> -
      • - <% end %> - <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> -
      • - <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%> -
      • - <% end %> -
      -
    • -
    -
    - <% end%> -
    -
    -
    - - <% count=homework_common.journals_for_messages.count %> -
    -
    -
    回复 - <%= count>0 ? "(#{count})" : "" %> - - <% if homework_common.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%> - <% end %> - -
    -
    - <%if count>3 %> - - <% end %> -
    - - <% replies_all_i = 0 %> - <% if count > 0 %> -
    -
      - <% homework_common.journals_for_messages.reorder("created_on desc").each do |comment| %> - - <% replies_all_i = replies_all_i + 1 %> -
    • -
      - <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> -
      -
      -
      - <% if comment.try(:user).try(:realname) == ' ' %> - <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= format_time(comment.created_on) %> - <% if comment.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - <% end %> - - -
      -
      - <%= comment.notes.html_safe %>
      -
      -
      -
    • - <% end %> -
    -
    - <% end %> - -
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
    -
    -
    - <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%> - <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %> - <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %> - -
    - -
    -

    - <% end%> -
    -
    -
    -
    -
    -
    -
    - + +
    + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %> + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %> + <% end %> + <% com_time = project.project_score.commit_time %> + <% time=project.updated_on %> + <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> +

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>  <%= project.project_score.changeset_num %>提交

    +
    + 项目名称:<%=project.name %>
    + 创建者:<%=(User.find project.user_id).show_name %>(组长)
    + 更新时间:<%=time_from_now time %> +
    +
    + <% if i == 9 && projects.count > 10 %> + 更多>> + <% end %> + <% if i > 9 && i == (projects.count - 1) %> + 收回<< + <% end %> + <% end %> +
    + <% end %> + <% end %> +
    + <% if is_teacher%> + <% comment_status = homework_common.homework_detail_manual.comment_status%> +
    +
      +
    • +
        +
      • + <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%> +
      • +
      • + <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> +
      • +
      • + <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %> +
      • + <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%> +
      • + <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%> +
      • + <% end %> + <% if homework_common.anonymous_comment == 0%> +
      • + <%= homework_anonymous_comment(homework_common, is_in_course) %> +
      • + <% end %> + <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> +
      • + <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%> +
      • + <% end %> +
      +
    • +
    +
    + <% end%> +
    +
    +
    + + <% count=homework_common.journals_for_messages.count %> +
    +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if homework_common.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%> + <% end %> + +
    +
    + <%if count>3 %> + + <% end %> +
    + + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% homework_common.journals_for_messages.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> +
      +
      +
      + <% if comment.try(:user).try(:realname) == ' ' %> + <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> + <% if comment.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + + +
      +
      + <%= comment.notes.html_safe %>
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%> + <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %> + <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %> +
    + + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    +
    + \ No newline at end of file diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index d145dab90..0d542882a 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -9,11 +9,14 @@ } else { $("#anonymous_comment").attr('checked',false); } - $("#BluePopupBox a.BlueCirBtn").click(); + <% if edit_mode && homework.is_program_homework? %> + $("#BluePopupBox a.BlueCirBtn").click(); + <% end %> <% if edit_mode && homework.is_group_homework? %> - $("#GroupPopupBox a.group_btn").click(); + $("#GroupPopupBox a.group_save_btn").click(); <% end %> }); + var homework_description_editor; function checked_val() { if ($("#anonymous_comment").is(":checked")) { $("#anonymous_comment").val(1); @@ -21,10 +24,125 @@ $("#anonymous_comment").val(0); } } + function nh_reset_homework_form(params){ + if(params.textarea.html() != "") { + cancel_edit(); + } else { + params.form[0].reset(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + } + } + function init_homework_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = false; + checked_val(); + if(!regex_homework_name()){ + $("#homework_name").focus(); + } + else if(!regex_homework_end_time()){ + $("#homework_end_time").focus(); + } + else if(!regex_homework_end_publish_time()){ + $("#homework_end_time").focus(); + } + else if(!regex_course_id()){ + $("#course_id").focus(); + } + else{ + params.textarea.html(params.editor.html()); + params.editor.sync(); + is_checked = true; + } + /*var is_checked = nh_check_field({ + issubmit:true, + content:params.editor, + contentmsg:params.contentmsg, + textarea:params.textarea + });*/ + if(is_checked){ + if(flag){ + return true; + }else{ + $(this)[0].submit(); + return false; + } + } + return false; + }); + } + function init_homework_editor(params){ + params.textarea.removeAttr('placeholder'); + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px", + items : ['code','emoticons','fontname', + 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', + 'formatblock', 'fontsize', '|','indent', 'outdent', + '|','imagedirectupload','table', 'media', 'preview',"more" + ], + afterChange:function(){//按键事件 + var edit = this.edit; + var body = edit.doc.body; + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150)); + }, + afterCreate:function(){ + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + var edit = this.edit; + var body = edit.doc.body; + edit.html(params.textarea.innerHTML); + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150)); + + } + }).loadPlugin('paste'); + return editor; + } + KindEditor.ready(function(K){ + $("div[nhname='homework_common_form']").each(function(){ + var params = {}; + params.kindutil = K; + params.div_form = $(this); + params.form = $("form",params.div_form); + if(params.form==undefined || params.form.length==0){ + return; + } + params.textarea = $("textarea[nhname='homework_textarea']",params.div_form); + params.cancel_btn = $("#new_message_cancel_btn"); + params.submit_btn = $("#new_message_submit_btn"); + if(params.textarea.data('init') == undefined) { + params.editor = init_homework_editor(params); + homework_description_editor = params.editor; + init_homework_form(params); + params.submit_btn.click(function () { + params.form.submit(); + }); + params.cancel_btn.click(function () { + reset_homework(); + nh_reset_homework_form(params); + }); + params.textarea.data('init', 1); + } + }); + }); <% end %>
    +

    @@ -32,7 +150,10 @@
    - <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%> + <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%> + <% unless edit_mode %> + + <% end %> <% if edit_mode %> <% end %> @@ -64,10 +185,12 @@
    <% if edit_mode %> - <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %> + + <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %> <% else %> <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %> - <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %> + + <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %> <% end %>
    @@ -83,17 +206,16 @@ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
    -
    <% if edit_mode %> - 确定 + 确定 <%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%> - 取消 + 取消 <% else %> - 发送 + 发送 - 取消 + 取消 <% end %>
    @@ -131,10 +253,16 @@
    -