diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index bc339319b..661073cdc 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -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 e1ea6935a..2c43eec77 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -34,13 +34,19 @@ class OrganizationsController < ApplicationController 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 @@ -57,7 +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 = params[:show_mode] + @organization.show_mode = 0 @organization.creator_id = User.current.id member = OrgMember.new(:user_id => User.current.id) @@ -70,14 +76,16 @@ class OrganizationsController < ApplicationController def show # 组织新类型 show_mode:判断标准 1为新类型,0为旧 - if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:type] .nil? + 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) @subfield_content = @organization.org_subfields.order("priority") # 项目两种动态 + @project_acts = get_project_activities_org @organization @project_issue_acts = get_project_issue_activities_org @organization @project_message_acts = get_project_message_activities_org @organization # 磕碜动态 #@project_acts_issues = get_project_activities_org @organization + @course_acts = get_course_activities_org @organization @course_acts_homework = get_course_homework_activities_org @organization @course_acts_message = get_course_message_activities_org @organization @course_acts_news = get_course_news_activities_org @organization @@ -105,7 +113,7 @@ class OrganizationsController < ApplicationController @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) + @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' @@ -153,6 +161,31 @@ class OrganizationsController < ApplicationController #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 = 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 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 = 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 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? @@ -194,7 +227,11 @@ class OrganizationsController < ApplicationController #@organization.name = params[:organization][:name] @organization.save respond_to do |format| - format.html { redirect_to setting_organization_path(@organization)} + if @organization.show_mode == 1 + format.html { redirect_to organization_path(@organization)} + else + format.html { redirect_to setting_organization_path(@organization)} + end end end @@ -228,11 +265,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] diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index c2ba5b03b..4faa802a5 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -30,7 +30,7 @@ module OrganizationsHelper 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 2;") + 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) @@ -59,4 +59,18 @@ module OrganizationsHelper 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/views/admin/homework.html.erb b/app/views/admin/homework.html.erb index e81936886..a3a64b316 100644 --- a/app/views/admin/homework.html.erb +++ b/app/views/admin/homework.html.erb @@ -35,7 +35,7 @@ <%=@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 %> diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb index e344e64dd..b1656cf37 100644 --- a/app/views/layouts/base_org_newstyle.html.erb +++ b/app/views/layouts/base_org_newstyle.html.erb @@ -65,7 +65,7 @@
- + <%# 登录 %> <%= render :partial => 'organizations/org_logined_header' %>
@@ -77,7 +77,7 @@ <% @subfield_content.each do |field| %> <% if is_default_field?(field) %> <% case field.name %> - <% when 'activity' %> + <% when 'activity' %> <%= link_to "首页", organization_path(@organization), :class => "fl navact" %> <% when 'course' %> 课程动态 @@ -87,17 +87,19 @@ <% else %> <% if field.field_type == "Post" && field.hide == 0 %> <%= field.name %> - <% elsif field.field_type == "Resource" && field.hide == 0%> + <% elsif field.field_type == "Resource" && field.hide == 0 %> <%= field.name %> <% end %> <% end %> <% end %> + <% if User.current.admin_of_org?(@organization) %> + 配置 + <% end %>
@@ -107,114 +109,222 @@ <% if is_default_field?(field) %> <% case field.name %> <% when 'course' %> -
-
-

课程动态

course activities

-
-
    - <% unless @course_acts_homework.nil? %> -
  • - <% @course_acts_homework.each do |act| %> - <%= render :partial => 'org_new_course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id, :course_activity => 0} %> - <% end %> -
  • +
    + <% if field.status == 0 %> +
    +

    课程动态

    + <% if @course_acts.nil? %> + +
    + <%= 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 %> - <% unless @course_acts_message.nil? %> -
  • - <% @course_acts_message.each do |act| %> - <%= render :partial => 'org_new_course_message', :locals => {:activity => Message.find(act.org_act_id), :user_activity_id =>act.id} %> - <% end %> -
  • +
    + <% else %> +
    +

    课程动态

    + <% if @course_acts.nil? %> + +
    + <%= 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 %> - <% unless @course_acts_news.nil? %> -
  • - <% @course_acts_news.each do |act| %> - <%= render :partial => 'org_new_course_news', :locals => {:activity => News.find(act.org_act_id), :user_activity_id =>act.id} %> - <% end %> -
  • - <% end %> -
    -
-
-
+
+ <% end %> <% when 'project' %> -
-
-

项目动态

project activities

-
- <% unless @project_message_acts.nil? %> -
- - <% @project_message_acts.each do |act| %> - <%= render :partial => 'organizations/org_new_project_message', :locals => {:activity => Message.find(act.org_act_id)} %> - <% end %> - <%= link_to "More", organization_path(@organization, :type => 1), :class => "more-btn mt30 fr", :target => "_blank" %> +
+ <% if field.status == 0 %> +
+

项目动态

+ <% if @project_acts.nil? %> +
-
- <% end %> - - <% unless @project_issue_acts.nil? %> -
- <% @project_issue_acts.each do |act| %> - <%= render :partial => 'organizations/org_new_project_issues', :locals => {:activity => Issue.find(act.org_act_id)} %> - <% end %> - <%= link_to "More", organization_path(@organization, :type => 1), :class => "more-btn mt30 fr", :target => "_blank" %> + <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
-
- <% end %> - -
-
+ <% 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.nil? %> + +
+ <%= 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" %> <%# 讨论类型 %> <% message_ats = get_message_org(@organization.id, field.id) %> <% ids = field.org_document_comments.map{|o| o.id}.join(",") %>
-
-

<%= field.name %><%= field.id %>

discussion zone

-
-
- <% message_ats.each do |act| %> - <%= render :partial => 'organizations/org_new_forum', :locals => {:activity => act, :field => field, :organization => @organization} %> + <% if field.status == 0 %> +
+

<%= field.name %>

+ <% if message_ats.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 %> +
+
    + + <% message_ats.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 %> - <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn mt30 fr", :target => "_blank" %> -
-
- <% unless ids.blank? %> - <% message_reply_ats = get_message_reply_org(@organization.id, ids) %> -
- <% message_reply_ats.each do |act| %> - <%= render :partial => 'organizations/org_new_forum_reply', :locals => {:activity => act, :field => field, :organization => @organization} %> + +
+ <% else %> +
+

<%= field.name %>

+ <% if message_ats.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 %> +
+ <% message_ats.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 %> -
-
-
- <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> -
+
+
+ <% end %>
<% elsif field.field_type == "Resource" %> <% org_attachs = get_attach_org2(field) %>
-

<%= field.name %><%= field.id %>

resource dwonload

-
- <%= render :partial => 'organizations/org_new_resource', :locals => {:org_attachs => org_attachs} %> - -
+

<%= 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 %> -
- <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> -
diff --git a/app/views/org_subfields/update_status.js.erb b/app/views/org_subfields/update_status.js.erb new file mode 100644 index 000000000..06982ccfc --- /dev/null +++ b/app/views/org_subfields/update_status.js.erb @@ -0,0 +1,3 @@ +$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); +$("#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_logined_header.html.erb b/app/views/organizations/_org_logined_header.html.erb index fa4c228a1..75ec7106a 100644 --- a/app/views/organizations/_org_logined_header.html.erb +++ b/app/views/organizations/_org_logined_header.html.erb @@ -24,7 +24,7 @@
<% else %>
- 登陆  |  + 登录  |  退出
<% end %> diff --git a/app/views/organizations/_org_new_course_act_list.html.erb b/app/views/organizations/_org_new_course_act_list.html.erb new file mode 100644 index 000000000..8dceeb6cb --- /dev/null +++ b/app/views/organizations/_org_new_course_act_list.html.erb @@ -0,0 +1,80 @@ +<% activities.each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> +
+ <%= link_to image_tag(url_to_avatar(activity.user),:width => "40", :height => "40"), user_path(activity.user), :class => "fl user-img" %> + +
+ <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %> + <%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %> +

发布时间:<%= format_date activity.updated_at %> + 作者:<%= activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname) %> + <%= activity.journals_for_messages.count %>

+
+ +
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> +
+ <%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %> + +
+ <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %> + <% end %> + <%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %> +

发布时间:<%= format_date activity.updated_on %> + 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> + <%= activity.children.count %>

+
+ +
+ <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> +
+ <%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %> + +
+ <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %> +

发布时间:<%= format_date activity.created_on %> + 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> + <%= activity.comments.count %>

+
+
+ <% elsif act.org_act_type == "Poll" %> + <% activity = Poll.find(act.org_act_id) %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% if ( activity.polls_status==2) %> +
+ <%= link_to image_tag(url_to_avatar(activity.user),:width => "40", :height => "40"), user_path(activity.user), :class => "fl user-img" %> + +
+ <% if has_commit %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "fl note-title" %> + <% else %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :target => '_blank', :class => "fl note-title" %> + <% end %> +

发布时间:<%= format_date activity.published_at %> + 作者:<%= activity.try(:user).try(:realname).nil? ? activity.try(:user) : activity.try(:user).try(:realname) %> + 0

+
+
+ <% end %> + <% elsif act.org_act_type == "Course" %> + <% activity = Course.find(act.org_act_id) %> +
+ <%= link_to image_tag(url_to_avatar(activity.teacher),:width => "40", :height => "40"), user_path(activity.teacher), :class => "fl user-img" %> + +
+ <%= link_to activity.name.to_s, course_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %> +

发布时间:<%= format_date activity.created_at %> + 作者:<%= activity.try(:teacher).try(:realname).nil? ? activity.try(:teacher) : activity.try(:teacher).try(:realname) %> + 0

+
+
+ <% end %> + +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_new_course_homework.html.erb b/app/views/organizations/_org_new_course_homework.html.erb index 3de4c0293..7d6a4ac5e 100644 --- a/app/views/organizations/_org_new_course_homework.html.erb +++ b/app/views/organizations/_org_new_course_homework.html.erb @@ -2,16 +2,18 @@
<% iamge_path = get_image_path_from_content(activity.description) %> <% if iamge_path.nil? %> - # + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %> + <% else %> - + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %> + <% end %>
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank' %>
- <%= activity.user.realname.nil? ? activity.user : activity.user.realname %> + <%=link_to activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname), user_path(activity.user), :class=>"publisher-name fl", :target => "_blank" %>

<%= format_date activity.updated_at %>

<%= activity.journals_for_messages.count %>
diff --git a/app/views/organizations/_org_new_course_message.html.erb b/app/views/organizations/_org_new_course_message.html.erb index 3877276ce..5e586bb28 100644 --- a/app/views/organizations/_org_new_course_message.html.erb +++ b/app/views/organizations/_org_new_course_message.html.erb @@ -2,9 +2,9 @@
<% iamge_path = get_image_path_from_content(activity.content) %> <% if iamge_path.nil? %> - # + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> <% else %> - + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> <% end %>
@@ -15,7 +15,7 @@ <% end %>
- <%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> + <%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %>

<%= format_date activity.updated_on %>

<%= activity.children.count %>
diff --git a/app/views/organizations/_org_new_course_news.html.erb b/app/views/organizations/_org_new_course_news.html.erb index ae2d03cbf..72b147ac3 100644 --- a/app/views/organizations/_org_new_course_news.html.erb +++ b/app/views/organizations/_org_new_course_news.html.erb @@ -2,16 +2,17 @@
<% iamge_path = get_image_path_from_content(activity.description) %> <% if iamge_path.nil? %> - # + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% else %> - + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> <% end %>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %>
- <%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> + <%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %>

<%= format_date activity.created_on %>

<%= activity.comments.count %>
diff --git a/app/views/organizations/_org_new_course_pic.html.erb b/app/views/organizations/_org_new_course_pic.html.erb new file mode 100644 index 000000000..15a9c4582 --- /dev/null +++ b/app/views/organizations/_org_new_course_pic.html.erb @@ -0,0 +1,107 @@ +<% activities.each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %> + + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %> + + <% end %> +
    +
    + <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank' %> +
    +
    + <%=link_to activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname), user_path(activity.user), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.updated_at %>

    +
    <%= activity.journals_for_messages.count %>
    +
    + +
  • + <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> + <% end %> +
    +
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %> + <% end %> +
    +
    + <%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.updated_on %>

    +
    <%= activity.children.count %>
    +
    + +
  • + <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% end %> +
    +
    + <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %> +
    +
    + <%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.created_on %>

    +
    <%= activity.comments.count %>
    +
    + +
  • + <% elsif act.org_act_type == "Poll" %> + <% activity = Poll.find(act.org_act_id) %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% if ( activity.polls_status==2) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.polls_description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% end %> +
    +
    + <% if has_commit %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank' %> + <% else %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :target => '_blank' %> + <% end %> +
    +
    + <%=link_to activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname), user_path(activity.user), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.published_at %>

    +
    0
    +
    + +
  • + <% end %> + <% end %> + +<% end %> + diff --git a/app/views/organizations/_org_new_forum_list.html.erb b/app/views/organizations/_org_new_forum_list.html.erb new file mode 100644 index 000000000..bcd79c35f --- /dev/null +++ b/app/views/organizations/_org_new_forum_list.html.erb @@ -0,0 +1,15 @@ + +
    + <%= link_to image_tag(url_to_avatar(activity.creator),:width => "40", :height => "40"), user_path(activity.creator), :class => "fl user-img" %> + +
    + <%= link_to activity.title.to_s, organization_path(@organization, :org_subfield_id => field.id), :target => '_blank', :class => "fl note-title" %> + <%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %> +

    发布时间:<%= format_date activity.updated_at %> + 作者:<%= activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname) %> + <%= activity.children.count %>

    +
    + +
    + + diff --git a/app/views/organizations/_org_new_forum_pic.html.erb b/app/views/organizations/_org_new_forum_pic.html.erb new file mode 100644 index 000000000..b42c7e865 --- /dev/null +++ b/app/views/organizations/_org_new_forum_pic.html.erb @@ -0,0 +1,24 @@ +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), organization_path(@organization, :org_subfield_id => field.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), organization_path(@organization, :org_subfield_id => field.id), :target => "_blank" %> + <% end %> +
    +
    + <%= link_to activity.title.to_s, organization_path(@organization, :org_subfield_id => field.id), :target => '_blank' %> +
    +
    + <%=link_to activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname), user_path(activity.creator), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.created_at %>

    +
    <%= activity.children.count %>
    +
    + +
  • + + + + diff --git a/app/views/organizations/_org_new_project_act_list.html.erb b/app/views/organizations/_org_new_project_act_list.html.erb new file mode 100644 index 000000000..278972b1a --- /dev/null +++ b/app/views/organizations/_org_new_project_act_list.html.erb @@ -0,0 +1,49 @@ +<% activities.each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = Issue.find(act.org_act_id) %> +
    + <%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %> + +
    + <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %> + <%#= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %> + <%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %> +

    发布时间:<%= format_date activity.updated_on %> + 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> + <%= activity.journals.count %>

    +
    + +
    + <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> +
    + <%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %> + +
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %> + <% end %> + <%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %> +

    发布时间:<%= format_date activity.updated_on %> + 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> + <%= activity.children.count %>

    +
    + +
    + <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> +
    + <%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %> + +
    + <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %> +

    发布时间:<%= format_date activity.created_on %> + 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> + <%= activity.comments.count %>

    +
    +
    + <% end %> + +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_new_project_pic.html.erb b/app/views/organizations/_org_new_project_pic.html.erb new file mode 100644 index 000000000..3adc77433 --- /dev/null +++ b/app/views/organizations/_org_new_project_pic.html.erb @@ -0,0 +1,77 @@ + + <% activities.each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = Issue.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), issue_url_in_org(activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), issue_url_in_org(activity.id), :target => "_blank" %> + <% end %> +
    +
    + <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank' %> +
    +
    + <%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.updated_on %>

    +
    <%= activity.journals.count %>
    +
    + +
  • + <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %> + <% end %> +
    +
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %> + <% end %> +
    +
    + <%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.updated_on %>

    +
    <%= activity.children.count %>
    +
    + +
  • + <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> +
  • + +
    + <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %> + <% end %> +
    +
    + <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %> +
    +
    + <%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %> +

    <%= format_date activity.created_on %>

    +
    <%= activity.comments.count %>
    +
    + +
  • + + <% end %> + + <% end %> + diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index d907ac33e..2c679eb3d 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -2,6 +2,7 @@
  • 顺序
  • 已有栏目
  • 状态
  • +
  • 排列
  • 类型
  • 域名目录
  • @@ -21,8 +22,23 @@
  • <%= name %>
  • 默认
  • +
  • + <% if field.name == "activity" %> + 默认 + <% 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.hide==0?"设为隐藏":"设为可见" %> + <%= field.hide==0?"隐藏":"可见" %>
    <% 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" ? "帖子" : "资源" %>
  • <%#= 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 %>