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/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index ba4c1f18f..bc339319b 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]) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 239253d82..da0eb8009 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -225,7 +225,7 @@ class OrganizationsController < ApplicationController 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})" + "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" #user_courses = Course.find_by_sql(sql) @courses = Course.find_by_sql(sql) # @added_course_ids = @organization.courses.map(&:id) @@ -269,7 +269,7 @@ class OrganizationsController < ApplicationController 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})" + " and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id}) and status=1" #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/student_work_controller.rb b/app/controllers/student_work_controller.rb index 71b23fdcf..6c86abf82 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -63,6 +63,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| @@ -369,6 +376,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) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 123f1fc96..f885c5c1c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -714,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) @@ -1213,12 +1214,12 @@ class UsersController < ApplicationController 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(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course')" + course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" project_types = "('Message','Issue','ProjectCreateInfo')" principal_types = "JournalsForMessage" if params[:type].present? @@ -1231,6 +1232,8 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) when "course_poll" @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) + when "course_journals" + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) when "project_issue" @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) when "project_message" @@ -1250,7 +1253,8 @@ class UsersController < ApplicationController # @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(','))+")" # 减少数据库交互 - user_ids = "(" + @user.id.to_s + "," + User.watched_by(@user.id).map{|u| u.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 + ")" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6432d83d8..1d443610f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2137,6 +2137,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 +3058,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/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/models/principal.rb b/app/models/principal.rb index dd376f609..2c8465538 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) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p) escape '/'" params = {:p => pattern} if q =~ /^(.+)\s+(.+)$/ a, b = "#{$1}%", "#{$2}%" diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb index 32e796382..3cc429185 100644 --- a/app/views/attachments/_activity_attach.html.erb +++ b/app/views/attachments/_activity_attach.html.erb @@ -3,14 +3,14 @@
- <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true -%> ( <%= number_to_human_size attachment.filesize %>) - <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= link_to h(truncate(attachment.author.name, length: 15, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, <%= format_time(attachment.created_on) %>
diff --git a/app/views/files/_org_order_filter.html.erb b/app/views/files/_org_order_filter.html.erb new file mode 100644 index 000000000..7fcf115f8 --- /dev/null +++ b/app/views/files/_org_order_filter.html.erb @@ -0,0 +1,9 @@ +<% if @order == "asc" %> + 按 <%= link_to "时间",params.merge(:sort => "created_on:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort => "downloads:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort => "quotes:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 +<% else %> + 按 <%= link_to "时间",params.merge(:sort => "created_on:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort => "downloads:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort =>"quotes:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 +<% end %> \ No newline at end of file diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index 9e0dd41d0..516e42c68 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -56,16 +56,8 @@

共有 <%= User.current.member_of_org?(@org_subfield.organization) ? @all_attachments.count : @all_attachments.select{|attach| attach.is_public == 1 }.count %> 个资源

-

- <% if @order == "asc" %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 - <% else %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>  /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 - <% end %> +

+ <%= render :partial => 'files/org_order_filter', :locals => {:order => @order, :sort => @sort, :tag_name => @tag_name, :search_name => nil} %>

diff --git a/app/views/files/search_files_in_subfield.js.erb b/app/views/files/search_files_in_subfield.js.erb index 77c364817..f1056debd 100644 --- a/app/views/files/search_files_in_subfield.js.erb +++ b/app/views/files/search_files_in_subfield.js.erb @@ -5,4 +5,6 @@ $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); $("#attachment_count").html("<%= @result.count %>"); + $("#org_sort").html("<%= escape_javascript(render :partial => 'org_order_filter', + :locals => {:sort => @sort, :order => @order, :tag_name => @tag_name, :search_name => @q}) %>"); <% end %> \ No newline at end of file diff --git a/app/views/files/search_org_subfield_tag_attachment.js.erb b/app/views/files/search_org_subfield_tag_attachment.js.erb index fe4aed937..775fd24a4 100644 --- a/app/views/files/search_org_subfield_tag_attachment.js.erb +++ b/app/views/files/search_org_subfield_tag_attachment.js.erb @@ -1,3 +1,5 @@ $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); -$("#attachment_count").html("<%= @result.count %>"); \ No newline at end of file +$("#attachment_count").html("<%= @result.count %>"); +$("#org_sort").html("<%= escape_javascript(render :partial => 'org_order_filter', + :locals => {:sort => @sort, :order => @order, :tag_name => @tag_name,:search_name => @q}) %>"); \ No newline at end of file diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index f2ece1f35..faf141600 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -90,8 +90,8 @@ <% end%> -
- <%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %> +
+ <%= link_to truncate(@organization.name,:length => 26), organization_path(@organization.id), :class=>"pr_info_name c_dark fb break_word" %> <% if User.current.logged? %> <% if @organization.is_public? %> <%= l(:label_public)%> diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb index fea89459b..679b35e5b 100644 --- a/app/views/org_document_comments/new.html.erb +++ b/app/views/org_document_comments/new.html.erb @@ -32,7 +32,10 @@ location.href = document.referrer; } -
+
+
<%= OrgSubfield.try(:find, params[:field_id]).try(:name) %>
+
+
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %>
diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 84b69717a..3e08d9f9e 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -4,7 +4,6 @@ :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); - $("#subfield_name").val(""); -<% else %> - $("#subfield_name").val(""); -<% end %> \ No newline at end of file +<% end %> +$("#subfield_name").val(""); +$("#sub_dir").val(""); \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 53003c85a..7e49d1780 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -63,7 +63,7 @@
    - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
@@ -77,7 +77,7 @@
    - <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.where("status=1").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index e3ed492a0..cf68d71f5 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -10,6 +10,9 @@ TO  <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> | <%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %> + <% if @organization.home_id == document.id %> + 已设为首页 + <% end %>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 0d490df77..d907ac33e 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -54,7 +54,7 @@
<% end %> <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %> @@ -85,6 +85,9 @@ url: "/org_subfields/" + field_id + "?name=" + input_value, type: 'put' }); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } $(show_id).show(); $(edit_id).hide(); @@ -109,6 +112,9 @@ url: "/org_subfields/" + field_id + "/update_sub_dir?sub_dir_name=" + input_value, type: 'put' }); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } $(show_id).show(); $(edit_id).hide(); @@ -128,16 +134,13 @@ function update_priority(show_id, edit_id, field_id, input_value){ var re = /^[0-9]*[1-9]*[0-9]$/ if(re.test(input_value) && $(show_id).html().trim() != input_value.trim() && input_value.trim() != ''){ - if(confirm("确定修改为" + input_value + "?")){ - $.ajax({ - url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value, - type: 'put' - }); - } + $.ajax({ + url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value, + type: 'put' + }); } - else - { - $(edit_id).find("input").val($(show_id).html().trim()); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); } $(show_id).show(); $(edit_id).hide(); diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index e12bf3849..b0c961d82 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -30,7 +30,7 @@
  • - + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
  • diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 3ef5d547c..c0ca2cfe4 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -19,8 +19,11 @@ '<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()+"&config_page=Y" + "&org_id="+id ) } - function update_org(id){ - check_uniq(id); + function update_org(id, old_value, input_value){ + if (old_value == input_value) + { + check_uniq(id); + } if( $checkName){ $("#edit_organization_"+id).submit(); } @@ -57,7 +60,7 @@
    组织URL:
    http:// - + .trustie.net申请 <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %> <% if domain.present? and record.present? and record.content == domain.subname %> @@ -77,7 +80,7 @@  允许游客下载 <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %>
    - 保存 + 保存 <% end %>
    @@ -96,7 +99,7 @@

    添加成员

    <%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%> - <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %> + <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
    <%= find_user_not_in_current_org_by_name(@project) %>
    @@ -129,9 +132,9 @@

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

    <% if domain %> - <%= domain.subname %>.trustie.net/ + <%= domain.subname %>.trustie.net/ <% else %> - 您还没有子域名,请先在左侧信息栏申请子域名 + 您还没有子域名,请先在左侧信息栏申请子域名 <% end %>
    @@ -195,12 +198,25 @@ } } -// $(document).ready(function(){ -// if ( $("#is_public").attr("checked") != true){ -// alert($(this).attr("checked")); -// $("#allow_download").attr("checked", false); -// $("#allow_download").attr("disabled", true); -// $("#allow_down_hint").html(""); -// } -// }); + //输入子域名或者二级目录,自动将输入换成小写 + function observe_input_to_lowercase(id){ + $(id).each(function(){ + var $this = $(this); + var old_input = $this.val(); + var check=function(){ + var val = $this.val(); + if ( old_input != val){ + $this.val(val.toLowerCase()); + old_input = val.toLowerCase(); + } + }; + var reset = function() { + if (timer) { + clearInterval(timer); + } + }; + var timer = setInterval(check, 300); + $this.bind('blur', reset); + }); + } \ No newline at end of file diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 20d6df9ba..6bcda51da 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -59,7 +59,7 @@ <% if x["status"].to_i != 0 %> 测试错误! 您的输出: -
    <%=x["result"]%>
    +
    <%=x["result"].force_encoding("UTF-8")%>
    正确输出:
    <%=x["output"]%>
    diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 0badbb192..8b2f57723 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -46,45 +46,43 @@ <% end%> \ No newline at end of file diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index eb73f9226..26090d104 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -54,56 +54,64 @@ sd_create_editor_from_data(<%= user_activity.id %>, null, "100%", "<%= user_activity.class.to_s %>"); }); - <% 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 => act.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%> + <% 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_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 5c05474a0..ccd329852 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -9,6 +9,13 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -22,6 +29,13 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -44,6 +58,43 @@ <% end %> +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -59,6 +110,24 @@ +
  •    截止时间快到啦
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -79,6 +148,22 @@ :onmouseover => "message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -94,6 +179,22 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -113,6 +214,18 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -127,6 +240,9 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -136,13 +252,37 @@
  • <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>"> <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
  • -
  • - <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id), - :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> - - -
  • + <% if ma.course_message.parent_id.nil? %> +
  • + <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id), + :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> + + +
  • + + <% else %> +
  • + <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id), + :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %> + + +
  • + + <% end %>
  • <%= time_tag(ma.created_at).html_safe %>
  • + <% end %> <% if ma.course_message_type == "StudentWorksScore" %> @@ -167,14 +307,33 @@
  • <% unless ma.content.nil? %> - <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id, :student_work_id => ma.course_message.student_work), + <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
  • + <% end %> -
  • <%= time_tag(ma.created_at).html_safe %>
  • - +
  • <%= time_tag(ma.created_at).html_safe %>
  • + <% end %> <% if ma.course_message_type == "JournalsForMessage" %> <% if ma.course_message.jour_type == 'Course' %> @@ -193,6 +352,9 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -208,11 +370,23 @@ ">回复了作品评论:
  • - <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id, :student_work_id => ma.course_message.jour.student_work), :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"}" %>
  • +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -232,10 +406,46 @@ +
  •   您成功提交了作品(但被标记为迟交啦)
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> + + + <% if ma.course_message_type == "StudentWork" && ma.status == 1 %> + + <% end %> <% if ma.course_message_type == "Course" %> <% end %> @@ -269,6 +496,16 @@ +
  • <% if ma.status == 0 || ma.status.nil?%> @@ -304,6 +541,15 @@
  • +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -324,6 +570,20 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -344,6 +604,20 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -364,6 +638,21 @@ +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -380,6 +669,27 @@ + +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -395,7 +705,23 @@ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + + +
  • 截止时间快到啦
  • <%= time_tag(ma.created_at).html_safe %>
  • diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fa4eaacbe..2fe9ab079 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -14,6 +14,7 @@
  • <%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
  • <%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> +
  • <%= link_to "课程留言", {:controller => "users", :action => "show", :type => "course_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> @@ -30,7 +31,7 @@
  • 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/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/stylesheets/courses.css b/public/stylesheets/courses.css index 7dd3fd74f..b4d07f64f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -419,6 +419,7 @@ a:hover.ping_sub{ background:#14a8b9;} /*.ping_distop span a{ float:right; width:20px; height:20px; background:url(images/star.png) -24px 0 no-repeat; margin-right:3px;}*/ .list_style ol li{list-style-type: decimal;margin-left: 20px;} .list_style ul li{list-style-type: disc;margin-left: 20px;} +span.author { font-size: 0.9em; color: #888; } /* 创建作品 work */ .Newwork{ width:668px; height:418px;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 94e3fa85a..c455a5998 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -99,6 +99,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .mr40{ margin-right:40px !important;} .mr65 {margin-right: 65px;} .mw20{ margin: 0 20px;} +.mw380 {max-width: 380px !important;} .mw400 {max-width: 400px !important;} .mt-20 {margin-top:-20px;} .mt-4 {margin-top: -4px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 0a3732ced..9d37dc1cb 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -180,6 +180,7 @@ h4{ font-size:14px; color:#3b3b3b;} .h150{ height:150px;} .p10 {padding-left:10px; padding-right:10px;} .mw360 {max-width: 360px !important;} +.mw380 {max-width: 380px !important;} .mw400 {max-width: 400px !important;} .mh18 {max-height: 18px;} @@ -1136,4 +1137,4 @@ a.program-btn{background: url(../images/homepage_icon.png) -86px -393px no-repea .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_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;}