diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index c7aa42b9e..e1e99447d 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -548,7 +548,8 @@ class AdminController < ApplicationController #作业 def homework - @homework = HomeworkCommon.order('end_time desc') + #@homework = HomeworkCommon.order('end_time desc') + @homework = HomeworkCommon.order( 'created_at desc ') @homework = paginateHelper @homework,30 @page = (params['page'] || 1).to_i - 1 respond_to do |format| diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 9853b4dc1..1dacffb6f 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -70,8 +70,8 @@ class AttachmentsController < ApplicationController def direct_download @attachment.increment_download send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), - :type => detect_content_type(@attachment), - :disposition => 'attachment' #inline can open in browser + :type => detect_content_type(@attachment), + :disposition => 'attachment' #inline can open in browser end def direct_download_history @@ -175,7 +175,7 @@ class AttachmentsController < ApplicationController @attachment = Attachment.find(params[:attachmentid]) if @attachment != nil filedense = params[:newtype].to_s - # d = Iconv.conv("unicodebig","utf-8",filedense) + # d = Iconv.conv("unicodebig","utf-8",filedense) if filedense == "%E5%85%AC%E5%BC%80" #l(:field_is_public) @attachment.is_public = 1 else @@ -210,9 +210,9 @@ class AttachmentsController < ApplicationController if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size]) if stale?(:etag => thumbnail) send_file thumbnail, - :filename => filename_for_content_disposition(@attachment.filename), - :type => detect_content_type(@attachment), - :disposition => 'inline' + :filename => filename_for_content_disposition(@attachment.filename), + :type => detect_content_type(@attachment), + :disposition => 'inline' end else # No thumbnail for the attachment or thumbnail could not be created @@ -292,10 +292,10 @@ class AttachmentsController < ApplicationController respond_to do |format| if !@attachment.container.nil? && - (@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) && - @attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && - @attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon) || - @attachment.container.is_a?(StudentWork)) + (@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) && + @attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && + @attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon) || + @attachment.container.is_a?(StudentWork)) if @attachment.container.is_a?(News) format.html { redirect_to_referer_or news_path(@attachment.container) } elsif @attachment.container.is_a?(StudentWorksScore) @@ -327,25 +327,25 @@ class AttachmentsController < ApplicationController elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgDocumentComment) format.html {redirect_to_referer_or org_document_comment_path(@attachment.container)} else - if @project.nil? - format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) } - else + if @project.nil? + format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) } + else format.html { redirect_to_referer_or project_path(@project) } - end + end end format.js - end + end end def delete_homework - @bid = @attachment.container.bid - # Make sure association callbacks are called - container = @attachment.container - @attachment.container.attachments.delete(@attachment) - #if container.attachments.empty? - #container.delete - #end + @bid = @attachment.container.bid + # Make sure association callbacks are called + container = @attachment.container + @attachment.container.attachments.delete(@attachment) + #if container.attachments.empty? + #container.delete + #end respond_to do |format| format.html { redirect_to_referer_or respond_path(@bid) } @@ -594,7 +594,7 @@ class AttachmentsController < ApplicationController end end -private + private def find_project @attachment = Attachment.find(params[:id]) # Show 404 if the filename in the url is wrong @@ -608,7 +608,7 @@ private @attachment.container.board.course) @course = @attachment.container.board.course else - unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork' + unless @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork' @project = @attachment.project end end @@ -628,7 +628,7 @@ private def read_authorize if @attachment.container_type == "HomeworkAttach" || @attachment.container_type == 'Bid' - true + true #User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access else @attachment.visible? ? true : deny_access @@ -654,14 +654,16 @@ private def renderTag @attachmentNew = Attachment.find(params[:attchmentId]) - respond_to do |format| + respond_to do |format| format.js end end def has_login - unless @attachment && @attachment.container_type == "PhoneAppVersion" - 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) + unless @attachment && @attachment.container_type == "Organization" + unless @attachment && @attachment.container_type == "PhoneAppVersion" + 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 end diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 7220eec27..0224a587d 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -71,18 +71,18 @@ class BlogCommentsController < ApplicationController @course.save redirect_to course_path(:id=>params[:course_id]) else - @article.children.delete - @article.delete + @article.children.destroy + @article.destroy redirect_to user_blogs_path(:user_id=>User.current) end else#如果是回复被删, if params[:course_id] #如果带了course_id过来了,那么这是要跳到课程大纲去的 - @article.delete + @article.destroy redirect_to syllabus_course_path(:id=>params[:course_id]) else root = @article.root - @article.delete + @article.destroy redirect_to user_blog_blog_comment_path(:user_id=>root.author_id,:blog_id=>root.blog_id,:id=>root.id) end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index c8518e8a3..a77346d89 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -70,31 +70,16 @@ class BoardsController < ApplicationController def show # 讨论区消息状态更新(已读和未读) if @project - query_forge_messages = @board.messages - query_forge_messages.each do |query_forge_message| - query = query_forge_message.forge_messages - query.each do |forge_message| - if User.current.id == forge_message.user_id - forge_message.update_attributes(:viewed => true) - end - end - end + ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true) # 更新@消息为已读 - @project.boards.each do |board| - board.messages.each do |m| - User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!} - end - end + # 注释掉这句是因为和上面的方法代码重复,一个类型的消息,已经更新就不需要再更新 + # @project.boards.each do |board| + # board.messages.each do |m| + # User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!} + # end + # end elsif @course - query_course_messages = @board.messages - query_course_messages.each do |query_course_message| - query = query_course_message.course_messages - query.each do |course_message| - if User.current.id == course_message.user_id - course_message.update_attributes(:viewed => true) - end - end - end + CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true) end sort_init 'updated_on', 'desc' diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index dfa30915e..af02829e0 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -851,8 +851,6 @@ class CoursesController < ApplicationController # render_403 # return # end - # 统计访问量 - @course.update_attribute(:visits, @course.visits.to_i + 1) #更新创建课程消息状态 create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0) create_course_messages.update_all(:viewed => true) @@ -1079,7 +1077,7 @@ class CoursesController < ApplicationController sql_select = "" if groupid == 0 sql_select = "SELECT members.*,( - SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) + SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, 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} @@ -1091,7 +1089,7 @@ class CoursesController < ApplicationController WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" else sql_select = "SELECT members.*,( - SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) + SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, 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/controllers/files_controller.rb b/app/controllers/files_controller.rb index 7ae1b85f8..cf94da8d9 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -458,10 +458,16 @@ class FilesController < ApplicationController if params[:in_project_toolbar] @in_project_toolbar = params[:in_project_toolbar] end - # 发送邮件 attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type]) if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') + # 发送邮件 Mailer.run.attachments_added(attachments[:files]) + # 生成动态 + attachments[:files].each do |file| + ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment") + end + # 更新资源总数, 根据上传的附件数累加 + @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil? end # end if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array) @@ -485,11 +491,6 @@ class FilesController < ApplicationController end end end - # 更新资源总数, 根据上传的附件数累加 - unless @project.project_score.nil? - @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) - end - # end # TODO: 临时用 nyan sort_init 'created_on', 'desc' sort_update 'created_on' => "#{Attachment.table_name}.created_on", @@ -622,6 +623,36 @@ class FilesController < ApplicationController @attachtype = 0 @contenttype = 0 + respond_to do |format| + format.js + # format.html { + # redirect_to org_subfield_files_url(@org_subfield) + # } + end + # 组织添加附件,为了修改图片 + elsif params[:organization_id] + @organization = Organization.find(params[:organization_id]) + @addTag=false + # atttchment_type = 0为logo 1为banner + if params[:logo] + attachments = Attachment.attach_filesex(@organization, params[:attachments], false) + else + attachments = Attachment.attach_filesex(@organization, params[:attachments], true) + end + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" + + @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)] + + show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + @attachtype = 0 + @contenttype = 0 + respond_to do |format| format.js # format.html { diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 17111b3f3..b1d16debb 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -37,16 +37,6 @@ class MessagesController < ApplicationController # Show a topic and its replies def show -=begin - if @course - topic_id = params[:r]?params[:r]:params[:id] - parent_id = params[:id] - url = course_boards_path(@course,:topic_id => topic_id,:parent_id=>parent_id); - redirect_to url - return; - end -=end - @isReply = true page = params[:page] # Find the page of the requested reply @@ -54,16 +44,7 @@ class MessagesController < ApplicationController offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i]) page = 1 + offset / REPLIES_PER_PAGE end - @reply_count = @topic.children.count - # @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page - # @replies = @topic.children. - # includes(:author, :attachments, {:board => :project}). - # reorder("#{Message.table_name}.created_on DESC"). - # limit(@reply_pages.per_page). - # offset(@reply_pages.offset). - # all - @reply = Message.new(:subject => "RE: #{@message.subject}") if @course messages_replies = @topic.children. diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index ba4c1f18f..661073cdc 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -11,7 +11,7 @@ class OrgSubfieldsController < ApplicationController sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+ "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'" if SubfieldSubdomainDir.find_by_sql(sql).count == 0 - SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir]) + SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase) end end @subfield.update_attributes(:field_type => params[:field_type]) @@ -130,6 +130,12 @@ class OrgSubfieldsController < ApplicationController @organization = @org_subfield.organization end + def update_status + @subfield = OrgSubfield.find(params[:id]) + @organization = Organization.find(@subfield.organization_id) + @subfield.update_attributes(:status => params[:status]) + end + def show_attachments obj @attachments = [] obj.each do |container| diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 239253d82..457b3bfa1 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -28,18 +28,25 @@ class OrganizationsController < ApplicationController helper :project_score helper :issues include UsersHelper - before_filter :find_organization, :only => [:show, :members, :apply_subdomain] + before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout] layout 'base_org' def index end + + def new @organization = Organization.new render :layout => 'new_base' end def edit - @organization = Organization.find(params[:id]) + # @organization = Organization.find(params[:id]) + begin + @organization = Organization.where("id =?", params[:id]) + ensure + render_404 + end end def destroy @@ -56,6 +63,7 @@ class OrganizationsController < ApplicationController @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.show_mode = 0 @organization.creator_id = User.current.id member = OrgMember.new(:user_id => User.current.id) @@ -67,50 +75,170 @@ class OrganizationsController < ApplicationController end def show - if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) - @organization = Organization.find(params[:id]) - # 统计访问量 - @organization.update_attribute(:visits, @organization.visits.to_i + 1) - if params[:org_subfield_id] - @org_subfield = OrgSubfield.find(params[:org_subfield_id]) - @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 - @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + # 组织新类型 show_mode:判断标准 1为新类型,0为旧 + if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:list] .nil? + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + # REDO:时间紧,暂时先这样 + @org_logo_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 0).order("created_on desc").first + @org_banner_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 1).order("created_on desc").first + + @subfield_content = @organization.org_subfields.order("priority") + @organization = Organization.find(params[:id]) + # 统计访问量 + @organization.update_column(:visits, @organization.visits.to_i + 1) + + # @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + # @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 + # @org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + + shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) + shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) + project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0 + course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0 + course_types = "('Message','News','HomeworkCommon','Poll','Course')" + @project_acts = get_project_activities_org @organization, project_ids + @course_acts = get_course_activities_org @organization, course_ids + #@org_acts = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc') + #@project_acts = OrgActivity.where("(container_id =? and container_type =?) " + + # "or (container_type ='Project' and org_act_type in ('Issue','Message') and container_id in (#{project_ids.join(',')})) ", + # @organization.id, 'Organization').order('updated_at desc').limit(8) + + #@course_acts = OrgActivity.where("(container_id =? and container_type =?) " + + # "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", + # @organization.id, 'Organization').order('updated_at desc').limit(8) + + + + # 项目两种动态 + #@project_acts = get_project_activities_org @organization + + # 课程动态 + #@project_acts_issues = get_project_activities_org @organization + #@course_acts = get_course_activities_org @organization + + render :layout => 'base_org_newstyle' else - shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) - shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) - project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0 - course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0 - course_types = "('Message','News','HomeworkCommon','Poll','Course')" - case params[:type] - when nil - @org_activities = OrgActivity.where("(container_id =? and container_type =?) " + - "or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+ - "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", - @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) - when 'project_issue' - @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'project_message' - @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'org' - @org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_homework' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_news' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_message' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_poll' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - end + render_403 end - @page = params[:page] ? params[:page].to_i : 1 - respond_to do |format| - format.html - format.js + else + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + @organization = Organization.find(params[:id]) + # 统计访问量 + @organization.update_column(:visits, @organization.visits.to_i + 1) + if params[:org_subfield_id] + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 + @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + else + shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) + shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) + project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0 + course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0 + course_types = "('Message','News','HomeworkCommon','Poll','Course')" + case params[:type] + when nil + @org_activities = OrgActivity.where("(container_id =? and container_type =?) " + + "or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+ + "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", + @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + when 'project_issue' + @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'project_message' + @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'org' + @org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_homework' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_news' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_message' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_poll' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + end + end + @page = params[:page] ? params[:page].to_i : 1 + respond_to do |format| + format.html + format.js + end + else + render_403 end + end + + end + + def get_project_message_activities_org org + project_ids = org.projects.map{|project| project.id}.join(",") + unless project_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'Message' order by updated_at desc limit 2;") else - render_403 + project_acts = nil + end + end + + def get_project_issue_activities_org org + project_ids = org.projects.map{|project| project.id}.join(",") + unless project_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;") + else + project_acts = nil + end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;") + end + + # 获取整过项目的动态 + def get_project_activities_org org, project_ids + unless project_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids.join(',')}) and container_type = 'project' + and org_act_type in ('Message', 'Issue') order by updated_at desc limit 8;") + else + project_acts = nil + end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;") + end + + # 获取整过课程的动态 + def get_course_activities_org org, course_ids + unless course_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids.join(',')}) and container_type = 'course' + and org_act_type in ('HomeworkCommon', 'Poll', 'Message', 'News', 'Course') order by updated_at desc limit 8;") + else + project_acts = nil + end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 5;") + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;") + end + + def get_course_homework_activities_org org + course_ids = org.courses.map{|course| course.id}.join(",") + unless course_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;") + else + project_acts = nil + end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 5;") + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;") + end + + def get_course_message_activities_org org + course_ids = org.courses.map{|course| course.id}.join(",") + unless course_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'Message' order by updated_at desc limit 1;") + else + project_acts = nil + end + end + + def get_course_news_activities_org org + course_ids = org.courses.map{|course| course.id}.join(",") + unless course_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'News' order by updated_at desc limit 1;") + else + project_acts = nil end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'News' order by updated_at desc limit 1;") end def update @@ -120,12 +248,17 @@ class OrganizationsController < ApplicationController # @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.show_mode = params[:show_mode] #@organization.name = params[:organization][:name] @organization.save respond_to do |format| + if @organization.show_mode == 1 + format.html { redirect_to organization_path(@organization)} + else format.html { redirect_to setting_organization_path(@organization)} end end + end def check_uniq @check = false; @@ -157,11 +290,6 @@ class OrganizationsController < ApplicationController end end - - def clear_org_avatar_temp - - end - def set_homepage @org = Organization.find(params[:id]) @org.home_id = params[:home_id] @@ -224,8 +352,13 @@ class OrganizationsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end - sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+ - "and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})" + if User.current.admin? + sql = "select courses.* from courses where courses.is_public = 1 and courses.name like '#{condition}'"+ + "and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id}) and courses.is_delete=0" + else + sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.is_public = 1 and courses.name like '#{condition}'"+ + "and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id}) and courses.is_delete=0" + end #user_courses = Course.find_by_sql(sql) @courses = Course.find_by_sql(sql) # @added_course_ids = @organization.courses.map(&:id) @@ -268,8 +401,13 @@ class OrganizationsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end - sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" + - " and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})" + if User.current.admin? + sql = "select projects.* from projects where projects.status != 9 and projects.is_public = 1 and projects.name like '#{condition}'" + + " and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id}) and status=1" + else + sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.is_public = 1 and projects.name like '#{condition}'" + + " and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id}) and status=1" + end #user_projects = Course.find_by_sql(sql) @projects = Course.find_by_sql(sql) # @added_course_ids = @organization.projects.map(&:id) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2ced977be..5c8d194b9 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -295,34 +295,34 @@ class ProjectsController < ApplicationController def show # 更新消息为已读 update_message_status(User.current, @project) + # over if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return end - # 统计访问量 - @project.update_attribute(:visits, @project.visits.to_i + 1) + # over @author = params[:user_id].blank? ? nil : User.active.find(params[:user_id]) @page = params[:page] ? params[:page].to_i + 1 : 0 # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? case params[:type] when nil - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo', 'Attachment')",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'issue' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'news' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'message' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'attachment' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) end else - @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public - = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc") - .page(params['page'|| 1]).per(10); + @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10); + end + g = Gitlab.client + unless @project.gpid.nil? + @static_total_per_user = g.rep_stats(@project.gpid) end - boards = @project.boards.includes(:last_message => :author).all - @topic_count = @project.boards.count # 根据对应的请求,返回对应的数据 respond_to do |format| format.html @@ -560,18 +560,9 @@ class ProjectsController < ApplicationController end def update_message_status(user, project) - project_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite") - project_invite_messages.each do |project_invite_message| - project_invite_message.update_attribute(:viewed, true) - end - #更新被加入项目消息的viewed字段 - join_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "JoinProject") - join_project_messages.each do |join_project| - join_project.update_attribute(:viewed, true) - end - #更新被移出项目消息的viewed字段 - remove_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "RemoveFromProject") - remove_project_messages.update_all(:viewed => true) + # 更新加入项目消息 + project__messages = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'JoinProject', 'RemoveFromProject') and user_id =? and project_id =? ", user, project) + project__messages.update_all(:viewed => true) unless project__messages.blank? end def message_invite(message_id, key) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 9bb6055ee..82a6196cb 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -30,7 +30,7 @@ class RepositoriesController < ApplicationController menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers] default_search_scope :changesets - before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo] + before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats] before_filter :find_repository, :only => [:edit, :update, :destroy, :committers] before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked] before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] @@ -332,7 +332,7 @@ update # end #if( !User.current.member_of?(@project) || @project.hidden_repo) - @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? + # @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? # :name, :path, :kind, :size, :lastrev, :changeset @entries = @repository.entries(@path, @rev) @@ -348,24 +348,25 @@ update # (show_error_not_found; return) unless @entries g = Gitlab.client @changesets = g.commits(@project.gpid, :ref_name => @rev) - # @changesets = @repository.latest_changesets(@path, @rev) - # @changesets_count = @repository.latest_changesets(@path, @rev).count + # 总的提交数 @changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count # 访问该页面的是会后则刷新 if @project.project_score.nil? ProjectScore.create(:project_id => @project.id, :score => false) end + # 刷新改页面的时候,更新统计数 if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0 update_commits_count(@project, @changesets_all_count) end # end + # 最近一次提交 @changesets_latest_coimmit = @changesets[0] unless @changesets[0].blank? update_commits_date(@project, @changesets_latest_coimmit) end + @creator = User.where("id =?", @project.user_id).first.try(:login) @properties = @repository.properties(@path, @rev) @repositories = @project.repositories - @course_tag = params[:course] project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT ip = RepositoriesHelper::REPO_IP_ADDRESS gitlab_address = Redmine::Configuration['gitlab_address'] @@ -374,11 +375,7 @@ update else @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s end - if @course_tag == 1 - render :action => 'show', :layout => 'base_courses' - else - render :action => 'show', :layout => 'base_projects' - end + render :action => 'show', :layout => 'base_projects' end end @@ -390,7 +387,7 @@ update g = Gitlab.client limit = 20 #每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来 - @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s) + @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:@rev) #add by hx #rep_count = commit_count(@project) @@ -565,10 +562,24 @@ update end def stats - @project_id = params[:id] - @repository_id = @repository.identifier - # 提交次数统计 - @status_commit_count = Changeset.count(:conditions => ["#{Changeset.table_name}.repository_id = ?", @repository.id]) + if @project.gpid.nil? + render 404 + return + end + project_id = @project.gpid + # @repository_id = @repository.identifier + # creator = params[:creator] + rev = params[:rev] + g = Gitlab.client + begin + @static_total_per_user = g.rep_stats(project_id, :rev => rev) + @static_total_per_user + # @static_month__per_user = g.rep_stats(project_id, :rev => rev, :creator => creator, :period => 2) + # @static_week_per_user = g.rep_stats(project_id, :rev => rev, :creator => creator, :period => 3) + rescue + render_404 + return + end render :layout => 'base_projects' end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index a698823e5..36a48f2a3 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -5,14 +5,14 @@ class StudentWorkController < ApplicationController include ApplicationHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment] before_filter :is_logged, :only => [:index] - ### + ### def program_test is_test = params[:is_test] == 'true' resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')} @@ -49,13 +49,127 @@ class StudentWorkController < ApplicationController resultObj[:time] = student_work_test.created_at.to_s(:db) resultObj[:index] = student_work.student_work_tests.count end - end end render :json => resultObj end + #行尾空格替换成□ + def space_replace_1(str) + for i in 0 .. str.size + tChar = str[i] + if tChar != ' ' && tChar != "\n" + sFlag = false + eFlag = false + elsif tChar == ' ' && sFlag == false + tStart = i + sFlag = true + elsif tChar == "\n" + tEnd = i - 1 + if sFlag == true + for j in tStart .. tEnd + str[j] = "□" + end + sFlag = false + end + end + end + end + +#由于负载问题 不要使用全局变量 +#根据传入的tIndex确定是第几次测试 +#之后如果觉得很卡 可以改成将结果传回JS再以参数形式传回来 + def program_test_ex + is_test = params[:is_test] == 'true' + resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T'),tseq:1,tcount:1,testid:1} #保存每测试一次返回的结果 + + student_work = find_or_save_student_work(is_test) + + resultObj[:tcount] = @homework.homework_tests.size + + unless student_work + resultObj[:status] = 100 + else + if @homework.homework_type == 2 && @homework.homework_detail_programing + #找到第index个测试的输入输出 + index = params[:tIndex].to_i + resultObj[:tseq] = index + test = @homework.homework_tests[index - 1] + + #请求测试 + result = test_realtime_ex(test, params[:src]) + + if result["status"].to_i != -2 + #result["results"].first['output'] = result["results"].first['output'].gsub(" ","□") + #result["results"].first['result'] = result["results"].first['result'].gsub(" ","□") + space_replace_1(result["results"].first['output']) + space_replace_1(result["results"].first['result']) + end + + logger.debug result + + #-1 默认值 0全部正确并结束 2 超时 -2 编译错误 + resultObj[:status] = -1 + resultObj[:results] = result["results"].first #本次测试结果 + resultObj[:error_msg] = result["error_msg"] #编译错误时的信息 + + if result["status"].to_i == -2 #编译错误 + resultObj[:results] = result["error_msg"] + resultObj[:status] = -2 + elsif result["results"][0]["status"].to_i == 2 + resultObj[:status] = 2 + end + + unless student_work.save + resultObj[:status] = 200 + else + student_work.name = params[:title] + student_work.description = params[:src] + + if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + student_work.late_penalty = @homework.late_penalty + else + student_work.late_penalty = 0 + end + + #每次从数据库取出上次的结果加上本次的结果再存入数据库 + status = result["status"] + if index == 1 + student_work_test = student_work.student_work_tests.build(status: status, + results: [resultObj[:results]],src: params[:src]) + student_work_test.save! + resultObj[:testid] = student_work_test.id + else + #先从数据库取出result + student_work_test = StudentWorkTest.find(params[:testid]) + results = student_work_test.results + results << resultObj[:results] + student_work_test.results = results + student_work_test.status = (result["status"] != 0 ? result["status"] : student_work_test.status) + student_work_test.save! + status = student_work_test.status + resultObj[:testid] = student_work_test.id + end + + #超时或编译错误则直接返回了并存入数据库 + if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size + if status == 0 + resultObj[:status] = 0 + end + student_work.save! + resultObj[:time] = student_work_test.created_at.to_s(:db) + resultObj[:index] = student_work.student_work_tests.count + end + + #渲染返回结果 + render :json => resultObj + end + end + end + end + + def index # 作业消息状态更新 @homework.course_messages.each do |homework_message| @@ -63,6 +177,13 @@ class StudentWorkController < ApplicationController homework_message.update_attributes(:viewed => true) if homework_message.viewed == 0 end end + + #修改作品提示消息更新 + student_work_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, StudentWork.name, 0) + student_work_messages.each do |message| + message.update_attribute(:viewed, true) + end + # 作品打分消息状态更新 studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0) studentworks_scores.each do |studentworks_score| @@ -230,12 +351,12 @@ class StudentWorkController < ApplicationController render_403 return end - @student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count end @score = @b_sort == "desc" ? "asc" : "desc" - + # 消息传过来的ID + @message_student_work_id = params[:student_work_id] respond_to do |format| format.js format.html @@ -369,6 +490,8 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + #如果学生作品被打分后修改,应该给老师提示 + send_message_to_teacher(@work) if @homework.homework_type == 3 @student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0) @@ -457,7 +580,7 @@ class StudentWorkController < ApplicationController end end end - redirect_to user_homeworks_user_path(User.current.id) + redirect_to student_homeworks_user_path(User.current.id) end def retry_work @@ -987,7 +1110,6 @@ class StudentWorkController < ApplicationController student_work end - def test_realtime(student_work, src) url = "#{Redmine::Configuration['judge_server']}api/realtime_test.json" @@ -1011,6 +1133,28 @@ class StudentWorkController < ApplicationController JSON.parse(res.body) end + def test_realtime_ex(test, src) + url = "#{Redmine::Configuration['judge_server']}api/realtime_test.json" + + factor = [] + factor << {input: test.input, output: test.output} + + solutions = { + src:src, + language:@homework.homework_detail_programing.language, + factor: factor + } + uri = URI(url) + body = solutions.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Post.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + JSON.parse(res.body) + end + #成绩计算 def set_final_score homework,student_work if homework && homework.homework_detail_manual diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 52a610bc5..8e08508ed 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -119,49 +119,46 @@ class UsersController < ApplicationController # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count case params[:type] when nil + # 系统消息为管理员发送,我的消息中包含有系统消息 @message_alls = [] - messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user, "SystemMessage", "SystemMessage").order("created_at desc") + messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc") messages.each do |message_all| @message_alls << message_all.message end when 'unviewed' @message_alls = [] - messages = MessageAll.where("user_id =?", @user).order("created_at desc") + messages = MessageAll.where("user_id =?", @user.id).includes(:message).order("created_at desc") messages.each do |message_all| # 在点击或者刷新消息列表后未读的消息存放在数组 if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0 @message_alls << message_all.message end end - #课程相关消息 when 'homework' - @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user).order("created_at desc") + @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user.id).order("created_at desc") when 'course_message' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user.id).order("created_at desc") when 'course_news' # 课程通知包含发布的通知和回复的通知 - @message_alls = CourseMessage.where("course_message_type in (?, ? ,?)", "News", "Comment", "Course").where("user_id =?", @user).order("created_at desc") + @message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =?", @user.id).order("created_at desc") when 'poll' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") - + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user.id).order("created_at desc") #项目相关消息 when 'issue' - @message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc") + @message_alls = ForgeMessage.where("forge_message_type in ('Issue', 'Journal') and user_id =?" , @user.id).order("created_at desc") when 'forge_message' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user.id).order("created_at desc") when 'forge_news' - @message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user).order("created_at desc") + @message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user.id).order("created_at desc") when 'apply' - @message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user).order("created_at desc") - + @message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user.id).order("created_at desc") #贴吧消息 when 'forum' - @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") - + @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user.id).order("created_at desc") #用户留言 when 'user_feedback' - @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user.id).order("created_at desc") else render_404 return @@ -717,6 +714,7 @@ class UsersController < ApplicationController end student_work.save + send_message_to_teacher(student_work) homework.update_attributes(:updated_at => Time.now) update_course_activity(homework.class,homework.id) update_user_activity(homework.class,homework.id) @@ -838,8 +836,8 @@ class UsersController < ApplicationController render_403 return end - user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} + user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 @@ -888,11 +886,11 @@ class UsersController < ApplicationController def user_ref_resource_search search = params[:search].to_s.strip.downcase if(params[:type].blank? || params[:type] == "1") #全部 - user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询 + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询 @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','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 (filename like '%#{search}%') ").order("created_on desc") elsif params[:type] == "2" #课程资源 - user_course_ids = User.current.courses.map { |c| c.id} + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && 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(',')})) and (filename like '%#{search}%') ").order("created_on desc") elsif params[:type] == "3" #项目资源 @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc") @@ -1124,13 +1122,13 @@ class UsersController < ApplicationController #显示更多用户课程 def user_courses4show @page = params[:page].to_i + 1 - @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) + @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) end #显示更多用户项目 def user_projects4show @page = params[:page].to_i + 1 - @projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5).offset(@page * 5) + @projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5).offset(@page * 5) end def user_course_activities @@ -1208,18 +1206,14 @@ class UsersController < ApplicationController end def show - # 统计访问量 - unless User.current == @user - @user.update_attribute(:visits, @user.visits.to_i + 1) - end #更新用户申请成为课程老师或教辅消息的状态 if params[:course_id] != nil join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?", params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false) join_course_messages.update_all(:viewed => true) end - shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) - shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) + shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) + shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) @page = params[:page] ? params[:page].to_i + 1 : 0 user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" @@ -1255,7 +1249,13 @@ class UsersController < ApplicationController end else # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) - blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + # 减少数据库交互 + watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(',')) + user_ids = "(" + @user.id.to_s + watched_user_ids + ")" + watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") + blog_ids = "(" + watched_user_blog_ids + ")" + @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + @@ -1577,16 +1577,14 @@ class UsersController < ApplicationController # 上传用户资源 def user_resource_create - user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} + user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} @user = User.find(params[:id]) # 保存文件 attach = Attachment.attach_filesex_public(@user, params[:attachments], params[:attachment_type], is_public = true) @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" @score = @b_sort == "desc" ? "asc" : "desc" - user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 @@ -1616,8 +1614,10 @@ class UsersController < ApplicationController @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) end end + @status = params[:status] @type = params[:type] + @path = user_resource_user_path(User.current, :type => @type) @limit = 25 @is_remote = true @atta_count = @attachments.count @@ -1675,6 +1675,7 @@ class UsersController < ApplicationController end @status = params[:status] @type = params[:type] + @path = user_resource_user_path(User.current, :type => @type) @limit = 25 @is_remote = true @atta_count = @attachments.count @@ -1699,6 +1700,7 @@ class UsersController < ApplicationController .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 } end @search = params[:search] + @type = params[:type] #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] @@ -1717,6 +1719,7 @@ class UsersController < ApplicationController @projects = @user.projects.visible end @search = params[:search] + @type = params[:type] #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids @@ -1813,11 +1816,41 @@ class UsersController < ApplicationController else @flag = false end + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + user_project_ids = User.current.projects.map {|p| p.id} 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") + if(params[:type].blank? || params[:type] == "1") # 我的资源 + # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 + if params[:status] == "2" + @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources(params[:id], @order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources(params[:id], @order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + end + elsif params[:type] == "6" # 公共资源 + if params[:status] == "2" + @attachments = get_course_resources_public( user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources_public(user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources_public(@order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources_public(@order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) + end + end @type = params[:type] @limit = 25 + @path = user_resource_user_path(User.current, :type => @type) @user = User.current @is_remote = true @atta_count = @attachments.count @@ -1924,11 +1957,42 @@ class UsersController < ApplicationController else @flag=true end + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + user_project_ids = User.current.projects.map {|p| p.id} 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") + if(params[:type].blank? || params[:type] == "1") # 我的资源 + # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 + if params[:status] == "2" + @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources(params[:id], @order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources(params[:id], @order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + end + elsif params[:type] == "6" # 公共资源 + if params[:status] == "2" + @attachments = get_course_resources_public( user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources_public(user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources_public(@order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources_public(@order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) + end + end + @status = params[:status] @type = params[:type] @limit = 25 + @path = user_resource_user_path(User.current, :type => @type) @user = User.current @is_remote = true @atta_count = @attachments.count @@ -2022,11 +2086,41 @@ class UsersController < ApplicationController else @flag=true end + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + user_project_ids = User.current.projects.map {|p| p.id} 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") + if(params[:type].blank? || params[:type] == "1") # 我的资源 + # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 + if params[:status] == "2" + @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources(params[:id], @order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources(params[:id], @order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + end + elsif params[:type] == "6" # 公共资源 + if params[:status] == "2" + @attachments = get_course_resources_public( user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources_public(user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources_public(@order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources_public(@order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) + end + end @type = params[:type] @limit = 25 + @path = user_resource_user_path(User.current, :type => @type) @user = User.current @is_remote = true @atta_count = @attachments.count @@ -2369,7 +2463,7 @@ class UsersController < ApplicationController # 获取我的资源 def get_my_resources author_id, user_course_ids, user_project_ids, order, score - attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('OrgSubfield','Principal','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 and container_id is not null)" + "or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}") end @@ -2475,15 +2569,15 @@ class UsersController < ApplicationController # 资源库 分为全部 课程资源 项目资源 附件 def user_resource - @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" - @score = @b_sort == "desc" ? "asc" : "desc" # 别人的资源库是没有权限去看的 if User.current.id.to_i != params[:id].to_i render_403 return end - user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} + user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 @@ -2540,8 +2634,8 @@ class UsersController < ApplicationController @user = User.find(params[:id]) @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" @score = @b_sort == "desc" ? "asc" : "desc" - user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} # user_org_ids = User.current.organizations.map {|o| o.id} + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} + user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) @@ -2565,6 +2659,10 @@ class UsersController < ApplicationController end def import_resources_search + if User.current.id.to_i != params[:id].to_i + render_403 + return + end @resource_id = params[:mul_id] @resource_type = params[:mul_type] @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" @@ -2573,15 +2671,10 @@ class UsersController < ApplicationController @switch_search = params[:name].nil? ? " " : params[:name] search = "%#{@switch_search.strip.downcase}%" # 别人的资源库是没有权限去看的 - if User.current.id.to_i != params[:id].to_i - render_403 - return - end - @resource_id = params[:mul_id] if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 - user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} + user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search) elsif params[:type] == "6" # 公共资源 @@ -2661,8 +2754,8 @@ class UsersController < ApplicationController @user = User.current @switch_search = params[:search].nil? ? " " : params[:search] search = "%#{@switch_search.strip.downcase}%" - user_course_ids = User.current.courses.map {|c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} + user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} + user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') # 全部 if params[:status] == "2" @attachments = get_course_resources_search(params[:id], user_course_ids, @order, @score, search) @@ -2720,6 +2813,7 @@ class UsersController < ApplicationController name = "%"+name+"%" @orgs = User.current.organizations.where("name like ?", name) @user = User.current + @type = params[:type] respond_to do |format| format.html {render :layout => 'static_base'} format.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a5cdb1a1..366cea06b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,6 +33,10 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter + def update_visiti_count container + container.update_column(:visits, container.visits + 1) + end + # Time 2015-03-24 15:27:29 # Author lizanle # Description 从硬盘上删除对应的资源文件 @@ -764,7 +768,7 @@ module ApplicationHelper # 判断版本库是否初始为gitlab def rep_is_gitlab?(project) - rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") + rep = project.repositories.where("type =?", "Repository::Gitlab") return rep.blank? ? true :false end @@ -2104,6 +2108,8 @@ module ApplicationHelper attachment.container.board.course course = attachment.container.board.course candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) + elsif attachment.container.class.to_s=="Organization" + candown = true elsif attachment.container.class.to_s=="HomeworkAttach" candown = true elsif attachment.container.class.to_s=="StudentWorksScore" @@ -2137,6 +2143,20 @@ module ApplicationHelper end + #如果学生作品被打分后修改,应该给老师提示 + def send_message_to_teacher student_work + if StudentWork === student_work + if student_work.student_works_scores.any? + course = student_work.homework_common.course + course.members.map(&:user_id).uniq.each do|user_id| + if User.find(user_id).allowed_to?(:as_teacher, course) + student_work.course_messages << CourseMessage.new(:user_id => user_id, :course_id => course.id, :viewed => false, :status => 1) + end + end + end + end + end + private def wiki_helper @@ -3044,3 +3064,7 @@ def is_default_field? field (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default' end +def host_with_protocol + return Setting.protocol + "://" + Setting.host_name +end + diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 37c7deb4c..3a6b347b3 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -24,40 +24,20 @@ module CoursesHelper def find_excelletn_course keywords, current_course # 获取tag匹配结果ID a_tags = [] - # kc = keywords.to_a - Course.visible.where("is_excellent =? and is_public =?", 1, 1).each do |ec| + Course.where("is_excellent =? and is_public =?", 1, 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 + excellent_ids = a_tags.uniq.delete_if{|i| i == current_course.id} sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id - and c.is_excellent =1 and c.is_public = 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) + and (c.is_excellent =1 or c.excellent_option =1) and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;" + default_ids = Course.find_by_sql(sql).flatten.map { |c| c.id } + excellent_ids << default_ids.flatten + arr_result = excellent_ids.flatten.uniq.first(5) + excellent_courses = Course.find(arr_result) + return excellent_courses end # 判断精品课程是否可见,非课程成员无法查看私有课程 @@ -258,7 +238,7 @@ module CoursesHelper # 学生人数计算 # add by nwb def studentCount course - course ? course.student.count.to_s : 0#course.student.count + course ? course.student.count.to_i : 0#course.student.count end #课程成员数计算 @@ -293,12 +273,17 @@ module CoursesHelper def searchTeacherAndAssistant project #searchPeopleByRoles(project, TeacherRoles) members = [] - project.members.each do |m| + project.members.includes(:user).each do |m| members << m if m && m.user && m.user.allowed_to?(:as_teacher,project) end members end + def TeacherAndAssistantCount course + students_count = course.student.count + number = course.members.count - students_count + end + def search_student_in_group(project, course_group_id) #searchPeopleByRoles(project, StudentRoles) members = [] @@ -766,7 +751,7 @@ module CoursesHelper #加入课程、退出课程按钮 def join_in_course_header(course, user, options=[]) if user.logged? - joined = course.members.map{|member| member.user_id}.include? user.id + joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' @@ -865,7 +850,7 @@ module CoursesHelper # 学生按作业总分排序,取前8个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( - SELECT SUM(IF(student_works.final_score is null,null,IF(student_works.final_score = 0, 0, student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) + SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, 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/issues_helper.rb b/app/helpers/issues_helper.rb index 4ad3cb49d..1cd22558b 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -111,9 +111,9 @@ module IssuesHelper def principals_options_for_isuue_list(project) if User.current.member_of?(project) - project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0]) + project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0]) else - project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0]) + project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0]) end end diff --git a/app/helpers/org_member_helper.rb b/app/helpers/org_member_helper.rb index fd70a0516..e16051eaf 100644 --- a/app/helpers/org_member_helper.rb +++ b/app/helpers/org_member_helper.rb @@ -9,7 +9,7 @@ module OrgMemberHelper principals = paginateHelper scope,10 s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| - link_to text, org_member_autocomplete_org_member_index_path(parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js')), :remote => true + link_to text, host_with_protocol + "/org_member/org_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js').to_query, :remote => true } s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 69c355313..4faa802a5 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -1,6 +1,7 @@ # encoding: utf-8 module OrganizationsHelper include ApplicationHelper + include FilesHelper def find_user_not_in_current_org_by_name org @@ -28,4 +29,48 @@ module OrganizationsHelper end end + def get_message_org(org_id, field_id) + OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 8;") + end + + def get_message_reply_org(org_id, ids) + # OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id is not null order by updated_at desc limit 1;") + OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id in (#{ids}) order by updated_at desc limit 1;") + end + + def get_attach_org(field_id) + Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") + end + + def get_attach_org2(field) + org_attachments = field.attachments + attachments = User.current.admin? ? org_attachments : visable_attachemnts(org_attachments) + return attachments.sort_by{|x| x.created_on}.reverse.first(6) + # Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") + end + + # 从内容中获取路径 + def get_image_path_from_content content + r = Regexp.new(/src="\/files\/uploads\/image(.+?)"/) + if r.match(content).nil? + image_path = nil + else + image_path = r.match(content)[1] + end + end + + #排列下拉框 + def subfield_status_option + type = [] + option1 = [] + option1 << "列表" + option1 << "1" + type << option1 + option2 = [] + option2 << "图片" + option2 << "0" + type << option2 + type + end + end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index df5c872f8..4e11e153e 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -130,7 +130,7 @@ module StudentWorkHelper def revise_attachment_status homework, attach date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d") status = "" - if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time < date)) + if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time.to_s < date)) status = "此时其他同学作品已公开" else status = "此时其他同学作品尚未公开" diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 714da9920..754bd4dee 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -23,6 +23,7 @@ class Attachment < ActiveRecord::Base belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'" belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'" belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'" + belongs_to :organization, foreign_key: 'container_id', conditions: "attachements.container_type = 'Organization'" belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" @@ -90,7 +91,7 @@ class Attachment < ActiveRecord::Base @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") before_save :files_to_final_location - after_save :act_as_course_activity,:act_as_forge_activity + after_save :act_as_course_activity after_create :office_conver, :be_user_score,:create_attachment_ealasticsearch_index after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score diff --git a/app/models/member.rb b/app/models/member.rb index 9eac21fa7..e19e1f0df 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -158,7 +158,7 @@ class Member < ActiveRecord::Base end def student_work_score_sum - sql_select = "SELECT (SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))) as score + sql_select = "SELECT (SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, 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} diff --git a/app/models/organization.rb b/app/models/organization.rb index 248783a26..427cd4c10 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -8,6 +8,8 @@ class Organization < ActiveRecord::Base has_many :org_courses, :dependent => :destroy has_many :org_subfields, :dependent => :destroy has_many :users, :through => :org_members + has_many :files + acts_as_attachable validates_uniqueness_of :name after_create :save_as_org_activity, :add_default_subfields diff --git a/app/models/principal.rb b/app/models/principal.rb index dd376f609..0c87ec0c6 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -42,9 +42,9 @@ class Principal < ActiveRecord::Base if q.blank? where({}) else - pattern = "%#{q}%" + pattern = "%#{q}%".gsub("/","//").gsub("_","/_") # sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ") - sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p)" + sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) escape '/' or LOWER(login) LIKE LOWER(:p) escape '/' or LOWER(mail) LIKE LOWER(:p) escape '/'" params = {:p => pattern} if q =~ /^(.+)\s+(.+)$/ a, b = "#{$1}%", "#{$2}%" diff --git a/app/models/project.rb b/app/models/project.rb index 32677143d..184b3c7af 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -108,7 +108,8 @@ class Project < ActiveRecord::Base has_many :tags, :through => :project_tags, :class_name => 'Tag' has_many :project_tags, :class_name => 'ProjectTags' # 动态级联删除 - has_many :forge_activities, :class_name => 'ForgeActivity', :dependent => :destroy + has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + #has_many :forge_activities, :class_name => 'ForgeActivity', :as =>:forge_act, :dependent => :destroy # 关联虚拟表 has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy @@ -1212,9 +1213,7 @@ class Project < ActiveRecord::Base # Author lizanle # Description 新建项目要在ForgeActivities中加一条数据。 def acts_as_forge_activities - fa = ForgeActivity.new(:user_id => User.current.id,:project_id => self.id, - :forge_act_id => self.id,:forge_act_type => "ProjectCreateInfo") - fa.save! + self.forge_acts << ForgeActivity.new(:user_id => User.current.id, :project_id => self.id) end diff --git a/app/models/user.rb b/app/models/user.rb index 78d823ea7..2a9a13c73 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -339,13 +339,15 @@ class User < Principal message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on message_new_time.save end - course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - 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 - org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count + user = User.current + onclick_time = user.onclick_time.onclick_time + course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + system_messages_count = SystemMessage.where("created_at >?", onclick_time).count + at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count end diff --git a/app/views/admin/homework.html.erb b/app/views/admin/homework.html.erb index 7260d68ff..03472d0a0 100644 --- a/app/views/admin/homework.html.erb +++ b/app/views/admin/homework.html.erb @@ -22,24 +22,27 @@ 提交作品数 - 提交截止日期 + 作业发布日期 <%@count=@page*30 %> <% for homework in @homework do %> + <% unless homework.nil? %> <% @count+=1 %> <%=@count %> - <%=link_to(homework.name, student_work_index_path(:homework => homework.id))%> + <%=link_to(homework.try(:name), student_work_index_path(:homework => homework.id))%> + <% if homework.course %> <%= link_to(homework.course.name, course_path(homework.course.id)) %> + <% end %> <%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'> <% if homework.try(:user).try(:realname) == ' '%> <%= link_to(homework.try(:user), user_path(homework.user_id)) %> @@ -51,9 +54,10 @@ <%=link_to(StudentWork.where('homework_common_id=?',homework.id).count, student_work_index_path(:homework => homework.id))%> - <%=format_date(homework.end_time) %> + <%=format_date( homework.created_at ) %> + <% end %> <% end %> diff --git a/app/views/admin/organization.html.erb b/app/views/admin/organization.html.erb index 02b897f80..6fde09ede 100644 --- a/app/views/admin/organization.html.erb +++ b/app/views/admin/organization.html.erb @@ -24,7 +24,8 @@ "> - <%= link_to org.name,home_path(:organization => org.id) %> + <%#= link_to org.name,home_path(:organization => org.id) %> + <%= link_to org.name, organization_path(org) %> diff --git a/app/views/boards/_course_show_detail.html.erb b/app/views/boards/_course_show_detail.html.erb index bc7b9667e..d465571c5 100644 --- a/app/views/boards/_course_show_detail.html.erb +++ b/app/views/boards/_course_show_detail.html.erb @@ -2,20 +2,7 @@ <%= import_ke(enable_at: false, prettify: false) %> <%= javascript_include_tag "create_kindeditor" %> <% end %> - - -<% if topics%> +<% if topics %> <% topics.each do |topic| %> <% if topic %> - <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %> + <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id, :is_course => 1, :is_board=>1} %> <% end %> <% end %> <% if topics.count == 10 %> - <%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%> <% end %> <% end%> - diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 9dd5c78ca..6cc755b61 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -192,6 +192,4 @@ function nh_init_board(params){ }); } } - - diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index bdbcabff0..763748ad7 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -50,7 +50,7 @@ -<% course_activities.each do |activity| if course_activities %> +<% course_activities.includes(:course_act).each do |activity| if course_activities %> - <% if activity && activity.course_act%> + <% if activity && activity.course_act %> <% act = activity.course_act %> <% case activity.course_act_type.to_s %> <% when 'HomeworkCommon' %> diff --git a/app/views/courses/_course_activity_users.html.erb b/app/views/courses/_course_activity_users.html.erb new file mode 100644 index 000000000..a0cac45f7 --- /dev/null +++ b/app/views/courses/_course_activity_users.html.erb @@ -0,0 +1,59 @@ +<% unless contributor_course_scor(course.id).count == 0 %> + +<% end %> \ No newline at end of file diff --git a/app/views/courses/_course_heroes.html.erb b/app/views/courses/_course_heroes.html.erb new file mode 100644 index 000000000..5e9851594 --- /dev/null +++ b/app/views/courses/_course_heroes.html.erb @@ -0,0 +1,21 @@ +<% hero_homework_scores = hero_homework_score(course, "desc") %> +<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %> + +<% end %> \ No newline at end of file diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index a0c659493..1db2edf57 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -1,9 +1,8 @@ -<% unless excellent_course_recommend(course).length == 0 %> +<% exc_course = excellent_course_recommend(course) %> +<% unless exc_course.length == 0 %> + + + + + + + + + +
+
+
+
+ <% if User.current.admin_of_org?(@organization) %> + + <% else %> + + <% end %> + <%= render :partial => 'organizations/org_logined_header' %> +
+
+
+ + + + + + + + <% @subfield_content.each do |field| %> + <% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> +
+ <% if field.status == 0 %> +
+

课程动态

+ <% if @course_acts.blank? %> + +
+ <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% else %> +
+
    + <% unless @course_acts.nil? %> + <%= render :partial => 'organizations/org_new_course_pic', :locals => {:activities => @course_acts.first(3)} %> + <% end %> +
    + <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
    +
+
+ <% end %> +
+ <% else %> +
+

课程动态

+ <% if @course_acts.blank? %> + +
+ <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% else %> +
+ <%= render :partial => 'organizations/org_new_course_act_list', :locals =>{:activities => @course_acts, :field => field, :organization => @organization} %> + +
+
+ <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% end %> + + +
+ <% end %> +
+ <% when 'project' %> +
+ <% if field.status == 0 %> +
+

项目动态

+ <% if @project_acts.blank? %> + +
+ <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% else %> +
+
    + <% unless @project_acts.nil? %> + <%= render :partial => 'organizations/org_new_project_pic', :locals => {:activities => @project_acts.first(3)} %> + <% end %> +
    + <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
    +
+
+ <% end %> + +
+ <% else %> +
+

项目动态

+ <% if @project_acts.blank? %> + +
+ <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% else %> +
+ <%= render :partial => 'organizations/org_new_project_act_list', :locals =>{:activities => @project_acts, :field => field, :organization => @organization} %> + +
+
+ <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% end %> + +
+ <% end %> +
+ <% end %> + <% else %> + <% if field.field_type == "Post" %> <%# 讨论类型 %> + <% org_subfield = OrgSubfield.find(field.id) %> + <% org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0 %> + <% org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc') %> + <%# message_ats = get_message_org(@organization.id, field.id) %> + <%# ids = field.org_document_comments.map{|o| o.id}.join(",") %> +
+ <% if field.status == 0 %> +
+

<%= field.name %>

+ <% if org_acts.blank? %> + +
+ <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% else %> + <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> + <% else %> + <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> + + <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% else %> +
+
    + + <% org_acts.first(3).each do |act| %> + <%= render :partial => 'organizations/org_new_forum_pic', :locals => {:activity => act, :field => field, :organization => @organization} %> + <% end %> +
    +
+ <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% else %> + <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> + <% else %> + <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> + <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> +
+
+ <% end %> + +
+ <% else %> +
+

<%= field.name %>

+ <% if org_acts.blank? %> + +
+ <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% else %> + <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> + <% else %> + <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> +
+ <% else %> +
+ <% org_acts.each do |act| %> + <%= render :partial => 'organizations/org_new_forum_list', :locals => {:activity => act, :field => field, :organization => @organization} %> + <% end %> + +
+
+ <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% else %> + <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> + <% else %> + <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> + <% end %> +
+ <% end %> + +
+
+ <% end %> +
+ <% elsif field.field_type == "Resource" %> + <% org_attachs = get_attach_org2(field) %> +
+
+

<%= field.name %>

+ <% if org_attachs.blank? %> + +
+ <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %> + <% else %> + <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %> + <% end %> + <% else %> + <%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %> + <% end %> + <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% else %> +
+ <%= render :partial => 'organizations/org_new_resource', :locals => {:org_attachs => org_attachs} %> + +
+ +
+ <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %> + <% else %> + <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %> + <% end %> + <% else %> + <%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %> + <% end %> + <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> +
+ <% end %> + +
+
+
+
+ <% end %> + <% end %> + <% end %> + + + + +
+
+ Top + + + + +
+ + + + <%#= call_hook :view_layouts_base_body_bottom %> + + + diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 5ad25d5bd..44dfeeea2 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -29,7 +29,7 @@ showMathMenuMSIE: false, tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); - + @@ -44,8 +44,6 @@
- - <%#= render :partial => 'layouts/new_header'%>
@@ -74,6 +72,9 @@ <% end %>
+ <%# 更新访问数,刷新的时候更新访问次数 %> + <% update_visiti_count @project %> + <%# over %>
<% if @project.project_type == 0 %> <% unless static_project_score(@project.project_score) == 0 %> @@ -104,20 +105,6 @@
+ + <%# 更新访问数,刷新的时候更新访问次数 %> + <% update_visiti_count @user %> + <%# over %> +

@@ -204,7 +209,19 @@ <% end%> <% end%>

- <% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %> + <% if @user.courses.visible.count > 0 + course_order_ids = "(" + + CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM + (SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ") + GROUP BY ca.course_id) AS c + ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")" + courses = Course.where("id in #{course_order_ids}") + else + courses = [] + + end + %> + <%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
    <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %> @@ -217,7 +234,19 @@ <%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%> <% end%>
- <% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%> + <% if @user.projects.visible.count > 0 + project_order_ids = "(" + + ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM + (SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ") + GROUP BY fa.project_id) AS p + ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")" + projects = Project.where("projects.id in #{project_order_ids}") + else + projects = [] + end + %> + + <%# projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<% else %> @@ -42,6 +58,21 @@
  • 新增
  • +
  • + <% if field.field_type == "Resource" %> + 列表 + <% else %> + <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> +
    + +
    + <%= select( :name,:group_id, subfield_status_option, + { :include_blank => false,:selected => field.status}, + {:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %> + <% end %> + + <% end %> +
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>
  • <% end %> <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %> - <%= field.hide==0?"设为隐藏":"设为可见" %> + <%= field.hide==0?"隐藏":"可见" %> <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %> 编辑 @@ -68,6 +99,34 @@ <% end %> \ No newline at end of file diff --git a/app/views/organizations/show_org_subfield.js.erb b/app/views/organizations/show_org_subfield.js.erb index 165b07afd..78b404b6f 100644 --- a/app/views/organizations/show_org_subfield.js.erb +++ b/app/views/organizations/show_org_subfield.js.erb @@ -1,2 +1,2 @@ -$("#hide_<%= @org_subfield.id %>").text("设为隐藏"); +$("#hide_<%= @org_subfield.id %>").text("隐藏"); $("#org_subfield_<%= @org_subfield.id %>").css("display", "block"); \ No newline at end of file diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index f9faa26d6..bb6cdad0c 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -73,15 +73,14 @@ <% case activity.forge_act_type %> - <% when "ProjectCreateInfo" %> + <% when "Project" %> <%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %> <% when "Issue" %> <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %> - <% when "Message" %> - <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %> + <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %> <% when "News" %> <% if !activity.forge_act.nil? and activity.forge_act.project %> diff --git a/app/views/projects/_rep_static.html.erb b/app/views/projects/_rep_static.html.erb new file mode 100644 index 000000000..0522fd34e --- /dev/null +++ b/app/views/projects/_rep_static.html.erb @@ -0,0 +1,111 @@ +<%= javascript_include_tag 'highcharts','highcharts-more' %> +
    +
    +
    +
    + \ No newline at end of file diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index 733eacab4..b73ef647f 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -138,7 +138,7 @@ <% roles.each do |role| %>
  • - <%= radio_button_tag 'membership[role_ids][]', role.id %> + <%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "报告人员" || role.name == "Reporter" %> <% if User.current.language == "zh" %> <% if role.id == 3 %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index f2b6cadeb..63d7d583f 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -29,5 +29,12 @@
  • +
    +
    + <%= render :partial => "rep_static" %> +
    +
    +
    + <%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
    \ No newline at end of file diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 750a3c6ec..4dfa86538 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -24,7 +24,9 @@
    克隆网址:
    -
    ZIP
    +
    + <%=link_to "统计", stats_repository_project_path(:id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :creator => @creator ), :class => "fl vl_zip" %> +
    <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> <% if User.current.id != @project.user_id %>
    <%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %> diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index 0bce15069..4a8bd9217 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -1,30 +1,123 @@ -
    +<%= javascript_include_tag 'highcharts','highcharts-more' %> +

    <%= l(:label_statistics) %>

    -<% if @status_commit_count ==0 %> -
    该项目目前还没有提交过代码!
    +<% if false %> +
    请在版本库中提交代码,统计信息将更准确
    <% else %> -
    修订 是版本库的提交次数, 显示为橘红色。

    -
    变更 是对版本库中文件的修改次数, 显示为蓝色。
    +
    + <%= render :partial => 'navigation' %> +
    +
    + +
    +
    +
    +
    + -

    - <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %> -

    -

    - <%# 用户每月提交代码次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %> -

    -

    - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %> -

    -

    - <%# 用户最近六个月的提交次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %> -

    -

    - <%# 用户最近六个月的代码量 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %> -

    <%= link_to l(:button_back), :action => 'show', :id => @project %>

    <% html_title(l(:label_repository), l(:label_statistics)) -%> <% end %> \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 57dd786eb..0a3796758 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -63,7 +63,11 @@ <% if @homework.anonymous_comment == 0%>
  • - <%= student_work.student_score.nil? ? "未参与" : format("%.1f",student_work.student_score)%> + <% if student_work.student_score.nil? %> + 未参与 + <% else %> + <%=format("%.1f",student_work.student_score) %> + <% end %> <% unless student_work.student_score.nil?%> (<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>) diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 6bcda51da..997d28f6d 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -18,7 +18,7 @@ <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
  • - <%= render :partial => 'student_work_praise' %> + <%= render :partial => 'student_work_praise',:locals => {:work => work} %>
  • <% end%>
    @@ -53,21 +53,36 @@ <% else %>
      - <% test.results.each_with_index do |x, i| %> + + <% test.results.reverse.each_with_index do |x, i| %> + <% unless x.nil? %>
    • - 测试<%=i+1%> + 测试<%=test.results.size-i%> <% if x["status"].to_i != 0 %> - 测试错误! + <% if x["status"].to_i == 2 %> + 超时! + <% else %> + 测试错误! + <% end %> 您的输出: -
      <%=x["result"].force_encoding("UTF-8")%>
      +
      <%=x["result"].force_encoding("UTF-8")%> 
      正确输出: -
      <%=x["output"]%>
      + +
      <%=x["output"]%>
      + <% if x["status"].to_i == 2 %> + 耗时: +
      <%=x["time_used"]%>毫秒
      + <% end %>
      <% else %> - 测试正确! + + 测试正确! + +
      <% end %>
    • + <% end %> <% end %>
    diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 67c04d71f..dc2fdafb6 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -25,7 +25,7 @@ <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
  • - <%= render :partial => 'student_work_praise' %> + <%= render :partial => 'student_work_praise',:locals => {:work => work} %>
  • <% end%>
    diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index f9f55456b..8b2f57723 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -46,8 +46,8 @@ <% end%> diff --git a/app/views/users/_send_homework_to_course.html.erb b/app/views/users/_send_homework_to_course.html.erb index b19fbd1a8..67fd36c3c 100644 --- a/app/views/users/_send_homework_to_course.html.erb +++ b/app/views/users/_send_homework_to_course.html.erb @@ -1,4 +1,4 @@ -
    +
    发送到
    @@ -8,33 +8,9 @@
    - <%= form_tag send_homework_to_course_user_path(user),:remote=>true,:id=>'choose_course_list_form' %> -
    - <%= hidden_field_tag(:send_id, send_id) %> -
    - <% if !courses.empty? %> - <% courses.each do |course| %> -
      -
    • - -
    • -
    • <%= truncate(course.name,:lendght=>25) + '['+current_time_and_term(course) + ']'%>
    • -
    - <% end %> -
    -
    -
    - -
    -
    - 确定 -
    -
    - 取消 -
    +
    + <%= render :partial => "users/send_homework_to_course_form", :locals => {:user => user, :courses => courses, :send_id => send_id} %>
    -
    - <% end %>
    - <% unless user_activity.act_type == "ProjectCreateInfo" %> - <% act= user_activity.act %> - <% case user_activity.container_type.to_s %> - <% when 'Course' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'HomeworkCommon' %> - <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> - <% when 'News' %> - <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% when 'Message'%> - <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> - <% when 'Poll' %> - <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> - <% when 'Course'%> - <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => user_activity.id} %> - <% when 'JournalsForMessage'%> - <%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %> - <% end %> - <% end %> - <% when 'Project' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'Issue' %> - <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %> - <% when 'Message' %> - <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> - <% when 'ProjectCreateInfo'%> - <%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% end %> - <% end %> - <% when 'Principal' %> - <% if act %> - <% 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,:is_activity=>1} %> + <% if user_activity.act_type == "ProjectCreateInfo" %> + <%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %> + <% else %> + <% act= user_activity.act %> + <%if act %> + + <% case user_activity.container_type.to_s %> + <% when 'Course' %> + <% case user_activity.act_type.to_s %> + <% when 'HomeworkCommon' %> + <%# cache (act) do %> + <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> + <%# end %> + <% when 'News' %> + <%# cache [act, act.comments.count] do %> + <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <%# end %> + <% when 'Message'%> + <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> + <% when 'Poll' %> + <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> + <% when 'Course'%> + <%# cache (act) do %> + <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %> + <%# end%> + <% when 'JournalsForMessage'%> + <%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %> + <% end %> + <% when 'Project' %> + <% case user_activity.act_type.to_s %> + <% when 'Issue' %> + <%# cache [act, act.journals.count, act.attachments.count] do%> + <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %> + <%# end %> + <% when 'Message' %> + <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> + <% when 'ProjectCreateInfo'%> + <%# cache (act) do %> + <%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <%# end %> + <% end %> + <% when 'Principal' %> + <% 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,:is_activity=>1} %> + <% end %> + <% end %> + <% when 'Blog'%> + <%# cache (act) do %> + <% case user_activity.act_type.to_s %> + <% when 'BlogComment' %> + <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% end %> + <%# end %> <% end %> - <% end %> + + <% end %> <% end %> - <% when 'Blog'%> - <%if act %> - <% case user_activity.act_type.to_s %> - <% when 'BlogComment' %> - <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% end %> - <% end %> - <% end %> - <% else %> - <%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %> <% end %> - <% end %> <% end %> <% if user_activities.count == 10%> diff --git a/app/views/users/_user_at_message.html.erb b/app/views/users/_user_at_message.html.erb index 089171c3d..8f0c6acaf 100644 --- a/app/views/users/_user_at_message.html.erb +++ b/app/views/users/_user_at_message.html.erb @@ -21,13 +21,6 @@ <%= link_to ma.subject.html_safe, ma.url, :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> <% end %> -
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> \ No newline at end of file diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index a196ee6c0..780b1c6eb 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -155,7 +155,7 @@ <% else %> <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %> <% end %> - <% student_works.each_with_index do |sw, i| %> + <% student_works.includes(:user).each_with_index do |sw, i| %> <% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
    - + 禁用匿评
    <% end %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 7de1ce417..ccd329852 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -370,7 +370,7 @@ ">回复了作品评论:
  • - <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> @@ -424,6 +424,28 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> + + + <% if ma.course_message_type == "StudentWork" && ma.status == 1 %> +
      +
    • + <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %> +
    • +
    • + <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "同学", + user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> + ">重新提交了作品: +
    • +
    • + <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.homework_common_id, :show_work_id => ma.course_message_id), + :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + <%#= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}" %> + + +
    • +
    • <%= time_tag(ma.created_at).html_safe %>
    • +
    + <% end %> <% if ma.course_message_type == "Course" %>
      diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 574411055..1fd981d73 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -15,9 +15,6 @@ -
    • <%= time_tag(ma.created_at).html_safe %>
    <% end %> @@ -38,21 +35,6 @@ -
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -74,21 +56,6 @@ -
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -114,9 +81,6 @@ - <% unless User.current.member_of?(ma.project) %>
  • <%=link_to "同意加入", {:controller => 'projects', :action => 'member', :id => ma.project_id, :message_id =>ma.id, :key => ma.secret_key}, @@ -144,13 +108,6 @@
  • -
  •    截止时间快到了!
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -169,13 +126,6 @@ -
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -197,11 +147,6 @@ -
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -210,37 +155,14 @@
  • <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %>
  • <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %> "><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %>
  • - <% if ma.forge_message.parent_id.nil? %> -
  • - <%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project, - :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id, - :topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> - - -
  • - - <% else %> -
  • - <%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project, - :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id, - :topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> - - -
  • - - <% end %> +
  • + <%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project, + :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id, + :topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> + + + +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -260,13 +182,6 @@ -
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -281,11 +196,6 @@ -
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> diff --git a/app/views/users/_user_message_forum.html.erb b/app/views/users/_user_message_forum.html.erb index d18292068..716fef349 100644 --- a/app/views/users/_user_message_forum.html.erb +++ b/app/views/users/_user_message_forum.html.erb @@ -15,13 +15,6 @@ - <% else %>
  • <%= link_to ma.memo.content.html_safe, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> @@ -29,13 +22,6 @@
  • - <% end %>
  • <%= time_tag(ma.memo.created_at).html_safe %>
  • diff --git a/app/views/users/_user_message_system.html.erb b/app/views/users/_user_message_system.html.erb index a80d35bd4..72241636f 100644 --- a/app/views/users/_user_message_system.html.erb +++ b/app/views/users/_user_message_system.html.erb @@ -15,14 +15,6 @@ -
  • <%= time_tag(ma.created_at).html_safe %>
  • <%# end %> diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb index 894eedbfc..1898090aa 100644 --- a/app/views/users/_user_message_userfeedaback.html.erb +++ b/app/views/users/_user_message_userfeedaback.html.erb @@ -24,7 +24,6 @@ <% end %>
  • <%= time_tag(ma.journals_for_message.created_on).html_safe %>
  • - <% end %> <% end %> \ No newline at end of file diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index bea78130a..a3bc45481 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -42,7 +42,190 @@
  • 预览
  • 重命名
  • -
  • 发送
  • +
  • 发送
  • 删除
  • - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb index c05a2ebd0..8db83aefc 100644 --- a/app/views/users/add_exist_file_to_course.js.erb +++ b/app/views/users/add_exist_file_to_course.js.erb @@ -1,6 +1,7 @@ <% if @flag == true%> $("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); diff --git a/app/views/users/add_exist_file_to_org.js.erb b/app/views/users/add_exist_file_to_org.js.erb index 9bfe1230a..c6e7f4011 100644 --- a/app/views/users/add_exist_file_to_org.js.erb +++ b/app/views/users/add_exist_file_to_org.js.erb @@ -1,6 +1,7 @@ <% if @flag == true%> $("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb index ed38fa066..4c24f4932 100644 --- a/app/views/users/add_exist_file_to_project.js.erb +++ b/app/views/users/add_exist_file_to_project.js.erb @@ -1,6 +1,7 @@ <% if @flag == true%> $("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); diff --git a/app/views/users/choose_user_course.js.erb b/app/views/users/choose_user_course.js.erb index 508004816..64f3708f8 100644 --- a/app/views/users/choose_user_course.js.erb +++ b/app/views/users/choose_user_course.js.erb @@ -1,7 +1,11 @@ +<% if params[:is_observe].nil? %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>'); showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","50%").css("left","50%"); $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +<% else %> + $("#send_homework_to_course_form").html("<%= escape_javascript(render :partial => 'users/send_homework_to_course_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>"); +<% end %> \ No newline at end of file diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index f8ce5cee4..f8635194d 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -11,42 +11,52 @@ }); +
    -
    <%= @is_test ? '模拟答题' : '提交作品' %>
    @@ -123,22 +133,34 @@ <% else %>
      - <% test.results.each_with_index do |x, i| %> -
    • 测试<%=i+1%> + <% test.results.reverse.each_with_index do |x, i| %> + <% unless x.nil? %> +
    • 测试<%=test.results.size-i%> <% if x["status"].to_i != 0 %> - 测试错误! + <% if x["status"].to_i == 2 %> + 超时! + <% else %> + 测试错误! + <% end %> 您的输出: -
      <%=x["result"]%>
      +
      <%=x["result"]%> 
      正确输出: -
      <%= x["output"] %>
      +
      <%= x["output"] %>
      + <% if x["status"].to_i == 2 %> +  耗时: +
      <%=x["time_used"]%>毫秒
      + <% end %>
    • <% else %> - 测试正确! + 测试正确! + +
      <% end %> <% end %> + <% end %>
    <% end %> diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index f4509987f..f30970dc4 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -9,18 +9,28 @@ //$("#upload_box").css('left','').css('top',''); //$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); //$("#upload_box").css('display','block'); -<% if params[:send_type].present? && params[:send_type] == 'news' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% elsif params[:send_type] == 'message' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% if params[:is_observe].nil? %> + <% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); + <% elsif params[:send_type] == 'file' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids, :type=>@type}) %>'); + <% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); + <% end %> + showModal('ajax-modal', '452px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top","50%").css("left","50%"); + $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); + $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); + var val = $("#search_course_input").val(); + $("#search_course_input").val("").focus().val(val); +<% else %> + <% if params[:send_type] == 'news' %> + $("#course_news_form").html("<%= escape_javascript(render :partial => 'users/course_news_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>") + <% elsif params[:send_type] == 'file' %> + $("#course_file_form").html("<%= escape_javascript(render :partial => 'users/course_file_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'message' %> + $("#course_message_form").html("<%= escape_javascript(render :partial => 'users/course_message_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); + <% end %> <% end %> -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","50%").css("left","50%"); -$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); -var val = $("#search_course_input").val(); -$("#search_course_input").val("").focus().val(val); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index ee12e9439..f2caf8b41 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,7 +1,8 @@ +<% if params[:is_observe].nil? %> <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids,:type => @type})%>'); <% elsif params[:send_type] == 'message' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% end %> @@ -12,4 +13,13 @@ $('#ajax-modal').parent().css("top","50%").css("left","50%"); $('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); var val = $("#search_org_input").val(); -$("#search_org_input").val("").focus().val(val); \ No newline at end of file +$("#search_org_input").val("").focus().val(val); +<% else %> + <% if params[:send_type] == 'news' %> + $("#org_news_form").html("<%= escape_javascript(render :partial => 'users/org_news_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'file' %> + $("#org_file_form").html("<%= escape_javascript(render :partial => 'users/org_file_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'message' %> + $("#org_message_form").html("<%= escape_javascript(render :partial => 'users/org_message_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index d58c56ca9..37d078662 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,7 +1,8 @@ +<% if params[:is_observe].nil? %> <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids,:type => @type}) %>'); <% elsif params[:send_type] == 'message' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% end %> @@ -14,3 +15,12 @@ $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); //$("#search_project_input").focus(); var val = $("#search_project_input").val(); $("#search_project_input").val("").focus().val(val); +<% else %> +<% if params[:send_type] == 'news' %> +$("#project_news_form").html("<%= escape_javascript(render :partial => 'users/project_news_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% elsif params[:send_type] == 'file' %> +$("#project_file_form").html("<%= escape_javascript(render :partial => 'users/project_file_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% elsif params[:send_type] == 'message' %> +$("#project_message_form").html("<%= escape_javascript(render :partial => 'users/project_message_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% end %> +<% end %> diff --git a/app/views/users/show.js.erb b/app/views/users/show.js.erb index eb5de9c6a..33013c36d 100644 --- a/app/views/users/show.js.erb +++ b/app/views/users/show.js.erb @@ -1,2 +1,2 @@ -$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type} )%>"); +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} )%>"); diff --git a/app/views/users/user_commit_homework.html.erb b/app/views/users/user_commit_homework.html.erb index 0f3c4810f..cab3c55ab 100644 --- a/app/views/users/user_commit_homework.html.erb +++ b/app/views/users/user_commit_homework.html.erb @@ -2,36 +2,46 @@ @@ -90,21 +100,33 @@ <% else %>
      - <% test.results.each_with_index do |x, i| %> -
    • 测试<%=i+1%> + <% test.results.reverse.each_with_index do |x, i| %> + <% unless x.nil? %> +
    • 测试<%=test.results.size-i%> <% if x["status"].to_i != 0 %> - 测试错误! + <% if x["status"].to_i == 2 %> + 超时! + <% else %> + 测试错误! + <% end %> 您的输出: -
      <%=x["result"]%>
      +
      <%=x["result"]%> 
      正确输出: -
      <%=x["output"]%>
      +
      <%=x["output"]%>
      + <% if x["status"].to_i == 2 %> +  耗时: +
      <%=x["time_used"]%>毫秒
      + <% end %>
    • <% else %> - 测试正确! + 测试正确! + +
      <% end %> + <% end %> <% end %>
    diff --git a/app/views/users/user_resource_create.js.erb b/app/views/users/user_resource_create.js.erb index e818f2870..d28898e0a 100644 --- a/app/views/users/user_resource_create.js.erb +++ b/app/views/users/user_resource_create.js.erb @@ -1,15 +1,15 @@ -closeModal(); -$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); -$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); -$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -$("#res_all_count").html(<%= @atta_count%>); -$("#res_count").html(0); -$("#checkboxAll").attr('checked',false); -//更新状态 -$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); -$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); -$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); -$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); -$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); -$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); +closeModal(); +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); +$("#res_all_count").html(<%= @atta_count%>); +$("#res_count").html(0); +$("#checkboxAll").attr('checked',false); +//更新状态 +$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); +$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); +$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); +$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); +$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); +$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); $("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>'); \ No newline at end of file diff --git a/app/views/users/user_resource_delete.js.erb b/app/views/users/user_resource_delete.js.erb index 9583274c6..ffb056e28 100644 --- a/app/views/users/user_resource_delete.js.erb +++ b/app/views/users/user_resource_delete.js.erb @@ -1,14 +1,14 @@ -$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); -$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); -$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -$("#res_all_count").html(<%= @atta_count%>); -$("#res_count").html(0); -$("#checkboxAll").attr('checked',false); -//更新状态 -$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); -$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); -$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); -$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); -$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); -$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); +$("#res_all_count").html(<%= @atta_count%>); +$("#res_count").html(0); +$("#checkboxAll").attr('checked',false); +//更新状态 +$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); +$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); +$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); +$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); +$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); +$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); $("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>'); \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d36117556..e67ca806d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -679,6 +679,7 @@ zh: label_repository: 版本库 label_course_repository: 代码库 label_browse: 上传文件 + label_browse_org: 上传图片 label_branch: 分支 label_tag: 标签 label_revision: 修订 diff --git a/config/routes.rb b/config/routes.rb index 1c7844d34..ea89bb57e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,6 +46,14 @@ RedmineApp::Application.routes.draw do end end resources :organizations do + resource :files do + member do + + end + collection do + + end + end resources :org_document_comments do member do @@ -112,6 +120,7 @@ RedmineApp::Application.routes.draw do member do match 'update_sub_dir', :via => [:put] match 'update_priority', :via => [:put] + match 'update_status', :via => [:post] end resource :boards end @@ -273,7 +282,7 @@ RedmineApp::Application.routes.draw do get 'absence_penalty_list' get 'evaluation_list' # post 'set_program_score' - post 'program_test' + post 'program_test_ex' post 'set_score_rule' end end @@ -827,7 +836,7 @@ RedmineApp::Application.routes.draw do get 'activity', :to => 'activities#index' # repositories routes - get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' + get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats', :as => "stats_repository_project" get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', :to => 'repositories#changes' diff --git a/db/migrate/20160321071740_add_index_to_message_alls.rb b/db/migrate/20160321071740_add_index_to_message_alls.rb new file mode 100644 index 000000000..d3e095da5 --- /dev/null +++ b/db/migrate/20160321071740_add_index_to_message_alls.rb @@ -0,0 +1,5 @@ +class AddIndexToMessageAlls < ActiveRecord::Migration + def change + add_index :message_alls, [:user_id, :message_id, :created_at] + end +end diff --git a/db/migrate/20160321073042_add_index_to_course_messages.rb b/db/migrate/20160321073042_add_index_to_course_messages.rb new file mode 100644 index 000000000..ede54779b --- /dev/null +++ b/db/migrate/20160321073042_add_index_to_course_messages.rb @@ -0,0 +1,5 @@ +class AddIndexToCourseMessages < ActiveRecord::Migration + def change + add_index :course_messages, [:user_id, :course_id, :created_at] + end +end diff --git a/db/migrate/20160321073107_add_index_to_memo_messages.rb b/db/migrate/20160321073107_add_index_to_memo_messages.rb new file mode 100644 index 000000000..59bf69fb5 --- /dev/null +++ b/db/migrate/20160321073107_add_index_to_memo_messages.rb @@ -0,0 +1,5 @@ +class AddIndexToMemoMessages < ActiveRecord::Migration + def change + add_index :memo_messages, [:user_id, :forum_id, :created_at] + end +end diff --git a/db/migrate/20160321073227_add_index_to_user_feedback_messages.rb b/db/migrate/20160321073227_add_index_to_user_feedback_messages.rb new file mode 100644 index 000000000..c067f58d8 --- /dev/null +++ b/db/migrate/20160321073227_add_index_to_user_feedback_messages.rb @@ -0,0 +1,5 @@ +class AddIndexToUserFeedbackMessages < ActiveRecord::Migration + def change + add_index :user_feedback_messages, [:user_id, :created_at] + end +end diff --git a/db/migrate/20160321075815_add_index_to_forge_messages.rb b/db/migrate/20160321075815_add_index_to_forge_messages.rb new file mode 100644 index 000000000..ada345501 --- /dev/null +++ b/db/migrate/20160321075815_add_index_to_forge_messages.rb @@ -0,0 +1,5 @@ +class AddIndexToForgeMessages < ActiveRecord::Migration + def change + add_index :forge_messages, [:user_id, :project_id, :created_at] + end +end diff --git a/db/migrate/20160321080116_add_forgetype_to_forge_messages.rb b/db/migrate/20160321080116_add_forgetype_to_forge_messages.rb new file mode 100644 index 000000000..5dbd96340 --- /dev/null +++ b/db/migrate/20160321080116_add_forgetype_to_forge_messages.rb @@ -0,0 +1,5 @@ +class AddForgetypeToForgeMessages < ActiveRecord::Migration + def change + add_index :forge_messages, [:forge_message_id, :forge_message_type] + end +end diff --git a/db/migrate/20160321080336_add_usertype_to_user_feedback_messages.rb b/db/migrate/20160321080336_add_usertype_to_user_feedback_messages.rb new file mode 100644 index 000000000..6a40ad444 --- /dev/null +++ b/db/migrate/20160321080336_add_usertype_to_user_feedback_messages.rb @@ -0,0 +1,5 @@ +class AddUsertypeToUserFeedbackMessages < ActiveRecord::Migration + def change + add_index :user_feedback_messages, [:journals_for_message_id] + end +end diff --git a/db/migrate/20160321080412_add_memotype_to_memo_messages.rb b/db/migrate/20160321080412_add_memotype_to_memo_messages.rb new file mode 100644 index 000000000..0e79cd8f6 --- /dev/null +++ b/db/migrate/20160321080412_add_memotype_to_memo_messages.rb @@ -0,0 +1,5 @@ +class AddMemotypeToMemoMessages < ActiveRecord::Migration + def change + add_index :memo_messages, [:memo_id, :memo_type] + end +end diff --git a/db/migrate/20160321080825_add_feed_to_user_feedback_messages.rb b/db/migrate/20160321080825_add_feed_to_user_feedback_messages.rb new file mode 100644 index 000000000..98a3e2c3e --- /dev/null +++ b/db/migrate/20160321080825_add_feed_to_user_feedback_messages.rb @@ -0,0 +1,5 @@ +class AddFeedToUserFeedbackMessages < ActiveRecord::Migration + def change + add_index :course_messages, [:course_message_type] + end +end diff --git a/db/migrate/20160321085313_add_index_mtye_to_message_alls.rb b/db/migrate/20160321085313_add_index_mtye_to_message_alls.rb new file mode 100644 index 000000000..8f5c734c4 --- /dev/null +++ b/db/migrate/20160321085313_add_index_mtye_to_message_alls.rb @@ -0,0 +1,5 @@ +class AddIndexMtyeToMessageAlls < ActiveRecord::Migration + def change + add_index :message_alls, [:message_type] + end +end diff --git a/db/migrate/20160322032610_change_domain_name_to_lowercase.rb b/db/migrate/20160322032610_change_domain_name_to_lowercase.rb new file mode 100644 index 000000000..35a82477d --- /dev/null +++ b/db/migrate/20160322032610_change_domain_name_to_lowercase.rb @@ -0,0 +1,14 @@ +class ChangeDomainNameToLowercase < ActiveRecord::Migration + def up + Secdomain.all.each do |domain| + domain.update_attribute(:subname, domain.subname.downcase) + end + + SubfieldSubdomainDir.all.each do |dir| + dir.update_attribute(:name, dir.name.downcase) + end + end + + def down + end +end diff --git a/db/migrate/20160324052634_change_project_create_type.rb b/db/migrate/20160324052634_change_project_create_type.rb new file mode 100644 index 000000000..8beca180d --- /dev/null +++ b/db/migrate/20160324052634_change_project_create_type.rb @@ -0,0 +1,8 @@ +class ChangeProjectCreateType < ActiveRecord::Migration + def up + execute("update forge_activities set forge_act_type = 'Project' where forge_act_type = 'ProjectCreateInfo'") + end + + def down + end +end diff --git a/db/migrate/20160324074942_add_index_to_forge_activities.rb b/db/migrate/20160324074942_add_index_to_forge_activities.rb new file mode 100644 index 000000000..e4e17ec44 --- /dev/null +++ b/db/migrate/20160324074942_add_index_to_forge_activities.rb @@ -0,0 +1,5 @@ +class AddIndexToForgeActivities < ActiveRecord::Migration + def change + add_index :forge_activities, [:project_id, :forge_act_id, :created_at, :forge_act_type], :name => "forge_act_index" + end +end diff --git a/db/migrate/20160325030146_add_index_to_course_actiivities.rb b/db/migrate/20160325030146_add_index_to_course_actiivities.rb new file mode 100644 index 000000000..3449ef6a1 --- /dev/null +++ b/db/migrate/20160325030146_add_index_to_course_actiivities.rb @@ -0,0 +1,5 @@ +class AddIndexToCourseActiivities < ActiveRecord::Migration + def change + add_index :course_activities, [:course_id, :course_act_id, :course_act_type, :created_at], :name => "course_act_index" + end +end diff --git a/db/migrate/20160325030423_add_index_to_user_activities.rb b/db/migrate/20160325030423_add_index_to_user_activities.rb new file mode 100644 index 000000000..f14f0d7ce --- /dev/null +++ b/db/migrate/20160325030423_add_index_to_user_activities.rb @@ -0,0 +1,5 @@ +class AddIndexToUserActivities < ActiveRecord::Migration + def change + add_index :user_activities, [:act_id, :act_type, :container_id, :created_at], :name => "user_act_index" + end +end diff --git a/db/migrate/20160328022312_add_coulumn_show_mode_to_organizations.rb b/db/migrate/20160328022312_add_coulumn_show_mode_to_organizations.rb new file mode 100644 index 000000000..11f3fa22e --- /dev/null +++ b/db/migrate/20160328022312_add_coulumn_show_mode_to_organizations.rb @@ -0,0 +1,5 @@ +class AddCoulumnShowModeToOrganizations < ActiveRecord::Migration + def change + add_column :organizations, :show_mode, :integer, :default => 0 + end +end diff --git a/db/migrate/20160328022623_set_show_mode_for_organizations.rb b/db/migrate/20160328022623_set_show_mode_for_organizations.rb new file mode 100644 index 000000000..719dfc1ff --- /dev/null +++ b/db/migrate/20160328022623_set_show_mode_for_organizations.rb @@ -0,0 +1,12 @@ +class SetShowModeForOrganizations < ActiveRecord::Migration + def up + Organization.transaction do + Organization.all.each do |org| + org.update_attribute(:show_mode, 0) + end + end + end + + def down + end +end diff --git a/db/migrate/20160329014316_update_one_student_teacher_score.rb b/db/migrate/20160329014316_update_one_student_teacher_score.rb new file mode 100644 index 000000000..cf56db220 --- /dev/null +++ b/db/migrate/20160329014316_update_one_student_teacher_score.rb @@ -0,0 +1,17 @@ +class UpdateOneStudentTeacherScore < ActiveRecord::Migration + def up + work = StudentWork.find 49774 + score = StudentWorksScore.new + score.score = 100 + score.user_id = 7318 + score.student_work_id = work.id + score.reviewer_role = 1 + if score.save + work.teacher_score = score.score + end + work.save + end + + def down + end +end diff --git a/db/migrate/20160331063938_add_status_to_org_subfields.rb b/db/migrate/20160331063938_add_status_to_org_subfields.rb new file mode 100644 index 000000000..70ce25e0c --- /dev/null +++ b/db/migrate/20160331063938_add_status_to_org_subfields.rb @@ -0,0 +1,5 @@ +class AddStatusToOrgSubfields < ActiveRecord::Migration + def change + add_column :org_subfields, :status, :integer, :default => true + end +end diff --git a/db/migrate/20160405021915_delete_anonymous_work.rb b/db/migrate/20160405021915_delete_anonymous_work.rb new file mode 100644 index 000000000..1677b248a --- /dev/null +++ b/db/migrate/20160405021915_delete_anonymous_work.rb @@ -0,0 +1,19 @@ +class DeleteAnonymousWork < ActiveRecord::Migration + def up + student_works = StudentWork.where("homework_common_id = 2882").map{|work| work.id} unless StudentWork.where("homework_common_id = 2882").empty? + student_work_ids = "(" + student_works.join(",") + ")" + student_work_scores = StudentWorksScore.where("student_work_id in #{student_work_ids}") + unless student_work_scores.empty? + student_work_scores.each do |sscore| + student_work = StudentWork.find sscore.student_work_id + student_work.student_score = 0 unless student_work.nil? + student_work.absence_penalty = 0 + sscore.destroy + student_work.save + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 2c55aad61..4e4201050 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,11 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160317090350) do +<<<<<<< HEAD +ActiveRecord::Schema.define(:version => 20160331063938) do +======= +ActiveRecord::Schema.define(:version => 20160405021915) do +>>>>>>> c3ee4dadfb92c75e8649cad7e0ed57c2ec02ec00 create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -405,6 +409,8 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.datetime "updated_at", :null => false end + add_index "course_activities", ["course_id", "course_act_id", "course_act_type", "created_at"], :name => "course_act_index" + create_table "course_attachments", :force => true do |t| t.string "filename" t.string "disk_filename" @@ -465,6 +471,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.integer "status" end + add_index "course_messages", ["course_message_type"], :name => "index_course_messages_on_course_message_type" + add_index "course_messages", ["user_id", "course_id", "created_at"], :name => "index_course_messages_on_user_id_and_course_id_and_created_at" + create_table "course_statuses", :force => true do |t| t.integer "changesets_count" t.integer "watchers_count" @@ -728,6 +737,7 @@ ActiveRecord::Schema.define(:version => 20160317090350) do end add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + add_index "forge_activities", ["project_id", "forge_act_id", "created_at", "forge_act_type"], :name => "forge_act_index" create_table "forge_messages", :force => true do |t| t.integer "user_id" @@ -741,6 +751,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.integer "status" end + add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" + add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" + create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -1055,6 +1068,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.datetime "updated_at", :null => false end + add_index "memo_messages", ["memo_id", "memo_type"], :name => "index_memo_messages_on_memo_id_and_memo_type" + add_index "memo_messages", ["user_id", "forum_id", "created_at"], :name => "index_memo_messages_on_user_id_and_forum_id_and_created_at" + create_table "memos", :force => true do |t| t.integer "forum_id", :null => false t.integer "parent_id" @@ -1078,6 +1094,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.datetime "updated_at", :null => false end + add_index "message_alls", ["message_type"], :name => "index_message_alls_on_message_type" + add_index "message_alls", ["user_id", "message_id", "created_at"], :name => "index_message_alls_on_user_id_and_message_id_and_created_at" + create_table "messages", :force => true do |t| t.integer "board_id", :null => false t.integer "parent_id" @@ -1274,6 +1293,7 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.datetime "updated_at", :null => false t.string "field_type" t.integer "hide", :default => 0 + t.integer "status", :default => 1 end create_table "organizations", :force => true do |t| @@ -1286,6 +1306,7 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.datetime "updated_at", :null => false t.boolean "allow_guest_download", :default => true t.integer "visits", :default => 0 + t.integer "show_mode", :default => 0 end create_table "phone_app_versions", :force => true do |t| @@ -1800,6 +1821,8 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.integer "user_id" end + add_index "user_activities", ["act_id", "act_type", "container_id", "created_at"], :name => "user_act_index" + create_table "user_extensions", :force => true do |t| t.integer "user_id", :null => false t.date "birthday" @@ -1830,6 +1853,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do t.datetime "updated_at", :null => false end + add_index "user_feedback_messages", ["journals_for_message_id"], :name => "index_user_feedback_messages_on_journals_for_message_id" + add_index "user_feedback_messages", ["user_id", "created_at"], :name => "index_user_feedback_messages_on_user_id_and_created_at" + create_table "user_grades", :force => true do |t| t.integer "user_id", :null => false t.integer "project_id", :null => false diff --git a/lib/gitlab-cli/lib/gitlab/client/repositories.rb b/lib/gitlab-cli/lib/gitlab/client/repositories.rb index 8824ca3e9..98a8ea150 100644 --- a/lib/gitlab-cli/lib/gitlab/client/repositories.rb +++ b/lib/gitlab-cli/lib/gitlab/client/repositories.rb @@ -89,6 +89,23 @@ class Gitlab::Client end alias_method :repo_commit, :commit + # Gets a statics of project repository. + # + # @example + # Gitlab.commits('viking') + # Gitlab.repo_commits('gitlab', :ref_name => 'api') + # + # @param [Integer] project The ID of a project. + # @param [Hash] options A customizable set of options. + # @option options [String] :ref_name The branch or tag name of a project repository. + # @option options [String] :creator The user name of a project repository. + # @option options [Integer] :period Statistics over time. 1:total 2:one month 3:one week + # @return [Array] + def rep_stats(project, options={}) + get("/projects/#{project}/repository/rep_stats", :query => options) + end + alias_method :repo_rep_stats, :rep_stats + # Get the diff of a commit in a project. # # @example diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index 6b22496b6..f5b48544d 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -140,6 +140,7 @@ module Redmine if file && file.size > 0 a = Attachment.create(:file => file, :author => author) elsif token + # 通过token值找到对应的attachment a = Attachment.find_by_token_only(token) if a a.filename = attachment['filename'] unless attachment['filename'].blank? diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index 50fc50b38..4a343ebf4 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -14,7 +14,7 @@ module RailsKindeditor output = ActiveSupport::SafeBuffer.new output << text_area_tag(name, content, input_html) output << javascript_tag(js_replace(id, options.merge(window_onload: 'true', - :autoHeightMode=>false, + :autoHeightMode=>true,#yuanke 所有调用该方法创建的KE都自动增高 afterCreate: eval_str(at_id, at_type), emotionsBasePath: 'http://' + Setting.host_name ))) @@ -29,7 +29,7 @@ module RailsKindeditor output_buffer = ActiveSupport::SafeBuffer.new output_buffer << build_text_area_tag(name, method, self, options, input_html) output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true', - :autoHeightMode=>false, + :autoHeightMode=>true,#yuanke 所有调用该方法创建的KE都自动增高 afterCreate: eval_str(at_id, at_type), emotionsBasePath: 'http://' + Setting.host_name ))) diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index 41702e2ce..9132f973c 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -1,336 +1,342 @@ -# encoding: utf-8 -# -# Redmine - project management software -# Copyright (C) 2006-2013 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -module Redmine - module Pagination - class Paginator - attr_reader :item_count, :per_page, :page, :page_param - def initialize(*args) - if args.first.is_a?(ActionController::Base) - args.shift - ActiveSupport::Deprecation.warn "Paginator no longer takes a controller instance as the first argument. Remove it from #new arguments." - end - item_count, per_page, page, page_param = *args - - @item_count = item_count - @per_page = per_page - page = (page || 1).to_i - if page < 1 - page = 1 - end - @page = page - @page_param = page_param || :page - end - - def offset - (page - 1) * per_page - end - - ## fq - def reverse_offset - offset = @item_count-@per_page*page - if offset < 0 - offset = 0 - end - offset - end - ## end - - - def first_page - if item_count > 0 - 1 - end - end - - def previous_page - if page > 1 - page - 1 - end - end - - def next_page - if last_item < item_count - page + 1 - end - end - - def last_page - if item_count > 0 - (item_count - 1) / per_page + 1 - end - end - - def first_item - item_count == 0 ? 0 : (offset + 1) - end - - def last_item - l = first_item + per_page - 1 - l > item_count ? item_count : l - end - - def linked_pages - pages = [] - if item_count > 0 - pages += [first_page, page, last_page] - pages += ((page-2)..(page+2)).to_a.select {|p| p > first_page && p < last_page} - end - pages = pages.compact.uniq.sort - if pages.size > 1 - pages - else - [] - end - end - - def items_per_page - ActiveSupport::Deprecation.warn "Paginator#items_per_page will be removed. Use #per_page instead." - per_page - end - - def current - ActiveSupport::Deprecation.warn "Paginator#current will be removed. Use .offset instead of .current.offset." - self - end - end - - # Paginates the given scope or model. Returns a Paginator instance and - # the collection of objects for the current page. - # - # Options: - # :parameter name of the page parameter - # - # Examples: - # @user_pages, @users = paginate User.where(:status => 1) - # - def paginate(scope, options={}) - options = options.dup - finder_options = options.extract!( - :conditions, - :order, - :joins, - :include, - :select - ) - if scope.is_a?(Symbol) || finder_options.values.compact.any? - return deprecated_paginate(scope, finder_options, options) - end - - paginator = paginator(scope.count, options) - collection = scope.limit(paginator.per_page).offset(paginator.offset).to_a - - return paginator, collection - end - - def deprecated_paginate(arg, finder_options, options={}) - ActiveSupport::Deprecation.warn "#paginate with a Symbol and/or find options is depreceted and will be removed. Use a scope instead." - klass = arg.is_a?(Symbol) ? arg.to_s.classify.constantize : arg - scope = klass.scoped(finder_options) - paginate(scope, options) - end - - def paginator(item_count, options={}) - options.assert_valid_keys :parameter, :per_page - - page_param = options[:parameter] || :page - page = (params[page_param] || 1).to_i - per_page = options[:per_page] || per_page_option - Paginator.new(item_count, per_page, page, page_param) - end - - module Helper - include Redmine::I18n - # Renders the pagination links for the given paginator. - # - # Options: - # :per_page_links if set to false, the "Per page" links are not rendered - # - def pagination_links_full(*args) - pagination_links_each(*args) do |text, parameters, options| - if block_given? - yield text, parameters, options - else - link_to text, params.merge(parameters), options - end - end - end - - # Yields the given block with the text and parameters - # for each pagination link and returns a string that represents the links - # def pagination_links_each(paginator, count=nil, options={}, &block) - # options.assert_valid_keys :per_page_links - # - # per_page_links = options.delete(:per_page_links) - # per_page_links = false if count.nil? - # page_param = paginator.page_param - # - # html = '' - # if paginator.previous_page - # # \xc2\xab(utf-8) = « - # text = "\xc2\xab " + l(:label_previous) - # html << yield(text, {page_param => paginator.previous_page}, :class => 'previous') + ' ' - # end - # - # previous = nil - # paginator.linked_pages.each do |page| - # if previous && previous != page - 1 - # html << content_tag('span', '...', :class => 'spacer') + ' ' - # end - # if page == paginator.page - # html << content_tag('span', page.to_s, :class => 'current page') - # else - # html << yield(page.to_s, {page_param => page}, :class => 'page') - # end - # html << ' ' - # previous = page - # end - # - # if paginator.next_page - # # \xc2\xbb(utf-8) = » - # text = l(:label_next) + " \xc2\xbb" - # html << yield(text, {page_param => paginator.next_page}, :class => 'next') + ' ' - # end - # - # html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' ' - # - # if per_page_links != false && links = per_page_links(paginator, &block) - # html << content_tag('span', links.to_s, :class => 'per-page') - # end - # - # html.html_safe - # end - #Added by Nie guanghui - #Designed for pagination. - def pagination_links_each(paginator, count=nil, options={}, &block) - #options.assert_valid_keys :per_page_links - - #per_page_links = options.delete(:per_page_links) - per_page_links = options[:per_page_links] - remote = options[:remote] ? options[:remote] : false - flag = options[:flag] ? options[:flag] : false - per_page_links = false if count.nil? - page_param = paginator.page_param - - html = '' - if paginator.previous_page - # \xc2\xab(utf-8) = « - if flag - text = l(:label_previous) - else - text = "\xc2\xab " + l(:label_previous) - end - html << '
  • ' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '
  • ' + ' ' - end - unless paginator.previous_page - if paginator.next_page - if flag - text = l(:label_previous) - else - text = "\xc2\xab " + l(:label_previous) - end - html << '
  • ' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '
  • ' + ' ' - end - end - - previous = nil - paginator.linked_pages.each do |page| - if previous && previous != page - 1 - if flag - html << '
  • ' << content_tag('a', '...', :class => 'c_blue') << '
  • ' + ' ' - else - html << '
  • ' << content_tag('span', '...', :class => 'spacer ') << '
  • ' + ' ' - end - end - if page == paginator.page - if flag - html << '
  • ' << content_tag('a', page.to_s, :class => 'current-page c_white') << '
  • ' - else - html << '
  • ' << content_tag('span', page.to_s, :class => 'current-page') << '
  • ' - end - else - html << '
  • ' << yield(page.to_s, {page_param => page}, :class => 'page c_blue', :remote => remote) << '
  • ' - end - html << ' ' - previous = page - end - - if paginator.next_page - if flag - text = l(:label_next) - else - text = l(:label_next) + " \xc2\xbb" - end - html << '
  • ' << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << '
  • ' + ' ' - end - - unless paginator.next_page - if paginator.previous_page - if flag - text = l(:label_next) - else - text = l(:label_next) + " \xc2\xbb" - end - html << "
  • " << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << "
  • " + ' ' - end - end - - # html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' ' - # - # if per_page_links != false && links = per_page_links(paginator, &block) - # html << content_tag('span', links.to_s, :class => 'per-page') - # end - - html.html_safe - end - - # Renders the "Per page" links. - def per_page_links(paginator, &block) - values = per_page_options(paginator.per_page, paginator.item_count) - if values.any? - links = values.collect do |n| - if n == paginator.per_page - content_tag('span', n.to_s) - else - yield(n, :per_page => n, paginator.page_param => nil) - end - end - l(:label_display_per_page, links.join(', ')).html_safe - end - end - - def per_page_options(selected=nil, item_count=nil) - options = Setting.per_page_options_array - if item_count && options.any? - if item_count > options.first - max = options.detect {|value| value >= item_count} || item_count - else - max = item_count - end - options = options.select {|value| value <= max || value == selected} - end - if options.empty? || (options.size == 1 && options.first == selected) - [] - else - options - end - end - end - end -end +# encoding: utf-8 +# +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module Redmine + module Pagination + class Paginator + attr_reader :item_count, :per_page, :page, :page_param + def initialize(*args) + if args.first.is_a?(ActionController::Base) + args.shift + ActiveSupport::Deprecation.warn "Paginator no longer takes a controller instance as the first argument. Remove it from #new arguments." + end + item_count, per_page, page, page_param = *args + + @item_count = item_count + @per_page = per_page + page = (page || 1).to_i + if page < 1 + page = 1 + end + @page = page + @page_param = page_param || :page + end + + def offset + (page - 1) * per_page + end + + ## fq + def reverse_offset + offset = @item_count-@per_page*page + if offset < 0 + offset = 0 + end + offset + end + ## end + + + def first_page + if item_count > 0 + 1 + end + end + + def previous_page + if page > 1 + page - 1 + end + end + + def next_page + if last_item < item_count + page + 1 + end + end + + def last_page + if item_count > 0 + (item_count - 1) / per_page + 1 + end + end + + def first_item + item_count == 0 ? 0 : (offset + 1) + end + + def last_item + l = first_item + per_page - 1 + l > item_count ? item_count : l + end + + def linked_pages + pages = [] + if item_count > 0 + pages += [first_page, page, last_page] + pages += ((page-2)..(page+2)).to_a.select {|p| p > first_page && p < last_page} + end + pages = pages.compact.uniq.sort + if pages.size > 1 + pages + else + [] + end + end + + def items_per_page + ActiveSupport::Deprecation.warn "Paginator#items_per_page will be removed. Use #per_page instead." + per_page + end + + def current + ActiveSupport::Deprecation.warn "Paginator#current will be removed. Use .offset instead of .current.offset." + self + end + end + + # Paginates the given scope or model. Returns a Paginator instance and + # the collection of objects for the current page. + # + # Options: + # :parameter name of the page parameter + # + # Examples: + # @user_pages, @users = paginate User.where(:status => 1) + # + def paginate(scope, options={}) + options = options.dup + finder_options = options.extract!( + :conditions, + :order, + :joins, + :include, + :select + ) + if scope.is_a?(Symbol) || finder_options.values.compact.any? + return deprecated_paginate(scope, finder_options, options) + end + + paginator = paginator(scope.count, options) + collection = scope.limit(paginator.per_page).offset(paginator.offset).to_a + + return paginator, collection + end + + def deprecated_paginate(arg, finder_options, options={}) + ActiveSupport::Deprecation.warn "#paginate with a Symbol and/or find options is depreceted and will be removed. Use a scope instead." + klass = arg.is_a?(Symbol) ? arg.to_s.classify.constantize : arg + scope = klass.scoped(finder_options) + paginate(scope, options) + end + + def paginator(item_count, options={}) + options.assert_valid_keys :parameter, :per_page + + page_param = options[:parameter] || :page + page = (params[page_param] || 1).to_i + per_page = options[:per_page] || per_page_option + Paginator.new(item_count, per_page, page, page_param) + end + + module Helper + include Redmine::I18n + # Renders the pagination links for the given paginator. + # + # Options: + # :per_page_links if set to false, the "Per page" links are not rendered + # + def pagination_links_full(*args) + page = "" + pagination_links_each(*args) do |text, parameters, options| + if block_given? + yield text, parameters, options + else + if args[2].nil? || args[2][:path].nil? + link_to text, params.merge(parameters), options + else + page = "&page=" + parameters[:page].to_s unless parameters[:page].nil? + link_to text, args[2][:path].to_s + page, options + end + end + end + end + + # Yields the given block with the text and parameters + # for each pagination link and returns a string that represents the links + # def pagination_links_each(paginator, count=nil, options={}, &block) + # options.assert_valid_keys :per_page_links + # + # per_page_links = options.delete(:per_page_links) + # per_page_links = false if count.nil? + # page_param = paginator.page_param + # + # html = '' + # if paginator.previous_page + # # \xc2\xab(utf-8) = « + # text = "\xc2\xab " + l(:label_previous) + # html << yield(text, {page_param => paginator.previous_page}, :class => 'previous') + ' ' + # end + # + # previous = nil + # paginator.linked_pages.each do |page| + # if previous && previous != page - 1 + # html << content_tag('span', '...', :class => 'spacer') + ' ' + # end + # if page == paginator.page + # html << content_tag('span', page.to_s, :class => 'current page') + # else + # html << yield(page.to_s, {page_param => page}, :class => 'page') + # end + # html << ' ' + # previous = page + # end + # + # if paginator.next_page + # # \xc2\xbb(utf-8) = » + # text = l(:label_next) + " \xc2\xbb" + # html << yield(text, {page_param => paginator.next_page}, :class => 'next') + ' ' + # end + # + # html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' ' + # + # if per_page_links != false && links = per_page_links(paginator, &block) + # html << content_tag('span', links.to_s, :class => 'per-page') + # end + # + # html.html_safe + # end + #Added by Nie guanghui + #Designed for pagination. + def pagination_links_each(paginator, count=nil, options={}, &block) + #options.assert_valid_keys :per_page_links + + #per_page_links = options.delete(:per_page_links) + per_page_links = options[:per_page_links] + remote = options[:remote] ? options[:remote] : false + flag = options[:flag] ? options[:flag] : false + per_page_links = false if count.nil? + page_param = paginator.page_param + + html = '' + if paginator.previous_page + # \xc2\xab(utf-8) = « + if flag + text = l(:label_previous) + else + text = "\xc2\xab " + l(:label_previous) + end + html << '
  • ' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '
  • ' + ' ' + end + unless paginator.previous_page + if paginator.next_page + if flag + text = l(:label_previous) + else + text = "\xc2\xab " + l(:label_previous) + end + html << '
  • ' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '
  • ' + ' ' + end + end + + previous = nil + paginator.linked_pages.each do |page| + if previous && previous != page - 1 + if flag + html << '
  • ' << content_tag('a', '...', :class => 'c_blue') << '
  • ' + ' ' + else + html << '
  • ' << content_tag('span', '...', :class => 'spacer ') << '
  • ' + ' ' + end + end + if page == paginator.page + if flag + html << '
  • ' << content_tag('a', page.to_s, :class => 'current-page c_white') << '
  • ' + else + html << '
  • ' << content_tag('span', page.to_s, :class => 'current-page') << '
  • ' + end + else + html << '
  • ' << yield(page.to_s, {page_param => page}, :class => 'page c_blue', :remote => remote) << '
  • ' + end + html << ' ' + previous = page + end + + if paginator.next_page + if flag + text = l(:label_next) + else + text = l(:label_next) + " \xc2\xbb" + end + html << '
  • ' << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << '
  • ' + ' ' + end + + unless paginator.next_page + if paginator.previous_page + if flag + text = l(:label_next) + else + text = l(:label_next) + " \xc2\xbb" + end + html << "
  • " << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << "
  • " + ' ' + end + end + + # html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' ' + # + # if per_page_links != false && links = per_page_links(paginator, &block) + # html << content_tag('span', links.to_s, :class => 'per-page') + # end + + html.html_safe + end + + # Renders the "Per page" links. + def per_page_links(paginator, &block) + values = per_page_options(paginator.per_page, paginator.item_count) + if values.any? + links = values.collect do |n| + if n == paginator.per_page + content_tag('span', n.to_s) + else + yield(n, :per_page => n, paginator.page_param => nil) + end + end + l(:label_display_per_page, links.join(', ')).html_safe + end + end + + def per_page_options(selected=nil, item_count=nil) + options = Setting.per_page_options_array + if item_count && options.any? + if item_count > options.first + max = options.detect {|value| value >= item_count} || item_count + else + max = item_count + end + options = options.select {|value| value <= max || value == selected} + end + if options.empty? || (options.size == 1 && options.first == selected) + [] + else + options + end + end + end + end +end diff --git a/public/assets/kindeditor/kindeditor-min.js b/public/assets/kindeditor/kindeditor-min.js index 7b35f52fb..d91af51eb 100644 --- a/public/assets/kindeditor/kindeditor-min.js +++ b/public/assets/kindeditor/kindeditor-min.js @@ -174,7 +174,7 @@ function(a,c){var d=J(c,["prop","delete"])<0?b.plugin.getSelectedCell:b.plugin.g function(a,d){c[d]&&b.afterCreate(function(){Ka(this.edit.doc,c[d],function(){b.cmd.selection();b.clickToolbar(d)})});b.clickToolbar(d,function(){b.focus().exec(d,null)})});b.afterCreate(function(){function c(){f.range.moveToBookmark(j);f.select();X&&(a("div."+l,i).each(function(){a(this).after("
    ").remove(!0)}),a("span.Apple-style-span",i).remove(!0),a("span.Apple-tab-span",i).remove(!0),a("span[style]",i).each(function(){a(this).css("white-space")=="nowrap"&&a(this).remove(!0)}),a("meta",i).remove()); var d=i[0].innerHTML;i.remove();d!==""&&(X&&(d=d.replace(/(
    )\1/ig,"$1")),b.pasteType===2&&(d=d.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/ig,""),/schemas-microsoft-com|worddocument|mso-\w+/i.test(d)?d=nb(d,b.filterMode?b.htmlTags:a.options.htmlTags):(d=U(d,b.filterMode?b.htmlTags:null),d=b.beforeSetHtml(d))),b.pasteType===1&&(d=d.replace(/ /ig," "),d=d.replace(/\n\s*\n/g,"\n"),d=d.replace(/]*>/ig,"\n"),d=d.replace(/<\/p>]*>/ig,"\n"),d=d.replace(/<[^>]+>/g,""),d=d.replace(/ {2}/g,"  "), b.newlineTag=="p"?/\n/.test(d)&&(d=d.replace(/^/,"

    ").replace(/$/,"

    ").replace(/\n/g,"

    ")):d=d.replace(/\n/g,"
    $&")),b.insertHtml(d,!0))}var d=b.edit.doc,f,j,i,l="__kindeditor_paste__",m=!1;a(d.body).bind("paste",function(p){if(b.pasteType===0)p.stop();else if(!m){m=!0;a("div."+l,d).remove();f=b.cmd.selection();j=f.range.createBookmark();i=a('

    ',d).css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",left:"-1981px",top:a(j.start).pos().y+ -"px","white-space":"nowrap"});a(d.body).append(i);if(o){var s=f.range.get(!0);s.moveToElementText(i[0]);s.select();s.execCommand("paste");p.preventDefault()}else f.range.selectNodeContents(i[0]),f.select();setTimeout(function(){c();m=!1},0)}})});b.beforeGetHtml(function(a){o&&A<=8&&(a=a.replace(/]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b){return unescape(b)}),a=a.replace(/(]*)?>)/ig,function(a,b,c){if(!/\s+type="[^"]+"/i.test(a))return b+' type="text"'+ +"px","white-space":"nowrap"});a(d.body).append(i);if(o||Yb){var s=f.range.get(!0);s.moveToElementText(i[0]);s.select();s.execCommand("paste");p.preventDefault()}else f.range.selectNodeContents(i[0]),f.select();setTimeout(function(){c();m=!1},0)}})});b.beforeGetHtml(function(a){o&&A<=8&&(a=a.replace(/]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b){return unescape(b)}),a=a.replace(/(]*)?>)/ig,function(a,b,c){if(!/\s+type="[^"]+"/i.test(a))return b+' type="text"'+ c;return a}));return a.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/ig,function(a,b,c,d){return b+fa(c).replace(/\s+/g," ")+d}).replace(/]*class="?ke-(flash|rm|media)"?[^>]*>/ig,function(a){var a=I(a),b=ba(a.style||""),c=pb(a["data-ke-tag"]),d=l(b.width,""),b=l(b.height,"");/px/i.test(d)&&(d=t(d));/px/i.test(b)&&(b=t(b));c.width=l(a.width,d);c.height=l(a.height,b);return Ma(c)}).replace(/]*class="?ke-anchor"?[^>]*>/ig,function(a){a=I(a);return''}).replace(/]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b,c){return""+unescape(c)+"<\/script>"}).replace(/]*data-ke-noscript-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b,c){return""+unescape(c)+""}).replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/ig,function(a,b,c){a=a.replace(/(\s+(?:href|src)=")[^"]*(")/i,function(a,b,d){return b+fa(c)+d});return a=a.replace(/\s+data-ke-src="[^"]*"/i, "")}).replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/ig,function(a,b,c){return b+c})});b.beforeSetHtml(function(a){o&&A<=8&&(a=a.replace(/]*>|<(select|button)[^>]*>[\s\S]*?<\/\1>/ig,function(a){var b=I(a);if(ba(b.style||"").display=="none")return'
    ';return a}));return a.replace(/]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig,function(a){a=I(a);a.src=l(a.src,"");a.width=l(a.width,0);a.height=l(a.height,0);return qb(b.themesPath+ diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 060898b88..74013be54 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -251,7 +251,7 @@ K.options = { langType : 'zh_CN', urlType : '', newlineTag : 'p', - resizeType : 2, + resizeType : 1, syncType : 'form', pasteType : 2, dialogAlignType : 'page', @@ -4938,7 +4938,7 @@ KEditor.prototype = { afterSetHtml : function(fn) { return this.handler('afterSetHtml', fn); }, - create : function() { + create : function() {K var self = this, fullscreenMode = self.fullscreenMode; if (self.isCreated) { return self; @@ -5076,8 +5076,11 @@ KEditor.prototype = { self.afterSetHtml(); }, afterCreate : function() { - self.edit = edit = this; + self.loadPlugin('autoheight'); + self.edit = edit = this; self.cmd = edit.cmd; + //edit.iframe[0].scroll = 'no'; + //edit.doc.body.style.overflowY = 'hidden'; self._docMousedownFn = function(e) { if (self.menu) { self.hideMenu(); @@ -6015,6 +6018,7 @@ _plugin('core', function(K) { 'white-space' : 'nowrap' }); K(doc.body).append(div); + if (_IE) { var rng = cmd.range.get(true); rng.moveToElementText(div[0]); diff --git a/public/assets/kindeditor/plugins/autoheight/autoheight.js b/public/assets/kindeditor/plugins/autoheight/autoheight.js index b63dc7062..82928ff0c 100644 --- a/public/assets/kindeditor/plugins/autoheight/autoheight.js +++ b/public/assets/kindeditor/plugins/autoheight/autoheight.js @@ -9,7 +9,7 @@ KindEditor.plugin('autoheight', function(K) { var self = this; - + //self.autoHeightMode = true; if (!self.autoHeightMode) { return; } diff --git a/public/images/org_new_style/banner.jpg b/public/images/org_new_style/banner.jpg new file mode 100644 index 000000000..3cf23c4e5 Binary files /dev/null and b/public/images/org_new_style/banner.jpg differ diff --git a/public/images/org_new_style/cd-top-arrow.svg b/public/images/org_new_style/cd-top-arrow.svg new file mode 100644 index 000000000..e80e10297 --- /dev/null +++ b/public/images/org_new_style/cd-top-arrow.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/public/images/org_new_style/con-left1.jpg b/public/images/org_new_style/con-left1.jpg new file mode 100644 index 000000000..f4936fa85 Binary files /dev/null and b/public/images/org_new_style/con-left1.jpg differ diff --git a/public/images/org_new_style/con-left2.jpg b/public/images/org_new_style/con-left2.jpg new file mode 100644 index 000000000..b7b7f3472 Binary files /dev/null and b/public/images/org_new_style/con-left2.jpg differ diff --git a/public/images/org_new_style/con-right.gif b/public/images/org_new_style/con-right.gif new file mode 100644 index 000000000..d49c2003e Binary files /dev/null and b/public/images/org_new_style/con-right.gif differ diff --git a/public/images/org_new_style/default-img.jpg b/public/images/org_new_style/default-img.jpg new file mode 100644 index 000000000..e345ca3d7 Binary files /dev/null and b/public/images/org_new_style/default-img.jpg differ diff --git a/public/images/org_new_style/default-img2.jpg b/public/images/org_new_style/default-img2.jpg new file mode 100644 index 000000000..8d194d605 Binary files /dev/null and b/public/images/org_new_style/default-img2.jpg differ diff --git a/public/images/org_new_style/default-img2.png b/public/images/org_new_style/default-img2.png new file mode 100644 index 000000000..3a824b1f6 Binary files /dev/null and b/public/images/org_new_style/default-img2.png differ diff --git a/public/images/org_new_style/detailimg4.jpg b/public/images/org_new_style/detailimg4.jpg new file mode 100644 index 000000000..22b3e674d Binary files /dev/null and b/public/images/org_new_style/detailimg4.jpg differ diff --git a/public/images/org_new_style/icons.png b/public/images/org_new_style/icons.png new file mode 100644 index 000000000..d31d59a88 Binary files /dev/null and b/public/images/org_new_style/icons.png differ diff --git a/public/images/org_new_style/img1.jpg b/public/images/org_new_style/img1.jpg new file mode 100644 index 000000000..acfee71e5 Binary files /dev/null and b/public/images/org_new_style/img1.jpg differ diff --git a/public/images/org_new_style/img2.jpg b/public/images/org_new_style/img2.jpg new file mode 100644 index 000000000..72741b981 Binary files /dev/null and b/public/images/org_new_style/img2.jpg differ diff --git a/public/images/org_new_style/logo.jpg b/public/images/org_new_style/logo.jpg new file mode 100644 index 000000000..689bd958a Binary files /dev/null and b/public/images/org_new_style/logo.jpg differ diff --git a/public/images/org_new_style/pic1.jpg b/public/images/org_new_style/pic1.jpg new file mode 100644 index 000000000..8866da4cb Binary files /dev/null and b/public/images/org_new_style/pic1.jpg differ diff --git a/public/images/org_new_style/pic2.jpg b/public/images/org_new_style/pic2.jpg new file mode 100644 index 000000000..1ad7665e7 Binary files /dev/null and b/public/images/org_new_style/pic2.jpg differ diff --git a/public/images/org_new_style/pic3.jpg b/public/images/org_new_style/pic3.jpg new file mode 100644 index 000000000..5f276d3df Binary files /dev/null and b/public/images/org_new_style/pic3.jpg differ diff --git a/public/images/vlicon/graph.png b/public/images/vlicon/graph.png new file mode 100644 index 000000000..5f3e1c989 Binary files /dev/null and b/public/images/vlicon/graph.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 2eaac8c39..9c3afd48b 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,1222 +1,1240 @@ -//= require_directory ./rateable -//= require jquery.min -//= require jquery.infinitescroll - -/* Redmine - project management software - Copyright (C) 2006-2013 Jean-Philippe Lang */ - -//动态高度控制 -function description_show_hide(id){ - showNormalImage('activity_description_'+id); - if($("#intro_content_"+id).height() > 810) { - $("#intro_content_show_"+id).show(); - } - $("#intro_content_show_"+id).click(function(){ - $("#activity_description_"+id).toggleClass("maxh360"); - $("#intro_content_show_"+id).hide(); - $("#intro_content_hide_"+id).show(); - }); - $("#intro_content_hide_"+id).click(function(){ - $("#activity_description_"+id).toggleClass("maxh360"); - $("#intro_content_hide_"+id).hide(); - $("#intro_content_show_"+id).show(); - }); -} - -function cleanArray (actual){ - var newArray = new Array(); - for (var i = 0; i< actual.length; i++){ - if (actual[i]){ - newArray.push(actual[i]); - } - } - return newArray; -} - -function checkAll(id, checked) { - if (checked) { - $('#'+id).find('input[type=checkbox]').attr('checked', true); - } else { - $('#'+id).find('input[type=checkbox]').removeAttr('checked'); - } -} - -function toggleCheckboxesBySelector(selector) { - var all_checked = true; - $(selector).each(function(index) { - if (!$(this).is(':checked')) { all_checked = false; } - }); - $(selector).attr('checked', !all_checked); -} - -function showAndScrollTo(id, focus) { - $('#'+id).show(); - if (focus !== null) { - $('#'+focus).focus(); - } - $('html, body').animate({scrollTop: $('#'+id).offset().top}, 400); -} - -function toggleRowGroup(el) { - var tr = $(el).parents('tr').first(); - var n = tr.next(); - tr.toggleClass('open'); - while (n.length && !n.hasClass('group')) { - n.toggle(); - n = n.next('tr'); - } -} - -function collapseAllRowGroups(el) { - var tbody = $(el).parents('tbody').first(); - tbody.children('tr').each(function(index) { - if ($(this).hasClass('group')) { - $(this).removeClass('open'); - } else { - $(this).hide(); - } - }); -} - -function expandAllRowGroups(el) { - var tbody = $(el).parents('tbody').first(); - tbody.children('tr').each(function(index) { - if ($(this).hasClass('group')) { - $(this).addClass('open'); - } else { - $(this).show(); - } - }); -} - -function toggleAllRowGroups(el) { - var tr = $(el).parents('tr').first(); - if (tr.hasClass('open')) { - collapseAllRowGroups(el); - } else { - expandAllRowGroups(el); - } -} - -function toggleFieldset(el) { - var fieldset = $(el).parents('fieldset').first(); - fieldset.toggleClass('collapsed'); - fieldset.children('div').toggle(); -} - -function hideFieldset(el) { - var fieldset = $(el).parents('fieldset').first(); - fieldset.toggleClass('collapsed'); - fieldset.children('div').hide(); -} - -function initFilters(){ - $('#add_filter_select').change(function(){ - addFilter($(this).val(), '', []); - }); - $('#filters-table td.field input[type=checkbox]').each(function(){ - toggleFilter($(this).val()); - }); - $('#filters-table td.field input[type=checkbox]').on('click',function(){ - toggleFilter($(this).val()); - }); - $('#filters-table .toggle-multiselect').on('click',function(){ - toggleMultiSelect($(this).siblings('select')); - }); - $('#filters-table input[type=text]').on('keypress', function(e){ - if (e.keyCode == 13) submit_query_form("query_form"); - }); -} - -function addFilter(field, operator, values) { - var fieldId = field.replace('.', '_'); - var tr = $('#tr_'+fieldId); - if (tr.length > 0) { - tr.show(); - } else { - buildFilterRow(field, operator, values); - } - $('#cb_'+fieldId).attr('checked', true); - toggleFilter(field); - $('#add_filter_select').val('').children('option').each(function(){ - if ($(this).attr('value') == field) { - $(this).attr('disabled', true); - } - }); -} - -function buildFilterRow(field, operator, values) { - var fieldId = field.replace('.', '_'); - var filterTable = $("#filters-table"); - var filterOptions = availableFilters[field]; - var operators = operatorByType[filterOptions['type']]; - var filterValues = filterOptions['values']; - var i, select; - - var tr = $('').attr('id', 'tr_'+fieldId).html( - '' + - '' + - ' 复选/multi-select' - ); - select = tr.find('td.values select'); - if (values.length > 1) { select.attr('multiple', true); } - for (i=0;i'); - if ($.isArray(filterValue)) { - option.val(filterValue[1]).text(filterValue[0]); - if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);} - } else { - option.val(filterValue).text(filterValue); - if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);} - } - select.append(option); - } - break; - case "date": - case "date_past": - tr.find('td.values').append( - '' + - ' ' + - ' '+labelDayPlural+'' - ); - $('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions); - $('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions); - $('#values_'+fieldId).val(values[0]); - break; - case "string": - case "text": - tr.find('td.values').append( - '' - ); - $('#values_'+fieldId).val(values[0]); - break; - case "relation": - tr.find('td.values').append( - '' + - '' - ); - $('#values_'+fieldId).val(values[0]); - select = tr.find('td.values select'); - for (i=0;i'); - option.val(filterValue[1]).text(filterValue[0]); - if (values[0] == filterValue[1]) { option.attr('selected', true); } - select.append(option); - } - case "integer": - case "float": - tr.find('td.values').append( - '' + - ' ' - ); - $('#values_'+fieldId+'_1').val(values[0]); - $('#values_'+fieldId+'_2').val(values[1]); - break; - } -} - -function toggleFilter(field) { - var fieldId = field.replace('.', '_'); - if ($('#cb_' + fieldId).is(':checked')) { - $("#operators_" + fieldId).show().removeAttr('disabled'); - toggleOperator(field); - } else { - $("#operators_" + fieldId).hide().attr('disabled', true); - enableValues(field, []); - } -} - -function enableValues(field, indexes) { - var fieldId = field.replace('.', '_'); - $('#tr_'+fieldId+' td.values .value').each(function(index) { - if ($.inArray(index, indexes) >= 0) { - $(this).removeAttr('disabled'); - $(this).parents('span').first().show(); - } else { - $(this).val(''); - $(this).attr('disabled', true); - $(this).parents('span').first().hide(); - } - - if ($(this).hasClass('group')) { - $(this).addClass('open'); - } else { - $(this).show(); - } - }); -} - -function toggleOperator(field) { - var fieldId = field.replace('.', '_'); - var operator = $("#operators_" + fieldId); - switch (operator.val()) { - case "!*": - case "*": - case "t": - case "ld": - case "w": - case "lw": - case "l2w": - case "m": - case "lm": - case "y": - case "o": - case "c": - enableValues(field, []); - break; - case "><": - enableValues(field, [0,1]); - break; - case "t+": - case ">t-": - case "0) { - lis.eq(i-1).show(); - } -} - -function displayTabsButtons() { - var lis; - var tabsWidth = 0; - var el; - $('div.tabs').each(function() { - el = $(this); - lis = el.find('ul').children(); - lis.each(function(){ - if ($(this).is(':visible')) { - tabsWidth += $(this).width() + 6; - } - }); - if ((tabsWidth < el.width() - 60) && (lis.first().is(':visible'))) { - el.find('div.tabs-buttons').hide(); - } else { - el.find('div.tabs-buttons').show(); - } - }); -} - -function setPredecessorFieldsVisibility() { - var relationType = $('#relation_relation_type'); - if (relationType.val() == "precedes" || relationType.val() == "follows") { - $('#predecessor_fields').show(); - } else { - $('#predecessor_fields').hide(); - } -} - -function showModal(id, width) { - var el = $('#'+id).first(); - if (el.length === 0 || el.is(':visible')) {return;} - var title = el.find('h3.title').text(); - el.dialog({ - width: width, - modal: true, - resizable: false, - dialogClass: 'modal', - title: title - }); - el.find("input[type=text], input[type=submit]").first().focus(); -} - -function hideModal(el) { - var modal; - if (el) { - modal = $(el).parents('.ui-dialog-content'); - } else { - modal = $('#ajax-modal'); - } - modal.dialog("close"); -} - -function submitPreview(url, form, target) { - $.ajax({ - url: url, - type: 'post', - data: $('#'+form).serialize(), - success: function(data){ - $('#'+target).html(data); - } - }); -} - -function collapseScmEntry(id) { - $('.'+id).each(function() { - if ($(this).hasClass('open')) { - collapseScmEntry($(this).attr('id')); - } - $(this).hide(); - }); - $('#'+id).removeClass('open'); -} - -function expandScmEntry(id) { - $('.'+id).each(function() { - $(this).show(); - if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) { - expandScmEntry($(this).attr('id')); - } - }); - $('#'+id).addClass('open'); -} - -function scmEntryClick(id, url) { - el = $('#'+id); - if (el.hasClass('open')) { - collapseScmEntry(id); - el.addClass('collapsed'); - return false; - } else if (el.hasClass('loaded')) { - expandScmEntry(id); - el.removeClass('collapsed'); - return false; - } - if (el.hasClass('loading')) { - return false; - } - el.addClass('loading'); - $.ajax({ - url: url, - success: function(data){ - el.after(data); - el.addClass('open').addClass('loaded').removeClass('loading'); - } - }); - return true; -} - -function randomKey(size) { - var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); - var key = ''; - for (i = 0; i < size; i++) { - key += chars[Math.floor(Math.random() * chars.length)]; - } - return key; -} - -// Can't use Rails' remote select because we need the form data -function updateIssueFrom(url) { - $.ajax({ - url: url, - type: 'post', - data: $('#issue-form').serialize() - }); -} - -function updateBulkEditFrom(url) { - $.ajax({ - url: url, - type: 'post', - data: $('#bulk_edit_form').serialize() - }); -} - -function clearMessage(id) { - $('#'+id).val(""); -} - - -function observeAutocompleteField(fieldId, url, options) { - $(document).ready(function() { - $('#'+fieldId).autocomplete($.extend({ - source: url, - select: function(e,ui){self.location="/issues/"+ui.item.value;}, - minLength: 1, - search: function(){$('#'+fieldId).addClass('ajax-loading');}, - response: function(){$('#'+fieldId).removeClass('ajax-loading'); - } - }, options)); - $('#'+fieldId).addClass('autocomplete'); - - }); - -} - -function observeSearchfield(fieldId, targetId, url) { - $('#'+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: {q: $this.val()}, - success: function(data){ if(targetId) $('#'+targetId).html(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 observeProjectModules() { - var f = function() { - /* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */ - if ($('#project_enabled_module_names_issue_tracking').attr('checked')) { - $('#project_trackers').show(); - }else{ - $('#project_trackers').hide(); - } - }; - - $(window).load(f); - $('#project_enabled_module_names_issue_tracking').change(f); -} - -function initMyPageSortable(list, url) { - $('#list-'+list).sortable({ - connectWith: '.block-receiver', - tolerance: 'pointer', - update: function(){ - $.ajax({ - url: url, - type: 'post', - data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})} - }); - } - }); - $("#list-top, #list-left, #list-right").disableSelection(); -} - -var warnLeavingUnsavedMessage; -function warnLeavingUnsaved(message) { - warnLeavingUnsavedMessage = message; - - $('form').submit(function(){ - $('textarea').removeData('changed'); - }); - $('textarea').change(function(){ - $(this).data('changed', 'changed'); - }); - window.onbeforeunload = function(){ - var warn = false; - $('textarea').blur().each(function(){ - if ($(this).data('changed')) { - warn = true; - } - }); - if (warn) {return warnLeavingUnsavedMessage;} - }; -} - -function setupHeartBeat(){ - var time = 60*1000*30; // 30 mins - setInterval(function(){$.getJSON('/account/heartbeat');},time); -} - -function setupAjaxIndicator() { - $('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) { - if(settings && settings.url && settings.url.match(/account\/heartbeat$/)){ - return; - } - if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') { - $('#ajax-indicator').show(); - } - }); - - $('#ajax-indicator').bind('ajaxStop', function() { - $('#ajax-indicator').hide(); - if(MathJax && MathJax.Hub) - MathJax.Hub.Queue(['Typeset', MathJax.Hub]); //如果是ajax刷新页面的话,手动执行MathJax的公式显示 - try{ - prettyPrint(); //如果刷新出来的页面如果存在代码行的话,也需要美化 - }catch (e){ - - } - }); -} - -function hideOnLoad() { - $('.hol').hide(); -} - -function addFormObserversForDoubleSubmit() { - $('form[method=post]').each(function() { - if (!$(this).hasClass('multiple-submit')) { - $(this).submit(function(form_submission) { - if ($(form_submission.target).attr('data-submitted')) { - form_submission.preventDefault(); - } else { - $(form_submission.target).attr('data-submitted', true); - } - }); - } - }); -} - -function blockEventPropagation(event) { - event.stopPropagation(); - event.preventDefault(); -} - -function toggleAndSettingWordsVal(parent_widget, text_widget, value){ - text_widget.val(value) - parent_widget.slideToggle(400) -} -function transpotUrl (scope) { - $(scope).each(function(){ - var tmpContent = $(this).html(); - tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>"); - // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2"); - $(this).html(tmpContent); - }); -} - -$(document).ready(setupAjaxIndicator); -$(document).ready(setupHeartBeat); -$(document).ready(hideOnLoad); -$(document).ready(addFormObserversForDoubleSubmit); - -function img_thumbnails() { - $('.thumbnails a').colorbox({rel:'nofollow'}); - $('.attachments').find('a').each(function(index, element) { - var href_value = $(element).attr('href'); - if (/\.(jpg|png|gif|bmp|jpeg|PNG|BMP|GIF|JPG|JPEG)$/.test(href_value)) { - $(element).colorbox({rel:'nofollow'}); - } - }); - $('.for_img_thumbnails').find('a').each(function(index, element) { - var href_value = $(element).attr('href'); - if (/\.(jpg|png|gif|bmp|jpeg|PNG|BMP|GIF|JPG|JPEG)$/.test(href_value)) { - $(element).colorbox({rel:'nofollow'}); - } - }); -} -$(document).ready(img_thumbnails); - -function TimeClose(dateText, inst) { - if(inst.id=="issue_start_date"){ - time=dateText; - } -} -var time=new Date(); -function TimeBeforeShow(input){ - if(input.id=="issue_due_date"){ - //var minDate = $(input).datepicker('option', 'minDate'); - var tempdata=$("#issue_start_date").attr("value"); - - $(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/"))); - //$('.selector').datepicker('option', 'minDate', '12/25/2012'); - } -} - -function SetMinValue(){ - /// var tempdata=$("#issue_start_date").attr("value"); - //$('.selector').datepicker('option', 'minDate', '12/25/2012'); - //alert(tempdata); - //$("#issue_due_date").datepicker({ - // minDate: new Date(2014,08,23) - //var datepickerOptions= - //{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; - //alert( $('.issue_due_date').length); - //$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23)); - //$("#issue_due_date").datepicker(datepickerOptions); - //$("##{issue_due_date}").datepicker(datepickerOptions); - //$("#issue_due_date").datepicker( - // {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true} - //) - //}); -} -function PrecentChange(obj){ - var _v= obj; - if(_v==100) - { - //var select=$("select[id='issue_status_id']"); - $("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected"); - } - else if(_v==0) - { - //alert(1); - $("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected"); - } - else if(_v!=100&&_v!=0) - { - // alert(2); - $("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected"); - } -} - -//added by lizanle 日期選擇js -function HS_DateAdd(interval,number,date){ - number = parseInt(number); - if (typeof(date)=="string"){var date = new Date(date.split("-")[0],date.split("-")[1],date.split("-")[2])} - if (typeof(date)=="object"){var date = date} - switch(interval){ - case "y":return new Date(date.getFullYear()+number,date.getMonth(),date.getDate()); break; - case "m":return new Date(date.getFullYear(),date.getMonth()+number,checkDate(date.getFullYear(),date.getMonth()+number,date.getDate())); break; - case "d":return new Date(date.getFullYear(),date.getMonth(),date.getDate()+number); break; - case "w":return new Date(date.getFullYear(),date.getMonth(),7*number+date.getDate()); break; - } -} -function checkDate(year,month,date){ - var enddate = ["31","28","31","30","31","30","31","31","30","31","30","31"]; - var returnDate = ""; - if (year%4==0){enddate[1]="29"} - if (date>enddate[month]){returnDate = enddate[month]}else{returnDate = date} - return returnDate; -} - -function WeekDay(date){ - var theDate; - if (typeof(date)=="string"){theDate = new Date(date.split("-")[0],date.split("-")[1],date.split("-")[2]);} - if (typeof(date)=="object"){theDate = date} - return theDate.getDay(); -} -function HS_calender(){ - var lis = ""; - var style = ""; - /*可以把下面的css剪切出去独立一个css文件*/ - style +=""; - - var now; - if (typeof(arguments[0])=="string"){ - selectDate = arguments[0].split("-"); - var year = selectDate[0]; - var month = parseInt(selectDate[1])-1+""; - var date = selectDate[2]; - now = new Date(year,month,date); - }else if (typeof(arguments[0])=="object"){ - now = arguments[0]; - } - var lastMonthEndDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+now.getMonth()+"-01").getDate(); - var lastMonthDate = WeekDay(now.getFullYear()+"-"+now.getMonth()+"-01"); - var thisMonthLastDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-01"); - var thisMonthEndDate = thisMonthLastDate.getDate(); - var thisMonthEndDay = thisMonthLastDate.getDay(); - var todayObj = new Date(); - today = todayObj.getFullYear()+"-"+todayObj.getMonth()+"-"+todayObj.getDate(); - - for (i=0; i" + lis; - lastMonthEndDate--; - } - for (i=1; i<=thisMonthEndDate; i++){ // Current Month's Date - - if(today == now.getFullYear()+"-"+now.getMonth()+"-"+i){ - var todayString = now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-"+i; - lis += "
  • "+i+"
  • "; - }else{ - lis += "
  • "+i+"
  • "; - } - - } - var j=1; - for (i=thisMonthEndDay; i<6; i++){ // Next Month's Date - lis += "
  • "+j+"
  • "; - j++; - } - lis += style; - - var CalenderTitle = "»"; - CalenderTitle += "«"; - CalenderTitle += ""+now.getFullYear()+""+(parseInt(now.getMonth())+1).toString()+"月"; - - if (arguments.length>1){ - arguments[1].parentNode.parentNode.getElementsByTagName("ul")[1].innerHTML = lis; - arguments[1].parentNode.innerHTML = CalenderTitle; - - }else{ - var CalenderBox = style+"
    "+CalenderTitle+"
      "+lis+"
    "; - return CalenderBox; - } -} -function _selectThisDay(d){ - var boxObj = d.parentNode.parentNode.parentNode.parentNode.parentNode; - boxObj.targetObj.value = d.title; - boxObj.parentNode.removeChild(boxObj); -} -function closeCalender(d){ - var boxObj = d.parentNode.parentNode.parentNode; - boxObj.parentNode.removeChild(boxObj); -} - -function CalenderselectYear(obj){ - var opt = ""; - var thisYear = obj.innerHTML; - for (i=1970; i<=2020; i++){ - if (i==thisYear){ - opt += ""; - }else{ - opt += ""; - } - } - opt = ""; - obj.parentNode.innerHTML = opt; -} - -function selectThisYear(obj){ - HS_calender(obj.value+"-"+obj.parentNode.parentNode.getElementsByTagName("span")[1].getElementsByTagName("a")[0].innerHTML+"-1",obj.parentNode); -} - -function CalenderselectMonth(obj){ - var opt = ""; - var thisMonth = obj.innerHTML; - for (i=1; i<=12; i++){ - if (i==thisMonth){ - opt += ""; - }else{ - opt += ""; - } - } - opt = ""; - obj.parentNode.innerHTML = opt; -} -function selectThisMonth(obj){ - HS_calender(obj.parentNode.parentNode.getElementsByTagName("span")[0].getElementsByTagName("a")[0].innerHTML+"-"+obj.value+"-1",obj.parentNode); -} -function HS_setDate(inputObj){ - var calenderObj = document.createElement("span"); - calenderObj.innerHTML = HS_calender(new Date()); - calenderObj.style.position = "absolute"; - calenderObj.targetObj = inputObj; - inputObj.parentNode.insertBefore(calenderObj,inputObj.nextSibling); -} -//lizanle 刷新函数 -function redo() { - window.location.reload() -} - -function encodeHomeworkUrl(url, is_base64){ - if(typeof is_base64 === 'boolean' && is_base64){ - return '/zipdown/download?base64file='+url; - } - var file = encodeURI(url).replace(/\+/g, '%2B'); - return '/zipdown/download?file='+file; -} - -//// 作业附件删除 -$(function(){ - $('.attachments a.delete-homework-icon').bind('ajax:complete', //this will work - function(event, data, status, xhr) { //note parametes - $(this).parent('p').remove(); - console.log("delete complete."); - }); - - $('a.tb_all').bind('ajax:complete', function (event, data, status, xhr) { - if(status == 'success'){ - var res = JSON.parse(data.responseText); - if(res.length<1){ - return; - } - - if(res.length==1){ - if(res[0].base64file){ - location.href = encodeHomeworkUrl(res[0].base64file, true);return; - } - location.href = encodeHomeworkUrl(res[0].file);return; - } - - document.getElementById('light').style.display='block'; - $container = $('#light .upload_box_ul'); - $container.empty(); - for(var i = 0; i 1){ - des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载'; - } else { - des = '第'+res[i].index+'个学生的作品下载'; - } - - if(res[i].base64file){ - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); - } else { - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); - } - } - } - }); - $('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) { - if(status == 'success'){ - var res = JSON.parse(data.responseText); - if(res.length == null){ - alert("该作业没有任何附件可下载"); - } - else if(res.length<1){ - return; - } - else - { - if(res.length==1){ - if(res[0].base64file){ - location.href = encodeHomeworkUrl(res[0].base64file, true);return; - } - location.href = encodeHomeworkUrl(res[0].file);return; - } - document.getElementById('light').style.display='block'; - $container = $('#light .upload_box_ul'); - $container.empty(); - for(var i = 0; i 1){ - des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载'; - } else { - des = '第'+res[i].index+'个学生的作品下载'; - } - - if(res[i].base64file){ - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); - } else { - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); - } - - } - } - } - }); -}); - - -//firefox的pre标签换行 -$(document).ready(function () { - var userAgent = navigator.userAgent.toLowerCase(); - var browser = { - version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1], - safari: /webkit/.test(userAgent), - opera: /opera/.test(userAgent), - msie: /msie/.test(userAgent) && !/opera/.test(userAgent), - mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) - }; - if (browser.mozilla || browser.opera){ - $("pre").addClass("break_word_firefox"); - } - else{ - $("pre").addClass("break_word"); - } -}); - -//点击发送资源弹出框中的组织,要更改选择栏目中的内容 -//@dom 选中的radio,值为org_id -function change_org_subfield(url){ - $.ajax({ - type:'get', - url:url - }) -} - -//点击图片即显示大图 -function showNormalImage(id) { - var description_images=$('div#'+id).find("img"); - if (description_images.length>0) { - for (var i=0; i").attr("href",image.attr('src')); - image.wrap(element); - $(image).parent().colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); - } - //$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框 - } - -} - - -//文件、帖子、通知分享 -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); -} - -//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 -function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { - $('#'+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, send_type:send_type}, - 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; - } -} - -var sendType = '1'; -var lastSendType ;//初始为发送到我的课程 -function show_send(id, user_id, send_type){ - if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 - $.ajax({ - type: 'get', - url: '/users/' + user_id + '/search_user_project', - data:{send_id:id, send_type:send_type} - }); - }else if(lastSendType == '1'){ - $.ajax({ - type: 'get', - url: '/users/' + user_id + '/search_user_course', - data:{send_id:id, send_type:send_type} - }); - }else if( lastSendType == '3'){//组织 - $.ajax({ - type: 'get', - url: '/users/' + user_id + '/search_user_org', - data:{send_id:id, send_type:send_type} - }); - }else{ - $.ajax({ - type: 'get', - url: '/users/' + user_id + '/search_user_course', - data:{send_id:id, send_type:send_type} - }); - } -} - -//id 发送的id -//发送的id数组 -//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 -function chooseSendType(res_id,res_ids, user_id, send_type){ - - sendType = $(".resourcesSendType").val(); - if (sendType === lastSendType) { - return; - } else if(lastSendType != null) { //不是第一次点击的时候 - if (sendType == '1') { - $.ajax({ - type: 'get', - url: '/users/' + user_id + '/search_user_course', - data:{send_id:res_id, send_type:send_type} - }); - } else if(sendType == '2') { - $.ajax({ - type: 'get', - url: '/users/' + user_id + '/search_user_project', - data:{send_id:res_id, send_type:send_type} - }); - }else if(sendType == '3'){ - $.ajax({ - type: 'get', - url: '/users/' + user_id + '/search_user_org', - data:{send_id:res_id, send_type:send_type} - }); - } - } - lastSendType = sendType; -} - -//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项 -function disable_down(source, des, hint){ - if (source.attr("checked")){ - des.attr("disabled", false); - hint.html(""); - } - else{ - des.attr("checked", false); - des.attr("disabled", true); - hint.html("(私有组织不允许游客下载资源)"); - - } -} - -function getRootPath(){ - //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp - var curWwwPath=window.document.location.href; - //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp - var pathName=window.document.location.pathname; - var pos=curWwwPath.indexOf(pathName); - //获取主机地址,如: http://localhost:8083 - var localhostPaht=curWwwPath.substring(0,pos); - //获取带"/"的项目名,如:/uimcardprj -// var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); - var projectName=""; - return(localhostPaht+projectName); -} -//自动保存草稿 -var editor2; -function elocalStorage(editor,mdu){ - if (window.sessionStorage){ - editor2 = editor; - var oc = window.sessionStorage.getItem('content'+mdu); - if(oc !== null ){ - var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; - $('#e_tips').html(h); - } - setInterval(function() { - d = new Date(); - var h = d.getHours(); - var m = d.getMinutes(); - var s = d.getSeconds(); - h = h < 10 ? '0' + h : h; - m = m < 10 ? '0' + m : m; - s = s < 10 ? '0' + s : s; - if(!editor.isEmpty()){ - add_data("content",mdu,editor.html()); - $('#e_tip').html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 "); - $('#e_tips').html(""); - } - },10000); - - }else{ - $('.ke-edit').after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); - } -} -function add_data(k,mdu,d){ - window.sessionStorage.setItem(k+mdu,d); -} -function rec_data(k,mdu){ - if(window.sessionStorage.getItem(k+mdu) !== null){ - editor2.html(window.sessionStorage.getItem(k+mdu)); - clear_data(k,mdu); - } -} -function clear_data(k,mdu){ - window.sessionStorage.removeItem(k+mdu); - if(k == 'content'){ - $("#e_tips").html(""); - }else{ - $("#e_tip").html(""); - } -} +//= require_directory ./rateable +//= require jquery.min +//= require jquery.infinitescroll + +/* Redmine - project management software + Copyright (C) 2006-2013 Jean-Philippe Lang */ + +//动态高度控制 +function description_show_hide(id){ + showNormalImage('activity_description_'+id); + if($("#intro_content_"+id).height() > 810) { + $("#intro_content_show_"+id).show(); + } + $("#intro_content_show_"+id).click(function(){ + $("#activity_description_"+id).toggleClass("maxh360"); + $("#intro_content_show_"+id).hide(); + $("#intro_content_hide_"+id).show(); + }); + $("#intro_content_hide_"+id).click(function(){ + $("#activity_description_"+id).toggleClass("maxh360"); + $("#intro_content_hide_"+id).hide(); + $("#intro_content_show_"+id).show(); + }); +} + +function cleanArray (actual){ + var newArray = new Array(); + for (var i = 0; i< actual.length; i++){ + if (actual[i]){ + newArray.push(actual[i]); + } + } + return newArray; +} + +function checkAll(id, checked) { + if (checked) { + $('#'+id).find('input[type=checkbox]').attr('checked', true); + } else { + $('#'+id).find('input[type=checkbox]').removeAttr('checked'); + } +} + +function toggleCheckboxesBySelector(selector) { + var all_checked = true; + $(selector).each(function(index) { + if (!$(this).is(':checked')) { all_checked = false; } + }); + $(selector).attr('checked', !all_checked); +} + +function showAndScrollTo(id, focus) { + $('#'+id).show(); + if (focus !== null) { + $('#'+focus).focus(); + } + $('html, body').animate({scrollTop: $('#'+id).offset().top}, 400); +} + +function toggleRowGroup(el) { + var tr = $(el).parents('tr').first(); + var n = tr.next(); + tr.toggleClass('open'); + while (n.length && !n.hasClass('group')) { + n.toggle(); + n = n.next('tr'); + } +} + +function collapseAllRowGroups(el) { + var tbody = $(el).parents('tbody').first(); + tbody.children('tr').each(function(index) { + if ($(this).hasClass('group')) { + $(this).removeClass('open'); + } else { + $(this).hide(); + } + }); +} + +function expandAllRowGroups(el) { + var tbody = $(el).parents('tbody').first(); + tbody.children('tr').each(function(index) { + if ($(this).hasClass('group')) { + $(this).addClass('open'); + } else { + $(this).show(); + } + }); +} + +function toggleAllRowGroups(el) { + var tr = $(el).parents('tr').first(); + if (tr.hasClass('open')) { + collapseAllRowGroups(el); + } else { + expandAllRowGroups(el); + } +} + +function toggleFieldset(el) { + var fieldset = $(el).parents('fieldset').first(); + fieldset.toggleClass('collapsed'); + fieldset.children('div').toggle(); +} + +function hideFieldset(el) { + var fieldset = $(el).parents('fieldset').first(); + fieldset.toggleClass('collapsed'); + fieldset.children('div').hide(); +} + +function initFilters(){ + $('#add_filter_select').change(function(){ + addFilter($(this).val(), '', []); + }); + $('#filters-table td.field input[type=checkbox]').each(function(){ + toggleFilter($(this).val()); + }); + $('#filters-table td.field input[type=checkbox]').on('click',function(){ + toggleFilter($(this).val()); + }); + $('#filters-table .toggle-multiselect').on('click',function(){ + toggleMultiSelect($(this).siblings('select')); + }); + $('#filters-table input[type=text]').on('keypress', function(e){ + if (e.keyCode == 13) submit_query_form("query_form"); + }); +} + +function addFilter(field, operator, values) { + var fieldId = field.replace('.', '_'); + var tr = $('#tr_'+fieldId); + if (tr.length > 0) { + tr.show(); + } else { + buildFilterRow(field, operator, values); + } + $('#cb_'+fieldId).attr('checked', true); + toggleFilter(field); + $('#add_filter_select').val('').children('option').each(function(){ + if ($(this).attr('value') == field) { + $(this).attr('disabled', true); + } + }); +} + +function buildFilterRow(field, operator, values) { + var fieldId = field.replace('.', '_'); + var filterTable = $("#filters-table"); + var filterOptions = availableFilters[field]; + var operators = operatorByType[filterOptions['type']]; + var filterValues = filterOptions['values']; + var i, select; + + var tr = $('').attr('id', 'tr_'+fieldId).html( + '' + + '' + + ' 复选/multi-select' + ); + select = tr.find('td.values select'); + if (values.length > 1) { select.attr('multiple', true); } + for (i=0;i'); + if ($.isArray(filterValue)) { + option.val(filterValue[1]).text(filterValue[0]); + if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);} + } else { + option.val(filterValue).text(filterValue); + if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);} + } + select.append(option); + } + break; + case "date": + case "date_past": + tr.find('td.values').append( + '' + + ' ' + + ' '+labelDayPlural+'' + ); + $('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions); + $('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions); + $('#values_'+fieldId).val(values[0]); + break; + case "string": + case "text": + tr.find('td.values').append( + '' + ); + $('#values_'+fieldId).val(values[0]); + break; + case "relation": + tr.find('td.values').append( + '' + + '' + ); + $('#values_'+fieldId).val(values[0]); + select = tr.find('td.values select'); + for (i=0;i'); + option.val(filterValue[1]).text(filterValue[0]); + if (values[0] == filterValue[1]) { option.attr('selected', true); } + select.append(option); + } + case "integer": + case "float": + tr.find('td.values').append( + '' + + ' ' + ); + $('#values_'+fieldId+'_1').val(values[0]); + $('#values_'+fieldId+'_2').val(values[1]); + break; + } +} + +function toggleFilter(field) { + var fieldId = field.replace('.', '_'); + if ($('#cb_' + fieldId).is(':checked')) { + $("#operators_" + fieldId).show().removeAttr('disabled'); + toggleOperator(field); + } else { + $("#operators_" + fieldId).hide().attr('disabled', true); + enableValues(field, []); + } +} + +function enableValues(field, indexes) { + var fieldId = field.replace('.', '_'); + $('#tr_'+fieldId+' td.values .value').each(function(index) { + if ($.inArray(index, indexes) >= 0) { + $(this).removeAttr('disabled'); + $(this).parents('span').first().show(); + } else { + $(this).val(''); + $(this).attr('disabled', true); + $(this).parents('span').first().hide(); + } + + if ($(this).hasClass('group')) { + $(this).addClass('open'); + } else { + $(this).show(); + } + }); +} + +function toggleOperator(field) { + var fieldId = field.replace('.', '_'); + var operator = $("#operators_" + fieldId); + switch (operator.val()) { + case "!*": + case "*": + case "t": + case "ld": + case "w": + case "lw": + case "l2w": + case "m": + case "lm": + case "y": + case "o": + case "c": + enableValues(field, []); + break; + case "><": + enableValues(field, [0,1]); + break; + case "t+": + case ">t-": + case "0) { + lis.eq(i-1).show(); + } +} + +function displayTabsButtons() { + var lis; + var tabsWidth = 0; + var el; + $('div.tabs').each(function() { + el = $(this); + lis = el.find('ul').children(); + lis.each(function(){ + if ($(this).is(':visible')) { + tabsWidth += $(this).width() + 6; + } + }); + if ((tabsWidth < el.width() - 60) && (lis.first().is(':visible'))) { + el.find('div.tabs-buttons').hide(); + } else { + el.find('div.tabs-buttons').show(); + } + }); +} + +function setPredecessorFieldsVisibility() { + var relationType = $('#relation_relation_type'); + if (relationType.val() == "precedes" || relationType.val() == "follows") { + $('#predecessor_fields').show(); + } else { + $('#predecessor_fields').hide(); + } +} + +function showModal(id, width) { + var el = $('#'+id).first(); + if (el.length === 0 || el.is(':visible')) {return;} + var title = el.find('h3.title').text(); + el.dialog({ + width: width, + modal: true, + resizable: false, + dialogClass: 'modal', + title: title + }); + el.find("input[type=text], input[type=submit]").first().focus(); +} + +function hideModal(el) { + var modal; + if (el) { + modal = $(el).parents('.ui-dialog-content'); + } else { + modal = $('#ajax-modal'); + } + modal.dialog("close"); +} + +function submitPreview(url, form, target) { + $.ajax({ + url: url, + type: 'post', + data: $('#'+form).serialize(), + success: function(data){ + $('#'+target).html(data); + } + }); +} + +function collapseScmEntry(id) { + $('.'+id).each(function() { + if ($(this).hasClass('open')) { + collapseScmEntry($(this).attr('id')); + } + $(this).hide(); + }); + $('#'+id).removeClass('open'); +} + +function expandScmEntry(id) { + $('.'+id).each(function() { + $(this).show(); + if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) { + expandScmEntry($(this).attr('id')); + } + }); + $('#'+id).addClass('open'); +} + +function scmEntryClick(id, url) { + el = $('#'+id); + if (el.hasClass('open')) { + collapseScmEntry(id); + el.addClass('collapsed'); + return false; + } else if (el.hasClass('loaded')) { + expandScmEntry(id); + el.removeClass('collapsed'); + return false; + } + if (el.hasClass('loading')) { + return false; + } + el.addClass('loading'); + $.ajax({ + url: url, + success: function(data){ + el.after(data); + el.addClass('open').addClass('loaded').removeClass('loading'); + } + }); + return true; +} + +function randomKey(size) { + var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); + var key = ''; + for (i = 0; i < size; i++) { + key += chars[Math.floor(Math.random() * chars.length)]; + } + return key; +} + +// Can't use Rails' remote select because we need the form data +function updateIssueFrom(url) { + $.ajax({ + url: url, + type: 'post', + data: $('#issue-form').serialize() + }); +} + +function updateBulkEditFrom(url) { + $.ajax({ + url: url, + type: 'post', + data: $('#bulk_edit_form').serialize() + }); +} + +function clearMessage(id) { + $('#'+id).val(""); +} + + +function observeAutocompleteField(fieldId, url, options) { + $(document).ready(function() { + $('#'+fieldId).autocomplete($.extend({ + source: url, + select: function(e,ui){self.location="/issues/"+ui.item.value;}, + minLength: 1, + search: function(){$('#'+fieldId).addClass('ajax-loading');}, + response: function(){$('#'+fieldId).removeClass('ajax-loading'); + } + }, options)); + $('#'+fieldId).addClass('autocomplete'); + + }); + +} + +function observeSearchfield(fieldId, targetId, url) { + $('#'+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: {q: $this.val()}, + success: function(data){ if(targetId) $('#'+targetId).html(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 observeProjectModules() { + var f = function() { + /* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */ + if ($('#project_enabled_module_names_issue_tracking').attr('checked')) { + $('#project_trackers').show(); + }else{ + $('#project_trackers').hide(); + } + }; + + $(window).load(f); + $('#project_enabled_module_names_issue_tracking').change(f); +} + +function initMyPageSortable(list, url) { + $('#list-'+list).sortable({ + connectWith: '.block-receiver', + tolerance: 'pointer', + update: function(){ + $.ajax({ + url: url, + type: 'post', + data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})} + }); + } + }); + $("#list-top, #list-left, #list-right").disableSelection(); +} + +var warnLeavingUnsavedMessage; +function warnLeavingUnsaved(message) { + warnLeavingUnsavedMessage = message; + + $('form').submit(function(){ + $('textarea').removeData('changed'); + }); + $('textarea').change(function(){ + $(this).data('changed', 'changed'); + }); + window.onbeforeunload = function(){ + var warn = false; + $('textarea').blur().each(function(){ + if ($(this).data('changed')) { + warn = true; + } + }); + if (warn) {return warnLeavingUnsavedMessage;} + }; +} + +function setupHeartBeat(){ + var time = 60*1000*30; // 30 mins + setInterval(function(){$.getJSON('/account/heartbeat');},time); +} + +function setupAjaxIndicator() { + $('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) { + if(settings && settings.url && settings.url.match(/account\/heartbeat$/)){ + return; + } + if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') { + $('#ajax-indicator').show(); + } + }); + + $('#ajax-indicator').bind('ajaxStop', function() { + $('#ajax-indicator').hide(); + if(MathJax && MathJax.Hub) + MathJax.Hub.Queue(['Typeset', MathJax.Hub]); //如果是ajax刷新页面的话,手动执行MathJax的公式显示 + try{ + prettyPrint(); //如果刷新出来的页面如果存在代码行的话,也需要美化 + }catch (e){ + + } + }); +} + +function hideOnLoad() { + $('.hol').hide(); +} + +function addFormObserversForDoubleSubmit() { + $('form[method=post]').each(function() { + if (!$(this).hasClass('multiple-submit')) { + $(this).submit(function(form_submission) { + if ($(form_submission.target).attr('data-submitted')) { + form_submission.preventDefault(); + } else { + $(form_submission.target).attr('data-submitted', true); + } + }); + } + }); +} + +function blockEventPropagation(event) { + event.stopPropagation(); + event.preventDefault(); +} + +function toggleAndSettingWordsVal(parent_widget, text_widget, value){ + text_widget.val(value) + parent_widget.slideToggle(400) +} +function transpotUrl (scope) { + $(scope).each(function(){ + var tmpContent = $(this).html(); + tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>"); + // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2"); + $(this).html(tmpContent); + }); +} + +$(document).ready(setupAjaxIndicator); +$(document).ready(setupHeartBeat); +$(document).ready(hideOnLoad); +$(document).ready(addFormObserversForDoubleSubmit); + +function img_thumbnails() { + $('.thumbnails a').colorbox({rel:'nofollow'}); + $('.attachments').find('a').each(function(index, element) { + var href_value = $(element).attr('href'); + if (/\.(jpg|png|gif|bmp|jpeg|PNG|BMP|GIF|JPG|JPEG)$/.test(href_value)) { + $(element).colorbox({rel:'nofollow'}); + } + }); + $('.for_img_thumbnails').find('a').each(function(index, element) { + var href_value = $(element).attr('href'); + if (/\.(jpg|png|gif|bmp|jpeg|PNG|BMP|GIF|JPG|JPEG)$/.test(href_value)) { + $(element).colorbox({rel:'nofollow'}); + } + }); +} +$(document).ready(img_thumbnails); + +function TimeClose(dateText, inst) { + if(inst.id=="issue_start_date"){ + time=dateText; + } +} +var time=new Date(); +function TimeBeforeShow(input){ + if(input.id=="issue_due_date"){ + //var minDate = $(input).datepicker('option', 'minDate'); + var tempdata=$("#issue_start_date").attr("value"); + + $(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/"))); + //$('.selector').datepicker('option', 'minDate', '12/25/2012'); + } +} + +function SetMinValue(){ + /// var tempdata=$("#issue_start_date").attr("value"); + //$('.selector').datepicker('option', 'minDate', '12/25/2012'); + //alert(tempdata); + //$("#issue_due_date").datepicker({ + // minDate: new Date(2014,08,23) + //var datepickerOptions= + //{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; + //alert( $('.issue_due_date').length); + //$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23)); + //$("#issue_due_date").datepicker(datepickerOptions); + //$("##{issue_due_date}").datepicker(datepickerOptions); + //$("#issue_due_date").datepicker( + // {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true} + //) + //}); +} +function PrecentChange(obj){ + var _v= obj; + if(_v==100) + { + //var select=$("select[id='issue_status_id']"); + $("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected"); + } + else if(_v==0) + { + //alert(1); + $("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected"); + } + else if(_v!=100&&_v!=0) + { + // alert(2); + $("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected"); + } +} + +//added by lizanle 日期選擇js +function HS_DateAdd(interval,number,date){ + number = parseInt(number); + if (typeof(date)=="string"){var date = new Date(date.split("-")[0],date.split("-")[1],date.split("-")[2])} + if (typeof(date)=="object"){var date = date} + switch(interval){ + case "y":return new Date(date.getFullYear()+number,date.getMonth(),date.getDate()); break; + case "m":return new Date(date.getFullYear(),date.getMonth()+number,checkDate(date.getFullYear(),date.getMonth()+number,date.getDate())); break; + case "d":return new Date(date.getFullYear(),date.getMonth(),date.getDate()+number); break; + case "w":return new Date(date.getFullYear(),date.getMonth(),7*number+date.getDate()); break; + } +} +function checkDate(year,month,date){ + var enddate = ["31","28","31","30","31","30","31","31","30","31","30","31"]; + var returnDate = ""; + if (year%4==0){enddate[1]="29"} + if (date>enddate[month]){returnDate = enddate[month]}else{returnDate = date} + return returnDate; +} + +function WeekDay(date){ + var theDate; + if (typeof(date)=="string"){theDate = new Date(date.split("-")[0],date.split("-")[1],date.split("-")[2]);} + if (typeof(date)=="object"){theDate = date} + return theDate.getDay(); +} +function HS_calender(){ + var lis = ""; + var style = ""; + /*可以把下面的css剪切出去独立一个css文件*/ + style +=""; + + var now; + if (typeof(arguments[0])=="string"){ + selectDate = arguments[0].split("-"); + var year = selectDate[0]; + var month = parseInt(selectDate[1])-1+""; + var date = selectDate[2]; + now = new Date(year,month,date); + }else if (typeof(arguments[0])=="object"){ + now = arguments[0]; + } + var lastMonthEndDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+now.getMonth()+"-01").getDate(); + var lastMonthDate = WeekDay(now.getFullYear()+"-"+now.getMonth()+"-01"); + var thisMonthLastDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-01"); + var thisMonthEndDate = thisMonthLastDate.getDate(); + var thisMonthEndDay = thisMonthLastDate.getDay(); + var todayObj = new Date(); + today = todayObj.getFullYear()+"-"+todayObj.getMonth()+"-"+todayObj.getDate(); + + for (i=0; i" + lis; + lastMonthEndDate--; + } + for (i=1; i<=thisMonthEndDate; i++){ // Current Month's Date + + if(today == now.getFullYear()+"-"+now.getMonth()+"-"+i){ + var todayString = now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-"+i; + lis += "
  • "+i+"
  • "; + }else{ + lis += "
  • "+i+"
  • "; + } + + } + var j=1; + for (i=thisMonthEndDay; i<6; i++){ // Next Month's Date + lis += "
  • "+j+"
  • "; + j++; + } + lis += style; + + var CalenderTitle = "»"; + CalenderTitle += "«"; + CalenderTitle += ""+now.getFullYear()+""+(parseInt(now.getMonth())+1).toString()+"月"; + + if (arguments.length>1){ + arguments[1].parentNode.parentNode.getElementsByTagName("ul")[1].innerHTML = lis; + arguments[1].parentNode.innerHTML = CalenderTitle; + + }else{ + var CalenderBox = style+"
    "+CalenderTitle+"
      "+lis+"
    "; + return CalenderBox; + } +} +function _selectThisDay(d){ + var boxObj = d.parentNode.parentNode.parentNode.parentNode.parentNode; + boxObj.targetObj.value = d.title; + boxObj.parentNode.removeChild(boxObj); +} +function closeCalender(d){ + var boxObj = d.parentNode.parentNode.parentNode; + boxObj.parentNode.removeChild(boxObj); +} + +function CalenderselectYear(obj){ + var opt = ""; + var thisYear = obj.innerHTML; + for (i=1970; i<=2020; i++){ + if (i==thisYear){ + opt += ""; + }else{ + opt += ""; + } + } + opt = ""; + obj.parentNode.innerHTML = opt; +} + +function selectThisYear(obj){ + HS_calender(obj.value+"-"+obj.parentNode.parentNode.getElementsByTagName("span")[1].getElementsByTagName("a")[0].innerHTML+"-1",obj.parentNode); +} + +function CalenderselectMonth(obj){ + var opt = ""; + var thisMonth = obj.innerHTML; + for (i=1; i<=12; i++){ + if (i==thisMonth){ + opt += ""; + }else{ + opt += ""; + } + } + opt = ""; + obj.parentNode.innerHTML = opt; +} +function selectThisMonth(obj){ + HS_calender(obj.parentNode.parentNode.getElementsByTagName("span")[0].getElementsByTagName("a")[0].innerHTML+"-"+obj.value+"-1",obj.parentNode); +} +function HS_setDate(inputObj){ + var calenderObj = document.createElement("span"); + calenderObj.innerHTML = HS_calender(new Date()); + calenderObj.style.position = "absolute"; + calenderObj.targetObj = inputObj; + inputObj.parentNode.insertBefore(calenderObj,inputObj.nextSibling); +} +//lizanle 刷新函数 +function redo() { + window.location.reload() +} + +function encodeHomeworkUrl(url, is_base64){ + if(typeof is_base64 === 'boolean' && is_base64){ + return '/zipdown/download?base64file='+url; + } + var file = encodeURI(url).replace(/\+/g, '%2B'); + return '/zipdown/download?file='+file; +} + +//// 作业附件删除 +$(function(){ + $('.attachments a.delete-homework-icon').bind('ajax:complete', //this will work + function(event, data, status, xhr) { //note parametes + $(this).parent('p').remove(); + console.log("delete complete."); + }); + + $('a.tb_all').bind('ajax:complete', function (event, data, status, xhr) { + if(status == 'success'){ + var res = JSON.parse(data.responseText); + if(res.length<1){ + return; + } + + if(res.length==1){ + if(res[0].base64file){ + location.href = encodeHomeworkUrl(res[0].base64file, true);return; + } + location.href = encodeHomeworkUrl(res[0].file);return; + } + + document.getElementById('light').style.display='block'; + $container = $('#light .upload_box_ul'); + $container.empty(); + for(var i = 0; i 1){ + des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载'; + } else { + des = '第'+res[i].index+'个学生的作品下载'; + } + + if(res[i].base64file){ + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + } else { + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + } + } + } + }); + $('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) { + if(status == 'success'){ + var res = JSON.parse(data.responseText); + if(res.length == null){ + alert("该作业没有任何附件可下载"); + } + else if(res.length<1){ + return; + } + else + { + if(res.length==1){ + if(res[0].base64file){ + location.href = encodeHomeworkUrl(res[0].base64file, true);return; + } + location.href = encodeHomeworkUrl(res[0].file);return; + } + document.getElementById('light').style.display='block'; + $container = $('#light .upload_box_ul'); + $container.empty(); + for(var i = 0; i 1){ + des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载'; + } else { + des = '第'+res[i].index+'个学生的作品下载'; + } + + if(res[i].base64file){ + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + } else { + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + } + + } + } + } + }); +}); + + +//firefox的pre标签换行 +$(document).ready(function () { + var userAgent = navigator.userAgent.toLowerCase(); + var browser = { + version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1], + safari: /webkit/.test(userAgent), + opera: /opera/.test(userAgent), + msie: /msie/.test(userAgent) && !/opera/.test(userAgent), + mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) + }; + if (browser.mozilla || browser.opera){ + $("pre").addClass("break_word_firefox"); + } + else{ + $("pre").addClass("break_word"); + } +}); + +//点击发送资源弹出框中的组织,要更改选择栏目中的内容 +//@dom 选中的radio,值为org_id +function change_org_subfield(url){ + $.ajax({ + type:'get', + url:url + }) +} + +//点击图片即显示大图 +function showNormalImage(id) { + var description_images=$('div#'+id).find("img"); + if (description_images.length>0) { + for (var i=0; i").attr("href",image.attr('src')); + image.wrap(element); + $(image).parent().colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); + } + //$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框 + } + +} + + +//文件、帖子、通知分享 +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); +} + +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 +function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { + $('#'+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, send_type:send_type, is_observe:true}, + 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, 500); + } + }; + var timer = setInterval(check, 500); + $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; + } +} + +var sendType = '1'; +var lastSendType ;//初始为发送到我的课程 +function show_send(id, user_id, send_type){ + if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:id, send_type:send_type} + }); + }else if(lastSendType == '1'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:id, send_type:send_type} + }); + }else if( lastSendType == '3'){//组织 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:id, send_type:send_type} + }); + }else{ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:id, send_type:send_type} + }); + } +} + +//id 发送的id +//发送的id数组 +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 +function chooseSendType(res_id,res_ids, user_id, send_type){ + + sendType = $(".resourcesSendType").val(); + if (sendType === lastSendType) { + return; + } else if(lastSendType != null) { //不是第一次点击的时候 + if (sendType == '1') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:res_id, send_type:send_type} + }); + } else if(sendType == '2') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:res_id, send_type:send_type} + }); + }else if(sendType == '3'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:res_id, send_type:send_type} + }); + } + } + lastSendType = sendType; +} + +//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项 +function disable_down(source, des, hint){ + if (source.attr("checked")){ + des.attr("disabled", false); + hint.html(""); + } + else{ + des.attr("checked", false); + des.attr("disabled", true); + hint.html("(私有组织不允许游客下载资源)"); + + } +} + +function getRootPath(){ + //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp + var curWwwPath=window.document.location.href; + //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp + var pathName=window.document.location.pathname; + var pos=curWwwPath.indexOf(pathName); + //获取主机地址,如: http://localhost:8083 + var localhostPaht=curWwwPath.substring(0,pos); + //获取带"/"的项目名,如:/uimcardprj +// var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); + var projectName=""; + return(localhostPaht+projectName); +} +//自动保存草稿 +var editor2; +function elocalStorage(editor,mdu){ + if (window.sessionStorage){ + editor2 = editor; + var oc = window.sessionStorage.getItem('content'+mdu); + if(oc !== null ){ + var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; + $('#e_tips').html(h); + } + setInterval(function() { + d = new Date(); + var h = d.getHours(); + var m = d.getMinutes(); + var s = d.getSeconds(); + h = h < 10 ? '0' + h : h; + m = m < 10 ? '0' + m : m; + s = s < 10 ? '0' + s : s; + if(!editor.isEmpty()){ + add_data("content",mdu,editor.html()); + $('#e_tip').html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 "); + $('#e_tips').html(""); + } + },10000); + + }else{ + $('.ke-edit').after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); + } +} +function add_data(k,mdu,d){ + window.sessionStorage.setItem(k+mdu,d); +} +function rec_data(k,mdu){ + if(window.sessionStorage.getItem(k+mdu) !== null){ + editor2.html(window.sessionStorage.getItem(k+mdu)); + clear_data(k,mdu); + } +} +function clear_data(k,mdu){ + window.sessionStorage.removeItem(k+mdu); + if(k == 'content'){ + $("#e_tips").html(""); + }else{ + $("#e_tip").html(""); + } +} + +function expand_reply(container,btnid){ + var target = $(container); + var btn = $(btnid); + if(btn.data('init')=='0'){ + btn.data('init',1); + btn.html('收起回复'); + target.show(); + }else{ + btn.data('init',0); + btn.html('展开更多'); + target.hide(); + target.eq(0).show(); + target.eq(1).show(); + target.eq(2).show(); + } +} diff --git a/public/javascripts/des_kindEditor.js b/public/javascripts/des_kindEditor.js index 3a05c909d..126d2a334 100644 --- a/public/javascripts/des_kindEditor.js +++ b/public/javascripts/des_kindEditor.js @@ -54,7 +54,7 @@ function nh_check_field(params){ params.content.sync(); if(params.content.isEmpty()){ - params.contentmsg.html('内容不能为空'); + params.contentmsg.html('请输入文章描述'); params.contentmsg.css({color:'#ff0000'}); }else{ params.contentmsg.html('填写正确'); @@ -131,7 +131,7 @@ function init_des_data(){ }); params.submit_btn.click(function () { params.editor.sync(); - params.form[0].submit(); + params.form.submit(); }); params.textarea.data('init', 1); $(this).show(); diff --git a/public/javascripts/highcharts-more.js b/public/javascripts/highcharts-more.js new file mode 100644 index 000000000..5f1894437 --- /dev/null +++ b/public/javascripts/highcharts-more.js @@ -0,0 +1,56 @@ +/* + Highcharts JS v4.2.3 (2016-02-08) + + (c) 2009-2016 Torstein Honsi + + License: www.highcharts.com/license +*/ +(function(m){typeof module==="object"&&module.exports?module.exports=m:m(Highcharts)})(function(m){function J(a,b,c){this.init(a,b,c)}var O=m.arrayMin,P=m.arrayMax,s=m.each,F=m.extend,t=m.merge,Q=m.map,q=m.pick,A=m.pInt,o=m.getOptions().plotOptions,k=m.seriesTypes,u=m.extendClass,K=m.splat,v=m.wrap,L=m.Axis,y=m.Tick,G=m.Point,R=m.Pointer,S=m.CenteredSeriesMixin,B=m.TrackerMixin,w=m.Series,x=Math,E=x.round,C=x.floor,M=x.max,T=m.Color,r=function(){};F(J.prototype,{init:function(a,b,c){var d=this,g= +d.defaultOptions;d.chart=b;d.options=a=t(g,b.angular?{background:{}}:void 0,a);(a=a.background)&&s([].concat(K(a)).reverse(),function(a){var g=a.backgroundColor,b=c.userOptions,a=t(d.defaultBackgroundOptions,a);if(g)a.backgroundColor=g;a.color=a.backgroundColor;c.options.plotBands.unshift(a);b.plotBands=b.plotBands||[];b.plotBands!==c.options.plotBands&&b.plotBands.unshift(a)})},defaultOptions:{center:["50%","50%"],size:"85%",startAngle:0},defaultBackgroundOptions:{shape:"circle",borderWidth:1,borderColor:"silver", +backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#FFF"],[1,"#DDD"]]},from:-Number.MAX_VALUE,innerRadius:0,to:Number.MAX_VALUE,outerRadius:"105%"}});var z=L.prototype,y=y.prototype,U={getOffset:r,redraw:function(){this.isDirty=!1},render:function(){this.isDirty=!1},setScale:r,setCategories:r,setTitle:r},N={isRadial:!0,defaultRadialGaugeOptions:{labels:{align:"center",x:0,y:null},minorGridLineWidth:0,minorTickInterval:"auto",minorTickLength:10,minorTickPosition:"inside",minorTickWidth:1, +tickLength:10,tickPosition:"inside",tickWidth:2,title:{rotation:0},zIndex:2},defaultRadialXOptions:{gridLineWidth:1,labels:{align:null,distance:15,x:0,y:null},maxPadding:0,minPadding:0,showLastLabel:!1,tickLength:0},defaultRadialYOptions:{gridLineInterpolation:"circle",labels:{align:"right",x:-3,y:-2},showLastLabel:!1,title:{x:4,text:null,rotation:90}},setOptions:function(a){a=this.options=t(this.defaultOptions,this.defaultRadialOptions,a);if(!a.plotBands)a.plotBands=[]},getOffset:function(){z.getOffset.call(this); +this.chart.axisOffset[this.side]=0;this.center=this.pane.center=S.getCenter.call(this.pane)},getLinePath:function(a,b){var c=this.center,b=q(b,c[2]/2-this.offset);return this.chart.renderer.symbols.arc(this.left+c[0],this.top+c[1],b,b,{start:this.startAngleRad,end:this.endAngleRad,open:!0,innerR:0})},setAxisTranslation:function(){z.setAxisTranslation.call(this);if(this.center)this.transA=this.isCircular?(this.endAngleRad-this.startAngleRad)/(this.max-this.min||1):this.center[2]/2/(this.max-this.min|| +1),this.minPixelPadding=this.isXAxis?this.transA*this.minPointOffset:0},beforeSetTickPositions:function(){this.autoConnect&&(this.max+=this.categories&&1||this.pointRange||this.closestPointRange||0)},setAxisSize:function(){z.setAxisSize.call(this);if(this.isRadial){this.center=this.pane.center=m.CenteredSeriesMixin.getCenter.call(this.pane);if(this.isCircular)this.sector=this.endAngleRad-this.startAngleRad;this.len=this.width=this.height=this.center[2]*q(this.sector,1)/2}},getPosition:function(a, +b){return this.postTranslate(this.isCircular?this.translate(a):0,q(this.isCircular?b:this.translate(a),this.center[2]/2)-this.offset)},postTranslate:function(a,b){var c=this.chart,d=this.center,a=this.startAngleRad+a;return{x:c.plotLeft+d[0]+Math.cos(a)*b,y:c.plotTop+d[1]+Math.sin(a)*b}},getPlotBandPath:function(a,b,c){var d=this.center,g=this.startAngleRad,e=d[2]/2,j=[q(c.outerRadius,"100%"),c.innerRadius,q(c.thickness,10)],l=/%$/,i,f=this.isCircular;this.options.gridLineInterpolation==="polygon"? +d=this.getPlotLinePath(a).concat(this.getPlotLinePath(b,!0)):(a=Math.max(a,this.min),b=Math.min(b,this.max),f||(j[0]=this.translate(a),j[1]=this.translate(b)),j=Q(j,function(a){l.test(a)&&(a=A(a,10)*e/100);return a}),c.shape==="circle"||!f?(a=-Math.PI/2,b=Math.PI*1.5,i=!0):(a=g+this.translate(a),b=g+this.translate(b)),d=this.chart.renderer.symbols.arc(this.left+d[0],this.top+d[1],j[0],j[0],{start:Math.min(a,b),end:Math.max(a,b),innerR:q(j[1],j[0]-j[2]),open:i}));return d},getPlotLinePath:function(a, +b){var c=this,d=c.center,g=c.chart,e=c.getPosition(a),j,l,i;c.isCircular?i=["M",d[0]+g.plotLeft,d[1]+g.plotTop,"L",e.x,e.y]:c.options.gridLineInterpolation==="circle"?(a=c.translate(a))&&(i=c.getLinePath(0,a)):(s(g.xAxis,function(a){a.pane===c.pane&&(j=a)}),i=[],a=c.translate(a),d=j.tickPositions,j.autoConnect&&(d=d.concat([d[0]])),b&&(d=[].concat(d).reverse()),s(d,function(e,b){l=j.getPosition(e,a);i.push(b?"L":"M",l.x,l.y)}));return i},getTitlePosition:function(){var a=this.center,b=this.chart, +c=this.options.title;return{x:b.plotLeft+a[0]+(c.x||0),y:b.plotTop+a[1]-{high:0.5,middle:0.25,low:0}[c.align]*a[2]+(c.y||0)}}};v(z,"init",function(a,b,c){var h;var d=b.angular,g=b.polar,e=c.isX,j=d&&e,l,i;i=b.options;var f=c.pane||0;if(d){if(F(this,j?U:N),l=!e)this.defaultRadialOptions=this.defaultRadialGaugeOptions}else if(g)F(this,N),this.defaultRadialOptions=(l=e)?this.defaultRadialXOptions:t(this.defaultYAxisOptions,this.defaultRadialYOptions);a.call(this,b,c);if(!j&&(d||g)){a=this.options;if(!b.panes)b.panes= +[];this.pane=(h=b.panes[f]=b.panes[f]||new J(K(i.pane)[f],b,this),f=h);f=f.options;b.inverted=!1;i.chart.zoomType=null;this.startAngleRad=b=(f.startAngle-90)*Math.PI/180;this.endAngleRad=i=(q(f.endAngle,f.startAngle+360)-90)*Math.PI/180;this.offset=a.offset||0;if((this.isCircular=l)&&c.max===void 0&&i-b===2*Math.PI)this.autoConnect=!0}});v(z,"autoLabelAlign",function(a){if(!this.isRadial)return a.apply(this,[].slice.call(arguments,1))});v(y,"getPosition",function(a,b,c,d,g){var e=this.axis;return e.getPosition? +e.getPosition(c):a.call(this,b,c,d,g)});v(y,"getLabelPosition",function(a,b,c,d,g,e,j,l,i){var f=this.axis,h=e.y,n=20,k=e.align,m=(f.translate(this.pos)+f.startAngleRad+Math.PI/2)/Math.PI*180%360;f.isRadial?(a=f.getPosition(this.pos,f.center[2]/2+q(e.distance,-25)),e.rotation==="auto"?d.attr({rotation:m}):h===null&&(h=f.chart.renderer.fontMetrics(d.styles.fontSize).b-d.getBBox().height/2),k===null&&(f.isCircular?(this.label.getBBox().width>f.len*f.tickInterval/(f.max-f.min)&&(n=0),k=m>n&&m<180-n? +"left":m>180+n&&m<360-n?"right":"center"):k="center",d.attr({align:k})),a.x+=e.x,a.y+=h):a=a.call(this,b,c,d,g,e,j,l,i);return a});v(y,"getMarkPath",function(a,b,c,d,g,e,j){var l=this.axis;l.isRadial?(a=l.getPosition(this.pos,l.center[2]/2+d),b=["M",b,c,"L",a.x,a.y]):b=a.call(this,b,c,d,g,e,j);return b});o.arearange=t(o.area,{lineWidth:1,marker:null,threshold:null,tooltip:{pointFormat:'\u25cf {series.name}: {point.low} - {point.high}
    '}, +trackByArea:!0,dataLabels:{align:null,verticalAlign:null,xLow:0,xHigh:0,yLow:0,yHigh:0},states:{hover:{halo:!1}}});k.arearange=u(k.area,{type:"arearange",pointArrayMap:["low","high"],dataLabelCollections:["dataLabel","dataLabelUpper"],toYData:function(a){return[a.low,a.high]},pointValKey:"low",deferTranslatePolar:!0,highToXY:function(a){var b=this.chart,c=this.xAxis.postTranslate(a.rectPlotX,this.yAxis.len-a.plotHigh);a.plotHighX=c.x-b.plotLeft;a.plotHigh=c.y-b.plotTop},translate:function(){var a= +this,b=a.yAxis;k.area.prototype.translate.apply(a);s(a.points,function(a){var d=a.low,g=a.high,e=a.plotY;g===null||d===null?a.isNull=!0:(a.plotLow=e,a.plotHigh=b.translate(g,0,1,0,1))});this.chart.polar&&s(this.points,function(b){a.highToXY(b)})},getGraphPath:function(){var a=this.points,b=[],c=[],d=a.length,g=w.prototype.getGraphPath,e,j,l;l=this.options;for(var i=l.step,d=a.length;d--;)e=a[d],!e.isNull&&(!a[d+1]||a[d+1].isNull)&&c.push({plotX:e.plotX,plotY:e.plotLow}),j={plotX:e.plotX,plotY:e.plotHigh, +isNull:e.isNull},c.push(j),b.push(j),!e.isNull&&(!a[d-1]||a[d-1].isNull)&&c.push({plotX:e.plotX,plotY:e.plotLow});a=g.call(this,a);if(i)i===!0&&(i="left"),l.step={left:"right",center:"center",right:"left"}[i];b=g.call(this,b);c=g.call(this,c);l.step=i;l=[].concat(a,b);!this.chart.polar&&c[0]==="M"&&(c[0]="L");this.areaPath=this.areaPath.concat(a,c);return l},drawDataLabels:function(){var a=this.data,b=a.length,c,d=[],g=w.prototype,e=this.options.dataLabels,j=e.align,l=e.verticalAlign,i=e.inside,f, +h,n=this.chart.inverted;if(e.enabled||this._hasPointLabels){for(c=b;c--;)if(f=a[c]){h=i?f.plotHighf.plotLow;f.y=f.high;f._plotY=f.plotY;f.plotY=f.plotHigh;d[c]=f.dataLabel;f.dataLabel=f.dataLabelUpper;f.below=h;if(n){if(!j)e.align=h?"right":"left"}else if(!l)e.verticalAlign=h?"top":"bottom";e.x=e.xHigh;e.y=e.yHigh}g.drawDataLabels&&g.drawDataLabels.apply(this,arguments);for(c=b;c--;)if(f=a[c]){h=i?f.plotHighf.plotLow;f.dataLabelUpper=f.dataLabel;f.dataLabel= +d[c];f.y=f.low;f.plotY=f._plotY;f.below=!h;if(n){if(!j)e.align=h?"left":"right"}else if(!l)e.verticalAlign=h?"bottom":"top";e.x=e.xLow;e.y=e.yLow}g.drawDataLabels&&g.drawDataLabels.apply(this,arguments)}e.align=j;e.verticalAlign=l},alignDataLabel:function(){k.column.prototype.alignDataLabel.apply(this,arguments)},setStackedPoints:r,getSymbol:r,drawPoints:r});o.areasplinerange=t(o.arearange);k.areasplinerange=u(k.arearange,{type:"areasplinerange",getPointSpline:k.spline.prototype.getPointSpline}); +(function(){var a=k.column.prototype;o.columnrange=t(o.column,o.arearange,{lineWidth:1,pointRange:null});k.columnrange=u(k.arearange,{type:"columnrange",translate:function(){var b=this,c=b.yAxis,d=b.xAxis,g=b.chart,e;a.translate.apply(b);s(b.points,function(a){var l=a.shapeArgs,i=b.options.minPointLength,f,h;a.plotHigh=e=c.translate(a.high,0,1,0,1);a.plotLow=a.plotY;h=e;f=a.plotY-e;Math.abs(f)\u25cf {series.name}
    Maximum: {point.high}
    Upper quartile: {point.q3}
    Median: {point.median}
    Lower quartile: {point.q1}
    Minimum: {point.low}
    '},whiskerLength:"50%",whiskerWidth:2});k.boxplot=u(k.column,{type:"boxplot", +pointArrayMap:["low","q1","median","q3","high"],toYData:function(a){return[a.low,a.q1,a.median,a.q3,a.high]},pointValKey:"high",pointAttrToOptions:{fill:"fillColor",stroke:"color","stroke-width":"lineWidth"},drawDataLabels:r,translate:function(){var a=this.yAxis,b=this.pointArrayMap;k.column.prototype.translate.apply(this);s(this.points,function(c){s(b,function(b){c[b]!==null&&(c[b+"Plot"]=a.translate(c[b],0,1,0,1))})})},drawPoints:function(){var a=this,b=a.options,c=a.chart.renderer,d,g,e,j,l,i, +f,h,n,k,m,H,I,o,t,r,v,u,w,x,B,A,y=a.doQuartiles!==!1,z,D=a.options.whiskerLength;s(a.points,function(p){n=p.graphic;B=p.shapeArgs;m={};o={};r={};A=p.color||a.color;if(p.plotY!==void 0)if(d=p.pointAttr[p.selected?"selected":""],v=B.width,u=C(B.x),w=u+v,x=E(v/2),g=C(y?p.q1Plot:p.lowPlot),e=C(y?p.q3Plot:p.lowPlot),j=C(p.highPlot),l=C(p.lowPlot),m.stroke=p.stemColor||b.stemColor||A,m["stroke-width"]=q(p.stemWidth,b.stemWidth,b.lineWidth),m.dashstyle=p.stemDashStyle||b.stemDashStyle,o.stroke=p.whiskerColor|| +b.whiskerColor||A,o["stroke-width"]=q(p.whiskerWidth,b.whiskerWidth,b.lineWidth),r.stroke=p.medianColor||b.medianColor||A,r["stroke-width"]=q(p.medianWidth,b.medianWidth,b.lineWidth),f=m["stroke-width"]%2/2,h=u+x+f,k=["M",h,e,"L",h,j,"M",h,g,"L",h,l],y&&(f=d["stroke-width"]%2/2,h=C(h)+f,g=C(g)+f,e=C(e)+f,u+=f,w+=f,H=["M",u,e,"L",u,g,"L",w,g,"L",w,e,"L",u,e,"z"]),D&&(f=o["stroke-width"]%2/2,j+=f,l+=f,z=/%$/.test(D)?x*parseFloat(D)/100:D/2,I=["M",h-z,j,"L",h+z,j,"M",h-z,l,"L",h+z,l]),f=r["stroke-width"]% +2/2,i=E(p.medianPlot)+f,t=["M",u,i,"L",w,i],n)p.stem.animate({d:k}),D&&p.whiskers.animate({d:I}),y&&p.box.animate({d:H}),p.medianShape.animate({d:t});else{p.graphic=n=c.g().add(a.group);p.stem=c.path(k).attr(m).add(n);if(D)p.whiskers=c.path(I).attr(o).add(n);if(y)p.box=c.path(H).attr(d).add(n);p.medianShape=c.path(t).attr(r).add(n)}})},setStackedPoints:r});o.errorbar=t(o.boxplot,{color:"#000000",grouping:!1,linkedTo:":previous",tooltip:{pointFormat:'\u25cf {series.name}: {point.low} - {point.high}
    '}, +whiskerWidth:null});k.errorbar=u(k.boxplot,{type:"errorbar",pointArrayMap:["low","high"],toYData:function(a){return[a.low,a.high]},pointValKey:"high",doQuartiles:!1,drawDataLabels:k.arearange?k.arearange.prototype.drawDataLabels:r,getColumnMetrics:function(){return this.linkedParent&&this.linkedParent.columnMetrics||k.column.prototype.getColumnMetrics.call(this)}});o.waterfall=t(o.column,{lineWidth:1,lineColor:"#333",dashStyle:"dot",borderColor:"#333",dataLabels:{inside:!0},states:{hover:{lineWidthPlus:0}}}); +k.waterfall=u(k.column,{type:"waterfall",upColorProp:"fill",pointValKey:"y",translate:function(){var a=this.options,b=this.yAxis,c,d,g,e,j,l,i,f,h,n=q(a.minPointLength,5),m=a.threshold,o=a.stacking;k.column.prototype.translate.apply(this);this.minPointLengthOffset=0;i=f=m;d=this.points;for(c=0,a=d.length;c0?b.translate(i,0,1)-e.y:b.translate(i,0,1)-b.translate(i-l,0,1);i+=l}e.height<0&&(e.y+=e.height,e.height*=-1);g.plotY=e.y=E(e.y)-this.borderWidth%2/2;e.height=M(E(e.height),0.001);g.yBottom= +e.y+e.height;if(e.height<=n)e.height=n,this.minPointLengthOffset+=n;e.y-=this.minPointLengthOffset;e=g.plotY+(g.negative?e.height:0)-this.minPointLengthOffset;this.chart.inverted?g.tooltipPos[0]=b.len-e:g.tooltipPos[1]=e}},processData:function(a){var b=this.yData,c=this.options.data,d,g=b.length,e,j,l,i,f,h;j=e=l=i=this.options.threshold||0;for(h=0;h0?(e.pointAttr= +g,e.color=d):e.pointAttr=a.pointAttr})},getGraphPath:function(){var a=this.data,b=a.length,c=E(this.options.lineWidth+this.borderWidth)%2/2,d=[],g,e,j;for(j=1;j0?(j-a)/k:0.5,h&&j>=0&&(j=Math.sqrt(j)),j=x.ceil(c+j*(d-c))/2),i.push(j);this.radii=i},animate:function(a){var b=this.options.animation;if(!a)s(this.points, +function(a){var d=a.graphic,a=a.shapeArgs;d&&a&&(d.attr("r",1),d.animate({r:a.r},b))}),this.animate=null},translate:function(){var a,b=this.data,c,d,g=this.radii;k.scatter.prototype.translate.call(this);for(a=b.length;a--;)c=b[a],d=g?g[a]:0,typeof d==="number"&&d>=this.minPxSize/2?(c.shapeType="circle",c.shapeArgs={x:c.plotX,y:c.plotY,r:d},c.dlBox={x:c.plotX-d,y:c.plotY-d,width:2*d,height:2*d}):c.shapeArgs=c.plotY=c.dlBox=void 0},drawLegendSymbol:function(a,b){var c=this.chart.renderer,d=c.fontMetrics(a.itemStyle.fontSize).f/ +2;b.legendSymbol=c.circle(d,a.baseline-d,d).attr({zIndex:3}).add(b.legendGroup);b.legendSymbol.isMarker=!0},drawPoints:k.column.prototype.drawPoints,alignDataLabel:k.column.prototype.alignDataLabel,buildKDTree:r,applyZones:r});L.prototype.beforePadding=function(){var a=this,b=this.len,c=this.chart,d=0,g=b,e=this.isXAxis,j=e?"xData":"yData",l=this.min,i={},f=x.min(c.plotWidth,c.plotHeight),h=Number.MAX_VALUE,n=-Number.MAX_VALUE,k=this.max-l,m=b/k,o=[];s(this.series,function(b){var g=b.options;if(b.bubblePadding&& +(b.visible||!c.options.chart.ignoreHiddenSeries))if(a.allowZoomOutside=!0,o.push(b),e)s(["minSize","maxSize"],function(a){var b=g[a],e=/%$/.test(b),b=A(b);i[a]=e?f*b/100:b}),b.minPxSize=i.minSize,b.maxPxSize=i.maxSize,b=b.zData,b.length&&(h=q(g.zMin,x.min(h,x.max(O(b),g.displayNegative===!1?g.zThreshold:-Number.MAX_VALUE))),n=q(g.zMax,x.max(n,P(b))))});s(o,function(a){var b=a[j],c=b.length,f;e&&a.getRadii(h,n,a.minPxSize,a.maxPxSize);if(k>0)for(;c--;)typeof b[c]==="number"&&(f=a.radii[c],d=Math.min((b[c]- +l)*m-f,d),g=Math.max((b[c]-l)*m+f,g))});o.length&&k>0&&!this.isLog&&(g-=b,m*=(b+d-g)/b,s([["min","userMin",d],["max","userMax",g]],function(b){q(a.options[b[0]],a[b[1]])===void 0&&(a[b[0]]+=b[2]/m)}))};(function(){function a(a,b){var c=this.chart,d=this.options.animation,i=this.group,f=this.markerGroup,h=this.xAxis.center,n=c.plotLeft,k=c.plotTop;if(c.polar){if(c.renderer.isSVG)d===!0&&(d={}),b?(c={translateX:h[0]+n,translateY:h[1]+k,scaleX:0.001,scaleY:0.001},i.attr(c),f&&f.attr(c)):(c={translateX:n, +translateY:k,scaleX:1,scaleY:1},i.animate(c,d),f&&f.animate(c,d),this.animate=null)}else a.call(this,b)}var b=w.prototype,c=R.prototype,d;b.searchPointByAngle=function(a){var b=this.chart,c=this.xAxis.pane.center;return this.searchKDTree({clientX:180+Math.atan2(a.chartX-c[0]-b.plotLeft,a.chartY-c[1]-b.plotTop)*(-180/Math.PI)})};v(b,"buildKDTree",function(a){if(this.chart.polar)this.kdByAngle?this.searchPoint=this.searchPointByAngle:this.kdDimensions=2;a.apply(this)});b.toXY=function(a){var b,c=this.chart, +d=a.plotX;b=a.plotY;a.rectPlotX=d;a.rectPlotY=b;b=this.xAxis.postTranslate(a.plotX,this.yAxis.len-b);a.plotX=a.polarPlotX=b.x-c.plotLeft;a.plotY=a.polarPlotY=b.y-c.plotTop;this.kdByAngle?(c=(d/Math.PI*180+this.xAxis.pane.options.startAngle)%360,c<0&&(c+=360),a.clientX=c):a.clientX=a.plotX};k.spline&&v(k.spline.prototype,"getPointSpline",function(a,b,c,d){var i,f,h,n,k,m,o;if(this.chart.polar){i=c.plotX;f=c.plotY;a=b[d-1];h=b[d+1];this.connectEnds&&(a||(a=b[b.length-2]),h||(h=b[1]));if(a&&h)n=a.plotX, +k=a.plotY,b=h.plotX,m=h.plotY,n=(1.5*i+n)/2.5,k=(1.5*f+k)/2.5,h=(1.5*i+b)/2.5,o=(1.5*f+m)/2.5,b=Math.sqrt(Math.pow(n-i,2)+Math.pow(k-f,2)),m=Math.sqrt(Math.pow(h-i,2)+Math.pow(o-f,2)),n=Math.atan2(k-f,n-i),k=Math.atan2(o-f,h-i),o=Math.PI/2+(n+k)/2,Math.abs(n-o)>Math.PI/2&&(o-=Math.PI),n=i+Math.cos(o)*b,k=f+Math.sin(o)*b,h=i+Math.cos(Math.PI+o)*m,o=f+Math.sin(Math.PI+o)*m,c.rightContX=h,c.rightContY=o;d?(c=["C",a.rightContX||a.plotX,a.rightContY||a.plotY,n||i,k||f,i,f],a.rightContX=a.rightContY=null): +c=["M",i,f]}else c=a.call(this,b,c,d);return c});v(b,"translate",function(a){var b=this.chart;a.call(this);if(b.polar&&(this.kdByAngle=b.tooltip&&b.tooltip.shared,!this.preventPostTranslate)){a=this.points;for(b=a.length;b--;)this.toXY(a[b])}});v(b,"getGraphPath",function(a,b){var c=this;if(this.chart.polar){b=b||this.points;if(this.options.connectEnds!==!1&&b[0].y!==null)this.connectEnds=!0,b.splice(b.length,0,b[0]);s(b,function(a){a.polarPlotY===void 0&&c.toXY(a)})}return a.apply(this,[].slice.call(arguments, +1))});v(b,"animate",a);if(k.column)d=k.column.prototype,v(d,"animate",a),v(d,"translate",function(a){var b=this.xAxis,c=this.yAxis.len,d=b.center,i=b.startAngleRad,f=this.chart.renderer,h,k;this.preventPostTranslate=!0;a.call(this);if(b.isRadial){b=this.points;for(k=b.length;k--;)h=b[k],a=h.barX+i,h.shapeType="path",h.shapeArgs={d:f.symbols.arc(d[0],d[1],c-h.plotY,null,{start:a,end:a+h.pointWidth,innerR:c-q(h.yBottom,c)})},this.toXY(h),h.tooltipPos=[h.plotX,h.plotY],h.ttBelow=h.plotY>d[1]}}),v(d, +"alignDataLabel",function(a,c,d,l,i,f){if(this.chart.polar){a=c.rectPlotX/Math.PI*180;if(l.align===null)l.align=a>20&&a<160?"left":a>200&&a<340?"right":"center";if(l.verticalAlign===null)l.verticalAlign=a<45||a>315?"bottom":a>135&&a<225?"top":"middle";b.alignDataLabel.call(this,c,d,l,i,f)}else a.call(this,c,d,l,i,f)});v(c,"getCoordinates",function(a,b){var c=this.chart,d={xAxis:[],yAxis:[]};c.polar?s(c.axes,function(a){var f=a.isXAxis,g=a.center,k=b.chartX-g[0]-c.plotLeft,g=b.chartY-g[1]-c.plotTop; +d[f?"xAxis":"yAxis"].push({axis:a,value:a.translate(f?Math.PI-Math.atan2(k,g):Math.sqrt(Math.pow(k,2)+Math.pow(g,2)),!0)})}):d=a.call(this,b);return d})})()}); diff --git a/public/javascripts/highcharts.js b/public/javascripts/highcharts.js new file mode 100644 index 000000000..374916866 --- /dev/null +++ b/public/javascripts/highcharts.js @@ -0,0 +1,340 @@ +/* + Highcharts JS v4.2.3 (2016-02-08) + + (c) 2009-2016 Torstein Honsi + + License: www.highcharts.com/license +*/ +(function(E,X){typeof module==="object"&&module.exports?module.exports=E.document?X(E):X:E.Highcharts=X(E)})(typeof window!=="undefined"?window:this,function(E){function X(a,b){var c="Highcharts error #"+a+": www.highcharts.com/errors/"+a;if(b)throw Error(c);E.console&&console.log(c)}function pb(a,b,c){this.options=b;this.elem=a;this.prop=c}function D(){var a,b=arguments,c,d={},e=function(a,b){var c,d;typeof a!=="object"&&(a={});for(d in b)b.hasOwnProperty(d)&&(c=b[d],a[d]=c&&typeof c==="object"&& +Object.prototype.toString.call(c)!=="[object Array]"&&d!=="renderTo"&&typeof c.nodeType!=="number"?e(a[d]||{},c):b[d]);return a};b[0]===!0&&(d=b[1],b=Array.prototype.slice.call(b,2));c=b.length;for(a=0;a-1?h.thousandsSep:""))):e=Qa(f,e)}k.push(e);a=a.slice(c+1);c=(d=!d)?"}":"{"}k.push(a);return k.join("")}function rb(a){return W.pow(10,T(W.log(a)/W.LN10))}function sb(a,b,c,d,e){var f,g=a,c=p(c,1);f=a/c;b||(b=[1,2,2.5,5,10],d===!1&&(c===1?b=[1,2,5,10]:c<=0.1&&(b=[1/c])));for(d=0;d=a||!e&&f<=(b[d]+(b[d+1]||b[d]))/ +2)break;g*=c;return g}function ib(a,b){var c=a.length,d,e;for(e=0;ec&&(c=a[b]);return c}function Sa(a,b){for(var c in a)a[c]&&a[c]!==b&&a[c].destroy&&a[c].destroy(),delete a[c]}function Ta(a){jb||(jb=Z(La));a&&jb.appendChild(a);jb.innerHTML=""}function fa(a,b){return parseFloat(a.toPrecision(b|| +14))}function Ua(a,b){b.renderer.globalAnimation=p(a,b.animation)}function Fb(){var a=N.global,b=a.useUTC,c=b?"getUTC":"get",d=b?"setUTC":"set";qa=a.Date||E.Date;qb=b&&a.timezoneOffset;Za=b&&a.getTimezoneOffset;kb=function(a,c,d,h,i,k){var j;b?(j=qa.UTC.apply(0,arguments),j+=Ya(j)):j=(new qa(a,c,p(d,1),p(h,0),p(i,0),p(k,0))).getTime();return j};tb=c+"Minutes";ub=c+"Hours";vb=c+"Day";$a=c+"Date";ab=c+"Month";bb=c+"FullYear";Gb=d+"Milliseconds";Hb=d+"Seconds";Ib=d+"Minutes";Jb=d+"Hours";wb=d+"Date"; +xb=d+"Month";yb=d+"FullYear"}function ia(a){if(!(this instanceof ia))return new ia(a);this.init(a)}function O(){}function Va(a,b,c,d){this.axis=a;this.pos=b;this.type=c||"";this.isNew=!0;!c&&!d&&this.addLabel()}function Kb(a,b,c,d,e){var f=a.chart.inverted;this.axis=a;this.isNegative=c;this.options=b;this.x=d;this.total=null;this.points={};this.stack=e;this.rightCliff=this.leftCliff=0;this.alignOptions={align:b.align||(f?c?"left":"right":"center"),verticalAlign:b.verticalAlign||(f?"middle":c?"bottom": +"top"),y:p(b.y,f?4:c?14:-6),x:p(b.x,f?c?-6:6:0)};this.textAlign=b.textAlign||(f?c?"right":"left":"center")}var z,y=E.document,W=Math,A=W.round,T=W.floor,ua=W.ceil,t=W.max,F=W.min,P=W.abs,U=W.cos,$=W.sin,ra=W.PI,ga=ra*2/360,za=E.navigator&&E.navigator.userAgent||"",Lb=E.opera,ya=/(msie|trident|edge)/i.test(za)&&!Lb,lb=y&&y.documentMode===8,mb=!ya&&/AppleWebKit/.test(za),Ma=/Firefox/.test(za),Mb=/(Mobile|Android|Windows Phone)/.test(za),Fa="http://www.w3.org/2000/svg",ca=y&&y.createElementNS&&!!y.createElementNS(Fa, +"svg").createSVGRect,Qb=Ma&&parseInt(za.split("Firefox/")[1],10)<4,ha=y&&!ca&&!ya&&!!y.createElement("canvas").getContext,cb,db,Nb={},zb=0,jb,N,Qa,G,Aa=function(){},S=[],eb=0,La="div",Rb=/^[0-9]+$/,nb=["plotTop","marginRight","marginBottom","plotLeft"],qa,kb,qb,Za,tb,ub,vb,$a,ab,bb,Gb,Hb,Ib,Jb,wb,xb,yb,I={},B;B=E.Highcharts?X(16,!0):{win:E};B.seriesTypes=I;var Ga=[],ja,sa,o,Na,Ab,Ba,M,V,H,Wa,Oa;pb.prototype={dSetter:function(){var a=this.paths[0],b=this.paths[1],c=[],d=this.now,e=a.length,f;if(d=== +1)c=this.toD;else if(e===b.length&&d<1)for(;e--;)f=parseFloat(a[e]),c[e]=isNaN(f)?a[e]:d*parseFloat(b[e]-f)+f;else c=b;this.elem.attr("d",c)},update:function(){var a=this.elem,b=this.prop,c=this.now,d=this.options.step;if(this[b+"Setter"])this[b+"Setter"]();else a.attr?a.element&&a.attr(b,c):a.style[b]=c+this.unit;d&&d.call(a,c,this)},run:function(a,b,c){var d=this,e=function(a){return e.stopped?!1:d.step(a)},f;this.startTime=+new qa;this.start=a;this.end=b;this.unit=c;this.now=this.start;this.pos= +0;e.elem=this.elem;if(e()&&Ga.push(e)===1)e.timerId=setInterval(function(){for(f=0;f=f+this.startTime){this.now=this.end;this.pos=1;this.update();a=g[this.prop]=!0;for(h in g)g[h]!==!0&&(a=!1);a&&e&&e.call(c);c=!1}else this.pos=d.easing((b-this.startTime)/f),this.now=this.start+ +(this.end-this.start)*this.pos,this.update(),c=!0;return c},initPath:function(a,b,c){var b=b||"",d=a.shift,e=b.indexOf("C")>-1,f=e?7:3,g,b=b.split(" "),c=[].concat(c),h=a.isArea,i=h?2:1,k=function(a){for(g=a.length;g--;)(a[g]==="M"||a[g]==="L")&&a.splice(g+1,0,a[g+1],a[g+2],a[g+1],a[g+2])};e&&(k(b),k(c));if(d<=c.length/f&&b.length===c.length)for(;d--;)c=c.slice(0,f).concat(c),h&&(c=c.concat(c.slice(c.length-f)));a.shift=0;if(b.length)for(a=c.length;b.length3?g.length%3:0;c=p(c,e.decimalPoint);d=p(d,e.thousandsSep);a=a<0?"-":"";a+=h?g.substr(0,h)+d:"";a+=g.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+d);+b&&(d=Math.abs(i-g+Math.pow(10,-Math.max(b,f)-1)),a+=c+d.toFixed(b).slice(2)); +return a};Math.easeInOutSine=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};ja=function(a,b){var c;if(b==="width")return Math.min(a.offsetWidth,a.scrollWidth)-ja(a,"padding-left")-ja(a,"padding-right");else if(b==="height")return Math.min(a.offsetHeight,a.scrollHeight)-ja(a,"padding-top")-ja(a,"padding-bottom");return(c=E.getComputedStyle(a,void 0))&&C(c.getPropertyValue(b))};sa=function(a,b){return b.indexOf?b.indexOf(a):[].indexOf.call(b,a)};Na=function(a,b){return[].filter.call(a,b)};Ba=function(a, +b){for(var c=[],d=0,e=a.length;d-1&&(f.splice(h,1),g[b]=f),d(b,c)):(e(),g[b]=[])):(e(),a.hcEvents={})};H=function(a,b,c,d){var e;e=a.hcEvents;var f,g,h,i,c=c||{};if(y.createEvent&&(a.dispatchEvent||a.fireEvent))e=y.createEvent("Events"),e.initEvent(b,!0,!0),e.target=a,u(e,c),a.dispatchEvent?a.dispatchEvent(e):a.fireEvent(b,e);else if(e){e=e[b]||[];f=e.length;h=function(){c.defaultPrevented=!0};for(g=0;g{point.key}
    ',pointFormat:'\u25cf {series.name}: {point.y}
    ',shadow:!0,snap:Mb?25:10,style:{color:"#333333",cursor:"default",fontSize:"12px",padding:"8px",pointerEvents:"none",whiteSpace:"nowrap"}},credits:{enabled:!0,text:"Highcharts.com", +href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"9px"}}};var aa=N.plotOptions,da=aa.line;Fb();ia.prototype={parsers:[{regex:/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/,parse:function(a){return[C(a[1]),C(a[2]),C(a[3]),parseFloat(a[4],10)]}},{regex:/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,parse:function(a){return[C(a[1],16),C(a[2],16),C(a[3],16), +1]}},{regex:/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/,parse:function(a){return[C(a[1]),C(a[2]),C(a[3]),1]}}],init:function(a){var b,c,d,e;if((this.input=a)&&a.stops)this.stops=Ba(a.stops,function(a){return new ia(a[1])});else for(d=this.parsers.length;d--&&!c;)e=this.parsers[d],(b=e.regex.exec(a))&&(c=e.parse(b));this.rgba=c||[]},get:function(a){var b=this.input,c=this.rgba,d;this.stops?(d=D(b),d.stops=[].concat(d.stops),o(this.stops,function(b,c){d.stops[c]=[d.stops[c][0], +b.get(a)]})):d=c&&!isNaN(c[0])?a==="rgb"||!a&&c[3]===1?"rgb("+c[0]+","+c[1]+","+c[2]+")":a==="a"?c[3]:"rgba("+c.join(",")+")":b;return d},brighten:function(a){var b,c=this.rgba;if(this.stops)o(this.stops,function(b){b.brighten(a)});else if(ma(a)&&a!==0)for(b=0;b<3;b++)c[b]+=C(a*255),c[b]<0&&(c[b]=0),c[b]>255&&(c[b]=255);return this},setOpacity:function(a){this.rgba[3]=a;return this}};O.prototype={opacity:1,textProps:"direction,fontSize,fontWeight,fontFamily,fontStyle,color,lineHeight,width,textDecoration,textOverflow,textShadow".split(","), +init:function(a,b){this.element=b==="span"?Z(b):y.createElementNS(Fa,b);this.renderer=a},animate:function(a,b,c){b=p(b,this.renderer.globalAnimation,!0);Oa(this);if(b){b=D(b,{});if(c)b.complete=c;Wa(this,a,b)}else this.attr(a,null,c);return this},colorGradient:function(a,b,c){var d=this.renderer,e,f,g,h,i,k,j,l,m,n,r,s=[],p;a.linearGradient?f="linearGradient":a.radialGradient&&(f="radialGradient");if(f){g=a[f];i=d.gradients;j=a.stops;n=c.radialReference;Ia(g)&&(a[f]=g={x1:g[0],y1:g[1],x2:g[2],y2:g[3], +gradientUnits:"userSpaceOnUse"});f==="radialGradient"&&n&&!q(g.gradientUnits)&&(h=g,g=D(g,d.getRadialAttr(n,h),{gradientUnits:"userSpaceOnUse"}));for(r in g)r!=="id"&&s.push(r,g[r]);for(r in j)s.push(j[r]);s=s.join(",");i[s]?n=i[s].attr("id"):(g.id=n="highcharts-"+zb++,i[s]=k=d.createElement(f).attr(g).add(d.defs),k.radAttr=h,k.stops=[],o(j,function(a){a[1].indexOf("rgba")===0?(e=ia(a[1]),l=e.get("rgb"),m=e.get("a")):(l=a[1],m=1);a=d.createElement("stop").attr({offset:a[0],"stop-color":l,"stop-opacity":m}).add(k); +k.stops.push(a)}));p="url("+d.url+"#"+n+")";c.setAttribute(b,p);c.gradient=s;a.toString=function(){return p}}},applyTextShadow:function(a){var b=this.element,c,d=a.indexOf("contrast")!==-1,e={},f=this.renderer.forExport,g=f||b.style.textShadow!==z&&!ya;if(d)e.textShadow=a=a.replace(/contrast/g,this.renderer.getContrast(b.style.fill));if(mb||f)e.textRendering="geometricPrecision";g?this.css(e):(this.fakeTS=!0,this.ySetter=this.xSetter,c=[].slice.call(b.getElementsByTagName("tspan")),o(a.split(/\s?,\s?/g), +function(a){var d=b.firstChild,e,f,a=a.split(" ");e=a[a.length-1];(f=a[a.length-2])&&o(c,function(a,c){var g;c===0&&(a.setAttribute("x",b.getAttribute("x")),c=b.getAttribute("y"),a.setAttribute("y",c||0),c===null&&b.setAttribute("y",0));g=a.cloneNode(1);K(g,{"class":"highcharts-text-shadow",fill:e,stroke:e,"stroke-opacity":1/t(C(f),3),"stroke-width":f,"stroke-linejoin":"round"});b.insertBefore(g,d)})}))},attr:function(a,b,c){var d,e=this.element,f,g=this,h;typeof a==="string"&&b!==z&&(d=a,a={},a[d]= +b);if(typeof a==="string")g=(this[a+"Getter"]||this._defaultGetter).call(this,a,e);else{for(d in a){b=a[d];h=!1;this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(d)&&(f||(this.symbolAttr(a),f=!0),h=!0);if(this.rotation&&(d==="x"||d==="y"))this.doTransform=!0;h||(h=this[d+"Setter"]||this._defaultSetter,h.call(this,b,d,e),this.shadows&&/^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(d)&&this.updateShadows(d,b,h))}if(this.doTransform)this.updateTransform(),this.doTransform= +!1}c&&c();return g},updateShadows:function(a,b,c){for(var d=this.shadows,e=d.length;e--;)c.call(null,a==="height"?Math.max(b-(d[e].cutHeight||0),0):a==="d"?this.d:b,a,d[e])},addClass:function(a){var b=this.element,c=K(b,"class")||"";c.indexOf(a)===-1&&K(b,"class",c+" "+a);return this},symbolAttr:function(a){var b=this;o("x,y,r,start,end,width,height,innerR,anchorX,anchorY".split(","),function(c){b[c]=p(a[c],b[c])});b.attr({d:b.renderer.symbols[b.symbolName](b.x,b.y,b.width,b.height,b)})},clip:function(a){return this.attr("clip-path", +a?"url("+this.renderer.url+"#"+a.id+")":"none")},crisp:function(a){var b,c={},d,e=this.strokeWidth||0;d=A(e)%2/2;a.x=T(a.x||this.x||0)+d;a.y=T(a.y||this.y||0)+d;a.width=T((a.width||this.width||0)-2*d);a.height=T((a.height||this.height||0)-2*d);a.strokeWidth=e;for(b in a)this[b]!==a[b]&&(this[b]=c[b]=a[b]);return c},css:function(a){var b=this.styles,c={},d=this.element,e,f,g="";e=!b;if(a&&a.color)a.fill=a.color;if(b)for(f in a)a[f]!==b[f]&&(c[f]=a[f],e=!0);if(e){e=this.textWidth=a&&a.width&&d.nodeName.toLowerCase()=== +"text"&&C(a.width)||this.textWidth;b&&(a=u(b,c));this.styles=a;e&&(ha||!ca&&this.renderer.forExport)&&delete a.width;if(ya&&!ca)L(this.element,a);else{b=function(a,b){return"-"+b.toLowerCase()};for(f in a)g+=f.replace(/([A-Z])/g,b)+":"+a[f]+";";K(d,"style",g)}e&&this.added&&this.renderer.buildText(this)}return this},on:function(a,b){var c=this,d=c.element;db&&a==="click"?(d.ontouchstart=function(a){c.touchEventFired=qa.now();a.preventDefault();b.call(d,a)},d.onclick=function(a){(za.indexOf("Android")=== +-1||qa.now()-(c.touchEventFired||0)>1100)&&b.call(d,a)}):d["on"+a]=b;return this},setRadialReference:function(a){var b=this.renderer.gradients[this.element.gradient];this.element.radialReference=a;b&&b.radAttr&&b.animate(this.renderer.getRadialAttr(a,b.radAttr));return this},translate:function(a,b){return this.attr({translateX:a,translateY:b})},invert:function(){this.inverted=!0;this.updateTransform();return this},updateTransform:function(){var a=this.translateX||0,b=this.translateY||0,c=this.scaleX, +d=this.scaleY,e=this.inverted,f=this.rotation,g=this.element;e&&(a+=this.attr("width"),b+=this.attr("height"));a=["translate("+a+","+b+")"];e?a.push("rotate(90) scale(-1,1)"):f&&a.push("rotate("+f+" "+(g.getAttribute("x")||0)+" "+(g.getAttribute("y")||0)+")");(q(c)||q(d))&&a.push("scale("+p(c,1)+" "+p(d,1)+")");a.length&&g.setAttribute("transform",a.join(" "))},toFront:function(){var a=this.element;a.parentNode.appendChild(a);return this},align:function(a,b,c){var d,e,f,g,h={};e=this.renderer;f=e.alignedObjects; +if(a){if(this.alignOptions=a,this.alignByTranslate=b,!c||xa(c))this.alignTo=d=c||"renderer",oa(f,this),f.push(this),c=null}else a=this.alignOptions,b=this.alignByTranslate,d=this.alignTo;c=p(c,e[d],e);d=a.align;e=a.verticalAlign;f=(c.x||0)+(a.x||0);g=(c.y||0)+(a.y||0);if(d==="right"||d==="center")f+=(c.width-(a.width||0))/{right:1,center:2}[d];h[b?"translateX":"x"]=A(f);if(e==="bottom"||e==="middle")g+=(c.height-(a.height||0))/({bottom:1,middle:2}[e]||1);h[b?"translateY":"y"]=A(g);this[this.placed? +"animate":"attr"](h);this.placed=!0;this.alignAttr=h;return this},getBBox:function(a,b){var c,d=this.renderer,e,f,g,h=this.element,i=this.styles;e=this.textStr;var k,j=h.style,l,m=d.cache,n=d.cacheKeys,r;f=p(b,this.rotation);g=f*ga;e!==z&&(r=["",f||0,i&&i.fontSize,h.style.width].join(","),r=e===""||Rb.test(e)?"num:"+e.toString().length+r:e+r);r&&!a&&(c=m[r]);if(!c){if(h.namespaceURI===Fa||d.forExport){try{l=this.fakeTS&&function(a){o(h.querySelectorAll(".highcharts-text-shadow"),function(b){b.style.display= +a})},Ma&&j.textShadow?(k=j.textShadow,j.textShadow=""):l&&l("none"),c=h.getBBox?u({},h.getBBox()):{width:h.offsetWidth,height:h.offsetHeight},k?j.textShadow=k:l&&l("")}catch(s){}if(!c||c.width<0)c={width:0,height:0}}else c=this.htmlGetBBox();if(d.isSVG){d=c.width;e=c.height;if(ya&&i&&i.fontSize==="11px"&&e.toPrecision(3)==="16.9")c.height=e=14;if(f)c.width=P(e*$(g))+P(d*U(g)),c.height=P(e*U(g))+P(d*$(g))}if(r){for(;n.length>250;)delete m[n.shift()];m[r]||n.push(r);m[r]=c}}return c},show:function(a){return this.attr({visibility:a? +"inherit":"visible"})},hide:function(){return this.attr({visibility:"hidden"})},fadeOut:function(a){var b=this;b.animate({opacity:0},{duration:a||150,complete:function(){b.attr({y:-9999})}})},add:function(a){var b=this.renderer,c=this.element,d;if(a)this.parentGroup=a;this.parentInverted=a&&a.inverted;this.textStr!==void 0&&b.buildText(this);this.added=!0;if(!a||a.handleZ||this.zIndex)d=this.zIndexSetter();d||(a?a.element:b.box).appendChild(c);if(this.onAdd)this.onAdd();return this},safeRemoveChild:function(a){var b= +a.parentNode;b&&b.removeChild(a)},destroy:function(){var a=this,b=a.element||{},c=a.shadows,d=a.renderer.isSVG&&b.nodeName==="SPAN"&&a.parentGroup,e,f;b.onclick=b.onmouseout=b.onmouseover=b.onmousemove=b.point=null;Oa(a);if(a.clipPath)a.clipPath=a.clipPath.destroy();if(a.stops){for(f=0;f]*>/g,"")))},textSetter:function(a){if(a!==this.textStr)delete this.bBox,this.textStr=a,this.added&&this.renderer.buildText(this)},fillSetter:function(a,b,c){typeof a==="string"?c.setAttribute(b,a):a&&this.colorGradient(a,b,c)},visibilitySetter:function(a,b,c){a=== +"inherit"?c.removeAttribute(b):c.setAttribute(b,a)},zIndexSetter:function(a,b){var c=this.renderer,d=this.parentGroup,c=(d||c).element||c.box,e,f,g=this.element,h;e=this.added;var i;q(a)&&(g.setAttribute(b,a),a=+a,this[b]===a&&(e=!1),this[b]=a);if(e){if((a=this.zIndex)&&d)d.handleZ=!0;d=c.childNodes;for(i=0;ia||!q(a)&&q(f)))c.insertBefore(g,e),h=!0;h||c.appendChild(g)}return h},_defaultSetter:function(a,b,c){c.setAttribute(b,a)}};O.prototype.yGetter= +O.prototype.xGetter;O.prototype.translateXSetter=O.prototype.translateYSetter=O.prototype.rotationSetter=O.prototype.verticalAlignSetter=O.prototype.scaleXSetter=O.prototype.scaleYSetter=function(a,b){this[b]=a;this.doTransform=!0};O.prototype["stroke-widthSetter"]=O.prototype.strokeSetter=function(a,b,c){this[b]=a;if(this.stroke&&this["stroke-width"])this.strokeWidth=this["stroke-width"],O.prototype.fillSetter.call(this,this.stroke,"stroke",c),c.setAttribute("stroke-width",this["stroke-width"]), +this.hasStroke=!0;else if(b==="stroke-width"&&a===0&&this.hasStroke)c.removeAttribute("stroke"),this.hasStroke=!1};var Ca=function(){this.init.apply(this,arguments)};Ca.prototype={Element:O,init:function(a,b,c,d,e,f){var g,d=this.createElement("svg").attr({version:"1.1"}).css(this.getStyle(d));g=d.element;a.appendChild(g);a.innerHTML.indexOf("xmlns")===-1&&K(g,"xmlns",Fa);this.isSVG=!0;this.box=g;this.boxWrapper=d;this.alignedObjects=[];this.url=(Ma||mb)&&y.getElementsByTagName("base").length?E.location.href.replace(/#.*?$/, +"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20"):"";this.createElement("desc").add().element.appendChild(y.createTextNode("Created with Highcharts 4.2.3"));this.defs=this.createElement("defs").add();this.allowHTML=f;this.forExport=e;this.gradients={};this.cache={};this.cacheKeys=[];this.imgCount=0;this.setSize(b,c,!1);var h;if(Ma&&a.getBoundingClientRect)this.subPixelFix=b=function(){L(a,{left:0,top:0});h=a.getBoundingClientRect();L(a,{left:ua(h.left)-h.left+"px",top:ua(h.top)-h.top+"px"})},b(), +M(E,"resize",b)},getStyle:function(a){return this.style=u({fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif',fontSize:"12px"},a)},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var a=this.defs;this.box=null;this.boxWrapper=this.boxWrapper.destroy();Sa(this.gradients||{});this.gradients=null;if(a)this.defs=a.destroy();this.subPixelFix&&V(E,"resize",this.subPixelFix);return this.alignedObjects=null},createElement:function(a){var b=new this.Element; +b.init(this,a);return b},draw:function(){},getRadialAttr:function(a,b){return{cx:a[0]-a[2]/2+b.cx*a[2],cy:a[1]-a[2]/2+b.cy*a[2],r:b.r*a[2]}},buildText:function(a){for(var b=a.element,c=this,d=c.forExport,e=p(a.textStr,"").toString(),f=e.indexOf("<")!==-1,g=b.childNodes,h,i,k=K(b,"x"),j=a.styles,l=a.textWidth,m=j&&j.lineHeight,n=j&&j.textShadow,r=j&&j.textOverflow==="ellipsis",s=g.length,R=l&&!a.added&&this.box,v=function(a){return m?C(m):c.fontMetrics(/(px|em)$/.test(a&&a.style.fontSize)?a.style.fontSize: +j&&j.fontSize||c.style.fontSize||12,a).h},x=function(a){return a.replace(/</g,"<").replace(/>/g,">")};s--;)b.removeChild(g[s]);!f&&!n&&!r&&e.indexOf(" ")===-1?b.appendChild(y.createTextNode(x(e))):(h=/<.*style="([^"]+)".*>/,i=/<.*href="(http[^"]+)".*>/,R&&R.appendChild(b),e=f?e.replace(/<(b|strong)>/g,'').replace(/<(i|em)>/g,'').replace(//g,"").split(//g):[e],e[e.length-1]=== +""&&e.pop(),o(e,function(e,f){var g,m=0,e=e.replace(//g,"|||");g=e.split("|||");o(g,function(e){if(e!==""||g.length===1){var n={},s=y.createElementNS(Fa,"tspan"),p;h.test(e)&&(p=e.match(h)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),K(s,"style",p));i.test(e)&&!d&&(K(s,"onclick",'location.href="'+e.match(i)[1]+'"'),L(s,{cursor:"pointer"}));e=x(e.replace(/<(.|\n)*?>/g,"")||" ");if(e!==" "){s.appendChild(y.createTextNode(e));if(m)n.dx=0;else if(f&&k!==null)n.x= +k;K(s,n);b.appendChild(s);!m&&f&&(!ca&&d&&L(s,{display:"block"}),K(s,"dy",v(s)));if(l){for(var n=e.replace(/([^\^])-/g,"$1- ").split(" "),R=g.length>1||f||n.length>1&&j.whiteSpace!=="nowrap",o,w,q,t=[],u=v(s),A=1,z=a.rotation,B=e,D=B.length;(R||r)&&(n.length||t.length);)a.rotation=0,o=a.getBBox(!0),q=o.width,!ca&&c.forExport&&(q=c.measureSpanWidth(s.firstChild.data,a.styles)),o=q>l,w===void 0&&(w=o),r&&w?(D/=2,B===""||!o&&D<0.5?n=[]:(o&&(w=!0),B=e.substring(0,B.length+(o?-1:1)*ua(D)),n=[B+(l>3?"\u2026": +"")],s.removeChild(s.firstChild))):!o||n.length===1?(n=t,t=[],n.length&&(A++,s=y.createElementNS(Fa,"tspan"),K(s,{dy:u,x:k}),p&&K(s,"style",p),b.appendChild(s)),q>l&&(l=q)):(s.removeChild(s.firstChild),t.unshift(n.pop())),n.length&&s.appendChild(y.createTextNode(n.join(" ").replace(/- /g,"-")));w&&a.attr("title",a.textStr);a.rotation=z}m++}}})}),R&&R.removeChild(b),n&&a.applyTextShadow&&a.applyTextShadow(n))},getContrast:function(a){a=ia(a).rgba;return a[0]+a[1]+a[2]>384?"#000000":"#FFFFFF"},button:function(a, +b,c,d,e,f,g,h,i){var k=this.label(a,b,c,i,null,null,null,null,"button"),j=0,l,m,n,r,s,p,a={x1:0,y1:0,x2:0,y2:1},e=D({"stroke-width":1,stroke:"#CCCCCC",fill:{linearGradient:a,stops:[[0,"#FEFEFE"],[1,"#F6F6F6"]]},r:2,padding:5,style:{color:"black"}},e);n=e.style;delete e.style;f=D(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#FFF"],[1,"#ACF"]]}},f);r=f.style;delete f.style;g=D(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#9BD"],[1,"#CDF"]]}},g);s=g.style;delete g.style;h=D(e,{style:{color:"#CCC"}}, +h);p=h.style;delete h.style;M(k.element,ya?"mouseover":"mouseenter",function(){j!==3&&k.attr(f).css(r)});M(k.element,ya?"mouseout":"mouseleave",function(){j!==3&&(l=[e,f,g][j],m=[n,r,s][j],k.attr(l).css(m))});k.setState=function(a){(k.state=j=a)?a===2?k.attr(g).css(s):a===3&&k.attr(h).css(p):k.attr(e).css(n)};return k.on("click",function(a){j!==3&&d.call(k,a)}).attr(e).css(u({cursor:"default"},n))},crispLine:function(a,b){a[1]===a[4]&&(a[1]=a[4]=A(a[1])-b%2/2);a[2]===a[5]&&(a[2]=a[5]=A(a[2])+b%2/ +2);return a},path:function(a){var b={fill:"none"};Ia(a)?b.d=a:Y(a)&&u(b,a);return this.createElement("path").attr(b)},circle:function(a,b,c){a=Y(a)?a:{x:a,y:b,r:c};b=this.createElement("circle");b.xSetter=b.ySetter=function(a,b,c){c.setAttribute("c"+b,a)};return b.attr(a)},arc:function(a,b,c,d,e,f){if(Y(a))b=a.y,c=a.r,d=a.innerR,e=a.start,f=a.end,a=a.x;a=this.symbol("arc",a||0,b||0,c||0,c||0,{innerR:d||0,start:e||0,end:f||0});a.r=c;return a},rect:function(a,b,c,d,e,f){var e=Y(a)?a.r:e,g=this.createElement("rect"), +a=Y(a)?a:a===z?{}:{x:a,y:b,width:t(c,0),height:t(d,0)};if(f!==z)g.strokeWidth=f,a=g.crisp(a);if(e)a.r=e;g.rSetter=function(a,b,c){K(c,{rx:a,ry:a})};return g.attr(a)},setSize:function(a,b,c){var d=this.alignedObjects,e=d.length;this.width=a;this.height=b;for(this.boxWrapper[p(c,!0)?"animate":"attr"]({width:a,height:b});e--;)d[e].align()},g:function(a){var b=this.createElement("g");return q(a)?b.attr({"class":"highcharts-"+a}):b},image:function(a,b,c,d,e){var f={preserveAspectRatio:"none"};arguments.length> +1&&u(f,{x:b,y:c,width:d,height:e});f=this.createElement("image").attr(f);f.element.setAttributeNS?f.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a):f.element.setAttribute("hc-svg-href",a);return f},symbol:function(a,b,c,d,e,f){var g=this,h,i=this.symbols[a],i=i&&i(A(b),A(c),d,e,f),k=/^url\((.*?)\)$/,j,l;if(i)h=this.path(i),u(h,{symbolName:a,x:b,y:c,width:d,height:e}),f&&u(h,f);else if(k.test(a))l=function(a,b){a.element&&(a.attr({width:b[0],height:b[1]}),a.alignByTranslate||a.translate(A((d- +b[0])/2),A((e-b[1])/2)))},j=a.match(k)[1],a=Nb[j]||f&&f.width&&f.height&&[f.width,f.height],h=this.image(j).attr({x:b,y:c}),h.isImg=!0,a?l(h,a):(h.attr({width:0,height:0}),Z("img",{onload:function(){this.width===0&&(L(this,{position:"absolute",top:"-999em"}),y.body.appendChild(this));l(h,Nb[j]=[this.width,this.height]);this.parentNode&&this.parentNode.removeChild(this);g.imgCount--;if(!g.imgCount)S[g.chartIndex].onload()},src:j})),this.imgCount++;return h},symbols:{circle:function(a,b,c,d){var e= +0.166*c;return["M",a+c/2,b,"C",a+c+e,b,a+c+e,b+d,a+c/2,b+d,"C",a-e,b+d,a-e,b,a+c/2,b,"Z"]},square:function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c,b+d,a,b+d,"Z"]},triangle:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d,a,b+d,"Z"]},"triangle-down":function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c/2,b+d,"Z"]},diamond:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d/2,a+c/2,b+d,a,b+d/2,"Z"]},arc:function(a,b,c,d,e){var f=e.start,c=e.r||c||d,g=e.end-0.001,d=e.innerR,h=e.open,i=U(f),k=$(f),j=U(g),g=$(g), +e=e.end-fc&&e>b+g&&eb+g&&ed&&h>a+g&&ha+g&&hj&&/[ \-]/.test(b.textContent||b.innerText))L(b,{width:j+"px",display:"block",whiteSpace:l||"normal"}),this.hasTextWidth=!0;else if(this.hasTextWidth)L(b,{width:"",display:"",whiteSpace:l||"nowrap"}),this.hasTextWidth=!1;this.getSpanCorrection(this.hasTextWidth? +j:b.offsetWidth,k,h,i,g)}L(b,{left:e+(this.xCorr||0)+"px",top:f+(this.yCorr||0)+"px"});if(mb)k=b.offsetHeight;this.cTT=m}}else this.alignOnAdd=!0},setSpanRotation:function(a,b,c){var d={},e=ya?"-ms-transform":mb?"-webkit-transform":Ma?"MozTransform":Lb?"-o-transform":"";d[e]=d.transform="rotate("+a+"deg)";d[e+(Ma?"Origin":"-origin")]=d.transformOrigin=b*100+"% "+c+"px";L(this.element,d)},getSpanCorrection:function(a,b,c){this.xCorr=-a*c;this.yCorr=-b}});u(Ca.prototype,{html:function(a,b,c){var d= +this.createElement("span"),e=d.element,f=d.renderer,g=function(a,b){o(["opacity","visibility"],function(c){fb(a,c+"Setter",function(a,c,d,e){a.call(this,c,d,e);b[d]=c})})};d.textSetter=function(a){a!==e.innerHTML&&delete this.bBox;e.innerHTML=this.textStr=a;d.htmlUpdateTransform()};g(d,d.element.style);d.xSetter=d.ySetter=d.alignSetter=d.rotationSetter=function(a,b){b==="align"&&(b="textAlign");d[b]=a;d.htmlUpdateTransform()};d.attr({text:a,x:A(b),y:A(c)}).css({position:"absolute",fontFamily:this.style.fontFamily, +fontSize:this.style.fontSize});e.style.whiteSpace="nowrap";d.css=d.htmlCss;if(f.isSVG)d.add=function(a){var b,c=f.box.parentNode,j=[];if(this.parentGroup=a){if(b=a.div,!b){for(;a;)j.push(a),a=a.parentGroup;o(j.reverse(),function(a){var d,e=K(a.element,"class");e&&(e={className:e});b=a.div=a.div||Z(La,e,{position:"absolute",left:(a.translateX||0)+"px",top:(a.translateY||0)+"px"},b||c);d=b.style;u(a,{translateXSetter:function(b,c){d.left=b+"px";a[c]=b;a.doTransform=!0},translateYSetter:function(b,c){d.top= +b+"px";a[c]=b;a.doTransform=!0}});g(a,d)})}}else b=c;b.appendChild(e);d.added=!0;d.alignOnAdd&&d.htmlUpdateTransform();return d};return d}});var J;if(!ca&&!ha){J={init:function(a,b){var c=["<",b,' filled="f" stroked="f"'],d=["position: ","absolute",";"],e=b===La;(b==="shape"||e)&&d.push("left:0;top:0;width:1px;height:1px;");d.push("visibility: ",e?"hidden":"visible");c.push(' style="',d.join(""),'"/>');if(b)c=e||b==="span"||b==="img"?c.join(""):a.prepVML(c),this.element=Z(c);this.renderer=a},add:function(a){var b= +this.renderer,c=this.element,d=b.box,e=a&&a.inverted,d=a?a.element||a:d;if(a)this.parentGroup=a;e&&b.invertChild(c,d);d.appendChild(c);this.added=!0;this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform();if(this.onAdd)this.onAdd();return this},updateTransform:O.prototype.htmlUpdateTransform,setSpanRotation:function(){var a=this.rotation,b=U(a*ga),c=$(a*ga);L(this.element,{filter:a?["progid:DXImageTransform.Microsoft.Matrix(M11=",b,", M12=",-c,", M21=",c,", M22=",b,", sizingMethod='auto expand')"].join(""): +"none"})},getSpanCorrection:function(a,b,c,d,e){var f=d?U(d*ga):1,g=d?$(d*ga):0,h=p(this.elemHeight,this.element.offsetHeight),i;this.xCorr=f<0&&-a;this.yCorr=g<0&&-h;i=f*g<0;this.xCorr+=g*b*(i?1-c:c);this.yCorr-=f*b*(d?i?c:1-c:1);e&&e!=="left"&&(this.xCorr-=a*c*(f<0?-1:1),d&&(this.yCorr-=h*c*(g<0?-1:1)),L(this.element,{textAlign:e}))},pathToVML:function(a){for(var b=a.length,c=[];b--;)if(ma(a[b]))c[b]=A(a[b]*10)-5;else if(a[b]==="Z")c[b]="x";else if(c[b]=a[b],a.isArc&&(a[b]==="wa"||a[b]==="at"))c[b+ +5]===c[b+7]&&(c[b+7]+=a[b+7]>a[b+5]?1:-1),c[b+6]===c[b+8]&&(c[b+8]+=a[b+8]>a[b+6]?1:-1);return c.join(" ")||"x"},clip:function(a){var b=this,c;a?(c=a.members,oa(c,b),c.push(b),b.destroyClip=function(){oa(c,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:lb?"inherit":"rect(auto)"});return b.css(a)},css:O.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&Ta(a)},destroy:function(){this.destroyClip&&this.destroyClip();return O.prototype.destroy.apply(this)},on:function(a,b){this.element["on"+ +a]=function(){var a=E.event;a.target=a.srcElement;b(a)};return this},cutOffPath:function(a,b){var c,a=a.split(/[ ,]/);c=a.length;if(c===9||c===11)a[c-4]=a[c-2]=C(a[c-2])-10*b;return a.join(" ")},shadow:function(a,b,c){var d=[],e,f=this.element,g=this.renderer,h,i=f.style,k,j=f.path,l,m,n,r;j&&typeof j.value!=="string"&&(j="x");m=j;if(a){n=p(a.width,3);r=(a.opacity||0.15)/n;for(e=1;e<=3;e++){l=n*2+1-2*e;c&&(m=this.cutOffPath(j.value,l+0.5));k=[''];h=Z(g.prepVML(k),null,{left:C(i.left)+p(a.offsetX,1),top:C(i.top)+p(a.offsetY,1)});if(c)h.cutOff=l+1;k=[''];Z(g.prepVML(k),null,null,h);b?b.element.appendChild(h):f.parentNode.insertBefore(h,f);d.push(h)}this.shadows=d}return this},updateShadows:Aa,setAttr:function(a,b){lb?this.element[a]=b:this.element.setAttribute(a,b)},classSetter:function(a){this.element.className=a},dashstyleSetter:function(a, +b,c){(c.getElementsByTagName("stroke")[0]||Z(this.renderer.prepVML([""]),null,null,c))[b]=a||"solid";this[b]=a},dSetter:function(a,b,c){var d=this.shadows,a=a||[];this.d=a.join&&a.join(" ");c.path=a=this.pathToVML(a);if(d)for(c=d.length;c--;)d[c].path=d[c].cutOff?this.cutOffPath(a,d[c].cutOff):a;this.setAttr(b,a)},fillSetter:function(a,b,c){var d=c.nodeName;if(d==="SPAN")c.style.color=a;else if(d!=="IMG")c.filled=a!=="none",this.setAttr("fillcolor",this.renderer.color(a,c,b,this))},"fill-opacitySetter":function(a, +b,c){Z(this.renderer.prepVML(["<",b.split("-")[0],' opacity="',a,'"/>']),null,null,c)},opacitySetter:Aa,rotationSetter:function(a,b,c){c=c.style;this[b]=c[b]=a;c.left=-A($(a*ga)+1)+"px";c.top=A(U(a*ga))+"px"},strokeSetter:function(a,b,c){this.setAttr("strokecolor",this.renderer.color(a,c,b,this))},"stroke-widthSetter":function(a,b,c){c.stroked=!!a;this[b]=a;ma(a)&&(a+="px");this.setAttr("strokeweight",a)},titleSetter:function(a,b){this.setAttr(b,a)},visibilitySetter:function(a,b,c){a==="inherit"&& +(a="visible");this.shadows&&o(this.shadows,function(c){c.style[b]=a});c.nodeName==="DIV"&&(a=a==="hidden"?"-999em":0,lb||(c.style[b]=a?"visible":"hidden"),b="top");c.style[b]=a},xSetter:function(a,b,c){this[b]=a;b==="x"?b="left":b==="y"&&(b="top");this.updateClipping?(this[b]=a,this.updateClipping()):c.style[b]=a},zIndexSetter:function(a,b,c){c.style[b]=a}};J["stroke-opacitySetter"]=J["fill-opacitySetter"];B.VMLElement=J=pa(O,J);J.prototype.ySetter=J.prototype.widthSetter=J.prototype.heightSetter= +J.prototype.xSetter;var Cb={Element:J,isIE8:za.indexOf("MSIE 8.0")>-1,init:function(a,b,c,d){var e;this.alignedObjects=[];d=this.createElement(La).css(u(this.getStyle(d),{position:"relative"}));e=d.element;a.appendChild(d.element);this.isVML=!0;this.box=e;this.boxWrapper=d;this.gradients={};this.cache={};this.cacheKeys=[];this.imgCount=0;this.setSize(b,c,!1);if(!y.namespaces.hcv){y.namespaces.add("hcv","urn:schemas-microsoft-com:vml");try{y.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}catch(f){y.styleSheets[0].cssText+= +"hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}}},isHidden:function(){return!this.box.offsetWidth},clipRect:function(a,b,c,d){var e=this.createElement(),f=Y(a);return u(e,{members:[],count:0,left:(f?a.x:a)+1,top:(f?a.y:b)+1,width:(f?a.width:c)-1,height:(f?a.height:d)-1,getCSS:function(a){var b=a.element,c=b.nodeName,a=a.inverted,d=this.top-(c==="shape"?b.offsetTop:0),e=this.left,b=e+this.width,f=d+this.height,d={clip:"rect("+A(a?e:d)+"px,"+ +A(a?f:b)+"px,"+A(a?b:f)+"px,"+A(a?d:e)+"px)"};!a&&lb&&c==="DIV"&&u(d,{width:b+"px",height:f+"px"});return d},updateClipping:function(){o(e.members,function(a){a.element&&a.css(e.getCSS(a))})}})},color:function(a,b,c,d){var e=this,f,g=/^rgba/,h,i,k="none";a&&a.linearGradient?i="gradient":a&&a.radialGradient&&(i="pattern");if(i){var j,l,m=a.linearGradient||a.radialGradient,n,r,s,p,v,x="",a=a.stops,w,q=[],ba=function(){h=[''];Z(e.prepVML(h),null,null,b)};n=a[0];w=a[a.length-1];n[0]>0&&a.unshift([0,n[1]]);w[0]<1&&a.push([1,w[1]]);o(a,function(a,b){g.test(a[1])?(f=ia(a[1]),j=f.get("rgb"),l=f.get("a")):(j=a[1],l=1);q.push(a[0]*100+"% "+j);b?(s=l,p=j):(r=l,v=j)});if(c==="fill")if(i==="gradient")c=m.x1||m[0]||0,a=m.y1||m[1]||0,n=m.x2||m[2]||0,m=m.y2||m[3]||0,x='angle="'+(90-W.atan((m-a)/(n-c))*180/ra)+'"',ba();else{var k=m.r,t=k*2,u=k*2,A=m.cx,B=m.cy,z=b.radialReference,y,k=function(){z&&(y= +d.getBBox(),A+=(z[0]-y.x)/y.width-0.5,B+=(z[1]-y.y)/y.height-0.5,t*=z[2]/y.width,u*=z[2]/y.height);x='src="'+N.global.VMLRadialGradientURL+'" size="'+t+","+u+'" origin="0.5,0.5" position="'+A+","+B+'" color2="'+v+'" ';ba()};d.added?k():d.onAdd=k;k=p}else k=j}else if(g.test(a)&&b.tagName!=="IMG")f=ia(a),d[c+"-opacitySetter"](f.get("a"),c,b),k=f.get("rgb");else{k=b.getElementsByTagName(c);if(k.length)k[0].opacity=1,k[0].type="solid";k=a}return k},prepVML:function(a){var b=this.isIE8,a=a.join("");b? +(a=a.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),a=a.indexOf('style="')===-1?a.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):a.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):a=a.replace("<","1&&f.attr({x:b,y:c,width:d,height:e});return f},createElement:function(a){return a==="rect"?this.symbol(a):Ca.prototype.createElement.call(this,a)},invertChild:function(a,b){var c=this,d=b.style,e=a.tagName==="IMG"&&a.style;L(a,{flip:"x",left:C(d.width)-(e?C(e.top): +1),top:C(d.height)-(e?C(e.left):1),rotation:-90});o(a.childNodes,function(b){c.invertChild(b,a)})},symbols:{arc:function(a,b,c,d,e){var f=e.start,g=e.end,h=e.r||c||d,c=e.innerR,d=U(f),i=$(f),k=U(g),j=$(g);if(g-f===0)return["x"];f=["wa",a-h,b-h,a+h,b+h,a+h*d,b+h*i,a+h*k,b+h*j];e.open&&!c&&f.push("e","M",a,b);f.push("at",a-c,b-c,a+c,b+c,a+c*k,b+c*j,a+c*d,b+c*i,"x","e");f.isArc=!0;return f},circle:function(a,b,c,d,e){e&&(c=d=2*e.r);e&&e.isCircle&&(a-=c/2,b-=d/2);return["wa",a,b,a+c,b+d,a+c,b+d/2,a+c, +b+d/2,"e"]},rect:function(a,b,c,d,e){return Ca.prototype.symbols[!q(e)||!e.r?"square":"callout"].call(0,a,b,c,d,e)}}};B.VMLRenderer=J=function(){this.init.apply(this,arguments)};J.prototype=D(Ca.prototype,Cb);cb=J}Ca.prototype.measureSpanWidth=function(a,b){var c=y.createElement("span"),d;d=y.createTextNode(a);c.appendChild(d);L(c,b);this.box.appendChild(c);d=c.offsetWidth;Ta(c);return d};var Ob;if(ha)B.CanVGRenderer=J=function(){Fa="http://www.w3.org/1999/xhtml"},J.prototype.symbols={},Ob=function(){function a(){var a= +b.length,d;for(d=0;d0&&c+i*k>e&&(m=A((d-c)/U(h*ga)));else if(d=c+(1-i)*k,c-i*ke&&(j=e-a.x+j*i,l=-1),j=F(b.slotWidth,j),jj||b.autoRotation&&g.styles.width)m=j;if(m){n.width= +m;if(!b.options.labels.style.textOverflow)n.textOverflow="ellipsis";g.css(n)}},getPosition:function(a,b,c,d){var e=this.axis,f=e.chart,g=d&&f.oldChartHeight||f.chartHeight;return{x:a?e.translate(b+c,null,null,d)+e.transB:e.left+e.offset+(e.opposite?(d&&f.oldChartWidth||f.chartWidth)-e.right-e.left:0),y:a?g-e.bottom+e.offset-(e.opposite?e.height:0):g-e.translate(b+c,null,null,d)-e.transB}},getLabelPosition:function(a,b,c,d,e,f,g,h){var i=this.axis,k=i.transA,j=i.reversed,l=i.staggerLines,m=i.tickRotCorr|| +{x:0,y:0},n=e.y;q(n)||(n=i.side===2?m.y+8:n=U(c.rotation*ga)*(m.y-c.getBBox(!1,0).height/2));a=a+e.x+m.x-(f&&d?f*k*(j?-1:1):0);b=b+n-(f&&!d?f*k*(j?1:-1):0);l&&(c=g/(h||1)%l,i.opposite&&(c=l-c-1),b+=c*(i.labelOffset/l));return{x:a,y:A(b)}},getMarkPath:function(a,b,c,d,e,f){return f.crispLine(["M",a,b,"L",a+(e?0:-c),b+(e?c:0)],d)},render:function(a,b,c){var d=this.axis,e=d.options,f=d.chart.renderer,g=d.horiz,h=this.type,i=this.label,k=this.pos,j=e.labels,l=this.gridLine,m=h?h+"Grid":"grid",n=h?h+"Tick": +"tick",r=e[m+"LineWidth"],s=e[m+"LineColor"],o=e[m+"LineDashStyle"],v=e[n+"Length"],m=p(e[n+"Width"],!h&&d.isXAxis?1:0),x=e[n+"Color"],w=e[n+"Position"],n=this.mark,q=j.step,ba=!0,t=d.tickmarkOffset,u=this.getPosition(g,k,t,b),A=u.x,u=u.y,B=g&&A===d.pos+d.len||!g&&u===d.pos?-1:1,c=p(c,1);this.isActive=!0;if(r){k=d.getPlotLinePath(k+t,r*B,b,!0);if(l===z){l={stroke:s,"stroke-width":r};if(o)l.dashstyle=o;if(!h)l.zIndex=1;if(b)l.opacity=0;this.gridLine=l=r?f.path(k).attr(l).add(d.gridGroup):null}if(!b&& +l&&k)l[this.isNew?"attr":"animate"]({d:k,opacity:c})}if(m&&v)w==="inside"&&(v=-v),d.opposite&&(v=-v),h=this.getMarkPath(A,u,v,m*B,g,f),n?n.animate({d:h,opacity:c}):this.mark=f.path(h).attr({stroke:x,"stroke-width":m,opacity:c}).add(d.axisGroup);if(i&&!isNaN(A))i.xy=u=this.getLabelPosition(A,u,i,g,j,t,a,q),this.isFirst&&!this.isLast&&!p(e.showFirstLabel,1)||this.isLast&&!this.isFirst&&!p(e.showLastLabel,1)?ba=!1:g&&!d.isRadial&&!j.step&&!j.rotation&&!b&&c!==0&&this.handleOverflow(u),q&&a%q&&(ba=!1), +ba&&!isNaN(u.y)?(u.opacity=c,i[this.isNew?"attr":"animate"](u),this.isNew=!1):i.attr("y",-9999)},destroy:function(){Sa(this,this.axis)}};B.PlotLineOrBand=function(a,b){this.axis=a;if(b)this.options=b,this.id=b.id};B.PlotLineOrBand.prototype={render:function(){var a=this,b=a.axis,c=b.horiz,d=a.options,e=d.label,f=a.label,g=d.width,h=d.to,i=d.from,k=q(i)&&q(h),j=d.value,l=d.dashStyle,m=a.svgElem,n=[],r,s=d.color,o=p(d.zIndex,0),v=d.events,x={},w=b.chart.renderer;b.isLog&&(i=Da(i),h=Da(h),j=Da(j));if(g){if(n= +b.getPlotLinePath(j,g),x={stroke:s,"stroke-width":g},l)x.dashstyle=l}else if(k){n=b.getPlotBandPath(i,h,d);if(s)x.fill=s;if(d.borderWidth)x.stroke=d.borderColor,x["stroke-width"]=d.borderWidth}else return;x.zIndex=o;if(m)if(n)m.show(),m.animate({d:n});else{if(m.hide(),f)a.label=f=f.destroy()}else if(n&&n.length&&(a.svgElem=m=w.path(n).attr(x).add(),v))for(r in d=function(b){m.on(b,function(c){v[b].apply(a,[c])})},v)d(r);e&&q(e.text)&&n&&n.length&&b.width>0&&b.height>0&&!n.flat?(e=D({align:c&&k&&"center", +x:c?!k&&4:10,verticalAlign:!c&&k&&"middle",y:c?k?16:10:k?6:-4,rotation:c&&!k&&90},e),this.renderLabel(e,n,k,o)):f&&f.hide();return a},renderLabel:function(a,b,c,d){var e=this.label,f=this.axis.chart.renderer;if(!e)e={align:a.textAlign||a.align,rotation:a.rotation},e.zIndex=d,this.label=e=f.text(a.text,0,0,a.useHTML).attr(e).css(a.style).add();d=[b[1],b[4],c?b[6]:b[1]];b=[b[2],b[5],c?b[7]:b[2]];c=Ra(d);f=Ra(b);e.align(a,!1,{x:c,y:f,width:Ea(d)-c,height:Ea(b)-f});e.show()},destroy:function(){oa(this.axis.plotLinesAndBands, +this);delete this.axis;Sa(this)}};var ka=B.Axis=function(){this.init.apply(this,arguments)};ka.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#D8D8D8",labels:{enabled:!0,style:{color:"#606060",cursor:"default",fontSize:"11px"},x:0,y:15},lineColor:"#C0D0E0",lineWidth:1,minPadding:0.01,maxPadding:0.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1, +minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:10,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",title:{align:"middle",style:{color:"#707070"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8,y:3},lineWidth:0,maxPadding:0.05,minPadding:0.05,startOnTick:!0,title:{rotation:270,text:"Values"},stackLabels:{enabled:!1,formatter:function(){return B.numberFormat(this.total, +-1)},style:D(aa.line.dataLabels.style,{color:"#000000"})}},defaultLeftAxisOptions:{labels:{x:-15,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{x:15,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{autoRotation:[-45],x:0,y:null},title:{rotation:0}},defaultTopAxisOptions:{labels:{autoRotation:[-45],x:0,y:-15},title:{rotation:0}},init:function(a,b){var c=b.isX;this.chart=a;this.horiz=a.inverted?!c:c;this.coll=(this.isXAxis=c)?"xAxis":"yAxis";this.opposite=b.opposite;this.side= +b.side||(this.horiz?this.opposite?0:2:this.opposite?1:3);this.setOptions(b);var d=this.options,e=d.type;this.labelFormatter=d.labels.formatter||this.defaultLabelFormatter;this.userOptions=b;this.minPixelPadding=0;this.reversed=d.reversed;this.visible=d.visible!==!1;this.zoomEnabled=d.zoomEnabled!==!1;this.categories=d.categories||e==="category";this.names=this.names||[];this.isLog=e==="logarithmic";this.isDatetimeAxis=e==="datetime";this.isLinked=q(d.linkedTo);this.ticks={};this.labelEdge=[];this.minorTicks= +{};this.plotLinesAndBands=[];this.alternateBands={};this.len=0;this.minRange=this.userMinRange=d.minRange||d.maxZoom;this.range=d.range;this.offset=d.offset||0;this.stacks={};this.oldStacks={};this.stacksTouched=0;this.min=this.max=null;this.crosshair=p(d.crosshair,ta(a.options.tooltip.crosshairs)[c?0:1],!1);var f,d=this.options.events;sa(this,a.axes)===-1&&(c&&!this.isColorAxis?a.axes.splice(a.xAxis.length,0,this):a.axes.push(this),a[this.coll].push(this));this.series=this.series||[];if(a.inverted&& +c&&this.reversed===z)this.reversed=!0;this.removePlotLine=this.removePlotBand=this.removePlotBandOrLine;for(f in d)M(this,f,d[f]);if(this.isLog)this.val2lin=Da,this.lin2val=na},setOptions:function(a){this.options=D(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],D(N[this.coll],a))},defaultLabelFormatter:function(){var a=this.axis,b=this.value,c=a.categories,d= +this.dateTimeLabelFormat,e=N.lang.numericSymbols,f=e&&e.length,g,h=a.options.labels.format,a=a.isLog?b:a.tickInterval;if(h)g=Ka(h,this);else if(c)g=b;else if(d)g=Qa(d,b);else if(f&&a>=1E3)for(;f--&&g===z;)c=Math.pow(1E3,f+1),a>=c&&b*10%c===0&&e[f]!==null&&(g=B.numberFormat(b/c,-1)+e[f]);g===z&&(g=P(b)>=1E4?B.numberFormat(b,-1):B.numberFormat(b,-1,z,""));return g},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=a.threshold=null;a.softThreshold=!a.isXAxis; +a.buildStacks&&a.buildStacks();o(a.series,function(c){if(c.visible||!b.options.chart.ignoreHiddenSeries){var d=c.options,e=d.threshold,f;a.hasVisibleSeries=!0;a.isLog&&e<=0&&(e=null);if(a.isXAxis){if(d=c.xData,d.length)a.dataMin=F(p(a.dataMin,d[0]),Ra(d)),a.dataMax=t(p(a.dataMax,d[0]),Ea(d))}else{c.getExtremes();f=c.dataMax;c=c.dataMin;if(q(c)&&q(f))a.dataMin=F(p(a.dataMin,c),c),a.dataMax=t(p(a.dataMax,f),f);if(q(e))a.threshold=e;if(!d.softThreshold||a.isLog)a.softThreshold=!1}}})},translate:function(a, +b,c,d,e,f){var g=this.linkedParent||this,h=1,i=0,k=d?g.oldTransA:g.transA,d=d?g.oldMin:g.min,j=g.minPixelPadding,e=(g.isOrdinal||g.isBroken||g.isLog&&e)&&g.lin2val;if(!k)k=g.transA;if(c)h*=-1,i=g.len;g.reversed&&(h*=-1,i-=h*(g.sector||g.len));b?(a=a*h+i,a-=j,a=a/k+d,e&&(a=g.lin2val(a))):(e&&(a=g.val2lin(a)),f==="between"&&(f=0.5),a=h*(a-d)*k+i+h*j+(ma(f)?k*f*g.pointRange:0));return a},toPixels:function(a,b){return this.translate(a,!1,!this.horiz,null,!0)+(b?0:this.pos)},toValue:function(a,b){return this.translate(a- +(b?0:this.pos),!0,!this.horiz,null,!0)},getPlotLinePath:function(a,b,c,d,e){var f=this.chart,g=this.left,h=this.top,i,k,j=c&&f.oldChartHeight||f.chartHeight,l=c&&f.oldChartWidth||f.chartWidth,m;i=this.transB;var n=function(a,b,c){if(ac)d?a=F(t(b,a),c):m=!0;return a},e=p(e,this.translate(a,null,null,c)),a=c=A(e+i);i=k=A(j-e-i);isNaN(e)?m=!0:this.horiz?(i=h,k=j-this.bottom,a=c=n(a,g,g+this.width)):(a=g,c=l-this.right,i=k=n(i,h,h+this.height));return m&&!d?null:f.renderer.crispLine(["M",a,i,"L", +c,k],b||1)},getLinearTickPositions:function(a,b,c){var d,e=fa(T(b/a)*a),f=fa(ua(c/a)*a),g=[];if(b===c&&ma(b))return[b];for(b=e;b<=f;){g.push(b);b=fa(b+a);if(b===d)break;d=b}return g},getMinorTickPositions:function(){var a=this.options,b=this.tickPositions,c=this.minorTickInterval,d=[],e,f=this.pointRangePadding||0;e=this.min-f;var f=this.max+f,g=f-e;if(g&&g/c=this.minRange,f,g,h,i,k,j;if(this.isXAxis&&this.minRange===z&&!this.isLog)q(a.min)||q(a.max)?this.minRange=null:(o(this.series,function(a){i=a.xData;for(g=k=a.xIncrement?1:i.length-1;g>0;g--)if(h=i[g]- +i[g-1],f===z||h=n?(s=n,k=0):b.dataMax<=n&&(R=n,i=0)),b.min=p(v,s,b.dataMin),b.max=p(x,R,b.dataMax));if(e)!a&&F(b.min,p(b.dataMin,b.min))<=0&&X(10,1),b.min=fa(Da(b.min),15),b.max=fa(Da(b.max),15);if(b.range&&q(b.max))b.userMin=b.min=v=t(b.min,b.minFromRange()),b.userMax=x=b.max,b.range=null;b.beforePadding&&b.beforePadding();b.adjustForMinRange();if(!m&&!b.axisPointRange&&!b.usePercentage&&!h&&q(b.min)&&q(b.max)&&(c=b.max-b.min))!q(v)&&k&&(b.min-=c*k),!q(x)&& +i&&(b.max+=c*i);if(ma(d.floor))b.min=t(b.min,d.floor);if(ma(d.ceiling))b.max=F(b.max,d.ceiling);if(r&&q(b.dataMin))if(n=n||0,!q(v)&&b.min=n)b.min=n;else if(!q(x)&&b.max>n&&b.dataMax<=n)b.max=n;b.tickInterval=b.min===b.max||b.min===void 0||b.max===void 0?1:h&&!j&&l===b.linkedParent.options.tickPixelInterval?j=b.linkedParent.tickInterval:p(j,this.tickAmount?(b.max-b.min)/t(this.tickAmount-1,1):void 0,m?1:(b.max-b.min)*l/t(b.len,l));g&&!a&&o(b.series,function(a){a.processData(b.min!==b.oldMin|| +b.max!==b.oldMax)});b.setAxisTranslation(!0);b.beforeSetTickPositions&&b.beforeSetTickPositions();if(b.postProcessTickInterval)b.tickInterval=b.postProcessTickInterval(b.tickInterval);if(b.pointRange&&!j)b.tickInterval=t(b.pointRange,b.tickInterval);a=p(d.minTickInterval,b.isDatetimeAxis&&b.closestPointRange);if(!j&&b.tickInterval0.5&&b.tickInterval<5&&b.max>1E3&&b.max<9999)), +!!this.tickAmount);if(!this.tickAmount&&this.len)b.tickInterval=b.unsquish();this.setTickPositions()},setTickPositions:function(){var a=this.options,b,c=a.tickPositions,d=a.tickPositioner,e=a.startOnTick,f=a.endOnTick,g;this.tickmarkOffset=this.categories&&a.tickmarkPlacement==="between"&&this.tickInterval===1?0.5:0;this.minorTickInterval=a.minorTickInterval==="auto"&&this.tickInterval?this.tickInterval/5:a.minorTickInterval;this.tickPositions=b=c&&c.slice();if(!b&&(b=this.isDatetimeAxis?this.getTimeTicks(this.normalizeTimeTickInterval(this.tickInterval, +a.units),this.min,this.max,a.startOfWeek,this.ordinalPositions,this.closestPointRange,!0):this.isLog?this.getLogTickPositions(this.tickInterval,this.min,this.max):this.getLinearTickPositions(this.tickInterval,this.min,this.max),b.length>this.len&&(b=[b[0],b.pop()]),this.tickPositions=b,d&&(d=d.apply(this,[this.min,this.max]))))this.tickPositions=b=d;if(!this.isLinked)this.trimTicks(b,e,f),this.min===this.max&&q(this.min)&&!this.tickAmount&&(g=!0,this.min-=0.5,this.max+=0.5),this.single=g,!c&&!d&& +this.adjustTickAmount()},trimTicks:function(a,b,c){var d=a[0],e=a[a.length-1],f=this.minPointOffset||0;if(b)this.min=d;else for(;this.min-f>a[0];)a.shift();if(c)this.max=e;else for(;this.max+fc&&(this.tickInterval*=2,this.setTickPositions());if(q(d)){for(a=c=b.length;a--;)(d===3&&a%2===1||d<=2&&a>0&&a=e&&(b=e));this.displayBtn=a!==z||b!==z;this.setExtremes(a,b,!1,z,{trigger:"zoom"});return!0},setAxisSize:function(){var a=this.chart,b=this.options,c=b.offsetLeft||0,d=this.horiz,e=p(b.width,a.plotWidth-c+(b.offsetRight||0)),f=p(b.height,a.plotHeight),g=p(b.top,a.plotTop),b=p(b.left,a.plotLeft+c),c=/%$/;c.test(f)&&(f=Math.round(parseFloat(f)/ +100*a.plotHeight));c.test(g)&&(g=Math.round(parseFloat(g)/100*a.plotHeight+a.plotTop));this.left=b;this.top=g;this.width=e;this.height=f;this.bottom=a.chartHeight-f-g;this.right=a.chartWidth-e-b;this.len=t(d?e:f,0);this.pos=d?b:g},getExtremes:function(){var a=this.isLog;return{min:a?fa(na(this.min)):this.min,max:a?fa(na(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=b?na(this.min):this.min,b=b?na(this.max): +this.max;a===null?a=b<0?b:c:c>a?a=c:b15&&a<165?"right":a>195&&a<345?"left":"center"},unsquish:function(){var a=this.ticks,b=this.options.labels,c=this.horiz,d=this.tickInterval,e=d,f=this.len/(((this.categories?1:0)+this.max-this.min)/d),g,h=b.rotation,i=this.chart.renderer.fontMetrics(b.style.fontSize,a[0]&&a[0].label),k,j=Number.MAX_VALUE,l,m=function(a){a/=f||1;a=a>1?ua(a):1;return a* +d};c?(l=!b.staggerLines&&!b.step&&(q(h)?[h]:f=-90&&a<=90)k=m(P(i.h/$(ga*a))),b=k+P(a/360),bm)m=a.labelLength}),m>i&&m>h.h?k.rotation=this.labelRotation:this.labelRotation=0;else if(g&&(l={width:i+"px"},!j)){l.textOverflow="clip";for(n=c.length;!f&&n--;)if(r=c[n],i=d[r].label)if(i.styles.textOverflow=== +"ellipsis"&&i.css({textOverflow:"clip"}),i.getBBox().height>this.len/c.length-(h.h-h.f)||d[r].labelLength>g)i.specCss={textOverflow:"ellipsis"}}if(k.rotation&&(l={width:(m>a.chartHeight*0.5?a.chartHeight*0.33:a.chartHeight)+"px"},!j))l.textOverflow="ellipsis";if(this.labelAlign=e.align||this.autoLabelAlign(this.labelRotation))k.align=this.labelAlign;o(c,function(a){var b=(a=d[a])&&a.label;if(b)b.attr(k),l&&b.css(D(l,b.specCss)),delete b.specCss,a.rotation=k.rotation});this.tickRotCorr=b.rotCorr(h.b, +this.labelRotation||0,this.side!==0)},hasData:function(){return this.hasVisibleSeries||q(this.min)&&q(this.max)&&!!this.tickPositions},getOffset:function(){var a=this,b=a.chart,c=b.renderer,d=a.options,e=a.tickPositions,f=a.ticks,g=a.horiz,h=a.side,i=b.inverted?[1,0,3,2][h]:h,k,j,l=0,m,n=0,r=d.title,s=d.labels,R=0,v=a.opposite,x=b.axisOffset,b=b.clipOffset,w=[-1,1,1,-1][h],u,ba=a.axisParent;k=a.hasData();a.showAxis=j=k||p(d.showEmpty,!0);a.staggerLines=a.horiz&&s.staggerLines;if(!a.axisGroup)a.gridGroup= +c.g("grid").attr({zIndex:d.gridZIndex||1}).add(ba),a.axisGroup=c.g("axis").attr({zIndex:d.zIndex||2}).add(ba),a.labelGroup=c.g("axis-labels").attr({zIndex:s.zIndex||7}).addClass("highcharts-"+a.coll.toLowerCase()+"-labels").add(ba);if(k||a.isLinked){if(o(e,function(b){f[b]?f[b].addLabel():f[b]=new Va(a,b)}),a.renderUnsquish(),s.reserveSpace!==!1&&(h===0||h===2||{1:"left",3:"right"}[h]===a.labelAlign||a.labelAlign==="center")&&o(e,function(a){R=t(f[a].getLabelSize(),R)}),a.staggerLines)R*=a.staggerLines, +a.labelOffset=R*(a.opposite?-1:1)}else for(u in f)f[u].destroy(),delete f[u];if(r&&r.text&&r.enabled!==!1){if(!a.axisTitle)a.axisTitle=c.text(r.text,0,0,r.useHTML).attr({zIndex:7,rotation:r.rotation||0,align:r.textAlign||{low:v?"right":"left",middle:"center",high:v?"left":"right"}[r.align]}).addClass("highcharts-"+this.coll.toLowerCase()+"-title").css(r.style).add(a.axisGroup),a.axisTitle.isNew=!0;if(j)l=a.axisTitle.getBBox()[g?"height":"width"],m=r.offset,n=q(m)?0:p(r.margin,g?5:10);a.axisTitle[j? +"show":"hide"](!0)}a.offset=w*p(d.offset,x[h]);a.tickRotCorr=a.tickRotCorr||{x:0,y:0};c=h===2?a.tickRotCorr.y:0;g=Math.abs(R)+n+(R&&w*(g?p(s.y,a.tickRotCorr.y+8):s.x)-c);a.axisTitleMargin=p(m,g);x[h]=t(x[h],a.axisTitleMargin+l+w*a.offset,g);d=d.offset?0:T(d.lineWidth/2)*2;b[i]=t(b[i],d)},getLinePath:function(a){var b=this.chart,c=this.opposite,d=this.offset,e=this.horiz,f=this.left+(c?this.width:0)+d,d=b.chartHeight-this.bottom-(c?this.height:0)+d;c&&(a*=-1);return b.renderer.crispLine(["M",e?this.left: +f,e?d:this.top,"L",e?b.chartWidth-this.right:f,e?d:b.chartHeight-this.bottom],a)},getTitlePosition:function(){var a=this.horiz,b=this.left,c=this.top,d=this.len,e=this.options.title,f=a?b:c,g=this.opposite,h=this.offset,i=e.x||0,k=e.y||0,j=C(e.style.fontSize||12),d={low:f+(a?0:d),middle:f+d/2,high:f+(a?d:0)}[e.align],b=(a?c+this.height:b)+(a?1:-1)*(g?-1:1)*this.axisTitleMargin+(this.side===2?j:0);return{x:a?d+i:b+(g?this.width:0)+h+i,y:a?b+k-(g?this.height:0)+h:d+k}},render:function(){var a=this, +b=a.chart,c=b.renderer,d=a.options,e=a.isLog,f=a.isLinked,g=a.tickPositions,h=a.axisTitle,i=a.ticks,k=a.minorTicks,j=a.alternateBands,l=d.stackLabels,m=d.alternateGridColor,n=a.tickmarkOffset,r=d.lineWidth,s,p=b.hasRendered&&q(a.oldMin)&&!isNaN(a.oldMin),v=a.showAxis,x=c.globalAnimation,w,t;a.labelEdge.length=0;a.overlap=!1;o([i,k,j],function(a){for(var b in a)a[b].isActive=!1});if(a.hasData()||f){a.minorTickInterval&&!a.categories&&o(a.getMinorTickPositions(),function(b){k[b]||(k[b]=new Va(a,b,"minor")); +p&&k[b].isNew&&k[b].render(null,!0);k[b].render(null,!1,1)});if(g.length&&(o(g,function(b,c){if(!f||b>=a.min&&b<=a.max)i[b]||(i[b]=new Va(a,b)),p&&i[b].isNew&&i[b].render(c,!0,0.1),i[b].render(c)}),n&&(a.min===0||a.single)))i[-1]||(i[-1]=new Va(a,-1,null,!0)),i[-1].render(-1);m&&o(g,function(c,d){t=g[d+1]!==z?g[d+1]+n:a.max-n;if(d%2===0&&c=G.second?0:j*T(i.getMilliseconds()/j));if(k>=G.second)i[Hb](k>=G.minute?0:j*T(i.getSeconds()/j));if(k>=G.minute)i[Ib](k>=G.hour?0:j*T(i[tb]()/j));if(k>=G.hour)i[Jb](k>=G.day?0:j*T(i[ub]()/j));if(k>=G.day)i[wb](k>=G.month? +1:j*T(i[$a]()/j));k>=G.month&&(i[xb](k>=G.year?0:j*T(i[ab]()/j)),h=i[bb]());k>=G.year&&(h-=h%j,i[yb](h));if(k===G.week)i[wb](i[$a]()-i[vb]()+p(d,1));b=1;if(qb||Za)i=i.getTime(),i=new qa(i+Ya(i));h=i[bb]();for(var d=i.getTime(),l=i[ab](),m=i[$a](),n=!g||!!Za,r=(G.day+(g?Ya(i):i.getTimezoneOffset()*6E4))%G.day;d=0.5)a=A(a),g=this.getLinearTickPositions(a,b,c);else if(a>=0.08)for(var f=T(b),h,i,k,j,l,e=a>0.3?[1,2,4]:a>0.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];fb&&(!d||j<=c)&&j!==z&&g.push(j),j>c&&(l=!0),j=k}else if(b=na(b),c=na(c),a=e[d? +"minorTickInterval":"tickInterval"],a=p(a==="auto"?null:a,this._minorAutoInterval,(c-b)*(e.tickPixelInterval/(d?5:1))/((d?f/this.tickPositions.length:f)||1)),a=sb(a,null,rb(a)),g=Ba(this.getLinearTickPositions(a,b,c),Da),!d)this._minorAutoInterval=a/5;if(!d)this.tickInterval=a;return g};var Pb=B.Tooltip=function(){this.init.apply(this,arguments)};Pb.prototype={init:function(a,b){var c=b.borderWidth,d=b.style,e=C(d.padding);this.chart=a;this.options=b;this.crosshairs=[];this.now={x:0,y:0};this.isHidden= +!0;this.label=a.renderer.label("",0,0,b.shape||"callout",null,null,b.useHTML,null,"tooltip").attr({padding:e,fill:b.backgroundColor,"stroke-width":c,r:b.borderRadius,zIndex:8}).css(d).css({padding:0}).add().attr({y:-9999});ha||this.label.shadow(b.shadow);this.shared=b.shared},destroy:function(){if(this.label)this.label=this.label.destroy();clearTimeout(this.hideTimer);clearTimeout(this.tooltipTimeout)},move:function(a,b,c,d){var e=this,f=e.now,g=e.options.animation!==!1&&!e.isHidden&&(P(a-f.x)>1|| +P(b-f.y)>1),h=e.followPointer||e.len>1;u(f,{x:g?(2*f.x+a)/3:a,y:g?(f.y+b)/2:b,anchorX:h?z:g?(2*f.anchorX+c)/3:c,anchorY:h?z:g?(f.anchorY+d)/2:d});e.label.attr(f);if(g)clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){e&&e.move(a,b,c,d)},32)},hide:function(a){var b=this;clearTimeout(this.hideTimer);a=p(a,this.options.hideDelay,500);if(!this.isHidden)this.hideTimer=Pa(function(){b.label[a?"fadeOut":"hide"]();b.isHidden=!0},a)},getAnchor:function(a,b){var c,d=this.chart,e=d.inverted, +f=d.plotTop,g=d.plotLeft,h=0,i=0,k,j,a=ta(a);c=a[0].tooltipPos;this.followPointer&&b&&(b.chartX===z&&(b=d.pointer.normalize(b)),c=[b.chartX-d.plotLeft,b.chartY-f]);c||(o(a,function(a){k=a.series.yAxis;j=a.series.xAxis;h+=a.plotX+(!e&&j?j.left-g:0);i+=(a.plotLow?(a.plotLow+a.plotHigh)/2:a.plotY)+(!e&&k?k.top-f:0)}),h/=a.length,i/=a.length,c=[e?d.plotWidth-i:h,this.shared&&!e&&a.length>1&&b?b.chartY-f:e?d.plotHeight-h:i]);return Ba(c,A)},getPosition:function(a,b,c){var d=this.chart,e=this.distance, +f={},g=c.h||0,h,i=["y",d.chartHeight,b,c.plotY+d.plotTop,d.plotTop,d.plotTop+d.plotHeight],k=["x",d.chartWidth,a,c.plotX+d.plotLeft,d.plotLeft,d.plotLeft+d.plotWidth],j=p(c.ttBelow,d.inverted&&!c.negative||!d.inverted&&c.negative),l=function(a,b,c,d,h,i){var k=cb?d:d+g);else return!1},m=function(a,b,c,d){var g;db-e?g=!1:f[a]=db-c/2?b-c-2:d-c/2;return g},n=function(a){var b= +i;i=k;k=b;h=a},r=function(){l.apply(0,i)!==!1?m.apply(0,k)===!1&&!h&&(n(!0),r()):h?f.x=f.y=0:(n(!0),r())};(d.inverted||this.len>1)&&n();r();return f},defaultFormatter:function(a){var b=this.points||ta(this),c;c=[a.tooltipFooterHeaderFormatter(b[0])];c=c.concat(a.bodyFormatter(b));c.push(a.tooltipFooterHeaderFormatter(b[0],!0));return c.join("")},refresh:function(a,b){var c=this.chart,d=this.label,e=this.options,f,g,h,i={},k,j=[];k=e.formatter||this.defaultFormatter;var i=c.hoverPoints,l,m=this.shared; +clearTimeout(this.hideTimer);this.followPointer=ta(a)[0].series.tooltipOptions.followPointer;h=this.getAnchor(a,b);f=h[0];g=h[1];m&&(!a.series||!a.series.noSharedTooltip)?(c.hoverPoints=a,i&&o(i,function(a){a.setState()}),o(a,function(a){a.setState("hover");j.push(a.getLabelConfig())}),i={x:a[0].category,y:a[0].y},i.points=j,this.len=j.length,a=a[0]):i=a.getLabelConfig();k=k.call(i,this);i=a.series;this.distance=p(i.tooltipOptions.distance,16);k===!1?this.hide():(this.isHidden&&(Oa(d),d.attr("opacity", +1).show()),d.attr({text:k}),l=e.borderColor||a.color||i.color||"#606060",d.attr({stroke:l}),this.updatePosition({plotX:f,plotY:g,negative:a.negative,ttBelow:a.ttBelow,h:h[2]||0}),this.isHidden=!1);H(c,"tooltipRefresh",{text:k,x:f+c.plotLeft,y:g+c.plotTop,borderColor:l})},updatePosition:function(a){var b=this.chart,c=this.label,c=(this.options.positioner||this.getPosition).call(this,c.width,c.height,a);this.move(A(c.x),A(c.y||0),a.plotX+b.plotLeft,a.plotY+b.plotTop)},getXDateFormat:function(a,b,c){var d, +b=b.dateTimeLabelFormats,e=c&&c.closestPointRange,f,g={millisecond:15,second:12,minute:9,hour:6,day:3},h,i="millisecond";if(e){h=Qa("%m-%d %H:%M:%S.%L",a.x);for(f in G){if(e===G.week&&+Qa("%w",a.x)===c.options.startOfWeek&&h.substr(6)==="00:00:00.000"){f="week";break}if(G[f]>e){f=i;break}if(g[f]&&h.substr(g[f])!=="01-01 00:00:00.000".substr(g[f]))break;f!=="week"&&(i=f)}f&&(d=b[f])}else d=b.day;return d||b.year},tooltipFooterHeaderFormatter:function(a,b){var c=b?"footer":"header",d=a.series,e=d.tooltipOptions, +f=e.xDateFormat,g=d.xAxis,h=g&&g.options.type==="datetime"&&ma(a.key),c=e[c+"Format"];h&&!f&&(f=this.getXDateFormat(a,e,g));h&&f&&(c=c.replace("{point.key}","{point.key:"+f+"}"));return Ka(c,{point:a,series:d})},bodyFormatter:function(a){return Ba(a,function(a){var c=a.series.tooltipOptions;return(c.pointFormatter||a.point.tooltipFormatter).call(a.point,c.pointFormat)})}};var ea;db=y&&y.documentElement.ontouchstart!==z;var Xa=B.Pointer=function(a,b){this.init(a,b)};Xa.prototype={init:function(a,b){var c= +b.chart,d=c.events,e=ha?"":c.zoomType,c=a.inverted,f;this.options=b;this.chart=a;this.zoomX=f=/x/.test(e);this.zoomY=e=/y/.test(e);this.zoomHor=f&&!c||e&&c;this.zoomVert=e&&!c||f&&c;this.hasZoom=f||e;this.runChartClick=d&&!!d.click;this.pinchDown=[];this.lastValidTouch={};if(B.Tooltip&&b.tooltip.enabled)a.tooltip=new Pb(a,b.tooltip),this.followTouchMove=p(b.tooltip.followTouchMove,!0);this.setDOMEvents()},normalize:function(a,b){var c,d,a=a||E.event;if(!a.target)a.target=a.srcElement;d=a.touches? +a.touches.length?a.touches.item(0):a.changedTouches[0]:a;if(!b)this.chartPosition=b=Ab(this.chart.container);d.pageX===z?(c=t(a.x,a.clientX-b.left),d=a.y):(c=d.pageX-b.left,d=d.pageY-b.top);return u(a,{chartX:A(c),chartY:A(d)})},getCoordinates:function(a){var b={xAxis:[],yAxis:[]};o(this.chart.axes,function(c){b[c.isXAxis?"xAxis":"yAxis"].push({axis:c,value:c.toValue(a[c.horiz?"chartX":"chartY"])})});return b},runPointActions:function(a){var b=this.chart,c=b.series,d=b.tooltip,e=d?d.shared:!1,f=b.hoverPoint, +g=b.hoverSeries,h=[Number.MAX_VALUE,Number.MAX_VALUE],i,k,j=[],l=[],m;if(!e&&!g)for(b=0;bh+k&&(d=h+k),ei+j&&(e=i+j),this.hasDragged=Math.sqrt(Math.pow(n-d,2)+Math.pow(r-e,2)),this.hasDragged>10){l=b.isInsidePlot(n-h,r-i);if(b.hasCartesianSeries&&(this.zoomX||this.zoomY)&&l&&!s&&!m)this.selectionMarker=m=b.renderer.rect(h,i,f?1:k,g?1:j,0).attr({fill:c.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add();m&&f&&(d-=n,m.attr({width:P(d),x:(d>0?0:d)+n})); +m&&g&&(d=e-r,m.attr({height:P(d),y:(d>0?0:d)+r}));l&&!m&&c.panning&&b.pan(a,c.panning)}},drop:function(a){var b=this,c=this.chart,d=this.hasPinched;if(this.selectionMarker){var e={originalEvent:a,xAxis:[],yAxis:[]},f=this.selectionMarker,g=f.attr?f.attr("x"):f.x,h=f.attr?f.attr("y"):f.y,i=f.attr?f.attr("width"):f.width,k=f.attr?f.attr("height"):f.height,j;if(this.hasDragged||d)o(c.axes,function(c){if(c.zoomEnabled&&q(c.min)&&(d||b[{xAxis:"zoomX",yAxis:"zoomY"}[c.coll]])){var f=c.horiz,n=a.type=== +"touchend"?c.minPixelPadding:0,r=c.toValue((f?g:h)+n),f=c.toValue((f?g+i:h+k)-n);e[c.coll].push({axis:c,min:F(r,f),max:t(r,f)});j=!0}}),j&&H(c,"selection",e,function(a){c.zoom(u(a,d?{animation:!1}:null))});this.selectionMarker=this.selectionMarker.destroy();d&&this.scaleGroups()}if(c)L(c.container,{cursor:c._cursor}),c.cancelClick=this.hasDragged>10,c.mouseIsDown=this.hasDragged=this.hasPinched=!1,this.pinchDown=[]},onContainerMouseDown:function(a){a=this.normalize(a);a.preventDefault&&a.preventDefault(); +this.dragStart(a)},onDocumentMouseUp:function(a){S[ea]&&S[ea].pointer.drop(a)},onDocumentMouseMove:function(a){var b=this.chart,c=this.chartPosition,a=this.normalize(a,c);c&&!this.inClass(a.target,"highcharts-tracker")&&!b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&this.reset()},onContainerMouseLeave:function(a){var b=S[ea];if(b&&(a.relatedTarget||a.toElement))b.pointer.reset(),b.pointer.chartPosition=null},onContainerMouseMove:function(a){var b=this.chart;if(!q(ea)||!S[ea]||!S[ea].mouseIsDown)ea= +b.index;a=this.normalize(a);a.returnValue=!1;b.mouseIsDown==="mousedown"&&this.drag(a);(this.inClass(a.target,"highcharts-tracker")||b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop))&&!b.openMenu&&this.runPointActions(a)},inClass:function(a,b){for(var c;a;){if(c=K(a,"class")){if(c.indexOf(b)!==-1)return!0;if(c.indexOf("highcharts-container")!==-1)return!1}a=a.parentNode}},onTrackerMouseOut:function(a){var b=this.chart.hoverSeries,a=a.relatedTarget||a.toElement;if(b&&a&&!b.options.stickyTracking&& +!this.inClass(a,"highcharts-tooltip")&&!this.inClass(a,"highcharts-series-"+b.index))b.onMouseOut()},onContainerClick:function(a){var b=this.chart,c=b.hoverPoint,d=b.plotLeft,e=b.plotTop,a=this.normalize(a);b.cancelClick||(c&&this.inClass(a.target,"highcharts-tracker")?(H(c.series,"click",u(a,{point:c})),b.hoverPoint&&c.firePointEvent("click",a)):(u(a,this.getCoordinates(a)),b.isInsidePlot(a.chartX-d,a.chartY-e)&&H(b,"click",a)))},setDOMEvents:function(){var a=this,b=a.chart.container;b.onmousedown= +function(b){a.onContainerMouseDown(b)};b.onmousemove=function(b){a.onContainerMouseMove(b)};b.onclick=function(b){a.onContainerClick(b)};M(b,"mouseleave",a.onContainerMouseLeave);eb===1&&M(y,"mouseup",a.onDocumentMouseUp);if(db)b.ontouchstart=function(b){a.onContainerTouchStart(b)},b.ontouchmove=function(b){a.onContainerTouchMove(b)},eb===1&&M(y,"touchend",a.onDocumentTouchEnd)},destroy:function(){var a;V(this.chart.container,"mouseleave",this.onContainerMouseLeave);eb||(V(y,"mouseup",this.onDocumentMouseUp), +V(y,"touchend",this.onDocumentTouchEnd));clearInterval(this.tooltipTimeout);for(a in this)this[a]=null}};u(B.Pointer.prototype,{pinchTranslate:function(a,b,c,d,e,f){(this.zoomHor||this.pinchHor)&&this.pinchTranslateDirection(!0,a,b,c,d,e,f);(this.zoomVert||this.pinchVert)&&this.pinchTranslateDirection(!1,a,b,c,d,e,f)},pinchTranslateDirection:function(a,b,c,d,e,f,g,h){var i=this.chart,k=a?"x":"y",j=a?"X":"Y",l="chart"+j,m=a?"width":"height",n=i["plot"+(a?"Left":"Top")],r,s,p=h||1,o=i.inverted,x=i.bounds[a? +"h":"v"],w=b.length===1,q=b[0][l],t=c[0][l],u=!w&&b[1][l],A=!w&&c[1][l],B,c=function(){!w&&P(q-u)>20&&(p=h||P(t-A)/P(q-u));s=(n-t)/p+q;r=i["plot"+(a?"Width":"Height")]/p};c();b=s;bx.max&&(b=x.max-r,B=!0);B?(t-=0.8*(t-g[k][0]),w||(A-=0.8*(A-g[k][1])),c()):g[k]=[t,A];o||(f[k]=s-n,f[m]=r);f=o?1/p:p;e[m]=r;e[k]=b;d[o?a?"scaleY":"scaleX":"scale"+j]=p;d["translate"+j]=f*n+(t-f*q)},pinch:function(a){var b=this,c=b.chart,d=b.pinchDown,e=a.touches,f=e.length,g=b.lastValidTouch,h= +b.hasZoom,i=b.selectionMarker,k={},j=f===1&&(b.inClass(a.target,"highcharts-tracker")&&c.runTrackerClick||b.runChartClick),l={};if(f>1)b.initiated=!0;h&&b.initiated&&!j&&a.preventDefault();Ba(e,function(a){return b.normalize(a)});if(a.type==="touchstart")o(e,function(a,b){d[b]={chartX:a.chartX,chartY:a.chartY}}),g.x=[d[0].chartX,d[1]&&d[1].chartX],g.y=[d[0].chartY,d[1]&&d[1].chartY],o(c.axes,function(a){if(a.zoomEnabled){var b=c.bounds[a.horiz?"h":"v"],d=a.minPixelPadding,e=a.toPixels(p(a.options.min, +a.dataMin)),f=a.toPixels(p(a.options.max,a.dataMax)),g=F(e,f),e=t(e,f);b.min=F(a.pos,g-d);b.max=t(a.pos+a.len,e+d)}}),b.res=!0;else if(d.length){if(!i)b.selectionMarker=i=u({destroy:Aa,touch:!0},c.plotBox);b.pinchTranslate(d,e,k,i,l,g);b.hasPinched=h;b.scaleGroups(k,l);if(!h&&b.followTouchMove&&f===1)this.runPointActions(b.normalize(a));else if(b.res)b.res=!1,this.reset(!1,0)}},touch:function(a,b){var c=this.chart;ea=c.index;a.touches.length===1?(a=this.normalize(a),c.isInsidePlot(a.chartX-c.plotLeft, +a.chartY-c.plotTop)&&!c.openMenu?(b&&this.runPointActions(a),this.pinch(a)):b&&this.reset()):a.touches.length===2&&this.pinch(a)},onContainerTouchStart:function(a){this.touch(a,!0)},onContainerTouchMove:function(a){this.touch(a)},onDocumentTouchEnd:function(a){S[ea]&&S[ea].pointer.drop(a)}});if(E.PointerEvent||E.MSPointerEvent){var va={},Db=!!E.PointerEvent,Sb=function(){var a,b=[];b.item=function(a){return this[a]};for(a in va)va.hasOwnProperty(a)&&b.push({pageX:va[a].pageX,pageY:va[a].pageY,target:va[a].target}); +return b},Eb=function(a,b,c,d){if((a.pointerType==="touch"||a.pointerType===a.MSPOINTER_TYPE_TOUCH)&&S[ea])d(a),d=S[ea].pointer,d[b]({type:c,target:a.currentTarget,preventDefault:Aa,touches:Sb()})};u(Xa.prototype,{onContainerPointerDown:function(a){Eb(a,"onContainerTouchStart","touchstart",function(a){va[a.pointerId]={pageX:a.pageX,pageY:a.pageY,target:a.currentTarget}})},onContainerPointerMove:function(a){Eb(a,"onContainerTouchMove","touchmove",function(a){va[a.pointerId]={pageX:a.pageX,pageY:a.pageY}; +if(!va[a.pointerId].target)va[a.pointerId].target=a.currentTarget})},onDocumentPointerUp:function(a){Eb(a,"onDocumentTouchEnd","touchend",function(a){delete va[a.pointerId]})},batchMSEvents:function(a){a(this.chart.container,Db?"pointerdown":"MSPointerDown",this.onContainerPointerDown);a(this.chart.container,Db?"pointermove":"MSPointerMove",this.onContainerPointerMove);a(y,Db?"pointerup":"MSPointerUp",this.onDocumentPointerUp)}});fb(Xa.prototype,"init",function(a,b,c){a.call(this,b,c);this.hasZoom&& +L(b.container,{"-ms-touch-action":"none","touch-action":"none"})});fb(Xa.prototype,"setDOMEvents",function(a){a.apply(this);(this.hasZoom||this.followTouchMove)&&this.batchMSEvents(M)});fb(Xa.prototype,"destroy",function(a){this.batchMSEvents(V);a.call(this)})}var ob=B.Legend=function(a,b){this.init(a,b)};ob.prototype={init:function(a,b){var c=this,d=b.itemStyle,e=b.itemMarginTop||0;this.options=b;if(b.enabled)c.itemStyle=d,c.itemHiddenStyle=D(d,b.itemHiddenStyle),c.itemMarginTop=e,c.padding=d=p(b.padding, +8),c.initialItemX=d,c.initialItemY=d-5,c.maxItemWidth=0,c.chart=a,c.itemHeight=0,c.symbolWidth=p(b.symbolWidth,16),c.pages=[],c.render(),M(c.chart,"endResize",function(){c.positionCheckboxes()})},colorizeItem:function(a,b){var c=this.options,d=a.legendItem,e=a.legendLine,f=a.legendSymbol,g=this.itemHiddenStyle.color,c=b?c.itemStyle.color:g,h=b?a.legendColor||a.color||"#CCC":g,g=a.options&&a.options.marker,i={fill:h},k;d&&d.css({fill:c,color:c});e&&e.attr({stroke:h});if(f){if(g&&f.isMarker)for(k in i.stroke= +h,g=a.convertAttribs(g),g)d=g[k],d!==z&&(i[k]=d);f.attr(i)}},positionItem:function(a){var b=this.options,c=b.symbolPadding,b=!b.rtl,d=a._legendItemPos,e=d[0],d=d[1],f=a.checkbox;(a=a.legendGroup)&&a.element&&a.translate(b?e:this.legendWidth-e-2*c-4,d);if(f)f.x=e,f.y=d},destroyItem:function(a){var b=a.checkbox;o(["legendItem","legendLine","legendSymbol","legendGroup"],function(b){a[b]&&(a[b]=a[b].destroy())});b&&Ta(a.checkbox)},destroy:function(){var a=this.group,b=this.box;if(b)this.box=b.destroy(); +if(a)this.group=a.destroy()},positionCheckboxes:function(a){var b=this.group.alignAttr,c,d=this.clipHeight||this.legendHeight,e=this.titleHeight;if(b)c=b.translateY,o(this.allItems,function(f){var g=f.checkbox,h;g&&(h=c+e+g.y+(a||0)+3,L(g,{left:b.translateX+f.checkboxOffset+g.x-20+"px",top:h+"px",display:h>c-6&&h(m||b.chartWidth-2*k-s-d.x))this.itemX=s,this.itemY+=r+this.lastLineHeight+n,this.lastLineHeight=0;this.maxItemWidth=t(this.maxItemWidth, +f);this.lastItemY=r+this.itemY+n;this.lastLineHeight=t(g,this.lastLineHeight);a._legendItemPos=[this.itemX,this.itemY];e?this.itemX+=f:(this.itemY+=r+g+n,this.lastLineHeight=g);this.offsetWidth=m||t((e?this.itemX-s-j:f)+k,this.offsetWidth)},getAllItems:function(){var a=[];o(this.chart.series,function(b){var c=b.options;if(p(c.showInLegend,!q(c.linkedTo)?z:!1,!0))a=a.concat(b.legendItems||(c.legendType==="point"?b.data:b))});return a},adjustMargins:function(a,b){var c=this.chart,d=this.options,e=d.align.charAt(0)+ +d.verticalAlign.charAt(0)+d.layout.charAt(0);this.display&&!d.floating&&o([/(lth|ct|rth)/,/(rtv|rm|rbv)/,/(rbh|cb|lbh)/,/(lbv|lm|ltv)/],function(f,g){f.test(e)&&!q(a[g])&&(c[nb[g]]=t(c[nb[g]],c.legend[(g+1)%2?"legendHeight":"legendWidth"]+[1,-1,-1,1][g]*d[g%2?"x":"y"]+p(d.margin,12)+b[g]))})},render:function(){var a=this,b=a.chart,c=b.renderer,d=a.group,e,f,g,h,i=a.box,k=a.options,j=a.padding,l=k.borderWidth,m=k.backgroundColor;a.itemX=a.initialItemX;a.itemY=a.initialItemY;a.offsetWidth=0;a.lastItemY= +0;if(!d)a.group=d=c.g("legend").attr({zIndex:7}).add(),a.contentGroup=c.g().attr({zIndex:1}).add(d),a.scrollGroup=c.g().add(a.contentGroup);a.renderTitle();e=a.getAllItems();ib(e,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)});k.reversed&&e.reverse();a.allItems=e;a.display=f=!!e.length;a.lastLineHeight=0;o(e,function(b){a.renderItem(b)});g=(k.width||a.offsetWidth)+j;h=a.lastItemY+a.lastLineHeight+a.titleHeight;h=a.handleOverflow(h);h+=j;if(l||m){if(i){if(g> +0&&h>0)i[i.isNew?"attr":"animate"](i.crisp({width:g,height:h})),i.isNew=!1}else a.box=i=c.rect(0,0,g,h,k.borderRadius,l||0).attr({stroke:k.borderColor,"stroke-width":l||0,fill:m||"none"}).add(d).shadow(k.shadow),i.isNew=!0;i[f?"show":"hide"]()}a.legendWidth=g;a.legendHeight=h;o(e,function(b){a.positionItem(b)});f&&d.align(u({width:g,height:h},k),!0,"spacingBox");b.isResizing||this.positionCheckboxes()},handleOverflow:function(a){var b=this,c=this.chart,d=c.renderer,e=this.options,f=e.y,f=c.spacingBox.height+ +(e.verticalAlign==="top"?-f:f)-this.padding,g=e.maxHeight,h,i=this.clipRect,k=e.navigation,j=p(k.animation,!0),l=k.arrowSize||12,m=this.nav,n=this.pages,r=this.padding,s,R=this.allItems,v=function(a){i.attr({height:a});if(b.contentGroup.div)b.contentGroup.div.style.clip="rect("+r+"px,9999px,"+(r+a)+"px,0)"};e.layout==="horizontal"&&(f/=2);g&&(f=F(f,g));n.length=0;if(a>f){this.clipHeight=h=t(f-20-this.titleHeight-r,0);this.currentPage=p(this.currentPage,1);this.fullHeight=a;o(R,function(a,b){var c= +a._legendItemPos[1],d=A(a.legendItem.getBBox().height),e=n.length;if(!e||c-n[e-1]>h&&(s||c)!==n[e-1])n.push(s||c),e++;b===R.length-1&&c+d-n[e-1]>h&&n.push(c);c!==s&&(s=c)});if(!i)i=b.clipRect=d.clipRect(0,r,9999,0),b.contentGroup.clip(i);v(h);if(!m)this.nav=m=d.g().attr({zIndex:1}).add(this.group),this.up=d.symbol("triangle",0,0,l,l).on("click",function(){b.scroll(-1,j)}).add(m),this.pager=d.text("",15,10).css(k.style).add(m),this.down=d.symbol("triangle-down",0,0,l,l).on("click",function(){b.scroll(1, +j)}).add(m);b.scroll(0);a=f}else if(m)v(c.chartHeight),m.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0;return a},scroll:function(a,b){var c=this.pages,d=c.length,e=this.currentPage+a,f=this.clipHeight,g=this.options.navigation,h=g.activeColor,g=g.inactiveColor,i=this.pager,k=this.padding;e>d&&(e=d);if(e>0)b!==z&&Ua(b,this.chart),this.nav.attr({translateX:k,translateY:f+this.padding+7+this.titleHeight,visibility:"visible"}),this.up.attr({fill:e===1?g:h}).css({cursor:e===1?"default": +"pointer"}),i.attr({text:e+"/"+d}),this.down.attr({x:18+this.pager.getBBox().width,fill:e===d?g:h}).css({cursor:e===d?"default":"pointer"}),c=-c[e-1]+this.initialItemY,this.scrollGroup.animate({translateY:c}),this.currentPage=e,this.positionCheckboxes(c)}};J=B.LegendSymbolMixin={drawRectangle:function(a,b){var c=a.options.symbolHeight||a.fontMetrics.f;b.legendSymbol=this.chart.renderer.rect(0,a.baseline-c+1,a.symbolWidth,c,a.options.symbolRadius||0).attr({zIndex:3}).add(b.legendGroup)},drawLineMarker:function(a){var b= +this.options,c=b.marker,d=a.symbolWidth,e=this.chart.renderer,f=this.legendGroup,a=a.baseline-A(a.fontMetrics.b*0.3),g;if(b.lineWidth){g={"stroke-width":b.lineWidth};if(b.dashStyle)g.dashstyle=b.dashStyle;this.legendLine=e.path(["M",0,a,"L",d,a]).attr(g).add(f)}if(c&&c.enabled!==!1)b=c.radius,this.legendSymbol=c=e.symbol(this.symbol,d/2-b,a-b,2*b,2*b,c).add(f),c.isMarker=!0}};(/Trident\/7\.0/.test(za)||Ma)&&fb(ob.prototype,"positionItem",function(a,b){var c=this,d=function(){b._legendItemPos&&a.call(c, +b)};d();setTimeout(d)});var hb=B.Chart=function(){this.getArgs.apply(this,arguments)};B.chart=function(a,b,c){return new hb(a,b,c)};hb.prototype={callbacks:[],getArgs:function(){var a=[].slice.call(arguments);if(xa(a[0])||a[0].nodeName)this.renderTo=a.shift();this.init(a[0],a[1])},init:function(a,b){var c,d=a.series;a.series=null;c=D(N,a);c.series=a.series=d;this.userOptions=a;d=c.chart;this.margin=this.splashArray("margin",d);this.spacing=this.splashArray("spacing",d);var e=d.events;this.bounds= +{h:{},v:{}};this.callback=b;this.isResizing=0;this.options=c;this.axes=[];this.series=[];this.hasCartesianSeries=d.showAxes;var f=this,g;f.index=S.length;S.push(f);eb++;d.reflow!==!1&&M(f,"load",function(){f.initReflow()});if(e)for(g in e)M(f,g,e[g]);f.xAxis=[];f.yAxis=[];f.animation=ha?!1:p(d.animation,!0);f.pointCount=f.colorCounter=f.symbolCounter=0;f.firstRender()},initSeries:function(a){var b=this.options.chart;(b=I[a.type||b.type||b.defaultSeriesType])||X(17,!0);b=new b;b.init(this,a);return b}, +isInsidePlot:function(a,b,c){var d=c?b:a,a=c?a:b;return d>=0&&d<=this.plotWidth&&a>=0&&a<=this.plotHeight},redraw:function(a){var b=this.axes,c=this.series,d=this.pointer,e=this.legend,f=this.isDirtyLegend,g,h,i=this.hasCartesianSeries,k=this.isDirtyBox,j=c.length,l=j,m=this.renderer,n=m.isHidden(),r=[];Ua(a,this);n&&this.cloneRenderTo();for(this.layOutTitles();l--;)if(a=c[l],a.options.stacking&&(g=!0,a.isDirty)){h=!0;break}if(h)for(l=j;l--;)if(a=c[l],a.options.stacking)a.isDirty=!0;o(c,function(a){a.isDirty&& +a.options.legendType==="point"&&(a.updateTotals&&a.updateTotals(),f=!0)});if(f&&e.options.enabled)e.render(),this.isDirtyLegend=!1;g&&this.getStacks();if(i&&!this.isResizing)this.maxTicks=null,o(b,function(a){a.setScale()});this.getMargins();i&&(o(b,function(a){a.isDirty&&(k=!0)}),o(b,function(a){var b=a.min+","+a.max;if(a.extKey!==b)a.extKey=b,r.push(function(){H(a,"afterSetExtremes",u(a.eventArgs,a.getExtremes()));delete a.eventArgs});(k||g)&&a.redraw()}));k&&this.drawChartBox();o(c,function(a){a.isDirty&& +a.visible&&(!a.isCartesian||a.xAxis)&&a.redraw()});d&&d.reset(!0);m.draw();H(this,"redraw");n&&this.cloneRenderTo(!0);o(r,function(a){a.call()})},get:function(a){var b=this.axes,c=this.series,d,e;for(d=0;d19?this.containerHeight:400))},cloneRenderTo:function(a){var b=this.renderToClone,c=this.container;a?b&&(this.renderTo.appendChild(c),Ta(b),delete this.renderToClone):(c&&c.parentNode===this.renderTo&&this.renderTo.removeChild(c),this.renderToClone=b=this.renderTo.cloneNode(0),L(b,{position:"absolute",top:"-9999px",display:"block"}),b.style.setProperty&&b.style.setProperty("display","block", +"important"),y.body.appendChild(b),c&&b.appendChild(c))},getContainer:function(){var a,b=this.options,c=b.chart,d,e;a=this.renderTo;var f="highcharts-"+zb++;if(!a)this.renderTo=a=c.renderTo;if(xa(a))this.renderTo=a=y.getElementById(a);a||X(13,!0);d=C(K(a,"data-highcharts-chart"));!isNaN(d)&&S[d]&&S[d].hasRendered&&S[d].destroy();K(a,"data-highcharts-chart",this.index);a.innerHTML="";!c.skipClone&&!a.offsetWidth&&this.cloneRenderTo();this.getChartSize();d=this.chartWidth;e=this.chartHeight;this.container= +a=Z(La,{className:"highcharts-container"+(c.className?" "+c.className:""),id:f},u({position:"relative",overflow:"hidden",width:d+"px",height:e+"px",textAlign:"left",lineHeight:"normal",zIndex:0,"-webkit-tap-highlight-color":"rgba(0,0,0,0)"},c.style),this.renderToClone||a);this._cursor=a.style.cursor;this.renderer=new (B[c.renderer]||cb)(a,d,e,c.style,c.forExport,b.exporting&&b.exporting.allowHTML);ha&&this.renderer.create(this,a,d,e);this.renderer.chartIndex=this.index},getMargins:function(a){var b= +this.spacing,c=this.margin,d=this.titleOffset;this.resetMargins();if(d&&!q(c[0]))this.plotTop=t(this.plotTop,d+this.options.title.margin+b[0]);this.legend.adjustMargins(c,b);this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin);this.extraTopMargin&&(this.plotTop+=this.extraTopMargin);a||this.getAxisMargins()},getAxisMargins:function(){var a=this,b=a.axisOffset=[0,0,0,0],c=a.margin;a.hasCartesianSeries&&o(a.axes,function(a){a.visible&&a.getOffset()});o(nb,function(d,e){q(c[e])||(a[d]+= +b[e])});a.setChartSize()},reflow:function(a){var b=this,c=b.options.chart,d=b.renderTo,e=c.width||ja(d,"width"),f=c.height||ja(d,"height"),c=a?a.target:E;if(!b.hasUserSize&&!b.isPrinting&&e&&f&&(c===E||c===y)){if(e!==b.containerWidth||f!==b.containerHeight)clearTimeout(b.reflowTimeout),b.reflowTimeout=Pa(function(){if(b.container)b.setSize(e,f,!1),b.hasUserSize=null},a?100:0);b.containerWidth=e;b.containerHeight=f}},initReflow:function(){var a=this,b=function(b){a.reflow(b)};M(E,"resize",b);M(a,"destroy", +function(){V(E,"resize",b)})},setSize:function(a,b,c){var d=this,e,f,g=d.renderer;d.isResizing+=1;Ua(c,d);d.oldChartHeight=d.chartHeight;d.oldChartWidth=d.chartWidth;if(q(a))d.chartWidth=e=t(0,A(a)),d.hasUserSize=!!e;if(q(b))d.chartHeight=f=t(0,A(b));a=g.globalAnimation;(a?Wa:L)(d.container,{width:e+"px",height:f+"px"},a);d.setChartSize(!0);g.setSize(e,f,c);d.maxTicks=null;o(d.axes,function(a){a.isDirty=!0;a.setScale()});o(d.series,function(a){a.isDirty=!0});d.isDirtyLegend=!0;d.isDirtyBox=!0;d.layOutTitles(); +d.getMargins();d.redraw(c);d.oldChartHeight=null;H(d,"resize");a=g.globalAnimation;Pa(function(){d&&H(d,"endResize",null,function(){d.isResizing-=1})},a===!1?0:a&&a.duration||500)},setChartSize:function(a){var b=this.inverted,c=this.renderer,d=this.chartWidth,e=this.chartHeight,f=this.options.chart,g=this.spacing,h=this.clipOffset,i,k,j,l;this.plotLeft=i=A(this.plotLeft);this.plotTop=k=A(this.plotTop);this.plotWidth=j=t(0,A(d-i-this.marginRight));this.plotHeight=l=t(0,A(e-k-this.marginBottom));this.plotSizeX= +b?l:j;this.plotSizeY=b?j:l;this.plotBorderWidth=f.plotBorderWidth||0;this.spacingBox=c.spacingBox={x:g[3],y:g[0],width:d-g[3]-g[1],height:e-g[0]-g[2]};this.plotBox=c.plotBox={x:i,y:k,width:j,height:l};d=2*T(this.plotBorderWidth/2);b=ua(t(d,h[3])/2);c=ua(t(d,h[0])/2);this.clipBox={x:b,y:c,width:T(this.plotSizeX-t(d,h[1])/2-b),height:t(0,T(this.plotSizeY-t(d,h[2])/2-c))};a||o(this.axes,function(a){a.setAxisSize();a.setAxisTranslation()})},resetMargins:function(){var a=this;o(nb,function(b,c){a[b]=p(a.margin[c], +a.spacing[c])});a.axisOffset=[0,0,0,0];a.clipOffset=[0,0,0,0]},drawChartBox:function(){var a=this.options.chart,b=this.renderer,c=this.chartWidth,d=this.chartHeight,e=this.chartBackground,f=this.plotBackground,g=this.plotBorder,h=this.plotBGImage,i=a.borderWidth||0,k=a.backgroundColor,j=a.plotBackgroundColor,l=a.plotBackgroundImage,m=a.plotBorderWidth||0,n,r=this.plotLeft,p=this.plotTop,o=this.plotWidth,v=this.plotHeight,x=this.plotBox,w=this.clipRect,t=this.clipBox;n=i+(a.shadow?8:0);if(i||k)if(e)e.animate(e.crisp({width:c- +n,height:d-n}));else{e={fill:k||"none"};if(i)e.stroke=a.borderColor,e["stroke-width"]=i;this.chartBackground=b.rect(n/2,n/2,c-n,d-n,a.borderRadius,i).attr(e).addClass("highcharts-background").add().shadow(a.shadow)}if(j)f?f.animate(x):this.plotBackground=b.rect(r,p,o,v,0).attr({fill:j}).add().shadow(a.plotShadow);if(l)h?h.animate(x):this.plotBGImage=b.image(l,r,p,o,v).add();w?w.animate({width:t.width,height:t.height}):this.clipRect=b.clipRect(t);if(m)g?(g.strokeWidth=-m,g.animate(g.crisp({x:r,y:p, +width:o,height:v}))):this.plotBorder=b.rect(r,p,o,v,0,-m).attr({stroke:a.plotBorderColor,"stroke-width":m,fill:"none",zIndex:1}).add();this.isDirtyBox=!1},propFromSeries:function(){var a=this,b=a.options.chart,c,d=a.options.series,e,f;o(["inverted","angular","polar"],function(g){c=I[b.type||b.defaultSeriesType];f=a[g]||b[g]||c&&c.prototype[g];for(e=d&&d.length;!f&&e--;)(c=I[d[e].type])&&c.prototype[g]&&(f=!0);a[g]=f})},linkSeries:function(){var a=this,b=a.series;o(b,function(a){a.linkedSeries.length= +0});o(b,function(b){var d=b.options.linkedTo;if(xa(d)&&(d=d===":previous"?a.series[b.index-1]:a.get(d)))d.linkedSeries.push(b),b.linkedParent=d,b.visible=p(b.options.visible,d.options.visible,b.visible)})},renderSeries:function(){o(this.series,function(a){a.translate();a.render()})},renderLabels:function(){var a=this,b=a.options.labels;b.items&&o(b.items,function(c){var d=u(b.style,c.style),e=C(d.left)+a.plotLeft,f=C(d.top)+a.plotTop+12;delete d.left;delete d.top;a.renderer.text(c.html,e,f).attr({zIndex:2}).css(d).add()})}, +render:function(){var a=this.axes,b=this.renderer,c=this.options,d,e,f,g;this.setTitle();this.legend=new ob(this,c.legend);this.getStacks&&this.getStacks();this.getMargins(!0);this.setChartSize();d=this.plotWidth;e=this.plotHeight-=21;o(a,function(a){a.setScale()});this.getAxisMargins();f=d/this.plotWidth>1.1;g=e/this.plotHeight>1.05;if(f||g)this.maxTicks=null,o(a,function(a){(a.horiz&&f||!a.horiz&&g)&&a.setTickInterval(!0)}),this.getMargins();this.drawChartBox();this.hasCartesianSeries&&o(a,function(a){a.visible&& +a.render()});if(!this.seriesGroup)this.seriesGroup=b.g("series-group").attr({zIndex:3}).add();this.renderSeries();this.renderLabels();this.showCredits(c.credits);this.hasRendered=!0},showCredits:function(a){if(a.enabled&&!this.credits)this.credits=this.renderer.text(a.text,0,0).on("click",function(){if(a.href)E.location.href=a.href}).attr({align:a.position.align,zIndex:8}).css(a.style).add().align(a.position)},destroy:function(){var a=this,b=a.axes,c=a.series,d=a.container,e,f=d&&d.parentNode;H(a, +"destroy");S[a.index]=z;eb--;a.renderTo.removeAttribute("data-highcharts-chart");V(a);for(e=b.length;e--;)b[e]=b[e].destroy();for(e=c.length;e--;)c[e]=c[e].destroy();o("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,pointer,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","),function(b){var c=a[b];c&&c.destroy&&(a[b]=c.destroy())});if(d)d.innerHTML="",V(d),f&&Ta(d);for(e in a)delete a[e]},isReadyToRender:function(){var a=this; +return!ca&&E==E.top&&y.readyState!=="complete"||ha&&!E.canvg?(ha?Ob.push(function(){a.firstRender()},a.options.global.canvasToolsURL):y.attachEvent("onreadystatechange",function(){y.detachEvent("onreadystatechange",a.firstRender);y.readyState==="complete"&&a.firstRender()}),!1):!0},firstRender:function(){var a=this,b=a.options;if(a.isReadyToRender()){a.getContainer();H(a,"init");a.resetMargins();a.setChartSize();a.propFromSeries();a.getAxes();o(b.series||[],function(b){a.initSeries(b)});a.linkSeries(); +H(a,"beforeRender");if(B.Pointer)a.pointer=new Xa(a,b);a.render();a.renderer.draw();if(!a.renderer.imgCount)a.onload();a.cloneRenderTo(!0)}},onload:function(){var a=this;o([this.callback].concat(this.callbacks),function(b){b&&a.index!==void 0&&b.apply(a,[a])});a.renderer.imgCount||H(a,"load")},splashArray:function(a,b){var c=b[a],c=Y(c)?c:[c,c,c,c];return[p(b[a+"Top"],c[0]),p(b[a+"Right"],c[1]),p(b[a+"Bottom"],c[2]),p(b[a+"Left"],c[3])]}};var Cb=B.CenteredSeriesMixin={getCenter:function(){var a=this.options, +b=this.chart,c=2*(a.slicedOffset||0),d=b.plotWidth-2*c,b=b.plotHeight-2*c,e=a.center,e=[p(e[0],"50%"),p(e[1],"50%"),a.size||"100%",a.innerSize||0],f=F(d,b),g,h;for(g=0;g<4;++g)h=e[g],a=g<2||g===2&&/%$/.test(h),e[g]=(/%$/.test(h)?[d,b,f,e[2]][g]*parseFloat(h)/100:parseFloat(h))+(a?c:0);e[3]>e[2]&&(e[3]=e[2]);return e}},Ha=function(){};Ha.prototype={init:function(a,b,c){this.series=a;this.color=a.color;this.applyOptions(b,c);this.pointAttr={};if(a.options.colorByPoint&&(b=a.options.colors||a.chart.options.colors, +this.color=this.color||b[a.colorCounter++],a.colorCounter===b.length))a.colorCounter=0;a.chart.pointCount++;return this},applyOptions:function(a,b){var c=this.series,d=c.options.pointValKey||c.pointValKey,a=Ha.prototype.optionsToObject.call(this,a);u(this,a);this.options=this.options?u(this.options,a):a;if(d)this.y=this[d];this.isNull=this.y===null;if(typeof this.x!=="number"&&c)this.x=b===void 0?c.autoIncrement():b;return this},optionsToObject:function(a){var b={},c=this.series,d=c.options.keys, +e=d||c.pointArrayMap||["y"],f=e.length,g=0,h=0;if(typeof a==="number"||a===null)b[e[0]]=a;else if(Ia(a)){if(!d&&a.length>f){c=typeof a[0];if(c==="string")b.name=a[0];else if(c==="number")b.x=a[0];g++}for(;hn){for(c=0;j===null&&ci||this.forceCrop))if(b[d-1]p)b=[],c=[];else if(b[0]p)e=this.cropData(this.xData,this.yData,n,p),b=e.xData,c=e.yData,e=e.start,f=!0;for(i=b.length||1;--i;)d=m?k(b[i])-k(b[i-1]):b[i]-b[i-1],d>0&&(g===z||d=c){f=t(0,i-h);break}for(c=i;cd){g=c+h;break}return{xData:a.slice(f,g),yData:b.slice(f,g),start:f,end:g}},generatePoints:function(){var a=this.options.data,b=this.data,c,d=this.processedXData,e=this.processedYData,f=this.pointClass,g=d.length,h=this.cropStart||0,i,k=this.hasGroupedData,j,l=[],m;if(!b&&!k)b=[],b.length=a.length,b=this.data=b;for(m=0;m0),k=this.getExtremesFromAll||this.options.getExtremesFromAll||this.cropped|| +(c[l+1]||k)>=g&&(c[l-1]||k)<=h,i&&k)if(i=j.length)for(;i--;)j[i]!==null&&(e[f++]=j[i]);else e[f++]=j;this.dataMin=Ra(e);this.dataMax=Ea(e)},translate:function(){this.processedXData||this.processData();this.generatePoints();for(var a=this.options,b=a.stacking,c=this.xAxis,d=c.categories,e=this.yAxis,f=this.points,g=f.length,h=!!this.modifyValue,i=a.pointPlacement,k=i==="between"||ma(i),j=a.threshold,l=a.startFromThreshold?j:0,m,n,r,o,R=Number.MAX_VALUE,a=0;a=0&&n<=e.len&&m>=0&&m<=c.len;v.clientX=k?c.translate(x,0,0,0,1):m;v.negative=v.y<(j||0);v.category=d&&d[v.x]!==z?d[v.x]:v.x;a&&(R=F(R,P(m-r)));r=m}this.closestPointRangePx=R},getValidPoints:function(a){return Na(a||this.points,function(a){return!a.isNull})},setClip:function(a){var b=this.chart,c=this.options,d=b.renderer,e=b.inverted,f=this.clipBox,g=f||b.clipBox, +h=this.sharedClipKey||["_sharedClip",a&&a.duration,a&&a.easing,g.height,c.xAxis,c.yAxis].join(","),i=b[h],k=b[h+"m"];if(!i){if(a)g.width=0,b[h+"m"]=k=d.clipRect(-99,e?-b.plotLeft:-b.plotTop,99,e?b.chartWidth:b.chartHeight);b[h]=i=d.clipRect(g)}a&&(i.count+=1);if(c.clip!==!1)this.group.clip(a||f?i:b.clipRect),this.markerGroup.clip(k),this.sharedClipKey=h;a||(i.count-=1,i.count<=0&&h&&b[h]&&(f||(b[h]=b[h].destroy()),b[h+"m"]&&(b[h+"m"]=b[h+"m"].destroy())))},animate:function(a){var b=this.chart,c=this.options.animation, +d;if(c&&!Y(c))c=aa[this.type].animation;a?this.setClip(c):(d=this.sharedClipKey,(a=b[d])&&a.animate({width:b.plotSizeX},c),b[d+"m"]&&b[d+"m"].animate({width:b.plotSizeX+99},c),this.animate=null)},afterAnimate:function(){this.setClip();H(this,"afterAnimate")},drawPoints:function(){var a,b=this.points,c=this.chart,d,e,f,g,h,i,k,j,l=this.options.marker,m=this.pointAttr[""],n,r,o,t=this.markerGroup,v=p(l.enabled,this.xAxis.isRadial,this.closestPointRangePx>2*l.radius);if(l.enabled!==!1||this._hasPointMarkers)for(f= +b.length;f--;)if(g=b[f],d=T(g.plotX),e=g.plotY,j=g.graphic,n=g.marker||{},r=!!g.marker,a=v&&n.enabled===z||n.enabled,o=g.isInside,a&&e!==z&&!isNaN(e)&&g.y!==null)if(a=g.pointAttr[g.selected?"select":""]||m,h=a.r,i=p(n.symbol,this.symbol),k=i.indexOf("url")===0,j)j[o?"show":"hide"](!0).attr(a).animate(u({x:d-h,y:e-h},j.symbolName?{width:2*h,height:2*h}:{}));else{if(o&&(h>0||k))g.graphic=c.renderer.symbol(i,d-h,e-h,2*h,2*h,r?n:l).attr(a).add(t)}else if(j)g.graphic=j.destroy()},convertAttribs:function(a, +b,c,d){var e=this.pointAttrToOptions,f,g,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(f in e)g=e[f],h[f]=p(a[g],b[f],c[f],d[f]);return h},getAttribs:function(){var a=this,b=a.options,c=aa[a.type].marker?b.marker:b,d=c.states,e=d.hover,f,g=a.color,h=a.options.negativeColor;f={stroke:g,fill:g};var i=a.points||[],k,j,l=[],m=a.pointAttrToOptions;k=a.hasPointSpecificOptions;var n=c.lineColor,r=c.fillColor;j=b.turboThreshold;var s=a.zones,t=a.zoneAxis||"y",v;b.marker?(e.radius=e.radius||c.radius+e.radiusPlus, +e.lineWidth=e.lineWidth||c.lineWidth+e.lineWidthPlus):(e.color=e.color||ia(e.color||g).brighten(e.brightness).get(),e.negativeColor=e.negativeColor||ia(e.negativeColor||h).brighten(e.brightness).get());l[""]=a.convertAttribs(c,f);o(["hover","select"],function(b){l[b]=a.convertAttribs(d[b],l[""])});a.pointAttr=l;g=i.length;if(!j||g=f.value;)f=s[++k];j.color=j.fillColor= +p(f.color,a.color)}k=b.colorByPoint||j.color;if(j.options)for(v in m)q(c[m[v]])&&(k=!0);if(k){c=c||{};k=[];d=c.states||{};f=d.hover=d.hover||{};if(!b.marker||j.negative&&!f.fillColor&&!e.fillColor)f[a.pointAttrToOptions.fill]=f.color||!j.options.color&&e[j.negative&&h?"negativeColor":"color"]||ia(j.color).brighten(f.brightness||e.brightness).get();f={color:j.color};if(!r)f.fillColor=j.color;if(!n)f.lineColor=j.color;c.hasOwnProperty("color")&&!c.color&&delete c.color;k[""]=a.convertAttribs(u(f,c), +l[""]);k.hover=a.convertAttribs(d.hover,l.hover,k[""]);k.select=a.convertAttribs(d.select,l.select,k[""])}else k=l;j.pointAttr=k}},destroy:function(){var a=this,b=a.chart,c=/AppleWebKit\/533/.test(za),d,e=a.data||[],f,g,h;H(a,"destroy");V(a);o(a.axisTypes||[],function(b){if(h=a[b])oa(h.series,a),h.isDirty=h.forceRedraw=!0});a.legendItem&&a.chart.legend.destroyItem(a);for(d=e.length;d--;)(f=e[d])&&f.destroy&&f.destroy();a.points=null;clearTimeout(a.animationTimeout);for(g in a)a[g]instanceof O&&!a[g].survive&& +(d=c&&g==="group"?"hide":"destroy",a[g][d]());if(b.hoverSeries===a)b.hoverSeries=null;oa(b.series,a);for(g in a)delete a[g]},getGraphPath:function(a,b,c){var d=this,e=d.options,f=e.step,g,h=[],i,a=a||d.points;(g=a.reversed)&&a.reverse();(f={right:1,center:2}[f]||f&&3)&&g&&(f=4-f);e.connectNulls&&!b&&!c&&(a=this.getValidPoints(a));o(a,function(g,j){var l=g.plotX,m=g.plotY,n=a[j-1];if((g.leftCliff||n&&n.rightCliff)&&!c)i=!0;g.isNull&&!q(b)&&j>0?i=!e.connectNulls:g.isNull&&!b?i=!0:(j===0||i?n=["M",g.plotX, +g.plotY]:d.getPointSpline?n=d.getPointSpline(a,g,j):f?(n=f===1?["L",n.plotX,m]:f===2?["L",(n.plotX+l)/2,n.plotY,"L",(n.plotX+l)/2,m]:["L",l,n.plotY],n.push("L",l,m)):n=["L",l,m],h.push.apply(h,n),i=!1)});return d.graphPath=h},drawGraph:function(){var a=this,b=this.options,c=[["graph",b.lineColor||this.color,b.dashStyle]],d=b.lineWidth,e=b.linecap!=="square",f=(this.gappedPath||this.getGraphPath).call(this),g=this.fillGraph&&this.color||"none";o(this.zones,function(d,e){c.push(["zoneGraph"+e,d.color|| +a.color,d.dashStyle||b.dashStyle])});o(c,function(c,i){var k=c[0],j=a[k];if(j)j.animate({d:f});else if((d||g)&&f.length)j={stroke:c[1],"stroke-width":d,fill:g,zIndex:1},c[2]?j.dashstyle=c[2]:e&&(j["stroke-linecap"]=j["stroke-linejoin"]="round"),a[k]=a.chart.renderer.path(f).attr(j).add(a.group).shadow(i<2&&b.shadow)})},applyZones:function(){var a=this,b=this.chart,c=b.renderer,d=this.zones,e,f,g=this.clips||[],h,i=this.graph,k=this.area,j=t(b.chartWidth,b.chartHeight),l=this[(this.zoneAxis||"y")+ +"Axis"],m,n=l.reversed,r=b.inverted,s=l.horiz,q,v,x,w=!1;if(d.length&&(i||k)&&l.min!==z)i&&i.hide(),k&&k.hide(),m=l.getExtremes(),o(d,function(d,o){e=n?s?b.plotWidth:0:s?0:l.toPixels(m.min);e=F(t(p(f,e),0),j);f=F(t(A(l.toPixels(p(d.value,m.max),!0)),0),j);w&&(e=f=l.toPixels(m.max));q=Math.abs(e-f);v=F(e,f);x=t(e,f);if(l.isXAxis){if(h={x:r?x:v,y:0,width:q,height:j},!s)h.x=b.plotHeight-h.x}else if(h={x:0,y:r?x:v,width:j,height:q},s)h.y=b.plotWidth-h.y;b.inverted&&c.isVML&&(h=l.isXAxis?{x:0,y:n?v:x, +height:h.width,width:b.chartWidth}:{x:h.y-b.plotLeft-b.spacingBox.x,y:0,width:h.height,height:b.chartHeight});g[o]?g[o].animate(h):(g[o]=c.clipRect(h),i&&a["zoneGraph"+o].clip(g[o]),k&&a["zoneArea"+o].clip(g[o]));w=d.value>m.max}),this.clips=g},invertGroups:function(){function a(){var a={width:b.yAxis.len,height:b.xAxis.len};o(["group","markerGroup"],function(c){b[c]&&b[c].attr(a).invert()})}var b=this,c=b.chart;if(b.xAxis)M(c,"resize",a),M(b,"destroy",function(){V(c,"resize",a)}),a(),b.invertGroups= +a},plotGroup:function(a,b,c,d,e){var f=this[a],g=!f;g&&(this[a]=f=this.chart.renderer.g(b).attr({zIndex:d||0.1}).add(e),f.addClass("highcharts-series-"+this.index));f.attr({visibility:c})[g?"attr":"animate"](this.getPlotBox());return f},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;if(a.inverted)b=c,c=this.xAxis;return{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a=this,b=a.chart,c,d=a.options,e=(c=d.animation)&&!!a.animate&& +b.renderer.isSVG&&p(c.duration,500)||0,f=a.visible?"inherit":"hidden",g=d.zIndex,h=a.hasRendered,i=b.seriesGroup;c=a.plotGroup("group","series",f,g,i);a.markerGroup=a.plotGroup("markerGroup","markers",f,g,i);e&&a.animate(!0);a.getAttribs();c.inverted=a.isCartesian?b.inverted:!1;a.drawGraph&&(a.drawGraph(),a.applyZones());o(a.points,function(a){a.redraw&&a.redraw()});a.drawDataLabels&&a.drawDataLabels();a.visible&&a.drawPoints();a.drawTracker&&a.options.enableMouseTracking!==!1&&a.drawTracker();b.inverted&& +a.invertGroups();d.clip!==!1&&!a.sharedClipKey&&!h&&c.clip(b.clipRect);e&&a.animate();if(!h)a.animationTimeout=Pa(function(){a.afterAnimate()},e);a.isDirty=a.isDirtyData=!1;a.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirtyData,c=this.isDirty,d=this.group,e=this.xAxis,f=this.yAxis;d&&(a.inverted&&d.attr({width:a.plotWidth,height:a.plotHeight}),d.animate({translateX:p(e&&e.left,a.plotLeft),translateY:p(f&&f.top,a.plotTop)}));this.translate();this.render();b&&H(this,"updatedData"); +(c||b)&&delete this.kdTree},kdDimensions:1,kdAxisArray:["clientX","plotY"],searchPoint:function(a,b){var c=this.xAxis,d=this.yAxis,e=this.chart.inverted;return this.searchKDTree({clientX:e?c.len-a.chartY+c.pos:a.chartX-c.pos,plotY:e?d.len-a.chartX+d.pos:a.chartY-d.pos},b)},buildKDTree:function(){function a(c,e,f){var g,h;if(h=c&&c.length)return g=b.kdAxisArray[e%f],c.sort(function(a,b){return a[g]-b[g]}),h=Math.floor(h/2),{point:c[h],left:a(c.slice(0,h),e+1,f),right:a(c.slice(h+1),e+1,f)}}var b=this, +c=b.kdDimensions;delete b.kdTree;Pa(function(){b.kdTree=a(b.getValidPoints(),c,c)},b.options.kdNow?0:1)},searchKDTree:function(a,b){function c(a,b,k,j){var l=b.point,m=d.kdAxisArray[k%j],n,p,o=l;p=q(a[e])&&q(l[e])?Math.pow(a[e]-l[e],2):null;n=q(a[f])&&q(l[f])?Math.pow(a[f]-l[f],2):null;n=(p||0)+(n||0);l.dist=q(n)?Math.sqrt(n):Number.MAX_VALUE;l.distX=q(p)?Math.sqrt(p):Number.MAX_VALUE;m=a[m]-l[m];n=m<0?"left":"right";p=m<0?"right":"left";b[n]&&(n=c(a,b[n],k+1,j),o=n[g]0&&this.singleStacks===!1&&(q.points[v][0]=q.points[this.index+","+w+",0"][0]); +e==="percent"?(s=s?i:k,j&&m[s]&&m[s][w]?(s=m[s][w],q.total=s.total=t(s.total,q.total)+P(u)||0):q.total=fa(q.total+(P(u)||0))):q.total=fa(q.total+(u||0));q.cum=p(q.cum,g)+(u||0);u!==null&&q.points[v].push(q.cum);c[x]=q.cum}if(e==="percent")l.usePercentage=!0;this.stackedYData=c;l.oldStacks={}}};Q.prototype.setPercentStacks=function(){var a=this,b=a.stackKey,c=a.yAxis.stacks,d=a.processedXData,e;o([b,"-"+b],function(b){var f;for(var g=d.length,h,i;g--;)if(h=d[g],e=a.getStackIndicator(e,h,a.index),f= +(i=c[b]&&c[b][h])&&i.points[e.key],h=f)i=i.total?100/i.total:0,h[0]=fa(h[0]*i),h[1]=fa(h[1]*i),a.stackedYData[g]=h[1]})};Q.prototype.getStackIndicator=function(a,b,c){!q(a)||a.x!==b?a={x:b,index:0}:a.index++;a.key=[c,b,a.index].join(",");return a};u(hb.prototype,{addSeries:function(a,b,c){var d,e=this;a&&(b=p(b,!0),H(e,"addSeries",{options:a},function(){d=e.initSeries(a);e.isDirtyLegend=!0;e.linkSeries();b&&e.redraw(c)}));return d},addAxis:function(a,b,c,d){var e=b?"xAxis":"yAxis",f=this.options; +new ka(this,D(a,{index:this[e].length,isX:b}));f[e]=ta(f[e]||{});f[e].push(a);p(c,!0)&&this.redraw(d)},showLoading:function(a){var b=this,c=b.options,d=b.loadingDiv,e=c.loading,f=function(){d&&L(d,{left:b.plotLeft+"px",top:b.plotTop+"px",width:b.plotWidth+"px",height:b.plotHeight+"px"})};if(!d)b.loadingDiv=d=Z(La,{className:"highcharts-loading"},u(e.style,{zIndex:10,display:"none"}),b.container),b.loadingSpan=Z("span",null,e.labelStyle,d),M(b,"redraw",f);b.loadingSpan.innerHTML=a||c.lang.loading; +if(!b.loadingShown)L(d,{opacity:0,display:""}),Wa(d,{opacity:e.style.opacity},{duration:e.showDuration||0}),b.loadingShown=!0;f()},hideLoading:function(){var a=this.options,b=this.loadingDiv;b&&Wa(b,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){L(b,{display:"none"})}});this.loadingShown=!1}});u(Ha.prototype,{update:function(a,b,c,d){function e(){f.applyOptions(a);if(f.y===null&&h)f.graphic=h.destroy();if(Y(a)&&!Ia(a))f.redraw=function(){if(h&&h.element&&a&&a.marker&&a.marker.symbol)f.graphic= +h.destroy();if(a&&a.dataLabels&&f.dataLabel)f.dataLabel=f.dataLabel.destroy();f.redraw=null};i=f.index;g.updateParallelArrays(f,i);if(l&&f.name)l[f.x]=f.name;j.data[i]=Y(j.data[i])?f.options:a;g.isDirty=g.isDirtyData=!0;if(!g.fixedBox&&g.hasCartesianSeries)k.isDirtyBox=!0;if(j.legendType==="point")k.isDirtyLegend=!0;b&&k.redraw(c)}var f=this,g=f.series,h=f.graphic,i,k=g.chart,j=g.options,l=g.xAxis&&g.xAxis.names,b=p(b,!0);d===!1?e():f.firePointEvent("update",{options:a},e)},remove:function(a,b){this.series.removePoint(sa(this, +this.series.data),a,b)}});u(Q.prototype,{addPoint:function(a,b,c,d){var e=this,f=e.options,g=e.data,h=e.graph,i=e.area,k=e.chart,j=e.xAxis&&e.xAxis.names,l=h&&h.shift||0,m=["graph","area"],h=f.data,n,r=e.xData;Ua(d,k);if(c){for(d=e.zones.length;d--;)m.push("zoneGraph"+d,"zoneArea"+d);o(m,function(a){if(e[a])e[a].shift=l+(f.step?2:1)})}if(i)i.isArea=!0;b=p(b,!0);i={series:e};e.pointClass.prototype.applyOptions.apply(i,[a]);m=i.x;d=r.length;if(e.requireSorting&&mm;)d--;e.updateParallelArrays(i, +"splice",d,0,0);e.updateParallelArrays(i,d);if(j&&i.name)j[m]=i.name;h.splice(d,0,a);n&&(e.data.splice(d,0,null),e.processData());f.legendType==="point"&&e.generatePoints();c&&(g[0]&&g[0].remove?g[0].remove(!1):(g.shift(),e.updateParallelArrays(i,"shift"),h.shift()));e.isDirty=!0;e.isDirtyData=!0;b&&(e.getAttribs(),k.redraw())},removePoint:function(a,b,c){var d=this,e=d.data,f=e[a],g=d.points,h=d.chart,i=function(){g&&g.length===e.length&&g.splice(a,1);e.splice(a,1);d.options.data.splice(a,1);d.updateParallelArrays(f|| +{series:d},"splice",a,1);f&&f.destroy();d.isDirty=!0;d.isDirtyData=!0;b&&h.redraw()};Ua(c,h);b=p(b,!0);f?f.firePointEvent("remove",null,i):i()},remove:function(a,b){var c=this,d=c.chart;H(c,"remove",null,function(){c.destroy();d.isDirtyLegend=d.isDirtyBox=!0;d.linkSeries();p(a,!0)&&d.redraw(b)})},update:function(a,b){var c=this,d=this.chart,e=this.userOptions,f=this.type,g=I[f].prototype,h=["group","markerGroup","dataLabelsGroup"],i;if(a.type&&a.type!==f||a.zIndex!==void 0)h.length=0;o(h,function(a){h[a]= +c[a];delete c[a]});a=D(e,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data},a);this.remove(!1);for(i in g)this[i]=z;u(this,I[a.type||f].prototype);o(h,function(a){c[a]=h[a]});this.init(d,a);d.linkSeries();p(b,!0)&&d.redraw(!1)}});u(ka.prototype,{update:function(a,b){var c=this.chart,a=c.options[this.coll][this.options.index]=D(this.userOptions,a);this.destroy(!0);this._addedPlotLB=this.chart._labelPanes=z;this.init(c,u(a,{events:z}));c.isDirtyBox=!0;p(b,!0)&&c.redraw()}, +remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);oa(b.axes,this);oa(b[c],this);b.options[c].splice(this.options.index,1);o(b[c],function(a,b){a.options.index=b});this.destroy();b.isDirtyBox=!0;p(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},b)},setCategories:function(a,b){this.update({categories:a},b)}});var wa=pa(Q);I.line=wa;aa.area=D(da,{softThreshold:!1,threshold:0});var la=pa(Q,{type:"area",singleStacks:!1,getStackPoints:function(){var a= +[],b=[],c=this.xAxis,d=this.yAxis,e=d.stacks[this.stackKey],f={},g=this.points,h=this.index,i=d.series,k=i.length,j,l=p(d.options.reversedStacks,!0)?1:-1,m,n;if(this.options.stacking){for(m=0;m=0&&m=0&&ma&&h>e?(h=t(a,e),k=2*e-h):hc&&k>e?(k=t(c,e), +h=2*e-k):k0.5;b=Math.round(b)+f;d-= +b;g&&(b-=1,d+=1);return{x:a,y:b,width:c,height:d}},translate:function(){var a=this,b=a.chart,c=a.options,d=a.borderWidth=p(c.borderWidth,a.closestPointRange*a.xAxis.transA<2?0:1),e=a.yAxis,f=a.translatedThreshold=e.getThreshold(c.threshold),g=p(c.minPointLength,5),h=a.getColumnMetrics(),i=h.width,k=a.barW=t(i,1+2*d),j=a.pointXOffset=h.offset;b.inverted&&(f-=0.5);c.pointPadding&&(k=ua(k));Q.prototype.translate.apply(a);o(a.points,function(c){var d=F(p(c.yBottom,f),9E4),h=999+P(d),h=F(t(-h,c.plotY), +e.len+h),o=c.plotX+j,s=k,q=F(h,d),v,u=t(h,d)-q;P(u)g?d-g:f-(v?g:0));c.barX=o;c.pointWidth=i;c.tooltipPos=b.inverted?[e.len+e.pos-b.plotLeft-h,a.xAxis.len-o-s/2,u]:[o+s/2,h+e.pos-b.plotTop,u];c.shapeType="rect";c.shapeArgs=a.crispCol(o,q,s,u)})},getSymbol:Aa,drawLegendSymbol:J.drawRectangle,drawGraph:Aa,drawPoints:function(){var a=this,b=this.chart,c=a.options,d=b.renderer,e=c.animationLimit||250,f,g;o(a.points,function(h){var i= +h.plotY,k=h.graphic;if(i!==z&&!isNaN(i)&&h.y!==null)f=h.shapeArgs,i=q(a.borderWidth)?{"stroke-width":a.borderWidth}:{},g=h.pointAttr[h.selected?"select":""]||a.pointAttr[""],k?(Oa(k),k.attr(i).attr(g)[b.pointCount\u25cf {series.name}
    ', +pointFormat:"x: {point.x}
    y: {point.y}
    "}});la=pa(Q,{type:"scatter",sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","markerGroup","dataLabelsGroup"],takeOrdinalPosition:!1,kdDimensions:2,drawGraph:function(){this.options.lineWidth&&Q.prototype.drawGraph.call(this)}});I.scatter=la;aa.pie=D(da,{borderColor:"#FFFFFF",borderWidth:1,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.y===null?void 0: +this.point.name},x:0},ignoreHiddenPoint:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,states:{hover:{brightness:0.1,shadow:!1}},stickyTracking:!1,tooltip:{followPointer:!0}});da={type:"pie",isCartesian:!1,pointClass:pa(Ha,{init:function(){Ha.prototype.init.apply(this,arguments);var a=this,b;a.name=p(a.name,"Slice");b=function(b){a.slice(b.type==="select")};M(a,"select",b);M(a,"unselect",b);return a},setVisible:function(a,b){var c=this,d=c.series,e=d.chart,f=d.options.ignoreHiddenPoint, +b=p(b,f);if(a!==c.visible){c.visible=c.options.visible=a=a===z?!c.visible:a;d.options.data[sa(c,d.data)]=c.options;o(["graphic","dataLabel","connector","shadowGroup"],function(b){if(c[b])c[b][a?"show":"hide"](!0)});c.legendItem&&e.legend.colorizeItem(c,a);!a&&c.state==="hover"&&c.setState("");if(f)d.isDirty=!0;b&&e.redraw()}},slice:function(a,b,c){var d=this.series;Ua(c,d.chart);p(b,!0);this.sliced=this.options.sliced=a=q(a)?a:!this.sliced;d.options.data[sa(this,d.data)]=this.options;a=a?this.slicedTranslation: +{translateX:0,translateY:0};this.graphic.animate(a);this.shadowGroup&&this.shadowGroup.animate(a)},haloPath:function(a){var b=this.shapeArgs,c=this.series.chart;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(c.plotLeft+b.x,c.plotTop+b.y,b.r+a,b.r+a,{innerR:this.shapeArgs.r,start:b.start,end:b.end})}}),requireSorting:!1,directTouch:!0,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth", +fill:"color"},animate:function(a){var b=this,c=b.points,d=b.startAngleRad;if(!a)o(c,function(a){var c=a.graphic,g=a.shapeArgs;c&&(c.attr({r:a.startR||b.center[3]/2,start:d,end:d}),c.animate({r:g.r,start:g.start,end:g.end},b.options.animation))}),b.animate=null},updateTotals:function(){var a,b=0,c=this.points,d=c.length,e,f=this.options.ignoreHiddenPoint;for(a=0;a0&&(e.visible||!f)?e.y/b*100:0,e.total=b},generatePoints:function(){Q.prototype.generatePoints.call(this); +this.updateTotals()},translate:function(a){this.generatePoints();var b=0,c=this.options,d=c.slicedOffset,e=d+c.borderWidth,f,g,h,i=c.startAngle||0,k=this.startAngleRad=ra/180*(i-90),i=(this.endAngleRad=ra/180*(p(c.endAngle,i+360)-90))-k,j=this.points,l=c.dataLabels.distance,c=c.ignoreHiddenPoint,m,n=j.length,o;if(!a)this.center=a=this.getCenter();this.getX=function(b,c){h=W.asin(F((b-a[1])/(a[2]/2+l),1));return a[0]+(c?-1:1)*U(h)*(a[2]/2+l)};for(m=0;m1.5*ra?h-=2*ra:h<-ra/2&&(h+=2*ra);o.slicedTranslation={translateX:A(U(h)*d),translateY:A($(h)*d)};f=U(h)*a[2]/2;g=$(h)*a[2]/2;o.tooltipPos=[a[0]+f*0.7,a[1]+g*0.7];o.half=h<-ra/2||h>ra/2?1:0;o.angle=h;e=F(e,l/2);o.labelPos=[a[0]+f+U(h)*l,a[1]+g+$(h)*l,a[0]+f+U(h)*e,a[1]+g+$(h)*e,a[0]+f,a[1]+g,l<0?"center":o.half?"right":"left",h]}},drawGraph:null,drawPoints:function(){var a= +this,b=a.chart.renderer,c,d,e=a.options.shadow,f,g,h,i;if(e&&!a.shadowGroup)a.shadowGroup=b.g("shadow").add(a.group);o(a.points,function(k){if(k.y!==null){d=k.graphic;h=k.shapeArgs;f=k.shadowGroup;g=k.pointAttr[k.selected?"select":""];if(!g.stroke)g.stroke=g.fill;if(e&&!f)f=k.shadowGroup=b.g("shadow").add(a.shadowGroup);c=k.sliced?k.slicedTranslation:{translateX:0,translateY:0};f&&f.attr(c);if(d)d.setRadialReference(a.center).attr(g).animate(u(h,c));else{i={"stroke-linejoin":"round"};if(!k.visible)i.visibility= +"hidden";k.graphic=d=b[k.shapeType](h).setRadialReference(a.center).attr(g).attr(i).attr(c).add(a.group).shadow(e,f)}}})},searchPoint:Aa,sortByAngle:function(a,b){a.sort(function(a,d){return a.angle!==void 0&&(d.angle-a.angle)*b})},drawLegendSymbol:J.drawRectangle,getCenter:Cb.getCenter,getSymbol:Aa};da=pa(Q,da);I.pie=da;Q.prototype.drawDataLabels=function(){var a=this,b=a.options,c=b.cursor,d=b.dataLabels,e=a.points,f,g,h=a.hasRendered||0,i,k,j=a.chart.renderer;if(d.enabled||a._hasPointLabels)a.dlProcessOptions&& +a.dlProcessOptions(d),k=a.plotGroup("dataLabelsGroup","data-labels",d.defer?"hidden":"visible",d.zIndex||6),p(d.defer,!0)&&(k.attr({opacity:+h}),h||M(a,"afterAnimate",function(){a.visible&&k.show();k[b.animation?"animate":"attr"]({opacity:1},{duration:200})})),g=d,o(e,function(e){var h,n=e.dataLabel,o,s,t=e.connector,v=!0,x,w={};f=e.dlOptions||e.options&&e.options.dataLabels;h=p(f&&f.enabled,g.enabled)&&e.y!==null;if(n&&!h)e.dataLabel=n.destroy();else if(h){d=D(g,f);x=d.style;h=d.rotation;o=e.getLabelConfig(); +i=d.format?Ka(d.format,o):d.formatter.call(o,d);x.color=p(d.color,x.color,a.color,"black");if(n)if(q(i))n.attr({text:i}),v=!1;else{if(e.dataLabel=n=n.destroy(),t)e.connector=t.destroy()}else if(q(i)){n={fill:d.backgroundColor,stroke:d.borderColor,"stroke-width":d.borderWidth,r:d.borderRadius||0,rotation:h,padding:d.padding,zIndex:1};if(x.color==="contrast")w.color=d.inside||d.distance<0||b.stacking?j.getContrast(e.color||a.color):"#000000";if(c)w.cursor=c;for(s in n)n[s]===z&&delete n[s];n=e.dataLabel= +j[h?"text":"label"](i,0,-9999,d.shape,null,null,d.useHTML).attr(n).css(u(x,w)).add(k).shadow(d.shadow)}n&&a.alignDataLabel(e,n,d,null,v)}})};Q.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=p(a.plotX,-9999),i=p(a.plotY,-9999),k=b.getBBox(),j=f.renderer.fontMetrics(c.style.fontSize).b,l=c.rotation,m=c.align,n=this.visible&&(a.series.forceDL||f.isInsidePlot(h,A(i),g)||d&&f.isInsidePlot(h,g?d.x+1:d.y+d.height-1,g)),o=p(c.overflow,"justify")==="justify";if(n)d=u({x:g?f.plotWidth- +i:h,y:A(g?f.plotHeight-h:i),width:0,height:0},d),u(c,{width:k.width,height:k.height}),l?(o=!1,g=f.renderer.rotCorr(j,l),g={x:d.x+c.x+d.width/2+g.x,y:d.y+c.y+d.height/2},b[e?"attr":"animate"](g).attr({align:c.align}),h=(l+720)%360,h=h>180&&h<360,m==="left"?g.y-=h?k.height:0:m==="center"?(g.x-=k.width/2,g.y-=k.height/2):m==="right"&&(g.x-=k.width,g.y-=h?0:k.height)):(b.align(c,null,d),g=b.alignAttr),o?this.justifyDataLabel(b,c,g,k,d,e):p(c.crop,!0)&&(n=f.isInsidePlot(g.x,g.y)&&f.isInsidePlot(g.x+k.width, +g.y+k.height)),c.shape&&!l&&b.attr({anchorX:a.plotX,anchorY:a.plotY});if(!n)Oa(b),b.attr({y:-9999}),b.placed=!1};Q.prototype.justifyDataLabel=function(a,b,c,d,e,f){var g=this.chart,h=b.align,i=b.verticalAlign,k,j,l=a.box?0:a.padding||0;k=c.x+l;if(k<0)h==="right"?b.align="left":b.x=-k,j=!0;k=c.x+d.width-l;if(k>g.plotWidth)h==="left"?b.align="right":b.x=g.plotWidth-k,j=!0;k=c.y+l;if(k<0)i==="bottom"?b.verticalAlign="top":b.y=-k,j=!0;k=c.y+d.height-l;if(k>g.plotHeight)i==="top"?b.verticalAlign="bottom": +b.y=g.plotHeight-k,j=!0;if(j)a.placed=!f,a.align(b,null,e)};if(I.pie)I.pie.prototype.drawDataLabels=function(){var a=this,b=a.data,c,d=a.chart,e=a.options.dataLabels,f=p(e.connectorPadding,10),g=p(e.connectorWidth,1),h=d.plotWidth,i=d.plotHeight,k,j,l=p(e.softConnector,!0),m=e.distance,n=a.center,r=n[2]/2,q=n[1],u=m>0,v,x,w,B=[[],[]],z,y,E,D,C,G=[0,0,0,0],L=function(a,b){return b.y-a.y};if(a.visible&&(e.enabled||a._hasPointLabels)){Q.prototype.drawDataLabels.apply(a);o(b,function(a){if(a.dataLabel&& +a.visible)B[a.half].push(a),a.dataLabel._pos=null});for(D=2;D--;){var H=[],M=[],I=B[D],K=I.length,J;if(K){a.sortByAngle(I,D-0.5);for(C=b=0;!b&&I[C];)b=I[C]&&I[C].dataLabel&&(I[C].dataLabel.getBBox().height||21),C++;if(m>0){x=F(q+r+m,d.plotHeight);for(C=t(0,q-r-m);C<=x;C+=b)H.push(C);x=H.length;if(K>x){c=[].concat(I);c.sort(L);for(C=K;C--;)c[C].rank=C;for(C=K;C--;)I[C].rank>=x&&I.splice(C,1);K=I.length}for(C=0;C0){if(x=M.pop(),J=x.i,y=x.y,c>y&&H[J+1]!==null||ch-f&&(G[1]=t(A(z+x-h+f),G[1])),y-b/2<0?G[0]=t(A(-y+b/2),G[0]):y+b/2>i&&(G[2]=t(A(y+b/2-i),G[2]))}}}if(Ea(G)===0||this.verifyDataLabelOverflow(G))this.placeDataLabels(),u&&g&&o(this.points,function(b){k=b.connector;w=b.labelPos;if((v=b.dataLabel)&&v._pos&&b.visible)E=v._attr.visibility,z=v.connX,y=v.connY,j=l?["M",z+(w[6]==="left"?5:-5),y,"C",z,y,2*w[2]-w[4],2*w[3]-w[5],w[2],w[3],"L",w[4],w[5]]:["M",z+(w[6]==="left"?5:-5),y,"L", +w[2],w[3],"L",w[4],w[5]],k?(k.animate({d:j}),k.attr("visibility",E)):b.connector=k=a.chart.renderer.path(j).attr({"stroke-width":g,stroke:e.connectorColor||b.color||"#606060",visibility:E}).add(a.dataLabelsGroup);else if(k)b.connector=k.destroy()})}},I.pie.prototype.placeDataLabels=function(){o(this.points,function(a){var b=a.dataLabel;if(b&&a.visible)(a=b._pos)?(b.attr(b._attr),b[b.moved?"animate":"attr"](a),b.moved=!0):b&&b.attr({y:-9999})})},I.pie.prototype.alignDataLabel=Aa,I.pie.prototype.verifyDataLabelOverflow= +function(a){var b=this.center,c=this.options,d=c.center,e=c.minSize||80,f=e,g;d[0]!==null?f=t(b[2]-t(a[1],a[3]),e):(f=t(b[2]-a[1]-a[3],e),b[0]+=(a[3]-a[1])/2);d[1]!==null?f=t(F(f,b[2]-t(a[0],a[2])),e):(f=t(F(f,b[2]-a[0]-a[2]),e),b[1]+=(a[0]-a[2])/2);fp(this.translatedThreshold,g.yAxis.len)),k=p(c.inside,!!this.options.stacking);if(h){d=D(h);if(d.y<0)d.height+=d.y,d.y=0;h=d.y+d.height-g.yAxis.len;h>0&&(d.height-=h);f&&(d={x:g.yAxis.len-d.y-d.height,y:g.xAxis.len-d.x-d.width,width:d.height,height:d.width});if(!k)f?(d.x+=i?0:d.width,d.width=0):(d.y+=i?d.height:0,d.height=0)}c.align=p(c.align,!f||k?"center":i?"right":"left");c.verticalAlign=p(c.verticalAlign, +f||k?"middle":i?"top":"bottom");Q.prototype.alignDataLabel.call(this,a,b,c,d,e)};(function(a){var b=a.Chart,c=a.each,d=a.pick,e=a.addEvent;b.prototype.callbacks.push(function(a){function b(){var e=[];c(a.series,function(a){var b=a.options.dataLabels,f=a.dataLabelCollections||["dataLabel"];(b.enabled||a._hasPointLabels)&&!b.allowOverlap&&a.visible&&c(f,function(b){c(a.points,function(a){if(a[b])a[b].labelrank=d(a.labelrank,a.shapeArgs&&a.shapeArgs.height),e.push(a[b])})})});a.hideOverlappingLabels(e)} +b();e(a,"redraw",b)});b.prototype.hideOverlappingLabels=function(a){var b=a.length,d,e,k,j,l,m,n,o,p;for(e=0;el.x+n.translateX+(k.width-p)||m.x+o.translateX+(j.width- +p)l.y+n.translateY+(k.height-p)||m.y+o.translateY+(j.height-p)h;if(b.series.length&&(i||l>F(j.dataMin,j.min))&&(!i||k= tCount ){ + if (typeof cb == 'function') {cb(data); return;} + return; + } + + test_post(i+1, data.testid); + } + ).fail(function(xhr, status){ + if(status == 'timeout'){ + alert("您的答案超时了, 请检查代码是否存在死循环的错误."); + } else { + alert("测试失败,服务器出错."); + } + return; + }); + + }; + + test_post(1, 0); }; $('#test-program-btn').on('click', test_program); @@ -377,6 +423,10 @@ $(function(){ var src = ''; if(language==4){ src = '\ +//注意\n\ + //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\ + //2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\ + //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),每行末尾的所有空格用□表示\n\ import java.io.*;\n\ import java.util.*;\n\ \n\ @@ -396,8 +446,12 @@ class Main\n\ '; } else if(language==1){ - src = '#include \n\ -\n\ + src = '\ +//注意\n\ + //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\ + //2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\ + //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),每行末尾的所有空格用□表示\n\ +#include \n\ int main()\n\ {\n\ //获取参数方式 scanf\n\ @@ -413,6 +467,10 @@ int main()\n\ '; } else if(language==2){ src = '\ +//注意\n\ + //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\ + //2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\ + //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),每行末尾的所有空格用□表示\n\ #include \n\ using namespace std;\n\ \n\ @@ -430,6 +488,10 @@ int main()\n\ '; } else if(language==3){ src = '\ +#注意\n\ + #1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\ + #2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\ + #3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),空格用□表示\n\ import sys \n\ \n\ #获取参数方式,使用raw_input\n\ diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 60cb491e0..b22ffffb3 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -443,6 +443,7 @@ a:hover.tijiao{ background:#0f99a9;} .members_left ul li span{ float:left; text-align:center; color:#484747;} .w150{ text-align:center; width:150px;min-height: 10px;} .width150{width:150px;min-height: 10px;} +.width120{width:120px;min-height: 10px;} .f_b{ font-weight: bold;} .members_right label{ margin-left:15px;} .N_search{ height:20px; border:1px solid #999;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index c455a5998..4558437a2 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -497,7 +497,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} .sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} -.boxContainer {height:33px; line-height:33px; position:relative} +.boxContainer {height:auto; line-height:33px; position:relative} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} .resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} @@ -1483,8 +1483,7 @@ a.choose-active {background-color:#269ac9; color:#ffffff;} .subject-list-from {width:145px; text-align:center;} /*视频播放默认图标*/ -.mediaIco{margin: 30px 0 30px 20px;} +.mediaIco{margin: 30px 0 30px 20px;width: 200px;} a.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;} a.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;} a.st_img { display:block;width:32px; height:32px; border:1px solid #CCC; padding:1px;} -a:hover.st_img { border:1px solid #1c9ec7; } diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index f2a3dd3c9..3a203c10d 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -18,12 +18,12 @@ .orgUrlInput {width:200px; outline:none; border:1px solid #eaeaea; height:22px;} a.saveBtn {padding:3px 5px; background-color:#269ac9; color:#ffffff;} a.saveBtn:hover {background-color:#297fb8;} -.orgMemberList {width:460px; float:left;} +.orgMemberList {width:480px; float:left;} .orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px;} .orgListUser {width:85px; float:left;} .orgListRole {width:180px; float:left;} .orgOrder {width:30px; float:left;margin-right:10px;text-align:center;} -.orgMemContainer {width:228px;} +.orgMemContainer {width:208px;} .orgMemberAdd {float:right;} .orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;} .undis {display:none;} @@ -75,7 +75,8 @@ a.linkGrey8:hover {color:#585858;} #orgUserName {display:inline-block;} .org_login_list a {color:#269ac9;} -.orgListStatus {width:55px; float:left;} +.orgListStatus {width:40px; float:left;} +.orgListStatusList {width:58px; float:left;} .personalUrl {border:1px solid #dddddd; width:75px; outline:none; white-space:nowrap; padding-left:2px;} .reCon{ margin:5px; width:710px;} .retop{width:710px; height:40px; background:#eaeaea; padding:5px;} diff --git a/public/stylesheets/org_new_style.css b/public/stylesheets/org_new_style.css new file mode 100644 index 000000000..5e73949a6 --- /dev/null +++ b/public/stylesheets/org_new_style.css @@ -0,0 +1,332 @@ +@charset "utf-8"; +/* CSS Document */ +body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} +body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5; background:#fff;} +div,img,tr,td,table{ border:0;} +table,tr,td{border:0;cellspacing:0; cellpadding:0;} +ol,ul,li{ list-style-type:none} +a:link,a:visited{color:#000;text-decoration:none;} +a:hover{color:#29156f;} + +.fl{ float:left;} +.fr{ float:right;} +.cl{ clear:both;overflow:hidden;} +.mr40{ margin-right:40px;} +.mr30{ margin-right:30px;} +.mb20{ margin-bottom:20px;} +.mb70{ margin-bottom:70px;} +.bg-grey{ background:#f2f2f2;} + +/** header **/ +.header{ width:100%; height:60px; padding:5px 0 0px; } +.header-con{ width:1200px; margin:0 auto; } +.logo{ position:relative; } +.logo-img{ height:52px; } +.login{ margin-top:15px;} +.login a{ color:#000; font-size:14px; margin-top:10px; } +.logo-add{ display:block; top:3px; left:0px; position:absolute; width:20px; height:20px;background:url(../images/org_new_style/icons.png) -7px -573px no-repeat;} + + +/*.header{ width:100%; height:60px; background:#29146f; padding:5px 0 0px; }*/ +/*.header-con{ width:1200px; margin:0 auto;}*/ +/*.logo,.logo img{ display:block; height:52px; }*/ +/*a.login{ background:url(../images/org_new_style/icons.png) -7px -11px no-repeat; width:146px; height:55px; margin-right:40px; margin-top:11px;}*/ +/*a:hover.login{ background:url(../images/org_new_style/icons.png) -7px -88px no-repeat; }*/ +/*a.register{ background:url(../images/org_new_style/icons.png) -190px -11px no-repeat; width:158px; height:55px; ;margin-top:11px;}*/ +/*a:hover.register{ background:url(../images/org_new_style/icons.png) -190px -88px no-repeat; }*/ +/*.login{ margin-top:15px;}*/ +/*.login a{ color:#fff; font-size:14px; margin-top:10px; }*/ +/** nav **/ +.nav-box{ width:100%; padding:0px 0 5px; background:#eeeeee;} +.nav-con{width:1200px; margin:0 auto; background:#eee;} +.nav{ } +.nav a{ display:block; padding:15px 10px; font-size:18px; color:#666666; background:#eee; border-top:3px solid #eee; margin-right:20px; } +a.navact{border-top:3px solid #ffbd18;} +.nav a:hover{border-top:3px solid #ffbd18;} + +/*.nav-box{ width:1200px; height:60px; margin:0 auto;}*/ +/*.nav a{ display:block; padding:15px 10px; font-size:18px; color:#000; margin-right:20px; }*/ +/*.navact{border-bottom:3px solid #ffbd18;}*/ +/*.nav a:hover{border-bottom:3px solid #ffbd18;}*/ +/*.searchbox{ width:338px; height:57px; border:1px solid #ccc; -webkit-border-radius: 3px;border-radius: 3px; margin:10px 0px 0 0;}*/ +/*.search-input{width:270px; height:40px; color:#bebebe; font-size:18px; border:1px solid #ccc; -webkit-border-radius: 3px;border-radius: 3px;border:0px; background:none; margin:10px 0 0 20px;}*/ +/*.search-input:hover{ border:none;color:#fff; }*/ +/*a.search-icon{ background:url(../images/org_new_style/icons.png) -387px -11px no-repeat; width:40px; height:40px; margin-top:8px;}*/ +/*a:hover.search-icon{ background:url(../images/org_new_style/icons.png) -387px -89px no-repeat;}*/ +/*.searchbox:hover{ background:#999999; color:#fff;}*/ + +/* banner */ +.banner{ width:100%; height:304px; color:#fff; text-align:center; line-height:2.4;position:relative;} +.banner-inner{ width:100%; margin:0 auto; text-align:center;} +.banner-img{ height:313px;} +.banner-txt{position:absolute; top:25%; left:35%; width:500px; padding:30px 0; margin:0 auto; background-color:rgba(255,255,255,.3); } +.banner-add{ display:block; position:absolute; top:10%; left:20%;width:27px; height:27px; background:url(../images/org_new_style/icons.png) -39px -570px no-repeat;} +.banner h1{ font-size:42px;} +.banner p{font-size:40px; color:#fff;} + +/*.banner{ width:100%; height:304px; background:#070317; color:#fff; text-align:center; line-height:2.4;}*/ +/*.banner-inner{ width:1500px; margin:0 auto; position:relative; text-align:center;}*/ +/*.banner-img{ height:304px;}*/ +/*.banner-txt{position:absolute; top:30%; left:0%; width:1500px; margin:0 auto;}*/ +/*.banner h1{ font-size:42px;}*/ +/*.banner a{font-size:28px; color:#fff;}*/ +/*.banner a:hover{ text-decoration:underline;}*/ +/*.banner p{ font-size:18px;}*/ +/*.banner span{ font-size:16px;}*/ + +/** box1 **/ +.box1{ width:100%; padding:60px 0;} +.content{ width:1200px; margin:0 auto;} +.box-top{ margin:0 auto; text-align:center; margin-bottom:45px; } +.box-title{ width:355px; height:67px; margin:0 auto; border-top:1px solid #ccc; border-bottom:1px solid #ccc; color:#000; text-align:center; font-size:40px; font-weight: lighter; margin-bottom:2px;} +.box-title-p{ font-size:20px; color:#999999;} +.row{ width:1200px; margin: 0 auto; } +.row-box1{ width:365px;} +.row-img{ margin-bottom:10px; width:365px; height:230px; display:block;} +.row-time{ color:#ffbd18; font-size:14px; font-weight:bold; line-height:1.9;} +.row-title{ font-size:16px; font-weight:bold; line-height:1.9;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} +.row-con { display:block; } +.row-con:hover{ color:#29156f; } +.row-txt{line-height:2.4; padding-bottom:10px; margin-bottom:10px; color:#888;} +.row-txt:hover{color:#29156f;} +.row-txt-line{border-bottom:1px solid #cccccc; width:365px;} +.row-box2{ width:388px; border:1px solid #ccc; border-bottom:none;} +.row-con2 a{ display:block;padding:20px 10px; border-bottom:1px solid #ccc;} +.row-con2 a:hover{ background:#29156f; color:#fff;} +.row-con2 a:hover{ color:#fff;} +.row-txt2{line-height:2.4; color:#888;} +.row-txt2:hover{ color:#fff; } + +/*.box1{ width:100%; padding:60px 0;}*/ +/*.content{ width:1200px; margin:0 auto;}*/ +/*.box-top{ margin:0 auto; text-align:center; margin-bottom:45px; }*/ +/*.box-title{ width:355px; height:67px; margin:0 auto; background:#29156f; color:#fff; text-align:center; font-size:40px; font-weight: lighter; margin-bottom:2px;}*/ +/*.box-title-p{ font-size:20px; color:#999999;}*/ +/*.row{ width:1200px; margin: 0 auto; }*/ +/*.row-box1{ width:365px;}*/ +/*.row-img{ margin-bottom:10px; width:365px; height:230px; display:block;}*/ +/*.row-time{ color:#ffbd18; font-size:14px; font-weight:bold; line-height:1.9;}*/ +/*.row-title{ font-size:16px; font-weight:bold; line-height:1.9;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}*/ +/*.row-con { display:block; }*/ +/*.row-con:hover{ color:#29156f; }*/ +/*.row-txt{line-height:2.4; padding-bottom:10px; margin-bottom:10px; color:#888;}*/ +/*.row-txt:hover{color:#29156f;}*/ +/*.row-txt-line{border-bottom:1px solid #cccccc; width:365px;}*/ +/*a.btn-more{ display:block; font-size:14px; width:110px; height:40px; -webkit-border-radius: 3px;border-radius: 3px;background:#ffbd18; color:#fff; text-align:center; line-height:3.0;}*/ +/*a:hover.btn-more{ background:#29156f;}*/ +/*.row-box2{ width:388px; border:1px solid #ccc; border-bottom:none;}*/ +/*.row-con2 a{ display:block;padding:20px 10px; border-bottom:1px solid #ccc;}*/ +/*.row-con2 a:hover{ background:#29156f; color:#fff;}*/ +/*.row-con2 a:hover{ color:#fff;}*/ +/*.row-txt2{line-height:2.4; color:#888;}*/ +/*.row-txt2:hover{ color:#fff; }*/ + +/** 活动专区 **/ +.con-left{ width:618px;} +.con-left-box{ margin-bottom:20px; height:96px; display:block;} +.con-left-img{ width:175px; height:96px;} +.con-left-txt{ width:360px; margin-left:15px; font-size:14px; color:#888; padding-top:8px; line-height:1.9; height:75px; overflow:hidden;text-overflow:ellipsis;display:-webkit-box; + -webkit-line-clamp:3;-webkit-box-orient:vertical;} +.con-left-txt:hover{color:#29156f;} +.con-left-pre{ margin-top:15px; } +a.con-back-btn{ display: block;width:25px;height:25px;background:url(../images/org_new_style/icons.png) no-repeat -38px -505px ;} +a.con-arrow-btn{ display: block;width:25px;height:25px;background:url(../images/org_new_style/icons.png) no-repeat -12px -505px ; opacity:.5;} +.con-right{ width:532px; height:170px; background:#f6f6f6 ; padding:25px;} +.con-right p{background: url(../images/org_new_style/con-right.gif) no-repeat 0 0;line-height:1.9; width:415px; padding:40px 0 0 20px; font-size:14px; color:#888; margin-left:20px;} +.con-r-img img{ border:3px solid #e6473b; -moz-border-radius: 50px; -webkit-border-radius: 50px;border-radius: 50px; display:block; width:67px; height:67px;} +.con-r-img img:hover{border:3px solid #29156f;} +.con-name{ font-size:18px; font-weight:bold; margin-top:5px;} +.con-r-img { text-align:center;} +.con-r-pre{ margin-top:20px;} +a.pre-arrow,a.pre-back{ display:block; width:25px; height:10px; background:#29156f; margin-left:5px;} +a.pre-back{ background:#888;} +/** footer **/ +.footer{ height:150px; background:#bbb; width:100%;} +.footer-con{ width:1200px; padding:30px 0 0 60px; margin:0 auto; text-align:center; font-size:14px; color:#fff;} +.footer-con ul{ display:block; width:430px; height:50px; margin:0 auto; } +.footer-con ul li a{font-size:18px; color:#fff; margin-right:35px; font-weight:bold;} +/** download **/ +.row-ziyuan{ width:570px; border-bottom:1px solid #e6e6e6; padding:15px 0;margin: 0px 15px;} +.ziyuan-box{ width:420px; margin-right:20px;} +.ziyuan-box span{ margin-right:5px;} +.ziyuan-title{ display:block; width:420px; font-size:16px;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} +.ziyuan-box p{display:block; width:420px; color:#888; font-size:12px; line-height:2.5;} +a.download-btn{ display:block; border:1px solid #ccc; margin-top:10px; font-size:14px; width:70px; height:27px;-webkit-border-radius: 3px;border-radius:3px;color:#888; text-align:center; line-height:1.9;} +a:hover.download-btn{ background:#29146f; color:#fff; border:none;} +.user-img,.user-img img{ margin-right:10px; -moz-border-radius: 50px; -webkit-border-radius: 50px;border-radius: 50px; display:block; width:40px; height:40px;} +.ml60{ margin-left:60px;} +.user-img img{border:2px solid #e6473b; } +.user-img img:hover{border:2px solid #29156f;} + + +.article-lwrap{ width:760px; border-bottom:1px solid #E4E4E4; padding:10px 0;} +.item-txt{ width:555px;} +.item-img,.item-img img{ width:180px; height:120px;} +.item-title{ display:block; width:555px; font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:5px;} +.item-bd{ width:555px; font-size:14px !important; color:#888; line-height:1.9; height:55px; overflow:hidden;text-overflow:ellipsis;display:-webkit-box; + -webkit-line-clamp:2;-webkit-box-orient:vertical; } +.item-bd:hover{color:#29156f;} +a.read-more{ color:red;} +a:hover.read-more{ text-decoration:underline;} +.publisher-hd,.publisher-hd img{ margin-right:10px; -moz-border-radius: 50px; -webkit-border-radius: 50px;border-radius: 50px; display:block; width:28px; height:28px;} +.left-info li,left-info li a{ float:left;} +.item-btm,.publisher-name,.pass-time{ margin-top:5px;} +.pass-time{ margin-left:20px; color:#888;} +.right-info{background:url(../images/org_new_style/icons.png) no-repeat -41px -541px ; width:15px; height:16px; padding-left:20px; color:#888; margin-top:5px;} +.nopic{ width:760px;} +.article-lwrap{ width:760px; border-bottom:1px solid #E4E4E4; padding:20px 0;} +.item-title-r{ display:block; width:400px; font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} +.article-rwrap{ width:400px; border-bottom:1px dashed #E4E4E4; padding:12px 0;} + +.course-list ul{ } +.course-list ul li{ display:block; width:370px; float:left; margin:0 15px;} +.course-list h5{display:block; width:380px; font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.course-list-img,.course-list-img img{ width:370px; height:220px; margin-bottom:10px;} + +/*用户图像*/ +.topnav_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 1px;} +.topnav_login_list a{color:#269ac9;} +.topnav_login_list li{ } +.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block; line-height:0;} +.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;} +.none {display: none;} + + +/** backtop **/ +.cd-top { + display: inline-block; + height: 60px; + width: 60px; + position: fixed; + bottom: 40px; + right: 10px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.05); + /* image replacement properties */ + overflow: hidden; + text-indent: 100%; + white-space: nowrap; + background: rgba(108, 108, 108, 0.8) url(../images/org_new_style/cd-top-arrow.svg) no-repeat center 50%; + visibility: hidden; + opacity: 0; + -webkit-transition: all 0.3s; + -moz-transition: all 0.3s; + transition: all 0.3s; +} +.cd-top.cd-is-visible { + /* the button becomes visible */ + visibility: visible; + opacity: 1; +} +.cd-top.cd-fade-out { + /* 如果用户继续向下滚动,这个按钮的透明度会变得更低 */ + opacity: .5; +} +.no-touch .cd-top:hover { + background-color: #29156f; + opacity: 1; +} + +a.more-btn-center{ display:block; border:1px solid #ccc; color:#000; margin-top:10px; width:120px; height:38px;font-size:14px; -webkit-border-radius: 25px;border-radius:25px;text-align:center; line-height:38px; margin:0 auto; margin-top:30px;} +a:hover.more-btn-center{ background:#aaa; color:#fff;} +.mt30{ margin-top:30px;} + +/*a.more-btn{ display:block; background:#ccc; color:#fff; margin-top:10px; width:100px; height:38px;font-size:14px; -webkit-border-radius: 5px;border-radius:5px;text-align:center; line-height:38px;}*/ +/*a.more-btn{ display:block; border:1px solid #ccc; color:#000; margin-top:10px; width:120px; height:38px;font-size:14px; -webkit-border-radius: 25px;border-radius:25px;text-align:center; line-height:38px; margin:0 auto; margin-top:30px;}*/ +/*a.more-btn-center{ display:block; border:1px solid #ccc; color:#000; margin-top:10px; width:120px; height:38px;font-size:14px; -webkit-border-radius: 25px;border-radius:25px;text-align:center; line-height:38px; margin:0 auto; margin-top:30px;}*/ +/*a:hover.more-btn{ background:#29146f; color:#fff;}*/ +/*a:hover.more-btn-center{ background:#29146f; color:#fff;}*/ +/*.mt30{ margin-top:30px;}*/ + +.nocontent{ font-size:30px; color:#888; margin:150px auto; text-align:center;} + +/** 帖子列表模式 **/ +.note-box{ width:515px; } +.note-box span{ margin-right:5px;} +.note-title{ display:block; width:515px; font-size:16px;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} +.note-box p{display:block; width:515px; color:#888; font-size:12px; line-height:2.5;} +.right-info2{background:url(../images/org_new_style/icons.png) no-repeat -41px -540px ; width:15px; line-height:1.9; height:16px; padding-left:20px; color:#888; margin-top:5px;} + +.upload_con h2 { + display: block; + background: #eaeaea; + font-size: 14px; + color: #343333; + height: 31px; + width: auto; + margin-top: 25px; + padding-left: 20px; + padding-top: 5px; +} +a.blue_btn { + background: #64bdd9; + color: #fff; + font-size: 14px; + font-weight: normal; + padding: 2px 8px; + text-align: center; + cursor: pointer; +} +a.grey_btn { + background: #d9d9d9; + color: #656565; + font-size: 14px; + font-weight: normal; + text-align: center; + margin-left: 10px; + margin-bottom: 10px; + padding: 2px 10px; +} +span.add_attachment { + font-size: 80%; + line-height: 2.5em; +} +.c_dark { + color: #2d2d2d; +} +.upload_filename { + background: url(../images/pic_file.png) 0 -20px no-repeat; + color: #7f7f7f; + width: 270px; + border: none; + padding-left: 20px; + margin-right: 10px; + margin-bottom: 5px; + white-space: nowrap; + text-overflow: ellipsis; +} +.profiler-results.profiler-left { + left: 0px; +} +.profiler-results { + z-index: 2147483643; + position: fixed; + top: 0px; +} + +.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} +.ajax-waiting input.upload_filename {background:url(../images/hourglass.png) no-repeat 0px 50%;} +.ajax-loading input.upload_filename {background:url(../images/loading.gif) no-repeat 0px 50%;} +div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } +.upload_filename{ background: url(../images/pic_file.png) 0 -20px no-repeat;color: #7f7f7f;width: 270px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} +.evaluation{position: relative;} +.evaluation_submit{position: absolute;right: 0px;bottom: 0px;} +.student_work_search{background-color: #64bdd9;color: white !important;padding: 2px 7px;margin-left: 10px;cursor: pointer; } + + + + + + + + + + + + + + + + + + + diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index e48e9fad2..f3403aa78 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -147,6 +147,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w90{ width:90px;} .w100{width: 100px;} .w125{width:125px;} +.w180{width:180px;} .w210{ width:210px;} .w150{ width:150px;} .w170{width:170px;} @@ -449,7 +450,7 @@ a:hover.search_btn{ background: #0fa9bb;} .resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} .sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} -.boxContainer {height:33px; line-height:33px; position:relative} +.boxContainer {height:auto; line-height:33px; position:relative} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} .resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index a086889f1..9e0e07a77 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -214,7 +214,7 @@ .recordBanner {width:670px; height:30px; background-color:#f1f1f1; color:#666666; line-height:30px; vertical-align:middle;} .vl_copy {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;} .vl_copy2 {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;} -.vl_zip {background:url(../images/vlicon/download_icon.png) 0px 0px no-repeat; padding-left:22px;} +.vl_zip {background:url(../images/vlicon/graph.png) 0px 2px no-repeat; padding-left:22px;} .vl_fork {background:url(../images/vlicon/fork_icon.png) 0px -2px no-repeat; padding-left:22px;} .vl_commit {background:url(../images/vlicon/commit_icon.png) 0px -2px no-repeat; padding-left:22px;weight:20px;height: 24px;} .vl_branch {background:url(../images/vlicon/branch_icon.png) 0px -2px no-repeat; padding-left:22px}