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 @@
<%= labelled_form_for @course do |f| %>
-
-
-
- * <%= l(:label_tags_course_name)%> :
-
- 课程名称不能为空
-
-
-
- * <%= l(:label_class_period)%> :
-
-
-
-
-
- * <%= l(:label_course_term)%> :
- <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
- <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
-
-
-
- * <%= l(:label_new_course_password)%> :
-
-
- 显示明码
-
+
+
+
+ * <%= l(:label_tags_course_name)%> :
+
+ 课程名称不能为空
+
- 学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
-
-
- <%= l(:label_new_course_description)%> :
-
+
+ * <%= l(:label_class_period)%> :
+
+
+
-
-
- 公开 :
-
- (打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)
+
+ * <%= l(:label_course_term)%> :
+ <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
+ <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
+
+
-
-
- 学生列表公开 :
-
- (打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)
+
+ * 结束学期 :
+ <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {} %>
+ <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{} %>
+ 仅针对跨越多个学期的班级,否则不用修改。
+
-
-
+
+ * <%= l(:label_new_course_password)%> :
+
+
+ 显示明码
+
+
+ 学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
+
+
+ <%= l(:label_new_course_description)%> :
+
+
+
+
+ 公开 :
+
+ (选中后课外用户可见该课程,否则仅对课内成员可见)
+
+
+
+ 学生列表公开 :
+
+ (选中后课外用户可见学生列表,否则仅对课内成员可见)
+
+
+
学生上传资源 :
id="course_publish_resource" name="course[publish_resource]" type="checkbox" />
- (打钩为"允许学生上传资源",不打钩为"不允许学生上传资源")
+ (选中后允许学生上传课程资源,否则不允许)
-
-
- 提交
- <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
-
-
+
+
+ 提交
+ <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
+
+
<% end%>
-
\ 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"} %>
+
+
* <%= l(:label_new_course_password)%> :
@@ -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 %>
- <% if @topic.author.id == User.current.id%>
+ <% if User.current.logged? %>
-
- <%= link_to(
- l(:button_edit),
- {:action => 'edit', :id => @topic},
- :class => 'postOptionLink'
- ) if @message.course_editable_by?(User.current) %>
-
-
- <%= link_to(
- l(:button_delete),
- {:action => 'destroy', :id => @topic},
- :method => :post,
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if @message.course_destroyable_by?(User.current) %>
- <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
-
+ <% if @topic.author.id == User.current.id %>
+
+ <%= link_to(
+ l(:button_edit),
+ {:action => 'edit', :id => @topic},
+ :class => 'postOptionLink'
+ ) if @message.course_editable_by?(User.current) %>
+
+
+ <%= link_to(
+ l(:button_delete),
+ {:action => 'destroy', :id => @topic},
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if @message.course_destroyable_by?(User.current) %>
+
+ <% end %>
+ <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb
index 9eb082d33..304694b39 100644
--- a/app/views/messages/_org_subfield_show.html.erb
+++ b/app/views/messages/_org_subfield_show.html.erb
@@ -7,6 +7,7 @@
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
+ $(".postRightContainer").css("margin-left", "0px");
});
-
+
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_path(@document.creator_id) %>
diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb
index f29799707..345c8f60f 100644
--- a/app/views/org_subfields/create.js.erb
+++ b/app/views/org_subfields/create.js.erb
@@ -1,5 +1,7 @@
$("#org_subfield_list").html("");
-$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
+$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
+ :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
+ :subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
$("#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("");
\ No newline at end of file
diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb
index 8a676e93e..2ba03fc36 100644
--- a/app/views/org_subfields/destroy.js.erb
+++ b/app/views/org_subfields/destroy.js.erb
@@ -1,4 +1,6 @@
$("#org_subfield_list").html("");
-$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
+$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
+ :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
+ :subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
\ 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 d11919927..39eaa3e98 100644
--- a/app/views/organizations/_org_left_subfield_list.html.erb
+++ b/app/views/organizations/_org_left_subfield_list.html.erb
@@ -1,34 +1,43 @@
-