diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index c7aa42b9e..e1e99447d 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -548,7 +548,8 @@ class AdminController < ApplicationController #作业 def homework - @homework = HomeworkCommon.order('end_time desc') + #@homework = HomeworkCommon.order('end_time desc') + @homework = HomeworkCommon.order( 'created_at desc ') @homework = paginateHelper @homework,30 @page = (params['page'] || 1).to_i - 1 respond_to do |format| diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 80f196ba5..e1ea6935a 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -28,11 +28,12 @@ class OrganizationsController < ApplicationController helper :project_score helper :issues include UsersHelper - before_filter :find_organization, :only => [:show, :members, :apply_subdomain] + before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout] layout 'base_org' def index end + def new @organization = Organization.new render :layout => 'new_base' @@ -68,50 +69,118 @@ class OrganizationsController < ApplicationController end def show - if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) - @organization = Organization.find(params[:id]) - # 统计访问量 - @organization.update_attribute(:visits, @organization.visits.to_i + 1) - if params[:org_subfield_id] - @org_subfield = OrgSubfield.find(params[:org_subfield_id]) - @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 - @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + # 组织新类型 show_mode:判断标准 1为新类型,0为旧 + if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:type] .nil? + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + @subfield_content = @organization.org_subfields.order("priority") + # 项目两种动态 + @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_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 + render :layout => 'base_org_newstyle' else - shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) - shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) - project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0 - course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0 - course_types = "('Message','News','HomeworkCommon','Poll','Course')" - case params[:type] - when nil - @org_activities = OrgActivity.where("(container_id =? and container_type =?) " + - "or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+ - "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", - @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) - when 'project_issue' - @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'project_message' - @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'org' - @org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_homework' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_news' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_message' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - when 'course_poll' - @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) - end - end - @page = params[:page] ? params[:page].to_i : 1 - respond_to do |format| - format.html - format.js + render_403 end else - render_403 + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + @organization = Organization.find(params[:id]) + # 统计访问量 + @organization.update_attribute(:visits, @organization.visits.to_i + 1) + if params[:org_subfield_id] + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 + @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + else + shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) + shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) + project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0 + course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0 + course_types = "('Message','News','HomeworkCommon','Poll','Course')" + case params[:type] + when nil + @org_activities = OrgActivity.where("(container_id =? and container_type =?) " + + "or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+ + "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", + @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + when 'project_issue' + @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'project_message' + @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'org' + @org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_homework' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_news' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_message' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'course_poll' + @org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + end + end + @page = params[:page] ? params[:page].to_i : 1 + respond_to do |format| + format.html + format.js + end + else + render_403 + end end + + end + + def get_project_message_activities_org org + project_ids = org.projects.map{|project| project.id}.join(",") + unless project_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'Message' order by updated_at desc limit 2;") + else + project_acts = nil + end + end + + def get_project_issue_activities_org org + project_ids = org.projects.map{|project| project.id}.join(",") + unless project_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;") + else + project_acts = nil + end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;") + end + + def get_course_homework_activities_org org + course_ids = org.courses.map{|course| course.id}.join(",") + unless course_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;") + else + project_acts = nil + end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 5;") + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;") + end + + def get_course_message_activities_org org + course_ids = org.courses.map{|course| course.id}.join(",") + unless course_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'Message' order by updated_at desc limit 1;") + else + project_acts = nil + end + end + + def get_course_news_activities_org org + course_ids = org.courses.map{|course| course.id}.join(",") + unless course_ids.blank? + project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'News' order by updated_at desc limit 1;") + else + project_acts = nil + end + #project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'News' order by updated_at desc limit 1;") end def update diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 69c355313..c2ba5b03b 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -1,6 +1,7 @@ # encoding: utf-8 module OrganizationsHelper include ApplicationHelper + include FilesHelper def find_user_not_in_current_org_by_name org @@ -28,4 +29,34 @@ module OrganizationsHelper end end + def get_message_org(org_id, field_id) + OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 2;") + end + + def get_message_reply_org(org_id, ids) + # OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id is not null order by updated_at desc limit 1;") + OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id in (#{ids}) order by updated_at desc limit 1;") + end + + def get_attach_org(field_id) + Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") + end + + def get_attach_org2(field) + org_attachments = field.attachments + attachments = User.current.admin? ? org_attachments : visable_attachemnts(org_attachments) + return attachments.sort_by{|x| x.created_on}.reverse.first(6) + # Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") + end + + # 从内容中获取路径 + def get_image_path_from_content content + r = Regexp.new(/src="\/files\/uploads\/image(.+?)"/) + if r.match(content).nil? + image_path = nil + else + image_path = r.match(content)[1] + end + end + end diff --git a/app/views/admin/homework.html.erb b/app/views/admin/homework.html.erb index 331806293..2159f8d71 100644 --- a/app/views/admin/homework.html.erb +++ b/app/views/admin/homework.html.erb @@ -22,7 +22,7 @@ 提交作品数 - 提交截止日期 + 作业发布日期 @@ -52,7 +52,7 @@ <%=link_to(StudentWork.where('homework_common_id=?',homework.id).count, student_work_index_path(:homework => homework.id))%> - <%=format_date(homework.end_time) %> + <%=format_date( homework.created_at ) %> <% end %> diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb new file mode 100644 index 000000000..e344e64dd --- /dev/null +++ b/app/views/layouts/base_org_newstyle.html.erb @@ -0,0 +1,256 @@ + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'org_new_style' %> + <%= javascript_include_tag 'org' %> + <%= javascript_include_tag 'attachments' %> + <%= call_hook :view_layouts_base_html_head %> + + <%= yield :header_tags -%> + + + + + + + + + +
+
+
+
+ + <%# 登录 %> + <%= render :partial => 'organizations/org_logined_header' %> +
+
+
+ + + + + +
+ + + <% @subfield_content.each do |field| %> + <% 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 %> +
  • + <% 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 %> +
  • + <% 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 %> +
    +
+
+ + +
+
+ <% 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" %> +
+
+ <% 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" %> +
+
+ <% 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} %> + <% 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} %> + <% end %> +
+
+ + <% end %> +
+
+
+ <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> +
+
+ <% 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} %> + +
+ +
+ <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %> +
+
+
+
+
+ <% end %> + <% end %> + <% end %> + + + + +
+
+ Top + + + + +
+ + + + + + + diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 7e49d1780..ebab8354c 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -84,8 +84,8 @@ <% end %> <% else %>
- <% if field.field_type == "Post" %> - <% if !field.subfield_subdomain_dir.nil? %> + <% if field.field_type == "Post" %> + <% 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 "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> <% else %> diff --git a/app/views/organizations/_org_logined_header.html.erb b/app/views/organizations/_org_logined_header.html.erb new file mode 100644 index 000000000..fa4c228a1 --- /dev/null +++ b/app/views/organizations/_org_logined_header.html.erb @@ -0,0 +1,48 @@ +<% if User.current.logged? %> + +<% else %> +
+ 登陆  |  + 退出 +
+<% end %> + + \ No newline at end of file diff --git a/app/views/organizations/_org_new_course_create.html.erb b/app/views/organizations/_org_new_course_create.html.erb new file mode 100644 index 000000000..fb953d10f --- /dev/null +++ b/app/views/organizations/_org_new_course_create.html.erb @@ -0,0 +1,5 @@ + + <%= format_date(activity.updated_at) %> +

<%= activity.title %>

+
<%= activity.description %>
+
\ 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 new file mode 100644 index 000000000..3de4c0293 --- /dev/null +++ b/app/views/organizations/_org_new_course_homework.html.erb @@ -0,0 +1,18 @@ + +
+ <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + # + <% else %> + + <% 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 %> +

<%= format_date activity.updated_at %>

+
<%= activity.journals_for_messages.count %>
+
+ \ No newline at end of file diff --git a/app/views/organizations/_org_new_course_message.html.erb b/app/views/organizations/_org_new_course_message.html.erb new file mode 100644 index 000000000..3877276ce --- /dev/null +++ b/app/views/organizations/_org_new_course_message.html.erb @@ -0,0 +1,22 @@ + +
+ <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + # + <% else %> + + <% 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 %> +
+
+ <%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %> +

<%= format_date activity.updated_on %>

+
<%= activity.children.count %>
+
+ \ No newline at end of file diff --git a/app/views/organizations/_org_new_course_news.html.erb b/app/views/organizations/_org_new_course_news.html.erb new file mode 100644 index 000000000..ae2d03cbf --- /dev/null +++ b/app/views/organizations/_org_new_course_news.html.erb @@ -0,0 +1,18 @@ + +
+ <% iamge_path = get_image_path_from_content(activity.description) %> + <% if iamge_path.nil? %> + # + <% else %> + + <% 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) %> +

<%= format_date activity.created_on %>

+
<%= activity.comments.count %>
+
+ \ No newline at end of file diff --git a/app/views/organizations/_org_new_course_poll.html.erb b/app/views/organizations/_org_new_course_poll.html.erb new file mode 100644 index 000000000..eb2ee08f7 --- /dev/null +++ b/app/views/organizations/_org_new_course_poll.html.erb @@ -0,0 +1,5 @@ + + <%= format_date activity.updated_at %> +

首届卫星导航仿真与测试专题研讨会在...首届卫星导航仿真与测试专题研讨会在...

+
10月15日,由卫星导航仿真与测试开放实验室联盟主办的首次专题研讨会在西安国家民用航天产业基地隆重召开...
+
\ No newline at end of file diff --git a/app/views/organizations/_org_new_forum.html.erb b/app/views/organizations/_org_new_forum.html.erb new file mode 100644 index 000000000..bcebbb67a --- /dev/null +++ b/app/views/organizations/_org_new_forum.html.erb @@ -0,0 +1,12 @@ +
+
+ <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + + <% else %> + + <% end %> + <%=link_to activity.content.html_safe, organization_path(organization, :org_subfield_id => field.id), :class => "con-left-txt fl", :target => "_blank" %> +
+ +
\ No newline at end of file diff --git a/app/views/organizations/_org_new_forum_reply.html.erb b/app/views/organizations/_org_new_forum_reply.html.erb new file mode 100644 index 000000000..8c5502b42 --- /dev/null +++ b/app/views/organizations/_org_new_forum_reply.html.erb @@ -0,0 +1,6 @@ + +
+ <%= link_to image_tag(url_to_avatar(activity.creator),:width => "40", :height => "40"), user_path(activity.creator) %> + <%= activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname) %>
+

<%= activity.content.html_safe %>

+
\ No newline at end of file diff --git a/app/views/organizations/_org_new_project_create.html.erb b/app/views/organizations/_org_new_project_create.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_new_project_issues.html.erb b/app/views/organizations/_org_new_project_issues.html.erb new file mode 100644 index 000000000..782accabd --- /dev/null +++ b/app/views/organizations/_org_new_project_issues.html.erb @@ -0,0 +1,17 @@ +
+

+ <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :class => "title-detail-r" %> +

+
+
    +
  • + <%= link_to activity.author.realname.nil? ? activity.author.login : activity.author.realname, user_path(activity.author), :class => "publisher-name fl", :target => "_blank" %> +
  • +
  • <%= format_date(activity.updated_on) %>
  • +
+
+ <%= activity.journals.count %> +
+
+
+
diff --git a/app/views/organizations/_org_new_project_message.html.erb b/app/views/organizations/_org_new_project_message.html.erb new file mode 100644 index 000000000..d37eeedc6 --- /dev/null +++ b/app/views/organizations/_org_new_project_message.html.erb @@ -0,0 +1,49 @@ +
+ <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + + <% else %> + + <% end %> + +
+
+
+

+ <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class => "title-detail" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class => "title-detail" %> + <% end %> +

+ <% if activity.parent_id.nil? %> + <% content = activity.content %> + <% else %> + <% content = activity.parent.content %> + <% end %> +
+ <%= content.to_s.html_safe %> + <% if activity.parent_id.nil? %> + <%= link_to "[查看全文]", board_message_url_in_org(activity.board.id,activity.id), :class => "read-more fl" %> + <% else %> + <%= link_to "[查看全文]", board_message_url_in_org(activity.board.id,activity.id), :class => "read-more fl" %> + <% end %> +
+
+ +
+ <%= activity.children.count %> +
+
+
+
+
+ diff --git a/app/views/organizations/_org_new_resource.html.erb b/app/views/organizations/_org_new_resource.html.erb new file mode 100644 index 000000000..61e6f44fb --- /dev/null +++ b/app/views/organizations/_org_new_resource.html.erb @@ -0,0 +1,14 @@ +<% org_attachs.each do |attach| %> +
+ <%= link_to image_tag(url_to_avatar(attach.author),:width => "40", :height => "40"), user_path(attach.author), :class => "fl user-img" %> + +
+ <%= link_to truncate(attach.filename,length: 35, omission: '...'), + download_named_attachment_path(attach.id, attach.filename), + :title => attach.filename+"\n"+attach.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :class => "fl ziyuan-title" %> +

上传时间:<%= format_date attach.created_on %>类型:<%= attach.tag_list[0] %> 下载次数:<%= attach.downloads%> 引用:<%= attach.quotes.nil? ? 0:attach.quotes %>

+
+ <%= link_to "下载", download_named_attachment_path(attach.id, attach.filename), :class => "download-btn fl" %> +
+
+<% end %> \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 2676105d3..39848d192 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -72,13 +72,13 @@
- - - - - - - +
+ 显示模式 : + /> + + /> + +
公开 : class="ml3" />
diff --git a/db/schema.rb b/db/schema.rb index 28931468b..8041b347b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160329014316) do +ActiveRecord::Schema.define(:version => 20160328022623) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1301,6 +1301,7 @@ ActiveRecord::Schema.define(:version => 20160329014316) do t.datetime "updated_at", :null => false t.boolean "allow_guest_download", :default => true t.integer "visits", :default => 0 + t.integer "show_mode", :default => 0 end create_table "phone_app_versions", :force => true do |t| diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index 79855b966..9132f973c 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -168,7 +168,7 @@ module Redmine if block_given? yield text, parameters, options else - if args[2][:path].nil? + if args[2].nil? || args[2][:path].nil? link_to text, params.merge(parameters), options else page = "&page=" + parameters[:page].to_s unless parameters[:page].nil? diff --git a/public/images/org_new_style/banner.jpg b/public/images/org_new_style/banner.jpg new file mode 100644 index 000000000..385b24c9e Binary files /dev/null and b/public/images/org_new_style/banner.jpg differ diff --git a/public/images/org_new_style/cd-top-arrow.svg b/public/images/org_new_style/cd-top-arrow.svg new file mode 100644 index 000000000..e80e10297 --- /dev/null +++ b/public/images/org_new_style/cd-top-arrow.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/public/images/org_new_style/con-left1.jpg b/public/images/org_new_style/con-left1.jpg new file mode 100644 index 000000000..f4936fa85 Binary files /dev/null and b/public/images/org_new_style/con-left1.jpg differ diff --git a/public/images/org_new_style/con-left2.jpg b/public/images/org_new_style/con-left2.jpg new file mode 100644 index 000000000..b7b7f3472 Binary files /dev/null and b/public/images/org_new_style/con-left2.jpg differ diff --git a/public/images/org_new_style/con-right.gif b/public/images/org_new_style/con-right.gif new file mode 100644 index 000000000..d49c2003e Binary files /dev/null and b/public/images/org_new_style/con-right.gif differ diff --git a/public/images/org_new_style/default-img.jpg b/public/images/org_new_style/default-img.jpg new file mode 100644 index 000000000..e345ca3d7 Binary files /dev/null and b/public/images/org_new_style/default-img.jpg differ diff --git a/public/images/org_new_style/default-img2.png b/public/images/org_new_style/default-img2.png new file mode 100644 index 000000000..3a824b1f6 Binary files /dev/null and b/public/images/org_new_style/default-img2.png differ diff --git a/public/images/org_new_style/detailimg4.jpg b/public/images/org_new_style/detailimg4.jpg new file mode 100644 index 000000000..22b3e674d Binary files /dev/null and b/public/images/org_new_style/detailimg4.jpg differ diff --git a/public/images/org_new_style/icons.png b/public/images/org_new_style/icons.png new file mode 100644 index 000000000..ab5d36b6f Binary files /dev/null and b/public/images/org_new_style/icons.png differ diff --git a/public/images/org_new_style/img1.jpg b/public/images/org_new_style/img1.jpg new file mode 100644 index 000000000..acfee71e5 Binary files /dev/null and b/public/images/org_new_style/img1.jpg differ diff --git a/public/images/org_new_style/img2.jpg b/public/images/org_new_style/img2.jpg new file mode 100644 index 000000000..72741b981 Binary files /dev/null and b/public/images/org_new_style/img2.jpg differ diff --git a/public/images/org_new_style/logo.jpg b/public/images/org_new_style/logo.jpg new file mode 100644 index 000000000..78e3918d4 Binary files /dev/null and b/public/images/org_new_style/logo.jpg differ diff --git a/public/images/org_new_style/pic1.jpg b/public/images/org_new_style/pic1.jpg new file mode 100644 index 000000000..8866da4cb Binary files /dev/null and b/public/images/org_new_style/pic1.jpg differ diff --git a/public/images/org_new_style/pic2.jpg b/public/images/org_new_style/pic2.jpg new file mode 100644 index 000000000..1ad7665e7 Binary files /dev/null and b/public/images/org_new_style/pic2.jpg differ diff --git a/public/images/org_new_style/pic3.jpg b/public/images/org_new_style/pic3.jpg new file mode 100644 index 000000000..5f276d3df Binary files /dev/null and b/public/images/org_new_style/pic3.jpg differ diff --git a/public/stylesheets/org_new_style.css b/public/stylesheets/org_new_style.css new file mode 100644 index 000000000..eb5a7c088 --- /dev/null +++ b/public/stylesheets/org_new_style.css @@ -0,0 +1,199 @@ +@charset "utf-8"; +/* CSS Document */ +body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} +body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5; background:#fff;} +div,img,tr,td,table{ border:0;} +table,tr,td{border:0;cellspacing:0; cellpadding:0;} +ol,ul,li{ list-style-type:none} +a:link,a:visited{color:#000;text-decoration:none;} +a:hover{color:#29156f;} + +.fl{ float:left;} +.fr{ float:right;} +.cl{ clear:both;overflow:hidden;} +.mr40{ margin-right:40px;} +.mr30{ margin-right:30px;} +.mb20{ margin-bottom:20px;} +.mb70{ margin-bottom:70px;} +.bg-grey{ background:#f2f2f2;} + +/** header **/ +.header{ width:100%; height:60px; background:#29146f; padding:5px 0 0px; } +.header-con{ width:1200px; margin:0 auto;} +.logo,.logo img{ display:block; height:52px; } +a.login{ background:url(../images/org_new_style/icons.png) -7px -11px no-repeat; width:146px; height:55px; margin-right:40px; margin-top:11px;} +a:hover.login{ background:url(../images/org_new_style/icons.png) -7px -88px no-repeat; } +a.register{ background:url(../images/org_new_style/icons.png) -190px -11px no-repeat; width:158px; height:55px; ;margin-top:11px;} +a:hover.register{ background:url(../images/org_new_style/icons.png) -190px -88px no-repeat; } +.login{ margin-top:15px;} +.login a{ color:#fff; font-size:14px; margin-top:10px; } +/** nav **/ +.nav-box{ width:1200px; height:60px; margin:0 auto;} +.nav a{ display:block; padding:15px 10px; font-size:18px; color:#000; margin-right:20px; } +.navact{border-bottom:3px solid #ffbd18;} +.nav a:hover{border-bottom:3px solid #ffbd18;} +.searchbox{ width:338px; height:57px; border:1px solid #ccc; -webkit-border-radius: 3px;border-radius: 3px; margin:10px 0px 0 0;} +.search-input{width:270px; height:40px; color:#bebebe; font-size:18px; border:1px solid #ccc; -webkit-border-radius: 3px;border-radius: 3px;border:0px; background:none; margin:10px 0 0 20px;} +.search-input:hover{ border:none;color:#fff; } +a.search-icon{ background:url(../images/org_new_style/icons.png) -387px -11px no-repeat; width:40px; height:40px; margin-top:8px;} +a:hover.search-icon{ background:url(../images/org_new_style/icons.png) -387px -89px no-repeat;} +.searchbox:hover{ background:#999999; color:#fff;} + +/* banner */ +.banner{ width:100%; height:234px; background:#070317 url(../images/org_new_style/banner.jpg) 0 0 no-repeat; color:#fff; text-align:center; padding-top:70px; line-height:2.4;} +.banner h2{ font-size:42px; } +.banner p{ font-size:18px;} +.banner span{ font-size:16px;} + +/** box1 **/ +.box1{ width:100%; padding:60px 0;} +.content{ width:1200px; margin:0 auto;} +.box-top{ margin:0 auto; text-align:center; margin-bottom:45px; } +.box-title{ width:355px; height:67px; margin:0 auto; background:#29156f; color:#fff; text-align:center; font-size:40px; font-weight: lighter; margin-bottom:2px;} +.box-title-p{ font-size:20px; color:#999999;} +.row{ width:1200px; margin: 0 auto; } +.row-box1{ width:365px;} +.row-img{ margin-bottom:10px; width:365px; height:230px; display:block;} +.row-time{ color:#ffbd18; font-size:14px; font-weight:bold; line-height:1.9;} +.row-title{ font-size:16px; font-weight:bold; line-height:1.9;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} +.row-con { display:block; } +.row-con:hover{ color:#29156f; } +.row-txt{line-height:2.4; padding-bottom:10px; margin-bottom:10px; color:#888;} +.row-txt:hover{color:#29156f;} +.row-txt-line{border-bottom:1px solid #cccccc; width:365px;} +a.btn-more{ display:block; font-size:14px; width:110px; height:40px; -webkit-border-radius: 3px;border-radius: 3px;background:#ffbd18; color:#fff; text-align:center; line-height:3.0;} +a:hover.btn-more{ background:#29156f;} +.row-box2{ width:388px; border:1px solid #ccc; border-bottom:none;} +.row-con2 a{ display:block;padding:20px 10px; border-bottom:1px solid #ccc;} +.row-con2 a:hover{ background:#29156f; color:#fff;} +.row-con2 a:hover{ color:#fff;} +.row-txt2{line-height:2.4; color:#888;} +.row-txt2:hover{ color:#fff; } + +/** 活动专区 **/ +.con-left{ width:618px;} +.con-left-box{ margin-bottom:20px; height:96px; display:block;} +.con-left-img{ width:175px; height:96px;} +.con-left-txt{ width:360px; margin-left:15px; font-size:14px; color:#888; padding-top:8px; line-height:1.9; height:75px; overflow:hidden;text-overflow:ellipsis;display:-webkit-box; + -webkit-line-clamp:3;-webkit-box-orient:vertical;} +.con-left-txt:hover{color:#29156f;} +.con-left-pre{ margin-top:15px; } +a.con-back-btn{ display: block;width:25px;height:25px;background:url(../images/org_new_style/icons.png) no-repeat -38px -505px ;} +a.con-arrow-btn{ display: block;width:25px;height:25px;background:url(../images/org_new_style/icons.png) no-repeat -12px -505px ; opacity:.5;} +.con-right{ width:532px; height:170px; background:#f6f6f6 ; padding:25px;} +.con-right p{background: url(../images/org_new_style/con-right.gif) no-repeat 0 0;line-height:1.9; width:415px; padding:40px 0 0 20px; font-size:14px; color:#888; margin-left:20px;} +.con-r-img img{ border:3px solid #e6473b; -moz-border-radius: 50px; -webkit-border-radius: 50px;border-radius: 50px; display:block; width:67px; height:67px;} +.con-r-img img:hover{border:3px solid #29156f;} +.con-name{ font-size:18px; font-weight:bold; margin-top:5px;} +.con-r-img { text-align:center;} +.con-r-pre{ margin-top:20px;} +a.pre-arrow,a.pre-back{ display:block; width:25px; height:10px; background:#29156f; margin-left:5px;} +a.pre-back{ background:#888;} +/** footer **/ +.footer{ height:150px; background:#29156f; width:100%;} +.footer-con{ width:1200px; padding:30px 0 0 60px; margin:0 auto; text-align:center; font-size:14px; color:#fff;} +.footer-con ul{ display:block; width:430px; height:50px; margin:0 auto; } +.footer-con ul li a{font-size:18px; color:#fff; margin-right:35px; font-weight:bold;} +/** download **/ +.row-ziyuan{ width:570px; border-bottom:1px solid #f0f0f0; padding:15px 0;margin: 0px 15px;} +.ziyuan-box{ width:420px; margin-right:20px;} +.ziyuan-box span{ margin-right:5px;} +.ziyuan-title{ display:block; width:420px; font-size:16px;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} +.ziyuan-box p{display:block; width:420px; color:#888; font-size:12px; line-height:2.5;} +a.download-btn{ display:block; border:1px solid #ccc; margin-top:10px; font-size:14px; width:70px; height:27px;-webkit-border-radius: 3px;border-radius:3px;color:#888; text-align:center; line-height:1.9;} +a:hover.download-btn{ background:#29146f; color:#fff; border:none;} +.user-img,.user-img img{ margin-right:10px; -moz-border-radius: 50px; -webkit-border-radius: 50px;border-radius: 50px; display:block; width:40px; height:40px;} +.ml60{ margin-left:60px;} +.user-img img{border:2px solid #e6473b; } +.user-img img:hover{border:2px solid #29156f;} + + +.article-lwrap{ width:760px; border-bottom:1px solid #E4E4E4; padding:10px 0;} +.item-txt{ width:555px;} +.item-img,.item-img img{ width:180px; height:120px;} +.item-title{ display:block; width:555px; font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:5px;} +.item-bd{ width:555px; font-size:14px !important; color:#888; line-height:1.9; height:55px; overflow:hidden;text-overflow:ellipsis;display:-webkit-box; + -webkit-line-clamp:2;-webkit-box-orient:vertical; } +.item-bd:hover{color:#29156f;} +a.read-more{ color:red;} +a:hover.read-more{ text-decoration:underline;} +.publisher-hd,.publisher-hd img{ margin-right:10px; -moz-border-radius: 50px; -webkit-border-radius: 50px;border-radius: 50px; display:block; width:28px; height:28px;} +.left-info li,left-info li a{ float:left;} +.item-btm,.publisher-name,.pass-time{ margin-top:5px;} +.pass-time{ margin-left:20px; color:#888;} +.right-info{background:url(../images/org_new_style/icons.png) no-repeat -41px -541px ; width:15px; height:16px; padding-left:20px; color:#888; margin-top:5px;} +.nopic{ width:760px;} +.article-lwrap{ width:760px; border-bottom:1px solid #E4E4E4; padding:20px 0;} +.item-title-r{ display:block; width:400px; font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} +.article-rwrap{ width:400px; border-bottom:1px dashed #E4E4E4; padding:12px 0;} + +.course-list ul{ } +.course-list ul li{ display:block; width:370px; float:left; margin:0 15px;} +.course-list h5{display:block; width:380px; font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.course-list-img,.course-list-img img{ width:370px; height:220px; margin-bottom:10px;} + +/*用户图像*/ +.topnav_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 1px;} +.topnav_login_list a{color:#269ac9;} +.topnav_login_list li{ } +.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block; line-height:0;} +.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;} +.none {display: none;} + + +/** backtop **/ +.cd-top { + display: inline-block; + height: 60px; + width: 60px; + position: fixed; + bottom: 40px; + right: 10px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.05); + /* image replacement properties */ + overflow: hidden; + text-indent: 100%; + white-space: nowrap; + background: rgba(232, 98, 86, 0.8) url(../images/org_new_style/cd-top-arrow.svg) no-repeat center 50%; + visibility: hidden; + opacity: 0; + -webkit-transition: all 0.3s; + -moz-transition: all 0.3s; + transition: all 0.3s; +} +.cd-top.cd-is-visible { + /* the button becomes visible */ + visibility: visible; + opacity: 1; +} +.cd-top.cd-fade-out { + /* 如果用户继续向下滚动,这个按钮的透明度会变得更低 */ + opacity: .5; +} +.no-touch .cd-top:hover { + background-color: #29156f; + opacity: 1; +} + + +a.more-btn{ display:block; background:#ccc; color:#fff; margin-top:10px; width:100px; height:38px;font-size:14px; -webkit-border-radius: 5px;border-radius:5px;text-align:center; line-height:38px;} +a.more-btn-center{ display:block; background:#ccc; color:#fff; margin-top:10px; width:100px; height:38px;font-size:14px; -webkit-border-radius: 5px;border-radius:5px;text-align:center; line-height:38px;width:100px; margin:0px auto;margin-top: 15px;} +a:hover.more-btn{ background:#29146f; color:#fff;} +a:hover.more-btn-center{ background:#29146f; color:#fff;} +.mt30{ margin-top:30px;} + + + + + + + + + + + + + + + +