diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 46362c2d3..d345fba5f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -63,7 +63,7 @@ class HomeworkCommonController < ApplicationController end @homework.end_time = params[:homework_common][:end_time] || Time.now @homework.course_id = params[:course_id] - @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1 + @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0 diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index ae13b7e78..de9ec9852 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -231,8 +231,10 @@ class MessagesController < ApplicationController @isReply = false if @project (render_403; return false) unless @message.editable_by?(User.current) - else + elsif @course (render_403; return false) unless @message.course_editable_by?(User.current) + else + (render_403; return false) unless @message.org_subfield_editable_by?(User.current) end @message.safe_attributes = params[:message] @@ -279,8 +281,10 @@ class MessagesController < ApplicationController def destroy if @project (render_403; return false) unless @message.destroyable_by?(User.current) - else + elsif @course (render_403; return false) unless @message.course_destroyable_by?(User.current) + else + (render_403; return false) unless @message.org_subfield_editable_by?(User.current) end r = @message.to_param @message.destroy diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 31f7d5d71..45256bb1b 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -282,6 +282,16 @@ class OrganizationsController < ApplicationController end end + def hide_org_subfield + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @org_subfield.update_attribute(:hide, 1) + end + + def show_org_subfield + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @org_subfield.update_attribute(:hide, 0) + end + def org_resources_subfield @org = Organization.find(params[:id]) @subfield = @org.org_subfields.where('field_type = "Resource" ') @@ -289,4 +299,5 @@ class OrganizationsController < ApplicationController format.js end end + end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 56722aa30..b4891f12b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -522,7 +522,7 @@ class UsersController < ApplicationController else homework.publish_time = params[:homework_common][:publish_time] end - homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1 + homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 homework.homework_type = params[:homework_type].to_i || 1 homework.late_penalty = 10 homework.teacher_priority = 1 diff --git a/app/helpers/org_subfields_helper.rb b/app/helpers/org_subfields_helper.rb index a9f8a396f..8dad7096f 100644 --- a/app/helpers/org_subfields_helper.rb +++ b/app/helpers/org_subfields_helper.rb @@ -1,2 +1,3 @@ module OrgSubfieldsHelper + include OrganizationsHelper end diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 607d2af5c..69c355313 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -17,6 +17,15 @@ module OrganizationsHelper s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end - + def get_default_name field + case field.name + when 'activity' then + return '动态' + when 'course' then + return '课程' + when 'project' then + return '项目' + end + end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 737a1ea69..318de2942 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -155,7 +155,6 @@ class Mailer < ActionMailer::Base # 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言 def send_for_user_activities(user, date_to, days) date_from = date_to - days.days - subject = "[ #{user.show_name}#{l(:label_day_mail)}]" date_from = "#{date_from} 17:59:59" date_to = "#{date_to} 17:59:59" # 生成token用于直接点击登录 @@ -270,10 +269,11 @@ class Mailer < ActionMailer::Base total_count = @issues.count + @issues_journals.count + @course_messages.count + @project_messages.count + @course_news.count + @course_news_comments.count + @project_news.count + @project_news_comments.count + @project_attachments.count + @course_journal_messages.count + @user_journal_messages.count + @project_journal_messages.count + @forums.count + @memos.count + @attachments.count + @bids.count + @wiki_contents.count + subject = "[ #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}]" @subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}" mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 - mail :to => user.mail,:subject => subject if has_content + mail :to => user.mail,:subject => @subject if has_content end # 作业截止时间邮件提醒 diff --git a/app/models/message.rb b/app/models/message.rb index f59f778a8..6d108e607 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -44,6 +44,8 @@ class Message < ActiveRecord::Base has_many :ActivityNotifies,:as => :activity, :dependent => :destroy + after_destroy :delete_org_activities + acts_as_searchable :columns => ['subject', 'content'], :include => {:board => :project}, :project_key => "#{Board.table_name}.project_id", @@ -316,4 +318,8 @@ class Message < ActiveRecord::Base end end end + + def delete_org_activities + OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all + end end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 5d60238bf..aabe1a921 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -196,6 +196,8 @@ class CoursesService @course.tea_id = current_user.id @course.term = params[:term] @course.time = params[:time] + @course.end_term = params[:end_term] + @course.end_time = params[:end_time] #@course.school_id = params[:occupation] @course.school_id = current_user.user_extensions.school_id @course.setup_time = params[:setup_time] diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index f1b917816..9875ec9b7 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -4,64 +4,82 @@
-
\ No newline at end of file +
+ \ No newline at end of file diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index ae6416c9d..23d0a2a3f 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -2,11 +2,11 @@

<%= l(:label_course_modify_settings)%>

@@ -50,6 +50,12 @@ <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term_selected"} %>
+
  • + + <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time_selected"} %> + <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term_selected"} %> +
  • +
  • @@ -123,15 +129,17 @@
  • diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 83bcb4dc9..8599ad750 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -120,19 +120,21 @@
    -
    - <%= link_to '文章', organization_org_document_comments_path(@organization) %>  - <% if User.current.logged? %> - ( - <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> - ) - <% end %> -  |  - <%= link_to '成员', members_organization_path(@organization.id) %>  - <% if User.current.logged? %> - (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) - <% end %> -
    + <% if User.current.logged? %> +
    + <%= link_to '文章', organization_org_document_comments_path(@organization) %>  + <% if User.current.logged? %> + ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) + <% end %> +  |  + <%= link_to '成员', members_organization_path(@organization.id) %>  + <% if User.current.logged? %> + (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) + <% end %> +
    + <% end %>
    <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 294f9b7d4..c3278a209 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -37,28 +37,30 @@ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
    - <% if @topic.author.id == User.current.id%> + <% if User.current.logged? %>