diff --git a/Gemfile b/Gemfile index a599613ba..d392c6561 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'https://rubygems.org/' +source 'https://ruby.taobao.org/' ### ����ִ��bundle config mirror.https://rubygems.org https://gems.ruby-china.org �л���ruby-chinaԴ unless RUBY_PLATFORM =~ /w32/ diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index d7e38f370..c938a2d4b 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -1,6 +1,6 @@ class OrgDocumentCommentsController < ApplicationController before_filter :find_organization, :only => [:new, :create, :show, :index] - before_filter :authorize_allowed, :only => [:create, :add_reply] + before_filter :authorize_allowed, :only => [:create] helper :attachments,:organizations layout 'base_org' @@ -13,6 +13,7 @@ class OrgDocumentCommentsController < ApplicationController @org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id) @org_document_comment.title = params[:org_document_comment][:title] @org_document_comment.content = params[:org_document_comment][:content] + @org_document_comment.status = params[:org_document_comment][:status] == "on" ? 1 : 0 @org_document_comment.save_attachments(params[:attachments]) if params[:field_id] @org_document_comment.org_subfield_id = params[:field_id].to_i diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index c628b25fc..159648f34 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -6,7 +6,7 @@ class OrgSubfieldsController < ApplicationController if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0 @res = true @organization = Organization.find(params[:organization_id]) - @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1) + @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id], :priority => @organization.org_subfields.order("priority").last.priority + 1) if !params[:sub_dir].blank? sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+ "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'" @@ -15,17 +15,31 @@ class OrgSubfieldsController < ApplicationController end end @subfield.update_attributes(:field_type => params[:field_type]) - # 如果栏目是教师,不参入类型的配置,定义为右三模式 - # 新增模块命名规则,左边1开头,右边2开头,以前的不变 - # eg:23 右三 - if params[:field_type] == "Comptec" - @subfield.update_attributes(:status => 23) - end + # admin配置的类型 + update_status_by_type(@subfield, params[:field_type]) else @res = false end end + # status类型说明,详见SubField + def update_status_by_type subfield, type + case type + when "Resource" + subfield.update_attribute(:status, 6) + when "Comptec" + subfield.update_attribute(:status, 6) + when "Compstu" + subfield.update_attribute(:status, 7) + when "Comppro" + subfield.update_attribute(:status, 5) + when "Compcou" + subfield.update_attribute(:status, 2) + when "Compact" + subfield.update_attribute(:status, 4) + end + end + def show @flag = params[:flag] || false sort = "" diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3ab62bbea..a0ef84798 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -28,7 +28,8 @@ class OrganizationsController < ApplicationController helper :project_score helper :issues include UsersHelper - before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers] + before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students, :projects, :courses] + before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts] layout 'base_org' def index @@ -76,22 +77,34 @@ class OrganizationsController < ApplicationController def show # 组织新类型 show_mode:判断标准 1为新类型,0为旧 - if @organization.show_mode.to_i == 1 && params[:org_subfield_id].nil? && params[:list] .nil? + if @organization.switch_type && params[:org_subfield_id].nil? && params[:list] .nil? if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) - # REDO:时间紧,暂时先这样 - @org_logo_attchment = Attachment.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 0 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first - @org_banner_attchment = Attachment.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 1 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first - @subfield_content = @organization.org_subfields.order("priority") - @organization = Organization.find(params[:id]) - 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')" - @project_acts = get_project_activities_org @organization, project_ids - @course_acts = get_course_activities_org @organization, course_ids - render :layout => 'base_org2' + 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')" + @project_acts = get_project_activities_org @organization, project_ids + @course_acts = get_course_activities_org @organization, course_ids + # 精品课程, 不符合条件的组织则不查询 + if @organization.org_subfields.where(:field_type => "Compcou", :hide => 0).count > 0 + @excellent_courses = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count + from courses c where c.is_delete =0 and c.is_public =1 and is_excellent =1 order by course_count desc limit 5;") + end + # 热门项目 + if @organization.org_subfields.where(:field_type => "Comppro", :hide => 0).count > 0 + # @excellent_projects = Project.where(:is_public => true, :status => true, :hot => true).order("project_score") + @excellent_projects = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count + from projects p where p.status =1 and p.is_public =1 and hot =1 order by project_count desc limit 5;") + end + # 最新动态, 来自我关联的项目和课程 + if @organization.org_subfields.where(:field_type => "Compact", :hide => 0).count > 0 + @acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'News', 'Message', 'Issue') and + ((container_type = 'Course' and container_id in (#{course_ids.join(',')})) or (container_type = 'Project' and container_id in (#{project_ids.join(',')}))) + order by created_at desc limit 6;") + end + render :layout => 'base_org_custom' else render_403 end @@ -159,22 +172,12 @@ class OrganizationsController < ApplicationController end def teachers - unless @organization.allow_set_teachers - render_403 - return - end q = params[:search].nil? ? "" : "#{params[:search].strip}" @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comptec").first : OrgSubfield.find(params[:org_subfield_id]) @type = params[:type] if @type == "courses" || @type.nil? @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") - elsif @type == "students" - @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count - from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") - elsif @type == "resources" - @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_id = u.id) as course_count - from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") elsif @type == "famous" @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") @@ -192,6 +195,73 @@ class OrganizationsController < ApplicationController end end + def students + q = params[:search].nil? ? "" : "#{params[:search].strip}" + @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id]) + @type = params[:type] + if @type == "courses" || @type.nil? + @org_students = User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count + from users u, user_extensions ue where u.id = ue.user_id and ue.identity= 1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") + elsif @type == "famous" + @org_students = User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count + from users u, user_extensions ue where u.id = ue.user_id and ue.identity= 1 and u.excellent_student =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") + end + limit = 10 + # @is_remote = true + @students_count = @org_students.count + @atta_pages = Paginator.new @students_count, limit, params['page'] || 1 + @offset ||= @atta_pages.offset + #@curse_attachments_all = @all_attachments[@offset, @limit] + @org_students = paginateHelper @org_students, limit + respond_to do |format| + format.html + format.js + end + end + + def atta_page_public container + limit = 10 + @containers_count = container.count + @atta_pages = Paginator.new @containers_count, limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @containers = paginateHelper container, limit + respond_to do |format| + format.html + format.js + end + end + + def projects + q = params[:search].nil? ? "" : "#{params[:search].strip}" + @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comppro").first : OrgSubfield.find(params[:org_subfield_id]) + @type = params[:type] + if @type.nil? + @containers = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count + from projects p where p.status =1 and p.is_public =1 and name like '%#{q}%' order by project_count desc;") + elsif @type == "famous" + @containers = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count + from projects p where p.status =1 and p.is_public =1 and hot =1 and name like '%#{q}%' order by project_count desc;") + end + atta_page_public @containers + end + + def courses + q = params[:search].nil? ? "" : "#{params[:search].strip}" + @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id]) + @type = params[:type] + if @type.nil? + @containers = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count + from courses c where c.is_delete =0 and c.is_public =1 and name like '%#{q}%' order by course_count desc;") + elsif @type == "famous" + @containers = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count + from courses c where c.is_delete =0 and c.is_public =1 and is_excellent = 1 and name like '%#{q}%' order by course_count desc;") + end + atta_page_public @containers + end + + def acts + end + def searchmember_by_name members, name #searchPeopleByRoles(project, StudentRoles) mems = [] @@ -322,6 +392,13 @@ class OrganizationsController < ApplicationController @organization = Organization.find(params[:id]) end + def allow_as_admin + unless User.current.admin? + render_403 + return + end + end + def setting @organization = Organization.find(params[:id]) @@ -471,6 +548,18 @@ class OrganizationsController < ApplicationController end end + def update_field_by_admin + @type = params[:type] + @status = params[:status] + if @type == "project" + @container = Project.find(params[:container]) + @status == "reset" ? @container.update_column(:hot, 0) : @container.update_column(:hot, 1) + else + @container = Course.find(params[:container]) + @status == "reset" ? @container.update_column(:is_excellent, 0) : @container.update_column(:is_excellent, 1) + end + end + # 设置为名师 def set_excellent_teacher @ex_teacher = User.find(params[:user]) @@ -483,6 +572,16 @@ class OrganizationsController < ApplicationController @ex_teacher.update_column(:excellent_teacher, 0) end + def set_excellent_student + @ex_student = User.find(params[:user]) + @ex_student.update_column(:excellent_student, 1) + end + + def reset_excellent_student + @ex_student = User.find(params[:user]) + @ex_student.update_column(:excellent_student, 0) + end + def hide_org_subfield @org_subfield = OrgSubfield.find(params[:org_subfield_id]) @org_subfield.update_attribute(:hide, 1) diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb index 80c14f004..d6b335006 100644 --- a/app/controllers/sub_document_comments_controller.rb +++ b/app/controllers/sub_document_comments_controller.rb @@ -1,7 +1,7 @@ class SubDocumentCommentsController < ApplicationController before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index, :destroy, :edit] before_filter :find_subfield_content, :only => [:show, :index] - before_filter :authorize_allowed, :only => [:create, :add_reply] + before_filter :authorize_allowed, :only => [:create] helper :attachments,:organizations layout 'base_sub_domain' diff --git a/app/controllers/sub_domains_controller.rb b/app/controllers/sub_domains_controller.rb index e32935789..438b67eec 100644 --- a/app/controllers/sub_domains_controller.rb +++ b/app/controllers/sub_domains_controller.rb @@ -18,6 +18,9 @@ class SubDomainsController < ApplicationController else @res = false end + respond_to do |format| + format.js + end end def update diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 009d5c4d6..88a524d1e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -123,6 +123,20 @@ class UsersController < ApplicationController end + #未读消息弹窗 + def user_messages_unviewed + @message_alls = [] + messages = MessageAll.where("user_id =?", User.current.id).includes(:message).order("created_at desc") + onclick_time = User.current.onclick_time.onclick_time + messages.each do |message_all| + # 未读的消息存放在数组 + if (message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0) || (message_all.message_type == "SystemMessage"&& !message_all.message.nil? && message_all.message.created_at > onclick_time) + @message_alls << message_all.message + break if @message_alls.length == 5 + end + end + end + # 用户消息 # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验 # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment) @@ -443,12 +457,7 @@ class UsersController < ApplicationController # 资源分享请求弹框 def apply_resource - if User.current.logged? - @attachment = Attachment.find params[:attachment_id] - @state = 2 - else - @state = 1 - end + @attachment = Attachment.find params[:attachment_id] respond_to do |format| format.js end @@ -2036,7 +2045,7 @@ class UsersController < ApplicationController @score = @b_sort == "desc" ? "asc" : "desc" user_project_ids = User.current.projects.map {|p| p.id} user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - if(params[:type].blank? || params[:type] == "1") # 我的资源 + if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) @@ -2050,7 +2059,7 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) end - elsif params[:type] == "6" # 公共资源 + elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @attachments = get_course_resources_public( user_course_ids, @order, @score) elsif params[:status] == "3" @@ -2190,7 +2199,7 @@ class UsersController < ApplicationController @score = @b_sort == "desc" ? "asc" : "desc" user_project_ids = User.current.projects.map {|p| p.id} user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - if(params[:type].blank? || params[:type] == "1") # 我的资源 + if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) @@ -2204,7 +2213,7 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) end - elsif params[:type] == "6" # 公共资源 + elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @attachments = get_course_resources_public( user_course_ids, @order, @score) elsif params[:status] == "3" @@ -2331,7 +2340,7 @@ class UsersController < ApplicationController @score = @b_sort == "desc" ? "asc" : "desc" user_project_ids = User.current.projects.map {|p| p.id} user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - if(params[:type].blank? || params[:type] == "1") # 我的资源 + if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) @@ -2345,7 +2354,7 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) end - elsif params[:type] == "6" # 公共资源 + elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @attachments = get_course_resources_public( user_course_ids, @order, @score) elsif params[:status] == "3" diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index ef59e0ed4..3ccdc3257 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -121,7 +121,7 @@ class WechatsController < ActionController::Base on :fallback, respond: 'fallback message' on :click, with: 'FEEDBACK' do |request, key| - request.reply.text "如有反馈问题,请直接切入至输入框,发微信给我们即可" + request.reply.text "如有反馈问题,请直接切换至输入框,发微信给我们即可" end on :click, with: 'MY_NEWS' do |request, key| diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 691c2b0ad..3aa7d8a4a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -70,7 +70,6 @@ module ApplicationHelper attach = Attachment.find(attachment_id) # 条件取否,result结果为true则不能下载 result = attach.is_public == 0 && attach.author != User.current && !attach.get_apply_resource_status(attach.id, User.current.id) && !attach_show_allow(attach) - return result end # Time 2015-03-24 15:27:29 @@ -3104,9 +3103,10 @@ def named_attachment_url_without_domain(id, filename, option={}) attachment_id = (Attachment === id ? id.id : id) Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/" + filename end + #判断是否为默认的组织栏目 def is_default_field? field - (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default' + (field.name == 'activity' || field.name == 'course' || field.name == 'project' ) && field.field_type == 'default' end def host_with_protocol diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index cba4fa210..fa0d33f6e 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -42,11 +42,15 @@ module OrganizationsHelper 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 + # 获取两种类型的隐藏状态,数量大于0说明是可见 + def double_field_show org + OrgSubfield.find_by_sql("SELECT * FROM `org_subfields` where organization_id = #{org.id} and (field_type = 'Compstu' or field_type = 'Comptec') and hide = 0;").count + 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;") + attachments = User.current.admin? ? org_attachments.first(5) : visable_attachemnts(org_attachments).first(5) + attachments.sort_by{|x| x.created_on}.reverse end # 从内容中获取路径 @@ -59,6 +63,58 @@ module OrganizationsHelper end end + def org_user_by_type obj + case obj.act_type + when "Message" + user = obj.act.author + when "News" + user = obj.act.author + when "HomeworkCommon" + user = obj.act.user + when "Issue" + user = obj.act.author + end + end + + def org_title_by_type obj + case obj.act_type + when "Message" + user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject + when "News" + user = obj.act.title + when "HomeworkCommon" + user = obj.act.name + when "Issue" + user = obj.act.subject + end + end + + def org_content_by_type obj + case obj.act_type + when "Message" + user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content + when "News" + user = obj.act.description + when "HomeworkCommon" + user = obj.act.description + when "Issue" + user = obj.act.description + end + end + + def org_time_by_type obj + case obj.act_type + when "Message" + time = obj.act.updated_on + when "News" + user = obj.act.created_on + when "HomeworkCommon" + user = obj.act.updated_at + when "Issue" + user = obj.act.updated_on + end + end + #排列下拉框 def subfield_status_option type = [] @@ -66,34 +122,14 @@ module OrganizationsHelper option1 << "左一" option1 << "1" type << option1 - # option2 = [] - # option2 << "中一" - # option2 << "2" - # type << option2 + option2 = [] + option2 << "左二" + option2 << "2" + type << option2 option3 = [] - option3 << "左二" + option3 << "左三" option3 << "3" type << option3 - option4 = [] - option4 << "左三" - option4 << "4" - type << option4 - option5 = [] - option5 << "左四" - option5 << "5" - type << option5 - option6 = [] - option6 << "右一" - option6 << "6" - type << option6 - option7 = [] - option7 << "右二" - option7 << "7" - type << option7 - option8 = [] - option8 << "右三" - option8 << "8" - type << option8 type end @@ -104,18 +140,22 @@ module OrganizationsHelper option1 << "左一" option1 << "1" type << option1 + option2 = [] + option2 << "左二" + option2 << "2" + type << option2 option3 = [] - option3 << "左二" - option3 << "3" + option3 << "左三" + option3 << "2" type << option3 option4 = [] - option4 << "左三" - option4 << "4" + option4 << "右一" + option4 << "3" type << option4 - option6 = [] - option6 << "右一" - option6 << "6" - type << option6 + option5 = [] + option5 << "右二" + option5 << "5" + type << option5 type end @@ -128,30 +168,36 @@ module OrganizationsHelper when 3 resulet = "左二" when 4 - resulet = "左三" - when 5 - resulet = "左四" - when 6 resulet = "右一" - when 7 + when 5 resulet = "右二" - when 8 + when 6 resulet = "右三" end end + # 系统栏目只有管理员才能看到 + def subfield_to_addmin?(org) + if User.current.admin? + @organization.org_subfields.order("priority") + else + @organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority} + end + end def get_subfield_acts field org_subfield = OrgSubfield.find(field.id) org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0 org_acts = 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') - org_acts + end + + def allow_to_create?(org, type) + !org_subfield_had_created?(org, type) && User.current.admin? end def org_subfield_had_created?(org, type) sub_field = org.org_subfields.select{|subfield| subfield.field_type == type} result = sub_field.length > 0 ? true : false - result end def org_subfield_type(field) @@ -166,9 +212,20 @@ module OrganizationsHelper result = "教师" when "Complex" result = "综合" + when "Compcou" + result = "课程" + when "Comppro" + result = "项目" + when "Compact" + result = "动态" end end + # 获取最新动态 + # def get_latest_acts + # acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'news', 'message', 'Issue') and (container_type = 'Course' or container_type = 'Project') order by created_at limit 10;") + # end + def org_teacher_resource_count user results = Attachment.find_by_sql("SELECT * FROM attachments where author_id = #{user.id};").count end @@ -187,4 +244,33 @@ module OrganizationsHelper from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 order by course_count desc").first(5) end + def excellent_students + User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count + from users u, user_extensions ue where u.id = ue.user_id and ue.identity = 1 and u.excellent_student = 1 order by course_count desc").first(5) + end + + def excellent_teachers_hide? org + org.org_subfields.where(:field_type => "Comptec").first.hide + end + + def excellent_students_hide? org + org.org_subfields.where(:field_type => "Compstu").first.hide + end + + #当前学期(2015春季学期) + def current_time_and_term course + str = "" + term = cur_course_term + if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year + str = course.time.to_s + course.term.to_s + elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term) + str = course.time.to_s + course.term.to_s + elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term)) + str = course.end_time.to_s + course.end_term.to_s + else + str = Time.now.year.to_s + cur_course_term.to_s + end + str + end + end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 8f9ee2d85..aa4ef8670 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -143,7 +143,7 @@ class Attachment < ActiveRecord::Base def get_apply_resource_status attachment_id, author_id status = ApplyResource.where("attachment_id =? and user_id =?", attachment_id, author_id).first.try(:status) - status == 2 ? true :false + status == 2 end # add by nwb diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 255410a89..05ae02fe2 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -21,7 +21,7 @@ class BlogComment < ActiveRecord::Base after_save :add_user_activity after_update :update_activity - after_create :update_parent_time, :blog_wechat_message + after_create :update_parent_time before_destroy :destroy_user_activity scope :like, lambda {|arg| diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 325b599e3..a915b1545 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -30,7 +30,7 @@ class HomeworkCommon < ActiveRecord::Base :author => :author, :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} after_create :act_as_activity, :send_mail,:act_as_course_message - after_update :update_activity, :wechat_message + after_update :update_activity after_save :act_as_course_activity after_destroy :delete_kindeditor_assets diff --git a/app/models/journal.rb b/app/models/journal.rb index 6d59c7414..bea273a41 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -55,7 +55,6 @@ class Journal < ActiveRecord::Base # fq after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id) - after_create :issue_wechat_message # end #after_destroy :down_user_score #before_save :be_user_score diff --git a/app/models/org_document_comment.rb b/app/models/org_document_comment.rb index 5aa3c1dab..dd070c825 100644 --- a/app/models/org_document_comment.rb +++ b/app/models/org_document_comment.rb @@ -1,5 +1,6 @@ class OrgDocumentComment < ActiveRecord::Base - attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title,:sticky,:locked + # status: 1 模式二中置顶 0:模式二中正常显示 + attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status include Redmine::SafeAttributes include ApplicationHelper belongs_to :organization diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index 1151426e3..32212a0e8 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -11,6 +11,8 @@ class OrgSubfield < ActiveRecord::Base acts_as_attachable after_create :create_board_sync after_destroy :update_priority + # status 为栏目定制决定参数,1 左一 2 左二 3 左三 4 右一 5 右二 6 右三 默认的 7 学霸 8 热门项目 9 精品课程 10 最新动态 + # 创建资源栏目讨论区 def create_board_sync @board = self.boards.build diff --git a/app/models/organization.rb b/app/models/organization.rb index c35d0591d..50f62ea11 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -18,17 +18,17 @@ class Organization < ActiveRecord::Base end def add_default_subfields - OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1) - OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2) - OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3) + OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1, :status => 0) + OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2, :status => 2) + OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3, :status => 2) end def switch_type - self.show_mode.to_i == 1 ? true : false + self.show_mode.to_i == 1 end def allow_set_teachers - self.allow_teacher.to_i == 1 ? true : false + self.allow_teacher.to_i == 1 end def secdomain_name diff --git a/app/views/layouts/_base_footer_public.html.erb b/app/views/layouts/_base_footer_public.html.erb index eb2e83ba2..7c5ab571e 100644 --- a/app/views/layouts/_base_footer_public.html.erb +++ b/app/views/layouts/_base_footer_public.html.erb @@ -4,7 +4,7 @@
  • <%= l(:label_about_us)%>|
  • <%= l(:label_contact_us)%>|
  • <%= l(:label_recruitment_information)%>|
  • -
  • <%= link_to l(:label_surpport_group), "https://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|
  • +
  • <%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|
  • <%= l(:label_forums)%>|
  • <%= l(:label_language)%> diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index 5997482fb..fc3410eb0 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -27,37 +27,37 @@
    - <%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %> -
    - -
    -
    -
    -
    -
    - - <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> + <%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %> +
    +
    +
    +
    +
    + + <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> +
    +
    -

    -

    -

    -
    +

    +

    +

    +
    -
    -
    - <%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %> +
    +
    + <%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %> +
    -
    -
    -
    - 确定 - - 取消
    +
    + 确定 + + 取消 +
    +
    -
    <% end %> -
    +
    \ No newline at end of file diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb index cf4ffddcf..ed327dece 100644 --- a/app/views/org_document_comments/new.html.erb +++ b/app/views/org_document_comments/new.html.erb @@ -37,35 +37,6 @@
    <%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %> -
    - -
    -
    -
    -
    -
    -
    - - <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> -
    -
    -

    -

    -

    -
    -
    -
    - <%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %> -
    -
    -
    - -
    - 确定 - - 取消 -
    -
    -
    + <%= render :partial => "form" %> <% end %>
    diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 4fc9482d4..c7adc39fb 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -5,7 +5,7 @@ showNormalImage('message_description_<%= @document.id %>'); }); -
    +
    <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> @@ -124,7 +124,7 @@
    <%# end %> - <% if User.current.logged?%> + <%# if User.current.logged?%>
    @@ -137,7 +137,7 @@
    - <% end %> + <%# end %>
    diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 5cc6d5c91..952ed7b2c 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -1,10 +1,9 @@ <% if @res %> $("#org_subfield_list").html(""); - $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', - :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); + $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); - $("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>"); + $("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); <% end %> $("#subfield_name").val(""); $("#sub_dir").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 c14eeae8f..f61e1c100 100644 --- a/app/views/org_subfields/destroy.js.erb +++ b/app/views/org_subfields/destroy.js.erb @@ -1,6 +1,5 @@ $("#org_subfield_list").html(""); -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', - :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); -$("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>"); \ No newline at end of file +$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); diff --git a/app/views/org_subfields/update.js.erb b/app/views/org_subfields/update.js.erb index 06982ccfc..c030b7767 100644 --- a/app/views/org_subfields/update.js.erb +++ b/app/views/org_subfields/update.js.erb @@ -1,3 +1,4 @@ $("#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 +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); \ No newline at end of file diff --git a/app/views/org_subfields/update_priority.js.erb b/app/views/org_subfields/update_priority.js.erb index 475649aac..043e8acbd 100644 --- a/app/views/org_subfields/update_priority.js.erb +++ b/app/views/org_subfields/update_priority.js.erb @@ -1,2 +1,2 @@ -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields.order("priority")}) %>"); -$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); \ No newline at end of file +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); diff --git a/app/views/organizations/_link_subfield_more.html.erb b/app/views/organizations/_link_subfield_more.html.erb index cb4a82ed1..0bf6cb530 100644 --- a/app/views/organizations/_link_subfield_more.html.erb +++ b/app/views/organizations/_link_subfield_more.html.erb @@ -1,9 +1,9 @@ <% 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 "更多", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more" , :target => "_blank" %> + <%= link_to "更多", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "f12 fontGrey2 fr" , :target => "_blank" %> <% else %> - <%= link_to "更多", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more" , :target => "_blank" %> + <%= link_to "更多", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "f12 fontGrey2 fr" , :target => "_blank" %> <% end %> <% else %> - <%= link_to "更多", organization_path(@organization, :org_subfield_id => field.id), :class => "more" , :target => "_blank" %> + <%= link_to "更多", organization_path(@organization, :org_subfield_id => field.id), :class => "f12 fontGrey2 fr" , :target => "_blank" %> <% end %> \ No newline at end of file diff --git a/app/views/organizations/_math_js.html.erb b/app/views/organizations/_math_js.html.erb new file mode 100644 index 000000000..7ac522061 --- /dev/null +++ b/app/views/organizations/_math_js.html.erb @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/app/views/organizations/_org2_footer.html.erb b/app/views/organizations/_org2_footer.html.erb new file mode 100644 index 000000000..9ff7051c1 --- /dev/null +++ b/app/views/organizations/_org2_footer.html.erb @@ -0,0 +1,12 @@ +
    + +
    \ No newline at end of file diff --git a/app/views/organizations/_org_avater_swap.html.erb b/app/views/organizations/_org_avater_swap.html.erb new file mode 100644 index 000000000..70bdf3b1b --- /dev/null +++ b/app/views/organizations/_org_avater_swap.html.erb @@ -0,0 +1,8 @@ +<% if @org_logo_attchment.blank? || !User.current.logged? %> + +<% else %> + +<% end %> +<% if User.current.admin_of_org?(@organization) %> + +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_container.html.erb b/app/views/organizations/_org_container.html.erb new file mode 100644 index 000000000..59ac4d95c --- /dev/null +++ b/app/views/organizations/_org_container.html.erb @@ -0,0 +1,24 @@ +<% containers.each do |container| %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(container), :width => "90", :height => "90"), container.class == Course ? course_path(container) : project_path(container) %> +
    +
    +
    <%=link_to container.name, container.class == Course ? course_path(container) : project_path(container) %>
    +
    +
    <%= container.members.count %>
    +
    成员
    +
    +
    +
    +
    <%= container.attachments.count %>
    +
    资源
    +
    +
    + <%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %> +
    +
    +
    +<% end %> + diff --git a/app/views/organizations/_org_custom_admin.html.erb b/app/views/organizations/_org_custom_admin.html.erb new file mode 100644 index 000000000..2f454819c --- /dev/null +++ b/app/views/organizations/_org_custom_admin.html.erb @@ -0,0 +1,30 @@ +<% if allow_to_create?(@organization, "Comptec") %> +
  • + + +
  • +<% end %> +<% if allow_to_create?(@organization, "Compstu") %> +
  • + + +
  • +<% end %> +<% if allow_to_create?(@organization, "Comppro") %> +
  • + + +
  • +<% end %> +<% if allow_to_create?(@organization, "Compcou") %> +
  • + + +
  • +<% end %> +<% if allow_to_create?(@organization, "Compact") %> +
  • + + +
  • +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb new file mode 100644 index 000000000..e05d52747 --- /dev/null +++ b/app/views/organizations/_org_custom_header.html.erb @@ -0,0 +1,96 @@ +
    +
    + <%= image_tag(url_to_avatar(@organization), width:"67", height: "61", :id => 'nh_user_tx', :class => "por_logo fl ", :target => "_blank") %> + <% if User.current.logged? %> + + <% else %> + + <% end %> + + + + +
    +
    +
    +
    + + <% if User.current.admin_of_org?(@organization) %> + 配置 + <% end %> +
    +
    + + + \ No newline at end of file diff --git a/app/views/organizations/_org_custom_left1.html.erb b/app/views/organizations/_org_custom_left1.html.erb new file mode 100644 index 000000000..4c1271ab8 --- /dev/null +++ b/app/views/organizations/_org_custom_left1.html.erb @@ -0,0 +1,170 @@ +
    + <% if acts.blank? %> +

    <%= field.name %>

    +

    该模块暂时没有相关内容

    + <% else %> +

    <%= field.name %> + <%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %> +

    + + + <%# if acts.count > 3 %> + <% activity = acts.first %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> + <% document = activity.org_act %> +
    + <% if get_image_path_from_content(document.content).nil? %> + <%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(document.content)}", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% end %> + <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => document.title %> +

    <%= time_from_now(document.created_at) %><%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %>

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %> +
    + <% else activity.container_type == 'OrgSubfield' %> + + <% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %> + <% message = activity.org_act %> + <% content = message.parent_id.nil? ? message.content : message.parent.content %> + <% title = message.parent_id.nil? ? message.subject : message.parent.subject %> + <% if message.board.org_subfield_id %> +
    + <% if get_image_path_from_content(content).nil? %> + <%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), board_message_url_in_org(message.board.id, message.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_url_in_org(message.board.id, message.id), :target => "_blank" %> + <% end %> + <%= link_to title, board_message_url_in_org(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %> +

    <%= time_from_now(message.created_on) %><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %> +
    + <% else %> +
    + <% if get_image_path_from_content(document.content).nil? %> + <%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), board_message_path(message.board.id, message.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_path(message.board.id, message.id), :target => "_blank" %> + <% end %> + <%= link_to title, board_message_path(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %> +

    <%= time_from_now(message.created_on) %><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %> +
    + <% end %> + <% end %> + <% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %> + <% news = activity.org_act %> + <% path = get_image_path_from_content(news.description) %> +
    + <% if path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), news_path(news), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{path}", :width => "299", :height => "246"), news_path(news), :target => "_blank" %> + <% end %> + <%= link_to news.title, news_path(news), :class => 'por_hot_title_r link-black', :target => "_blank", :title => news.title %> +

    <%= time_from_now(news.created_on) %><%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %>

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %> +
    + <% end %> + <% end %> + <% end %> + + <%# end %> +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_left2.html.erb b/app/views/organizations/_org_custom_left2.html.erb new file mode 100644 index 000000000..2c389766f --- /dev/null +++ b/app/views/organizations/_org_custom_left2.html.erb @@ -0,0 +1,212 @@ +
    +<% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> +

    课程动态

    + <% if @course_acts.blank? %> +

    该模块暂时没有相关内容

    + <% else %> + <% @course_acts.first(4).each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = act.org_act %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
    + <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.name.to_s %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now(activity.updated_at) %> +
    + <% elsif act.org_act_type == "Message" %> + <% activity = act.org_act %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
    + <%= link_to activity.parent_id.nil? ? activity.subject : activity.parent.subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.parent_id.nil? ? activity.subject : activity.parent.subject %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now activity.updated_on %> +
    + <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
    + <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.title %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now activity.created_on %> +
    + <% elsif act.org_act_type == "Poll" %> + <% activity = act.org_act %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% iamge_path = get_image_path_from_content(activity.polls_description) %> + <% if ( activity.polls_status==2) %> +
    + <% if has_commit %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "por_course_title link-black", :title => poll_name %> + <% else %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "por_course_title link-black", :title => poll_name %> + <% end %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.polls_description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now activity.published_at %> +
    + <% end %> + <% end %> + <% end %> + <% end %> + <% when 'project' %> +

    项目动态

    + <% if @project_acts.blank? %> +

    该模块暂时没有相关内容

    + <% else %> + <% @project_acts.first(4).each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = act.org_act %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
    + <%= link_to activity.subject, issue_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.subject %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), issue_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), issue_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now activity.updated_on %> +
    + <% elsif act.org_act_type == "Message" %> + <% activity = act.org_act %> + <% iamge_path = get_image_path_from_content(activity.content) %> + <% subject = activity.parent_id.nil? ? activity.subject : activity.parent.subject %> +
    + <%= link_to subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "por_course_title link-black", :title => subject %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now activity.updated_on %> +
    + <% elsif act.org_act_type == "News" %> + <% activity = act.org_act %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
    + <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.title %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now activity.created_on %> +
    + <% end %> + <% end %> + <% end %> + <% end %> +<% else %> + <% if field.field_type == "Post" %> + <% org_acts = get_subfield_acts field %> + <% if org_acts.blank? %> +

    <%= field.name %>

    +

    该模块暂时没有相关内容

    + <% else %> +

    <%= field.name %> + <%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %> +

    + <% org_acts.first(4).each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% iamge_path = get_image_path_from_content(document.content) %> +
    + <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "por_course_title link-black", :title => document.title %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now document.created_at %> +
    + <% else activity.container_type == 'OrgSubfield' %> + <% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where(:id => activity.org_act_id).count > 0 %> + <% message = activity.org_act %> + <% title = message.parent_id.nil? ? message.subject : message.parent.subject %> + <% content = message.parent_id.nil? ? message.content : message.parent.content%> + <% iamge_path = get_image_path_from_content(content) %> + <% if message.board.org_subfield_id %> +
    + <%= link_to title, board_message_url_in_org(message.board.id, message.id), :target => '_blank', :class => "por_course_title link-black", :title => title %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(message.board.id, message.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(message.board.id, message.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now message.created_on %> +
    + <% else %> +
    + <%= link_to title, board_message_path(message.board, message.id), :target => '_blank', :class => "por_course_title link-black", :title => title %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_path(message.board.id, message.id), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_path(message.board.id, message.id), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now message.created_on %> +
    + <% end %> + <% end %> + <% if activity.org_act_type == 'News' and News.where(:id => activity.org_act_id).count > 0 %> + <% news = activity.org_act %> + <% iamge_path = get_image_path_from_content(news.description) %> +
    + <%= link_to news.title, news_path(news), :target => '_blank', :class => "por_course_title link-black", :title => news.title %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_path(news), :target => "_blank", :class =>"fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_path(news), :target => "_blank", :class =>"fl" %> + <% end %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now news.created_on %> +
    + <% end %> + <% end %> + <% end %> + <% end %> + <% elsif 'Compcou' %> +

    <%= field.name %>

    + <% if @excellent_courses.blank? %> +

    该模块暂时没有相关内容

    + <% else %> + <% @excellent_courses.first(4).each do |course| %> +
    + <%= link_to course.name, course_path(course.id), :target => '_blank', :class => "por_course_title link-black", :title => course.name %> + <%= link_to image_tag(url_to_avatar(course),:width => "140", :height => "100"), course_path(course), :target => "_blank", :class => "fl" %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => course.id, :content=> course.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= current_time_and_term course %> +
    + <% end %> + <% end %> + <% end %> +<% end %> +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_left3.html.erb b/app/views/organizations/_org_custom_left3.html.erb new file mode 100644 index 000000000..3d5d01dee --- /dev/null +++ b/app/views/organizations/_org_custom_left3.html.erb @@ -0,0 +1,149 @@ +
    + <% if acts.blank? %> +

    <%= field.name %>

    +

    该模块暂时没有相关内容

    + <% else %> +

    <%= field.name %> + <%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %> +

    +
    +
    + <% activity = acts.first %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> + <% document = activity.org_act %> + <% if get_image_path_from_content(document.content).nil? %> + <%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(document.content)}", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% end %> + <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "por_post_title link-black", :title => document.title %> +

    + <%= time_from_now(document.created_at) %> + <%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %> +

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => acts.first.org_act.id, :content=> acts.first.org_act.content, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %> + <% else activity.container_type == 'OrgSubfield' %> + <% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %> + <% message = activity.org_act %> + <% content = message.parent_id.nil? ? message.content : message.parent.content %> + <% title = message.parent_id.nil? ? message.subject : message.parent.subject %> + <% iamge_path = get_image_path_from_content(content) %> + <% if message.board.org_subfield_id %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "299", :height => "246"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %> + <% end %> + <%= link_to title, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "por_post_title link-black", :title => title %> +

    + <%= time_from_now(message.created_on) %> + <%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %> +

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> message.content, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %> + <% else %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), board_message_path(message.board, message), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "299", :height => "246"), board_message_path(message.board, message), :target => "_blank" %> + <% end %> + <%= link_to title, board_message_path(message.board, message), :target => '_blank', :class => "por_post_title link-black", :title => title %> +

    + <%= time_from_now(message.created_on) %> + <%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %> +

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> message.content, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %> + <% end %> + <% end %> + <% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %> + <% news = News.find(activity.org_act_id) %> + <% iamge_path = get_image_path_from_content(news.description) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), news_path(news), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "299", :height => "246"), news_path(news), :target => "_blank" %> + <% end %> + <%= link_to news.title, news_path(news), :target => '_blank', :class => "por_post_title link-black", :title => news.title %> +

    + <%= time_from_now(news.created_on) %> + <%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %> +

    + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %> + <% end %> + <% end %> +
    + <% unless acts[1..5].nil? %> + <% acts[1..5].each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %> + <% document = activity.org_act %> + + <% else activity.container_type == 'OrgSubfield' %> + <% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %> + <% message = Message.find(activity.org_act_id) %> + <% if message.board.org_subfield_id %> + + <% else %> + + <% end %> + <% end %> + <% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %> + <% news = News.find(activity.org_act_id) %> + <% iamge_path = get_image_path_from_content(news.description) %> + + <% end %> + <% end %> + <% end %> + <% end %> +
    + <% unless acts[6..19].nil? %> +
    + +
    + <% end %> +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_right1.html.erb b/app/views/organizations/_org_custom_right1.html.erb new file mode 100644 index 000000000..9d710ba54 --- /dev/null +++ b/app/views/organizations/_org_custom_right1.html.erb @@ -0,0 +1,37 @@ +
    +

    <%= field.name %>

    + <% if @acts.blank? %> +

    该模块暂时没有相关内容

    + <% else %> + + <% end %> +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_right2.html.erb b/app/views/organizations/_org_custom_right2.html.erb new file mode 100644 index 000000000..9d206ff93 --- /dev/null +++ b/app/views/organizations/_org_custom_right2.html.erb @@ -0,0 +1,24 @@ +
    +

    热点项目

    + <% if containers.blank? %> +

    该模块暂时没有相关内容

    + <% else %> + + <% end %> +
    diff --git a/app/views/organizations/_org_custom_right3.html.erb b/app/views/organizations/_org_custom_right3.html.erb new file mode 100644 index 000000000..a461a38dc --- /dev/null +++ b/app/views/organizations/_org_custom_right3.html.erb @@ -0,0 +1,105 @@ +<% if field.field_type == "Resource" %> +
    +

    <%= field.name %><%= link_to "更多>", org_subfield_files_path(field), :target => "_blank", :class => "f12 fontGrey2 fr" %>

    +
    + +
    +
    +<% elsif field.field_type == "Comptec" || field.field_type == "Compstu" %> +
    + +
    + +
    +
    + +
    +
    + + +<% end %> diff --git a/app/views/organizations/_org_field_menu.html.erb b/app/views/organizations/_org_field_menu.html.erb new file mode 100644 index 000000000..792bea87e --- /dev/null +++ b/app/views/organizations/_org_field_menu.html.erb @@ -0,0 +1,44 @@ + \ 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 4340213a4..30234c300 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -91,7 +91,7 @@ <% end %> <% else %>
    - <% if field.field_type == "Post" || field.field_type == "Complex" || field.field_type == "Compstu" || field.field_type == "Comptec" %> + <% if field.field_type == "Post" || field.field_type == "Complex" %>
    <% if !field.subfield_subdomain_dir.nil? %> @@ -101,28 +101,47 @@ <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% end %> <% else %> - <% if field.field_type == "Comptec" %> - <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> - <% else %> - <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> - <% end %> + <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% end %> - <% if User.current.logged? and User.current.admin_of_org?(organization) && field.field_type != "Comptec" %> + <% if User.current.logged? and User.current.admin_of_org?(organization) %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %> <% end %>
    - <% unless (field.sub_domains.count == 0 || !if_hidden_subdomain(field)) %>
  • <% end %> - <% else %> + <% elsif field.field_type == "Comptec" && User.current.admin? %> +
    + <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> +
    + <% elsif field.field_type == "Compstu" && User.current.admin? %> +
    + <%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> +
    + <% elsif field.field_type == "Compstu" && User.current.admin? %> +
    + <%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> +
    + <% elsif field.field_type == "Comppro" && User.current.admin? %> +
    + <%= link_to "#{field.name}", projects_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> +
    + <% elsif field.field_type == "Compcou" && User.current.admin? %> +
    + <%= link_to "#{field.name}", courses_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> +
    + <% elsif field.field_type == "Compact" && User.current.admin? %> +
    + <%= link_to "#{field.name}", acts_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> +
    + <% elsif field.field_type == "Resource" %>
    <% 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) %> diff --git a/app/views/organizations/_org_member_list.html.erb b/app/views/organizations/_org_member_list.html.erb index 0059a2be5..8e8a23b60 100644 --- a/app/views/organizations/_org_member_list.html.erb +++ b/app/views/organizations/_org_member_list.html.erb @@ -31,8 +31,9 @@ <% end %> <% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%> - 编辑 + 编辑 <%= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
    +
    <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_students_list.html.erb b/app/views/organizations/_org_students_list.html.erb new file mode 100644 index 000000000..d3db6fbf6 --- /dev/null +++ b/app/views/organizations/_org_students_list.html.erb @@ -0,0 +1,45 @@ +<% org_students.each do |org_student| %> + <% school = School.where("id =?", org_student.school_id).first %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(org_student), :width => "90", :height => "90"), user_url_in_org(org_student), :alt => "用户头像" %> +
    +
    +
    <%=link_to org_student.try(:realname).nil? ? org_student.try(:login) : org_student.try(:realname), user_url_in_org(org_student) %> + <% unless school.nil? %> + <%= school.name %> + <% end %> +
    +
    +
    <%= org_student.courses.count %>
    +
    课程数
    +
    +
    +
    +
    <%= org_teacher_resource_count(org_student) %>
    +
    资源数
    +
    +
    + <% if User.current.admin_of_org?(@organization) %> + <%= org_student.excellent_student ==0 ? "设为学霸" : "取消设置" %> + <% end %> +
    +
    +
    +<% end %> + + \ No newline at end of file diff --git a/app/views/organizations/_organization_content_extension.html.erb b/app/views/organizations/_organization_content_extension.html.erb new file mode 100644 index 000000000..919961057 --- /dev/null +++ b/app/views/organizations/_organization_content_extension.html.erb @@ -0,0 +1,24 @@ +
    + + <%= content.to_s.html_safe%> + +
    + + + \ No newline at end of file diff --git a/app/views/organizations/_setting_excellent_students.html.erb b/app/views/organizations/_setting_excellent_students.html.erb new file mode 100644 index 000000000..696d85378 --- /dev/null +++ b/app/views/organizations/_setting_excellent_students.html.erb @@ -0,0 +1,12 @@ +<% if @organization.allow_set_teachers && !org_subfield_had_created?(@organization, "Comptec") %> +
  • + + +
  • +<% end %> +<% if User.current.admin? && !org_subfield_had_created?(@organization, "Compstu") %> +
  • + + +
  • +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_show_custom.html.erb b/app/views/organizations/_show_custom.html.erb new file mode 100644 index 000000000..ad77f4286 --- /dev/null +++ b/app/views/organizations/_show_custom.html.erb @@ -0,0 +1,24 @@ +
    + <% @subfield_content.each do |field| %> + <% if field.status.to_i == 1 %> + <%= render :partial => 'organizations/org_custom_left1', :locals => {:field => field, :acts => get_subfield_acts(field) } %> + <% elsif field.status.to_i == 2 %> + <%= render :partial => 'organizations/org_custom_left2', :locals => {:field => field} %> + <% elsif field.status.to_i == 3 %> + <%= render :partial => 'organizations/org_custom_left3', :locals => {:field => field, :acts => get_subfield_acts(field) }%> + <% end %> + <% end %> +
    + +
    + <% @subfield_content.each do |field| %> + <% if field.status.to_i == 4 %> + <%= render :partial => 'organizations/org_custom_right1', :locals => {:field => field} %> + <% elsif field.status.to_i == 5 %> + <%= render :partial => 'organizations/org_custom_right2', :locals => {:field => field, :containers => @excellent_projects} %> + <% elsif field.status.to_i == 6 %> + <%= render :partial => 'organizations/org_custom_right3', :locals => {:field => field} %> + <% end %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_show_type2.html.erb b/app/views/organizations/_show_type2.html.erb new file mode 100644 index 000000000..eba77174c --- /dev/null +++ b/app/views/organizations/_show_type2.html.erb @@ -0,0 +1,33 @@ +
    + <% @subfield_content.each do |field| %> + <% if field.status.to_i == 1 %> + <%= render :partial => 'organizations/org_subfield_leftT', :locals => {:field => field} %> + <% elsif field.status.to_i == 3 %> + <%#= render :partial => 'organizations/org_subfield_leftM', :locals => {:field => field} %> +
    + <%= render :partial => 'organizations/org_subfield_leftM1', :locals => {:field => field} %> + <%= render :partial => 'organizations/org_subfield_leftM2', :locals => {:field => field} %> +
    +
    + <% elsif field.status.to_i == 4 %> + <%= render :partial => 'organizations/org_subfield_leftMD', :locals => {:field => field} %> + <% elsif field.status.to_i == 5 %> + <%= render :partial => 'organizations/org_subfield_leftD', :locals => {:field => field} %> + <% end %> + <% end %> +
    + +
    + <% @subfield_content.each do |field| %> + <% if field.status.to_i == 6 %> + <%= render :partial => 'organizations/org_subfield_rightT', :locals => {:field => field} %> + <% elsif field.status.to_i == 7 %> + <%= render :partial => 'organizations/org_subfield_rightM', :locals => {:field => field} %> + <% elsif field.status.to_i == 8 %> + <%= render :partial => 'organizations/org_subfield_rightD', :locals => {:field => field} %> + <% elsif field.status.to_i == 23 %> + <%= render :partial => 'organizations/org_subfield_rightM2', :locals => {:field => field} %> + <% end %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index f16e53b0e..946043a62 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -23,7 +23,7 @@
  • <%= name %>
  • 默认
  • - <% if field.name == "activity" %> + <% if field.name == "activity" || field.name == "course" || field.name == "project" %> 默认 <% 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 %> @@ -57,7 +57,7 @@
  • 新增
  • - <% if field.field_type == "Resource" || field.field_type == "Comptec" %> + <% if field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact" || field.field_type == "Compstu" %> 默认 <% 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 %> @@ -92,7 +92,7 @@ <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %> | 编辑 - <% unless field.field_type == "Resource" || field.field_type == "Comptec" %> + <% unless field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Compstu" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact" %> | diff --git a/app/views/organizations/courses.html.erb b/app/views/organizations/courses.html.erb new file mode 100644 index 000000000..875fc3340 --- /dev/null +++ b/app/views/organizations/courses.html.erb @@ -0,0 +1,30 @@ +
    +
    + <% if @type == "famous" %> + 精品课程 + <% else %> + <%= @field.name %> + <% end %> +
    +
    +
    + +
    + <%=render 'organizations/org_container', :containers => @containers %> +
    +
    +
      + <%= pagination_links_full @atta_pages, @containers_count, :per_page_links => false, :flag => true %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/courses.js.erb b/app/views/organizations/courses.js.erb new file mode 100644 index 000000000..dc42c115c --- /dev/null +++ b/app/views/organizations/courses.js.erb @@ -0,0 +1,3 @@ +$("#org_container_list").html('<%= escape_javascript( render :partial => 'organizations/org_container', :locals => {:containers => @containers})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); +$("#org_student_search").attr('href','<%= courses_organization_path(@organization, :type => @type) %>'); \ No newline at end of file diff --git a/app/views/organizations/projects.html.erb b/app/views/organizations/projects.html.erb new file mode 100644 index 000000000..1c6cfa1d1 --- /dev/null +++ b/app/views/organizations/projects.html.erb @@ -0,0 +1,30 @@ +
    +
    + <% if @type == "famous" %> + 热门项目 + <% else %> + <%= @field.name %> + <% end %> +
    +
    +
    + +
    + <%=render 'organizations/org_container', :containers => @containers %> +
    +
    +
      + <%= pagination_links_full @atta_pages, @containers_count, :per_page_links => false, :flag => true %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/projects.js.erb b/app/views/organizations/projects.js.erb new file mode 100644 index 000000000..e8d4f244a --- /dev/null +++ b/app/views/organizations/projects.js.erb @@ -0,0 +1,3 @@ +$("#org_container_list").html('<%= escape_javascript( render :partial => 'organizations/org_container', :locals => {:containers => @containers})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); +$("#org_student_search").attr('href','<%= projects_organization_path(@organization, :type => @type) %>'); \ No newline at end of file diff --git a/app/views/organizations/reset_excellent_student.js.erb b/app/views/organizations/reset_excellent_student.js.erb new file mode 100644 index 000000000..29684c7e4 --- /dev/null +++ b/app/views/organizations/reset_excellent_student.js.erb @@ -0,0 +1 @@ +$("#hide_<%= @ex_student.id %>").text("设为学霸"); \ No newline at end of file diff --git a/app/views/organizations/set_excellent_student.js.erb b/app/views/organizations/set_excellent_student.js.erb new file mode 100644 index 000000000..a8bb963c8 --- /dev/null +++ b/app/views/organizations/set_excellent_student.js.erb @@ -0,0 +1 @@ +$("#hide_<%= @ex_student.id %>").text("取消设置"); \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 0c8af8471..775bc7e6a 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -87,11 +87,11 @@  允许游客下载 <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %>
  • - <% if User.current.admin? %> -
    允许设置名师榜 : - class="ml3" /> -
    - <% end %> + + + + + 保存 <% end %>
    @@ -162,8 +162,8 @@ -
    - <%= render :partial => 'organizations/setting_excellent_teachers' %> +
    + <%= render :partial => 'organizations/org_custom_admin' %>
  • 新增
  • @@ -172,7 +172,7 @@
    - <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority")} %> + <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)} %>
    @@ -184,7 +184,7 @@ function add_org_subfield_subdomain(){ if ($("#subfield_name_subdomain").val().trim() != "") $("#add_subfield_form_subdomain").submit(); - $("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority")} )) %>'); + $("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)})) %>'); } var $is_exist = false; function apply_subdomain(id, domain){ diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index d93ead84b..72e95ded9 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -1,66 +1,71 @@ -<%= javascript_include_tag "jquery.infinitescroll.js" %> +<%# 区分两种模式 params[:org_subfield_id] 不为空的时候则跳到栏目%> +<% if @organization.switch_type && params[:org_subfield_id].nil? %> + <%= render :partial => 'show_custom' %> +<% else %> + <%= javascript_include_tag "jquery.infinitescroll.js" %> -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> -<% end %> + <%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <% end %> -<% if params[:show_homepage].nil? and User.current.logged? %> -
    -
    <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
    - <% if params[:org_subfield_id].nil? %> -
    -<% end %> -<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> - - <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> - <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> -<% end %> -<% if @org_activities %> - <%= render :partial => 'organizations/org_activities', - :locals => {:org_activities => @org_activities, - :page=> @page, - :org => @organization, - :org_act_count=> @org_activities.count} %> + <% end %> + + <% end %> + <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> + + <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> + <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> + <% end %> + <% if @org_activities %> + <%= render :partial => 'organizations/org_activities', + :locals => {:org_activities => @org_activities, + :page=> @page, + :org => @organization, + :org_act_count=> @org_activities.count} %> + <% end %> <% end %> @@ -70,3 +75,4 @@ + diff --git a/app/views/organizations/students.html.erb b/app/views/organizations/students.html.erb new file mode 100644 index 000000000..770967210 --- /dev/null +++ b/app/views/organizations/students.html.erb @@ -0,0 +1,30 @@ +
    +
    + <% if @type == "famous" %> + 学霸列表 + <% else %> + <%= @field.name %> + <% end %> +
    +
    +
    + +
    + <%=render 'organizations/org_students_list', :org_students => @org_students %> +
    +
    + +
    +
    \ No newline at end of file diff --git a/app/views/organizations/students.js.erb b/app/views/organizations/students.js.erb new file mode 100644 index 000000000..c65f8f861 --- /dev/null +++ b/app/views/organizations/students.js.erb @@ -0,0 +1,3 @@ +$("#org_students_list").html('<%= escape_javascript( render :partial => 'organizations/org_students_list', :locals => {:org_students => @org_students})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @students_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); +$("#org_student_search").attr('href','<%= students_organization_path(@organization, :type => @type) %>'); \ No newline at end of file diff --git a/app/views/organizations/update_field_by_admin.js.erb b/app/views/organizations/update_field_by_admin.js.erb new file mode 100644 index 000000000..ba218c746 --- /dev/null +++ b/app/views/organizations/update_field_by_admin.js.erb @@ -0,0 +1,5 @@ +<% if @type == "course" %> +$("#hide_<%= @container.id %>").text("<%= (@status == 'reset' ? '设为精品' : '取消精品') %>"); +<% elsif @type == "project" %> +$("#hide_<%= @container.id %>").text("<%= (@status == 'reset' ? '设为热门' : '取消热门') %>"); +<% end %> diff --git a/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb index eef87bc9b..1fa96e602 100644 --- a/app/views/projects/settings/_new_edit.html.erb +++ b/app/views/projects/settings/_new_edit.html.erb @@ -30,6 +30,11 @@ >
    +
  • + + > +
    +
  • 保存 <% end %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index c0bb15ab4..30c15c03d 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -29,13 +29,16 @@ - <% unless @project.gpid.nil? || @project.project_score.changeset_num == 0 || @project.rep_statics.blank? %> -
    -
    - <%= render :partial => "rep_static" %> -
    -
    -
    + <%# 时间紧,权限待优化 %> + <% unless @project.hidden_repo && !User.current.member_of?(@project) && !User.current.admin? %> + <% unless @project.gpid.nil? || @project.project_score.changeset_num == 0 || @project.rep_statics.blank? %> +
    +
    + <%= render :partial => "rep_static" %> +
    +
    +
    + <% end %> <% end %> <%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %> diff --git a/app/views/sub_document_comments/_new.html.erb b/app/views/sub_document_comments/_new.html.erb index c6cc13164..aec91c878 100644 --- a/app/views/sub_document_comments/_new.html.erb +++ b/app/views/sub_document_comments/_new.html.erb @@ -36,7 +36,7 @@ $('#doc_title_hint').hide(); } -
    +
    <%= form_tag org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id), :id => 'new_sub_document_form' do |f| %>
    diff --git a/app/views/sub_document_comments/show.html.erb b/app/views/sub_document_comments/show.html.erb index 7050c1c66..f85f3ed25 100644 --- a/app/views/sub_document_comments/show.html.erb +++ b/app/views/sub_document_comments/show.html.erb @@ -8,7 +8,7 @@ showNormalImage('message_description_<%= @document.id %>'); }); -
    +
    <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> @@ -138,7 +138,7 @@
    <%# end %> - <% if User.current.logged?%> + <%# if User.current.logged?%>
    @@ -151,7 +151,7 @@
    - <% end %> + <%# end %>
    diff --git a/app/views/sub_domains/_new.html.erb b/app/views/sub_domains/_new.html.erb index 25b660750..865eae785 100644 --- a/app/views/sub_domains/_new.html.erb +++ b/app/views/sub_domains/_new.html.erb @@ -9,10 +9,6 @@ - - - -
  • @@ -20,8 +16,3 @@ <% end %>
    - - - \ No newline at end of file diff --git a/app/views/sub_domains/create.js.erb b/app/views/sub_domains/create.js.erb index 0990e35de..8c7b7f64a 100644 --- a/app/views/sub_domains/create.js.erb +++ b/app/views/sub_domains/create.js.erb @@ -1,8 +1,5 @@ <% if @res %> -$("#org_subfield_list").html(""); -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); <% end %> -$("#subfield_name").val(""); -$("#sub_dir").val(""); \ No newline at end of file diff --git a/app/views/sub_domains/destroy.js.erb b/app/views/sub_domains/destroy.js.erb index 913c400f7..4d8ef21de 100644 --- a/app/views/sub_domains/destroy.js.erb +++ b/app/views/sub_domains/destroy.js.erb @@ -1,4 +1,4 @@ $("#org_subfield_list").html(""); -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#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/sub_domains/domain_update_priority.js.erb b/app/views/sub_domains/domain_update_priority.js.erb index 475649aac..e4de7c931 100644 --- a/app/views/sub_domains/domain_update_priority.js.erb +++ b/app/views/sub_domains/domain_update_priority.js.erb @@ -1,2 +1,2 @@ -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields.order("priority")}) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#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/sub_domains/update.js.erb b/app/views/sub_domains/update.js.erb index 02810eee7..2c0af9c42 100644 --- a/app/views/sub_domains/update.js.erb +++ b/app/views/sub_domains/update.js.erb @@ -1,3 +1,4 @@ $("#subsubdomain_show_<%= @subdomain.id %>").html("<%= @subdomain.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 +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); \ No newline at end of file diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index cdd270a56..3f5138107 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -49,8 +49,6 @@ alert("您只能删除没有历史记录的资源,请重新选择后再删除。"); return; } - - if(data != "" && confirm('确认要删除这些资源吗?')) { $.post( '<%= user_resource_delete_user_path(User.current.id,:type=>@type,:status=>@status)%>', @@ -62,8 +60,6 @@ } } - - function show_send(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} diff --git a/app/views/users/_show_new_upload.html.erb b/app/views/users/_show_new_upload.html.erb index b343aeae1..e63cf2af9 100644 --- a/app/views/users/_show_new_upload.html.erb +++ b/app/views/users/_show_new_upload.html.erb @@ -1,3 +1 @@ -<% if @type != "2" %> - -<% end %> + diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 60d5b6ed8..0c18dbcc3 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -259,7 +259,7 @@ '您申请引用作业"'+HomeworkCommon.find(ma.course_message_id).name+'"的申请已通过' : '您申请引用作业"'+HomeworkCommon.find(ma.course_message_id).name+'"的申请被拒绝' %> - <% if User.current.member_of_course?(ma.course_message.course) || User.current.admin? || ma.course_message.is_open == 1 %> + <% if User.current.member_of_course?(ma.course_message.course) || User.current.admin? || (ma.course_message.is_open == 1 && ma.course_message.course.is_public == 1) %> <%= link_to link_str, student_work_index_path(:homework => ma.course_message.id), :title => link_str,:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey "}", :target => '_blank' %> <% else %> <%=link_str %> @@ -399,7 +399,7 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> - <% elsif ma.course_message.jour_type == 'HomeworkCommon' %> + <% elsif ma.course_message.jour_type == 'HomeworkCommon' %>