diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 7a226f50d..6df683948 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -1,9 +1,51 @@ class BlogsController < ApplicationController before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage] before_filter :find_user + include PraiseTreadHelper + def index @article = BlogComment.new + + @order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 + + #确定 sort_type 1升序 2 降序 + if @order.to_i == @type.to_i + @b_sort = @b_sort.to_i == 1 ? 2 : 1 + else + @b_sort = 2 + end + + sort_name = "updated_at" + + sort_type = @b_sort == 1 ? "asc" : "desc" + + @topics = @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.#{sort_name} #{sort_type}") + + #根据 赞+回复数排序 + if @order.to_i == 2 + @type = 2 + + @topics.each do |topic| + topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count) + end + + @b_sort == 1 ? @topics = @topics.sort{|x,y| x[:infocount] <=> y[:infocount] } : @topics = @topics.sort{|x,y| y[:infocount] <=> x[:infocount] } + + @topics = sort_by_sticky @topics + else + @type = 1 + end + + #分页 + @limit = 10 + @is_remote = true + @atta_count = @topics.count + @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @topics = paginateHelper @topics,@limit + respond_to do |format| + format.js format.html {render :layout=>'new_base_user'} end end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index a77346d89..260c28b16 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -28,6 +28,7 @@ class BoardsController < ApplicationController helper :watchers helper :project_score helper :attachments + include PraiseTreadHelper def index #modify by nwb @flag = params[:flag] || false @@ -62,13 +63,24 @@ class BoardsController < ApplicationController else render_403 end - end - end def show # 讨论区消息状态更新(已读和未读) + @order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 + + #确定 sort_type 1升序 2 降序 + if @order.to_i == @type.to_i + @b_sort = @b_sort.to_i == 1 ? 2 : 1 + else + @b_sort = 2 + end + + sort_name = "updated_at" + + sort_type = @b_sort == 1 ? "asc" : "desc" + if @project ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true) # 更新@消息为已读 @@ -82,63 +94,84 @@ class BoardsController < ApplicationController CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true) end - sort_init 'updated_on', 'desc' - sort_update 'created_on' => "#{Message.table_name}.created_on", - 'replies' => "#{Message.table_name}.replies_count", - 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)" + # sort_init 'updated_on', 'desc' + # sort_update 'created_on' => "#{Message.table_name}.created_on", + # 'replies' => "#{Message.table_name}.replies_count", + # 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)" @is_new = params[:is_new] @topic_count = @board ? @board.topics.count : 0 if @project if @board - limit = 10; @topic_count = @board.topics.count(); - @topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10 - @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc"). - limit(limit).offset(@topic_pages).includes(:last_reply). + @topic_pages = 0#(params[:page] ? params[:page].to_i + 1 : 0) *10 + @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}"). + offset(@topic_pages).includes(:last_reply). preload(:author, {:last_reply => :author}).all(); else @topics = []; end elsif @course if (@board) - limit = 10; @topic_count = @board.topics.count(); - @topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10 - @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc"). - limit(limit).offset(@topic_pages).includes(:last_reply). - preload(:author, {:last_reply => :author}).all(); + @topic_pages = 0 #(params[:page] ? params[:page].to_i + 1 : 0) *10 + @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").offset(@topic_pages).includes(:last_reply).preload(:author, {:last_reply => :author}).all(); else @topics = []; end end + #根据 赞+回复数排序 + if @order.to_i == 2 + @type = 2 + @topics.each do |topic| + topic[:infocount] = get_praise_num(topic) + (topic.parent ? x.parent.children.count : topic.children.count) + end + @b_sort == 1 ? @topics = @topics.sort{|x,y| x[:infocount] <=> y[:infocount] } : @topics = @topics.sort{|x,y| y[:infocount] <=> x[:infocount] } + @topics = sort_by_sticky @topics + else + @type = 1 + end + + #分页 + @limit = 15 + @is_remote = true + @atta_count = @topics.count + @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @topics = paginateHelper @topics,@limit + @page = params[:page] ? params[:page].to_i + 1 : 0 @message = Message.new(:board => @board) #modify by nwb - respond_to do |format| - format.js - format.html { - if @project - render :action => 'show', :layout => 'base_projects' - elsif @course - @params=params - render :action => 'show', :layout => 'base_courses' - end - } - format.atom { - @messages = @board.messages. - reorder('created_on DESC'). - includes(:author, :board). - limit(Setting.feeds_limit.to_i). - all - if @project - render_feed(@messages, :title => "#{@project}: #{@board}") - elsif @course - render_feed(@messages, :title => "#{@course}: #{@board}") - end - - } + if (params[:page] || params[:order]) + respond_to do |format| + format.js{render "show.js.erb"} + end + else + respond_to do |format| + format.js + format.html { + if @project + render :action => 'show', :layout => 'base_projects' + elsif @course + @params=params + render :action => 'show', :layout => 'base_courses' + end + } + format.atom { + @messages = @board.messages. + reorder('created_on DESC'). + includes(:author, :board). + limit(Setting.feeds_limit.to_i). + all + if @project + render_feed(@messages, :title => "#{@project}: #{@board}") + elsif @course + render_feed(@messages, :title => "#{@course}: #{@board}") + end + } + end end end diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index f45e1dbd7..f47471e0f 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -70,25 +70,59 @@ class NewsController < ApplicationController end elsif @course if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) + @order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 + + #确定 sort_type 1升序 2 降序 + if @order.to_i == @type.to_i + @b_sort = @b_sort.to_i == 1 ? 2 : 1 + else + @b_sort = 2 + end + + sort_name = "created_on" + + sort_type = @b_sort == 1 ? "asc" : "desc" + scope = @course ? @course.news.course_visible : News.course_visible news_arr = scope.map{|news| news.id} @page = params[:page] ? params[:page].to_i + 1 : 0 - news_page = @page *10 + news_page = 0 #@page *10 @news_count = scope.count @is_new = params[:is_new] @q = params[:subject] if params[:subject].nil? || params[:subject].blank? - scope_order = scope.reorder("#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC").limit(10).offset(news_page).includes(:author,:course).all() + scope_order = scope.reorder("#{News.table_name}.sticky DESC, #{News.table_name}.#{sort_name} #{sort_type}").offset(news_page).includes(:author,:course).all() #all(:include => [:author, :course], #:order => "#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC").limit(10).offset(news_page) else - scope_order = scope.where("#{News.table_name}.title like '#{'%' << params[:subject].to_s << '%'}'").reorder("#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC").limit(10).offset(news_page).includes(:author,:course).all() + scope_order = scope.where("#{News.table_name}.title like '#{'%' << params[:subject].to_s << '%'}'").reorder("#{News.table_name}.sticky DESC, #{News.table_name}.#{sort_name} #{sort_type}").offset(news_page).includes(:author,:course).all() #.all(:include => [:author, :course],:order => "#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC") end + #根据 赞+回复数排序 + if @order.to_i == 2 + @type = 2 + scope_order.each do |topic| + topic[:infocount] = get_praise_num(topic) + topic.comments.count + end + @b_sort == 1 ? scope_order = scope_order.sort{|x,y| x[:infocount] <=> y[:infocount] } : scope_order = scope_order.sort{|x,y| y[:infocount] <=> x[:infocount] } + scope_order = sort_by_sticky scope_order + else + @type = 1 + end + @newss = scope_order + + #分页 + @limit = 15 + @is_remote = true + @atta_count = @newss.count + @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @newss = paginateHelper @newss,@limit + #@newss = paginateHelper scope_order,10 respond_to do |format| format.html { diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 93e0e9c4b..c22f9e4ab 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -32,6 +32,10 @@ class SettingsController < ApplicationController hidden_non_project = Setting.find_by_name("hidden_non_project") @text = (hidden_non_project && hidden_non_project.value == "0") ? l(:label_show_non_project) : l(:label_hidden_non_project) + #1隐藏了课程信息 0显示了课程信息 + hidden_courses = Setting.find_by_name("hidden_courses") + @text_1 = (hidden_courses && hidden_courses.value == "1") ? l(:label_show_courses) : l(:label_hidden_courses) + @notifiables = Redmine::Notifiable.all if request.post? && params[:settings] && params[:settings].is_a?(Hash) settings = (params[:settings] || {}).dup.symbolize_keys @@ -89,4 +93,22 @@ class SettingsController < ApplicationController redirect_to settings_url end + + #隐藏/显示课程信息 + def hidden_courses + @notifiable = Setting.find_by_name("hidden_courses") + if @notifiable + @notifiable.value == "1" ? @notifiable.value = 0 : @notifiable.value = 1 + @notifiable.save + else + @notifiable = Setting.new() + @notifiable.name = "hidden_courses" + @notifiable.value = 1 + @notifiable.save + end + + redirect_to settings_url + end end + + diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 49658bbd9..e7c10f9eb 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -5,7 +5,7 @@ class StudentWorkController < ApplicationController include ApplicationHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:code_repeattest,:work_canrepeat,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] @@ -81,8 +81,6 @@ class StudentWorkController < ApplicationController #根据传入的tIndex确定是第几次测试 #之后如果觉得很卡 可以改成将结果传回JS再以参数形式传回来 def program_test_ex - tStarttime = Time.now - is_test = params[:is_test] == 'true' resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T'),tseq:1,tcount:1,testid:1} #保存每测试一次返回的结果 @@ -100,17 +98,8 @@ class StudentWorkController < ApplicationController test = @homework.homework_tests[index - 1] #请求测试 - begin - result = test_realtime_ex(test, params[:src]) - rescue Timeout::Error - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒" + result = test_realtime_ex(test, params[:src]) - #status 0:答案正确 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时 - CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id) - - end if result["status"].to_i != -2 #result["results"].first['output'] = result["results"].first['output'].gsub(" ","□") #result["results"].first['result'] = result["results"].first['result'].gsub(" ","□") @@ -125,19 +114,11 @@ class StudentWorkController < ApplicationController resultObj[:results] = result["results"].first #本次测试结果 resultObj[:error_msg] = result["error_msg"] #编译错误时的信息 - #该状态用于存入CodeTests - tmpstatus = -1 if result["status"].to_i == -2 #编译错误 resultObj[:results] = result["error_msg"] resultObj[:status] = -2 - tmpstatus = -2 elsif result["results"][0]["status"].to_i == 2 resultObj[:status] = 2 - tmpstatus = 2 - end - - if result["status"] == 0 - tmpstatus = 0 end unless student_work.save @@ -153,14 +134,6 @@ class StudentWorkController < ApplicationController end #每次从数据库取出上次的结果加上本次的结果再存入数据库 - if result["status"].to_i != -2 - result["results"].first['user_wait'] = tUsedtime - - if result["results"][0]["status"].to_i == 2 - result["status"] = 2 - end - end - status = result["status"] if index == 1 student_work_test = student_work.student_work_tests.build(status: status, @@ -189,19 +162,6 @@ class StudentWorkController < ApplicationController resultObj[:index] = student_work.student_work_tests.count end - #将每次用户等待时间都存起来以便管理界面显示用 - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒" - - time_used = 0 - if result["status"].to_i != -2 - #至少一毫秒 - time_used = result["results"].first['time_used'] == 0 ? 1:result["results"].first['time_used'] - end - #0:答案正确 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时 - CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>time_used,:wait_time=>tUsedtime,:student_work_id=>student_work.id) - #渲染返回结果 render :json => resultObj end @@ -209,114 +169,6 @@ class StudentWorkController < ApplicationController end end - #找出该作业的所有提交作业 - def find_all_student_work_by_homeid() - all_studentwork = StudentWork.where("homework_common_id =#{@homework.id} and is_test = 0 ") - - all_studentwork - end - - def request_code_repeattest(src) - url = "#{Redmine::Configuration['jplag_server']}api/realtime_test.json" - - factor = [] - src.each do |test| - factor << {work_id: test.id, des: test.description,created_at:test.created_at.to_i} - end - - solutions = { - homeid:@homework.id, - language:@homework.homework_detail_programing.language, - factor: factor - } - uri = URI(url) - body = solutions.to_json - - logger.debug "send body" - logger.debug body - - res = Net::HTTP.new(uri.host, uri.port).start do |client| - request = Net::HTTP::Post.new(uri.path) - request.body = body - request["Content-Type"] = "application/json" - client.request(request) - end - - JSON.parse(res.body) - end - - #点击代码查重按钮 - def work_canrepeat - @homework_id = params[:homework] - @course_id = params[:course_id] - - all_studentwork = find_all_student_work_by_homeid() - - @work_count = all_studentwork.count - end - - #代码查重 status: 0完成 -2不需要查重 -1查重失败不支持该语言 - def code_repeattest - tStarttime = Time.now - logger.debug "code_repeattest start is #{tStarttime}}" - resultObj = {status: -2} - - @homework = HomeworkCommon.find params[:homework] - - all_studentwork = find_all_student_work_by_homeid() - - if all_studentwork == nil - resultObj[:status] = -2 - elsif all_studentwork.count <= 1 - resultObj[:status] = -2 - else - - #@homework.homework_detail_programing.language、id、description - logger.debug "time1 is #{Time.now.usec} " - result = request_code_repeattest(all_studentwork) - logger.debug "time2 is #{Time.now.usec} " - - resultObj[:status] = result['status'].to_i - # resultObj[:results] = result['results'] - - #Time.now, simi_id = simiworkid , simi_value = simivalue - if resultObj[:status] == 0 - @homework.simi_time = Time.now - resultObj[:comparetime] = @homework.simi_time - @homework.update_column('simi_time', @homework.simi_time) - - logger.debug "time3 is #{Time.now.usec} " - result['results'].each do |key,value| - @student_work = StudentWork.where("id =?", key.to_i).first - @student_work.update_column('simi_id', value['simiworkid'].to_i) - @student_work.update_column('simi_value', value['simivalue'].to_i) - # sqlstr = "update student_works set simi_id=#{value['simiworkid']},simi_value=#{value['simivalue']} where id=#{key.to_i} " - # dbh.execute(sqlstr) - end - logger.debug "time4 is #{Time.now.usec} " - end - end - tEndtime = Time.now - logger.debug "code_repeattest end is #{tEndtime}}" - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000000+(tEndtime.usec - tStarttime.usec) - logger.debug "code_repeattest userd utime is #{tUsedtime}" - render :json => resultObj - end - - #上次代码查重时间 - def last_codecomparetime - resultObj = {status: 0} - @homework = HomeworkCommon.find params[:homework] - - #转换一下 - if @homework.simi_time != nil - resultObj[:comparetime] = Time.parse(@homework.simi_time.to_s).strftime("%Y-%m-%d %H:%M:%S") - else - resultObj[:comparetime] = 0 - end - - render :json => resultObj - end def index # 作业消息状态更新 @@ -499,8 +351,8 @@ class StudentWorkController < ApplicationController render_403 return end - @student_work_count = (search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name).count end + end @score = @b_sort == "desc" ? "asc" : "desc" @is_focus = params[:is_focus] ? params[:is_focus].to_i : 0 # 消息传过来的ID diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7392ed8ff..1744fd9af 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -41,7 +41,7 @@ class UsersController < ApplicationController :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, - :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course] + :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -288,6 +288,27 @@ class UsersController < ApplicationController end end + #处理引用作业的请求 + #status 1 同意 2 拒绝 + def dealwith_apply_homework + @msg = CourseMessage.find(params[:msg_id]) + case params[:agree] + when 'Y' + ah = ApplyHomework.where("user_id = ? and homework_common_id = ?",@msg.apply_user_id, @msg.course_message_id) + unless ah.empty? + ah.first.update_column('status', 2) + CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>5,:apply_result=>1) + @msg.update_attributes(:apply_result=>1,:viewed=>1) + end + when 'N' + CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>5,:apply_result=>2) + @msg.update_attributes(:apply_result=>2,:viewed=>1) + end + respond_to do |format| + format.js + end + end + # added by bai def show_score @@ -372,13 +393,38 @@ class UsersController < ApplicationController end # end + #申请引用非公开作业 + def apply_for_homework + if User.current.logged? + homework = HomeworkCommon.find params[:homework_id] + unless homework.nil? + ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework_id].to_i) + if ah.empty? + ApplyHomework.create(:user_id => params[:id].to_i, :homework_common_id => params[:homework_id].to_i, :status => 1) + Mailer.run.apply_for_homework_request(homework, User.current) + CourseMessage.create(:user_id => homework.user_id, :course_id => homework.course.id, :viewed => false,:course_message_id=>params[:homework_id].to_i,:course_message_type=>'HomeworkCommon',:status=>5,:apply_user_id=>params[:id].to_i) + @state = 2 + @ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", params[:id].to_i, params[:homework_id].to_i).first + @homework = homework + else + @state = 3 + end + end + else + @state = 1 + end + respond_to do |format| + format.js + end + end + #用户作业列表 def user_homeworks @order,@b_sort = params[:order] || "created_at",params[:sort] || "desc" @user = User.current @r_sort = @b_sort == "desc" ? "asc" : "desc" - if(params[:type].blank? || params[:type] == "1") #公共题库 - visible_course = Course.where("is_public = 1 && is_delete = 0") + if(params[:type].blank? || params[:type] == "1") #题库 + visible_course = Course.where("is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}") elsif params[:type] == "2" #我的题库 @@ -424,6 +470,14 @@ class UsersController < ApplicationController def choose_user_course homework = HomeworkCommon.find params[:send_id].to_i + if homework.course.is_public == 0 && homework.user_id != User.current.id + ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:send_id].to_i) + if ah.empty? + @status = 2 + elsif ah.first.status == 1 + @status = 1 + end + end if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)} @@ -528,12 +582,18 @@ class UsersController < ApplicationController @order,@b_sort = params[:order] || "created_at",params[:sort] || "desc" @r_sort = @b_sort == "desc" ? "asc" : "desc" @user = User.current - if(params[:type].blank? || params[:type] == "1") #公共题库 - visible_course = Course.where("is_public = 1 && is_delete = 0") + if(params[:type].blank? || params[:type] == "1") #题库 + visible_course = Course.where("is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}") elsif params[:type] == "2" #我的题库 @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}") + elsif params[:type] == "3" #申请题库 + #apply_homeworks = ApplyHomework.where("user_id = ?",@user.id) + #homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")" + #@homeworks = HomeworkCommon.where("id in #{homework_ids}") + sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN apply_homeworks as ah ON homework_commons.id = ah.homework_common_id where ah.user_id = #{@user.id} order by ah.created_at desc" + @homeworks = HomeworkCommon.find_by_sql(sql) end if params[:property] && params[:property] == "1" @homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}") @@ -571,8 +631,8 @@ class UsersController < ApplicationController @user = User.current search = params[:name].to_s.strip.downcase type_ids = params[:property]=="" || params[:property].nil? ? "(1, 2, 3)" : "(" + params[:property] + ")" - if(params[:type].blank? || params[:type] == "1") #全部 - visible_course = Course.where("is_public = 1 && is_delete = 0") + if(params[:type].blank? || params[:type] == "1") #全部 + visible_course = Course.where("is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" all_homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'") all_user_ids = all_homeworks.map{|hw| hw.user_id} @@ -586,7 +646,7 @@ class UsersController < ApplicationController else @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and homework_type in #{type_ids} and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}") end - elsif params[:type] == "2" #课程资源 + elsif params[:type] == "2" #我的题库 if @order == "course_name" sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.user_id = #{@user.id} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}" @homeworks = HomeworkCommon.find_by_sql(sql) @@ -595,6 +655,17 @@ class UsersController < ApplicationController else @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}") end + elsif params[:type] == "3" #申请题库 + apply_homeworks = ApplyHomework.where("user_id = ?",@user.id) + homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")" + if @order == "course_name" + sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.id in #{homework_ids} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}" + @homeworks = HomeworkCommon.find_by_sql(sql) + elsif @order == "user_name" + @homeworks = HomeworkCommon.where("homework_commons.id in #{homework_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}") + else + @homeworks = HomeworkCommon.where("id in #{homework_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}") + end end =begin if params[:property] && params[:property] == "1" @@ -2857,6 +2928,97 @@ class UsersController < ApplicationController end end + def user_courselist + @order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 + + #确定 sort_type + if @order.to_i == @type.to_i + @c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序 + else + @c_sort = 2 + end + + sort_name = "created_at" + sort_type = @c_sort == 1 ? "asc" : "desc" + + if @user.courses.visible.count > 0 + course_order_ids = "(" + CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ") GROUP BY ca.course_id) AS c ").map {|c| c.course_id}.join(",") + ")" + @courses = Course.where("id in #{course_order_ids}").order("#{sort_name} #{sort_type}") + else + @courses = [] + end + + #根据 作业+资源数排序 + if @order.to_i == 2 + @type = 2 + @courses.each do |course| + course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count) + end + @c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]}) + else + @type = 1 + end + + #分页 + @limit = 10 + @is_remote = true + @atta_count = @courses.count + @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @courses = paginateHelper @courses,@limit + + respond_to do |format| + format.js + format.html {render :layout => 'new_base_user'} + end + end + + def user_projectlist + @order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 + + #确定 sort_type + if @order.to_i == @type.to_i + @c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序 + else + @c_sort = 2 + end + + sort_name = "created_on" + sort_type = @c_sort == 1 ? "asc" : "desc" + + if @user.projects.visible.count > 0 + project_order_ids = "(" +ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM (SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ") GROUP BY fa.project_id) AS p ").map {|p| p.project_id}.join(",") + ")" + @projects = Project.where("projects.id in #{project_order_ids}").order("#{sort_name} #{sort_type}") + else + @projects = [] + end + + #根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num + if @order.to_i == 2 + @type = 2 + @projects.each do |project| + project[:infocount] = project.project_score.issue_num+project.project_score.attach_num + end + + @c_sort == 1 ? (@projects = @projects.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@projects = @projects.sort{|x,y| y[:infocount] <=> x[:infocount] }) + else + @type = 1 + end + + #分页 + @limit = 10 + @is_remote = true + @atta_count = @projects.count + @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @projects = paginateHelper @projects,@limit + + respond_to do |format| + format.js + format.html {render :layout => 'new_base_user'} + end + end + private def find_user diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 163e76999..464b4fcc6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3065,7 +3065,27 @@ def host_with_protocol return Setting.protocol + "://" + Setting.host_name end -def strip_html(text,len=0,endss="...") +#将有置顶属性的提到数组前面 #infocount 相同的按时间降序排列 +def sort_by_sticky topics + tmpTopics = [] + tmpIndex = 0 + topics.each do |topic| + if topic.sticky == 1 + tmpTopics[tmpIndex] = topic + tmpIndex = tmpIndex + 1 + end + end + + topics.each do |topic| + if topic.sticky == 0 + tmpTopics[tmpIndex] = topic + tmpIndex = tmpIndex + 1 + end + end + + topics = tmpTopics + return topics +enddef strip_html(text,len=0,endss="...") ss = "" if text.length>0 ss=text.gsub(/<\/?.*?>/, '').strip @@ -3078,5 +3098,4 @@ def strip_html(text,len=0,endss="...") end end return ss -end - +end \ No newline at end of file diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 4faa802a5..b3b014de1 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -5,17 +5,17 @@ module OrganizationsHelper def find_user_not_in_current_org_by_name org - if params[:q] && params[:q].lstrip.rstrip != "" - scope = Principal.active.sorted.not_member_of_org(org).like(params[:q]) - else - scope = [] - end - principals = paginateHelper scope,10 - s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') - links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| - link_to text, org_member_autocomplete_org_member_index_path( parameters.merge(:q => params[:q],:flag => true,:org=>org, :format => 'js')), :remote => true - } - s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) + if params[:q] && params[:q].lstrip.rstrip != "" + scope = Principal.active.sorted.not_member_of_org(org).like(params[:q]) + else + scope = [] + end + principals = paginateHelper scope,10 + s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') + links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| + link_to text, org_member_autocomplete_org_member_index_path( parameters.merge(:q => params[:q],:flag => true,:org=>org, :format => 'js')), :remote => true + } + s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end def get_default_name field diff --git a/app/models/apply_homework.rb b/app/models/apply_homework.rb new file mode 100644 index 000000000..c92eccca6 --- /dev/null +++ b/app/models/apply_homework.rb @@ -0,0 +1,6 @@ +class ApplyHomework < ActiveRecord::Base + #status:1. 待审核 2.审核通过 + belongs_to :user + belongs_to :homework_common + attr_accessible :status, :user_id, :homework_common_id +end diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 79d27f3c5..3375aa5ab 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,8 +1,9 @@ class CourseMessage < ActiveRecord::Base # status说明: status在课程不同的类型,区分不同的功能 status = 9 作品的提交记录 # HomeworkCommon:status: - # nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败 - attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status + # nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败; 5:申请引用作业 + # apply_user_id: 申请者的用户id + attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status, :apply_user_id, :apply_result # 多态 虚拟关联 belongs_to :course_message ,:polymorphic => true diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 664e5cfac..8d8fa7085 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -1041,7 +1041,13 @@ class Mailer < ActionMailer::Base :subject => @subject end - + def apply_for_homework_request(homework, user) + @receive = User.find(homework.user_id) + @user = user + @subject = "#{@user.show_name} #{l(:label_apply_for_homework)} #{homework.name} " + mail :to => @receive.mail, + :subject => @subject + end private diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index edbce26d3..ea494d0f9 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -1,226 +1,78 @@ -
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> -
-
- <% if activity.author.id == User.current.id || User.current.admin? %> - +
+
+ \ No newline at end of file diff --git a/app/views/blogs/_article_list.html.erb b/app/views/blogs/_article_list.html.erb index f3fd1aa61..c52fa017e 100644 --- a/app/views/blogs/_article_list.html.erb +++ b/app/views/blogs/_article_list.html.erb @@ -38,7 +38,7 @@
-
+
<%= @user.name%>的博客
@@ -51,44 +51,9 @@ <% end %> <% if topics%> - <% topics.each do |topic| %> - - <% if topic %> - <%= render :partial => 'blogs/article', :locals => {:activity => topic, :user_activity_id => topic.id} %> - <% end %> - <% end %> - - <%# if topics.count == 10 %> - - <%# end %> + <%= render :partial => 'blogs/article', :locals => {:topics => topics} %> <% end%>
- - <% if topic %> - <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id, :is_course => 1, :is_board=>1} %> - <% end %> - <% end %> - - <% if topics.count == 10 %> - <%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%> - <% end %> -<% end%> +<% if @topics || topics %> + <%= render :partial => 'users/course_boardlist', :locals => {:topics => @topics ? @topics: topics , :is_course => 1, :is_board=>1} %> +<% end %> \ No newline at end of file diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb index 1d5cc3b75..260fb88c1 100644 --- a/app/views/boards/_project_show_detail.html.erb +++ b/app/views/boards/_project_show_detail.html.erb @@ -2,60 +2,7 @@ <%= import_ke(enable_at: false, prettify: false) %> <%= javascript_include_tag "create_kindeditor" %> <% end %> - -<% if topics%> - <% topics.each do |topic| %> - - <% if topic %> - <%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %> - <% end %> - <% end %> - - <% if topics.count == 10 %> - - <%= link_to "点击展开更多", boards_topic_path(@board, :project_id => @board.project.id ,:page => page), :id => "show_more_project_topic",:remote => "true",:class => "loadMore mt10 f_grey"%> - <% end %> -<% end%> - - +<%if @topics || topics %> + <%= render :partial => 'users/project_boardlist', :locals => {:topics => @topics ? @topics: topics , :is_course => 1, :is_board=>1} %> +<% end %> \ No newline at end of file diff --git a/app/views/boards/show.js.erb b/app/views/boards/show.js.erb index c9208fd2c..cb7ee64a1 100644 --- a/app/views/boards/show.js.erb +++ b/app/views/boards/show.js.erb @@ -1,5 +1,5 @@ <% if @course %> - $("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show_detail',:locals => {:topics => @topics, :page => @page} )%>"); + $("#course-boardlist").replaceWith('<%= escape_javascript( render :partial => 'users/course_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1}) %>'); <% else %> - $("#show_more_project_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/project_show_detail',:locals => {:topics => @topics, :page => @page} )%>"); + $("#project-boardlist").replaceWith('<%= escape_javascript( render :partial => 'users/project_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1}) %>'); <% end %> \ No newline at end of file diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index dc3a20482..93df27e42 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -7,7 +7,15 @@ <%= link_to image_tag(url_to_avatar(topic.author), :width => 50,:height => 50,:alt => '贴吧图片'), user_path(topic.author) if topic.author%>
-
<%=topic.subject%>
+
+ <%=topic.subject%> +
+
+ + <%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %> + <%= get_praise_num(topic)%> +
+
<%= topic.content.html_safe%>
@@ -16,12 +24,7 @@
最后回复:<%= author.name%>
<%= format_date(topic.last_reply.created_at)%>
<% end%> - 更新时间:<%= format_date(topic.updated_at)%> -
-
- - <%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %> - <%= get_praise_num(topic)%> + 更新时间:<%= format_date(topic.updated_at)%>
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index c04081128..f5b421f62 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -5,17 +5,18 @@
+ <% end %> <%# if @user.courses.visible.count > 0 - course_order_ids = "(" + - CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM + course_order_ids = "(" + + CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM (SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ") GROUP BY ca.course_id) AS c ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")" - courses = Course.where("id in #{course_order_ids}") - else + courses = Course.where("id in #{course_order_ids}") + else courses = [] - end + end %> - <% if @user.courses.visible.count > 0 - courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) - else - courses = [] - end %> -
- + <% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %> + +
+
+
    + <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %> +
+
+ <% if !courses.empty? %> +
+ +
+ <% end %>
- 项目 - + <%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => "homepageMenuText" %> <% if is_current_user%> <%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%> <% end%>
<%# if @user.projects.visible.count > 0 - project_order_ids = "(" + - ForgeActivity.find_by_sql("SELECT p.project_id, p.updated_at FROM - (SELECT fa.project_id, MAX(fa.updated_at) AS updated_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ") + project_order_ids = "(" + + ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM + (SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ") GROUP BY fa.project_id) AS p - ORDER BY p.updated_at DESC limit 5").map {|p| p.project_id}.join(",") + ")" - projects = Project.where("projects.id in #{project_order_ids}") - else - projects = [] - end - %> - - <% if @user.projects.visible.count > 0 - projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5) + ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")" + projects = Project.where("projects.id in #{project_order_ids}") else projects = [] end %> -
- + + <% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%> +
+
+
    + <%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %> +
+
+ <% if !projects.empty? %> +
+ +
+ <% end %>
@@ -343,6 +353,22 @@ $("#courseMenu").mouseleave(function(){ $("#topnav_course_menu").hide(); }); + + $('#user_hide_course').hide(); + function leftCourseslistChange(){ + $('#homepageLeftMenuCourses').slideToggle(); + $('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon"); + $('#hide_show_courseicon').toggleClass("homepageLeftMenuMoreIcon"); + + } + + $('#user_hide_project').hide(); + function leftProjectslistChange(){ + $('#homepageLeftMenuForge').slideToggle(); + $('#hide_show_projecticon').toggleClass("homepageLeftMenuHideIcon"); + $('#hide_show_projecticon').toggleClass("homepageLeftMenuMoreIcon"); + + } diff --git a/app/views/news/_course_news_detail.html.erb b/app/views/news/_course_news_detail.html.erb index bd3215fb3..e20177536 100644 --- a/app/views/news/_course_news_detail.html.erb +++ b/app/views/news/_course_news_detail.html.erb @@ -4,41 +4,6 @@ <% end %> <% if newss%> - <% newss.each do |news| %> - - <% if news %> - <%= render :partial => 'users/course_news', :locals => {:activity => news, :user_activity_id => news.id} %> - <% end %> - <% end %> - - <% if newss.count == 10 %> - <%= link_to "点击展开更多",news_index_path(:course_id => @course.id ,:page => page),:id => "show_more_course_news",:remote => "true",:class => "loadMore mt10 f_grey"%> - <% end %> + <%= render :partial => 'users/course_newslist', :locals => {:topics => newss} %> <% end%> diff --git a/app/views/news/index.js.erb b/app/views/news/index.js.erb index d2cac877c..c5d5c84aa 100644 --- a/app/views/news/index.js.erb +++ b/app/views/news/index.js.erb @@ -1,5 +1,5 @@ <% if @project %> $("#show_more_project_news").replaceWith("<%= escape_javascript(render :partial => 'project_news_detail', :locals=>{ :all_news=>@newss,:page => @page})%>"); <% else %> - $("#show_more_course_news").replaceWith("<%= escape_javascript( render :partial => 'course_news_detail', :locals =>{:newss => @newss, :page => @page} )%>"); + $("#course-newslist").replaceWith('<%= escape_javascript( render :partial => 'users/course_newslist', :locals => {:topics => @newss}) %>'); <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_content.html.erb b/app/views/organizations/_org_content.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_logined_header.html.erb b/app/views/organizations/_org_logined_header.html.erb index 75ec7106a..22cf920e9 100644 --- a/app/views/organizations/_org_logined_header.html.erb +++ b/app/views/organizations/_org_logined_header.html.erb @@ -1,48 +1,54 @@ -<% if User.current.logged? %> - -<% else %> - -<% end %> - - \ No newline at end of file diff --git a/app/views/organizations/_org_subfield_leftD.html.erb b/app/views/organizations/_org_subfield_leftD.html.erb new file mode 100644 index 000000000..676d5d1c3 --- /dev/null +++ b/app/views/organizations/_org_subfield_leftD.html.erb @@ -0,0 +1,117 @@ +
+

合作伙伴更多

+
+
    +
  • + + +
  • +
  • + + +
  • +
+
+
+
<
+
>
+
+
+
+
+ +<% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> +

暂无内容!

+ <% when 'project' %> +

暂无内容!

+ <% end %> +<% else %> + <% if field.field_type == "Post" %> <%# 讨论类型 %> + <% org_acts = get_subfield_acts field %> + <% unless org_acts.blank? %> + <% org_acts.each do |activity| %> +
+

合作伙伴更多

+
+ <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% end %> + <% elsif 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 %> + <% iamge_path = get_image_path_from_content(message.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %> + <% end %> + <% else %> + <% iamge_path = get_image_path_from_content(message.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %> + <% end %> + <% 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/ad-default.jpg", :width => "369", :height => "169"), news_path(news), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), news_path(news), :target => "_blank" %> + <% end %> + <% end %> + <% end %> +
+
+ <% end %> + <% else %> +
+

合作伙伴更多

+
+
    +
  • + + +
  • +
  • + + +
  • +
+
+
+
<
+
>
+
+
+
+
+ <% end %> + <% elsif field.field_type == "Resource" %> + <% org_attachs = get_attach_org2(field) %> +
+ <% 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 image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %> + <% end %> + <% else %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %> + <% end %> +
+ <% end %> +<% end %> diff --git a/app/views/organizations/_org_subfield_leftM1.html.erb b/app/views/organizations/_org_subfield_leftM1.html.erb new file mode 100644 index 000000000..a987e23cb --- /dev/null +++ b/app/views/organizations/_org_subfield_leftM1.html.erb @@ -0,0 +1,256 @@ +

<%= field.name %>更多

+
+<% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> + <% if @course_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftM1_default', :locals => {:field => field} %> + <% else %> + <% @course_acts.first(1).each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %> +

+ <%= format_date activity.updated_at %> +
+

<%= activity.description.to_s.html_safe %>

+
+
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

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

+ <%= format_date activity.updated_on %> +
+

<%= activity.content.to_s.html_safe %>

+
+
+ <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %> +

+ <%= format_date activity.created_on %> +
+

<%= activity.description.to_s.html_safe %>

+
+
+ <% elsif act.org_act_type == "Poll" %> + <% activity = Poll.find(act.org_act_id) %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% iamge_path = get_image_path_from_content(activity.polls_description) %> + <% if ( activity.polls_status==2) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <% if has_commit %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h3-title" %> + <% else %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h3-title" %> + <% end %> +

+ <%= format_date activity.published_at %> +
+

<%= activity.polls_description.to_s.html_safe %>

+
+
+ <% end %> + <% end %> + <% end %> + <% end %> + <% when 'project' %> + <% if @project_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftM1_default', :locals => {:field => field} %> + <% else %> + <% @project_acts.first(4).each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = Issue.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %> +

+ <%= format_date activity.updated_on %> +
+

<%= activity.description.to_s.html_safe %>

+
+
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

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

+ <%= format_date activity.updated_on %> +
+

<%= activity.content.to_s.html_safe %>

+
+
+ <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %> +

+ 2016-04-08 +
+

<%= activity.description.to_s.html_safe %>

+
+
+ <% end %> + <% end %> + <% end %> + <% end %> +<% else %> + <% if field.field_type == "Post" %> + <% org_acts = get_subfield_acts field %> + <% if org_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftM1_default', :locals => {:field => field} %> + <% else %> + <% org_acts.first(4).each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "h3-title" %> +

+ <%= format_date document.created_at %> +
+

<%= document.content.to_s.html_safe %>

+
+
+ <% 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.parent_id.nil? %> + <% content = message.content%> + <% else %> + <% content = message.parent.content%> + <% end %> + <% 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/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

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

+ <%= format_date message.created_on %> +
+

<%= content.to_s.html_safe %>

+
+
+ <% else %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <% if message.parent_id.nil? %> + <%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "h3-title" %> + <% else %> + <%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "h3-title" %> + <% end %> +

+ <%= format_date message.created_on %> +
+

<%= content.to_s.html_safe %>

+
+
+ <% 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/files-default.jpg", :width => "380", :height => "165"), news_path(news), :target => "_blank", :class =>"sn-news-bigimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), news_path(news), :target => "_blank", :class =>"sn-news-bigimg" %> + <% end %> +

+ <%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "h3-title" %> +

+ <%= format_date news.created_on %> +
+

<%= news.description.to_s.html_safe %>

+
+
+ <% end %> + <% end %> + <% end %> + <% end %> + <% end %> +<% end %> + + diff --git a/app/views/organizations/_org_subfield_leftM1_default.html.erb b/app/views/organizations/_org_subfield_leftM1_default.html.erb new file mode 100644 index 000000000..919d76363 --- /dev/null +++ b/app/views/organizations/_org_subfield_leftM1_default.html.erb @@ -0,0 +1,8 @@ +
+ +

+ +
+

+
+
diff --git a/app/views/organizations/_org_subfield_leftM2.html.erb b/app/views/organizations/_org_subfield_leftM2.html.erb new file mode 100644 index 000000000..aec1a88fe --- /dev/null +++ b/app/views/organizations/_org_subfield_leftM2.html.erb @@ -0,0 +1,233 @@ +
+<% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> + <% if @course_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftM2_default', :locals => {:field => field} %> + <% else %> + <% @course_acts.first(4).each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/right_top.jpg", :width => "85", :height => "85"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %> +

+ <%= format_date activity.updated_at %> +
+
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %> + <% end %> +

+ <%= format_date 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) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %> +

+ <%= format_date activity.created_on %> +
+
+ <% elsif act.org_act_type == "Poll" %> + <% activity = Poll.find(act.org_act_id) %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% iamge_path = get_image_path_from_content(activity.polls_description) %> + <% if ( activity.polls_status==2) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <% if has_commit %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h4-title fl mt10" %> + <% else %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h4-title fl mt10" %> + <% end %> +

+ <%= format_date activity.published_at %> +
+
+ <% end %> + <% end %> + <% end %> + <% end %> + <% when 'project' %> + <% if @project_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftM2_default', :locals => {:field => field} %> + <% else %> + <% @project_acts.first(4).each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = Issue.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %> +

+ <%= format_date activity.updated_on %> +
+
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %> + <% end %> +

+ <%= format_date 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) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %> +

+ <%= format_date activity.created_on %> +
+
+ <% end %> + <% end %> + <% end %> + <% end %> +<% else %> + <% if field.field_type == "Post" %> + <% org_acts = get_subfield_acts field %> + <% if org_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftM2_default', :locals => {:field => field} %> + <% else %> + <% org_acts.first(4).each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "h4-title fl mt10" %> +

+ <%= format_date 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 = Message.find(activity.org_act_id) %> + <% if message.parent_id.nil? %> + <% content = message.content%> + <% else %> + <% content = message.parent.content%> + <% end %> + <% 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/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <% if message.parent_id.nil? %> + <%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h4-title fl mt10" %> + <% else %> + <%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h4-title fl mt10" %> + <% end %> +

+ <%= format_date message.created_on %> +
+
+ <% else %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <% if message.parent_id.nil? %> + <%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "h4-title fl mt10" %> + <% else %> + <%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "h4-title fl mt10" %> + <% end %> +

+ <%= format_date message.created_on %> +
+
+ <% 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/files-default.jpg", :width => "85", :height => "85"), news_path(news), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), news_path(news), :target => "_blank", :class =>"sn-news-smallimg fl" %> + <% end %> +

+ <%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "h4-title fl mt10" %> +

+ <%= format_date news.created_on %> +
+
+ <% end %> + <% end %> + <% end %> + <% end %> + <% end %> +<% end %> +
+
\ No newline at end of file diff --git a/app/views/organizations/_org_subfield_leftM2_default.html.erb b/app/views/organizations/_org_subfield_leftM2_default.html.erb new file mode 100644 index 000000000..1b47d9d5c --- /dev/null +++ b/app/views/organizations/_org_subfield_leftM2_default.html.erb @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/app/views/organizations/_org_subfield_leftMD.html.erb b/app/views/organizations/_org_subfield_leftMD.html.erb new file mode 100644 index 000000000..2db926776 --- /dev/null +++ b/app/views/organizations/_org_subfield_leftMD.html.erb @@ -0,0 +1,258 @@ +
+

<%= field.name %>更多

+
+ <% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> + <% if @course_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %> + <% else %> + <% @course_acts.first(4).each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %> +

+
+ <%= link_to activity.description.to_s.html_safe, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

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

+
+ <%= link_to activity.content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %> +

+
+ <%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% elsif act.org_act_type == "Poll" %> + <% activity = Poll.find(act.org_act_id) %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% iamge_path = get_image_path_from_content(activity.polls_description) %> + <% if ( activity.polls_status==2) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <% if has_commit %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "resources-title" %> + <% else %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "resources-title" %> + <% end %> +

+
+ <%= link_to activity.polls_description.to_s.html_safe, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% end %> + <% end %> + <% end %> + <% end %> + <% when 'project' %> + <% if @project_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %> + <% else %> + <% @project_acts.first(4).each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = Issue.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %> +

+
+ <%= link_to activity.description.to_s.html_safe, issue_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

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

+
+ <%= link_to activity.content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %> +

+
+ <%= link_to activity.content.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% end %> + <% end %> + <% end %> + <% end %> + <% else %> + <% if field.field_type == "Post" %> + <% org_acts = get_subfield_acts field %> + <% if org_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %> + <% else %> + <% org_acts.first(4).each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "resources-title" %> +

+
+ <%= link_to document.content.to_s.html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% 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.parent_id.nil? %> + <% content = message.content%> + <% else %> + <% content = message.parent.content%> + <% end %> + <% 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/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

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

+
+ <%= link_to content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% else %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <% if message.parent_id.nil? %> + <%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "resources-title" %> + <% else %> + <%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "resources-title" %> + <% end %> +

+
+ <%= link_to content.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% 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/files-default.jpg", :width => "185", :height => "125"), news_path(news), :target => "_blank", :class =>"sn-resourcesimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), news_path(news), :target => "_blank", :class =>"sn-resourcesimg" %> + <% end %> +

+ <%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "resources-title" %> +

+
+ <%= link_to news.description.to_s.html_safe, news_path(news), :target => '_blank', :class => "resources-tag" %> +
+ 更多 +
+ <% end %> + <% end %> + <% end %> + <% end %> + <% end %> + <% end %> +
+
+
\ No newline at end of file diff --git a/app/views/organizations/_org_subfield_leftMD_default.html.erb b/app/views/organizations/_org_subfield_leftMD_default.html.erb new file mode 100644 index 000000000..4268c7cc8 --- /dev/null +++ b/app/views/organizations/_org_subfield_leftMD_default.html.erb @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/app/views/organizations/_org_subfield_leftT.html.erb b/app/views/organizations/_org_subfield_leftT.html.erb new file mode 100644 index 000000000..e64044a6b --- /dev/null +++ b/app/views/organizations/_org_subfield_leftT.html.erb @@ -0,0 +1,276 @@ +<% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> + <% if @course_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftT_default', :locals => {:field => field} %> + <% else %> +
+ +
+
+ <% @course_acts.first(4).each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> + + <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> + + <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> + + <% elsif act.org_act_type == "Poll" %> + <% activity = Poll.find(act.org_act_id) %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% iamge_path = get_image_path_from_content(activity.polls_description) %> + <% if ( activity.polls_status==2) %> + + <% end %> + <% end %> + <% end %> +
+
+
+ + + + +
+
+ + +
+
+ <% end %> + <% when 'project' %> + <% if @project_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftT_default', :locals => {:field => field} %> + <% else %> +
+ +
+
+ <% @project_acts.first(4).each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = Issue.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> + + <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> + + <% elsif act.org_act_type == "News" %> + <% activity = News.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> + + <% end %> + <% end %> +
+
+
+ + + + +
+
+ + +
+
+ <% end %> + <% end %> +<% else %> + <% if field.field_type == "Post" %> + <% org_acts = get_subfield_acts field %> + <% if org_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftT_default', :locals => {:field => field} %> + <% else %> +
+ +
+
+ <% org_acts.first(4).each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> + + <% elsif 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 %> + <% if message.parent_id.nil? %> + <% content = message.content%> + <% else %> + <% content = message.parent.content%> + <% end %> + <% iamge_path = get_image_path_from_content(content) %> + + <% else %> + <% if message.parent_id.nil? %> + <% content = message.content%> + <% else %> + <% content = message.parent.content%> + <% end %> + <% iamge_path = get_image_path_from_content(content) %> + + <% 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 %> + <% end %> +<% end %> + + \ No newline at end of file diff --git a/app/views/organizations/_org_subfield_leftT_default.html b/app/views/organizations/_org_subfield_leftT_default.html new file mode 100644 index 000000000..f2f66758f --- /dev/null +++ b/app/views/organizations/_org_subfield_leftT_default.html @@ -0,0 +1,10 @@ +
+ +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/organizations/_org_subfield_rightD.html.erb b/app/views/organizations/_org_subfield_rightD.html.erb new file mode 100644 index 000000000..131ae5183 --- /dev/null +++ b/app/views/organizations/_org_subfield_rightD.html.erb @@ -0,0 +1,73 @@ +<% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> +

暂无内容!

+ <% when 'project' %> +

暂无内容!

+ <% end %> +<% else %> + <% if field.field_type == "Post" %> <%# 讨论类型 %> + <% org_acts = get_subfield_acts field %> + <% unless org_acts.blank? %> + <% activity = org_acts.first %> +
+ <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> + <% end %> + <% elsif 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 %> + <% iamge_path = get_image_path_from_content(message.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %> + <% end %> + <% else %> + <% iamge_path = get_image_path_from_content(message.content) %> + <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %> + <% end %> + <% 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/ad-default.jpg", :width => "369", :height => "169"), news_path(news), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), news_path(news), :target => "_blank" %> + <% end %> + <% end %> + <% end %> +
+ <% else %> +
+ +
+ <% end %> + <% elsif field.field_type == "Resource" %> + <% org_attachs = get_attach_org2(field) %> +
+ <% 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 image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %> + <% end %> + <% else %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %> + <% end %> +
+ <% end %> +<% end %> diff --git a/app/views/organizations/_org_subfield_rightM.html.erb b/app/views/organizations/_org_subfield_rightM.html.erb new file mode 100644 index 000000000..d75b9f20f --- /dev/null +++ b/app/views/organizations/_org_subfield_rightM.html.erb @@ -0,0 +1,98 @@ +<% if is_default_field?(field) %> + <% case field.name %> +<% when 'course' %> +

暂无内容!

+ <% when 'project' %> +

暂无内容!

+ <% end %> +<% else %> + <% if field.field_type == "Post" %> <%# 讨论类型 %> + <% org_acts = get_subfield_acts field %> + <% unless org_acts.blank? %> + <% activity = org_acts.first %> +
+ <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> +

<%= field.name %>

+
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "fl sn-index-wximg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "fl sn-index-wximg" %> + <% end %> +

<%=link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>

+
+
+ <% 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 %> + <% iamge_path = get_image_path_from_content(message.content) %> +

<%= field.name %>

+
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "fl sn-index-wximg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "fl sn-index-wximg" %> + <% end %> +

<%=link_to message.content.to_s.html_safe, board_message_url_in_org(message.board.id, message.id), :target => "_blank" %>

+
+
+ <% else %> + <% iamge_path = get_image_path_from_content(message.content) %> +

<%= field.name %>

+
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), board_message_path(message.board, activity), :target => "_blank", :class => "fl sn-index-wximg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_path(message.board, activity), :target => "_blank", :class => "fl sn-index-wximg" %> + <% end %> +

<%=link_to message.content.to_s.html_safe, board_message_path(message.board, activity), :target => "_blank" %>

+
+
+ <% 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) %> +

<%= field.name %>

+
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), news_path(news), :target => "_blank", :class => "fl sn-index-wximg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), news_path(news), :target => "_blank", :class => "fl sn-index-wximg" %> + <% end %> +

<%=link_to news.description.to_s.html_safe, news_path(news), :target => "_blank" %>

+
+
+ <% end %> + <% end %> +
+ <% else %> +
+

<%= field.name %>

+
+ +

暂无内容!

+
+
+
+ <% end %> + <% elsif field.field_type == "Resource" %> + <% org_attachs = get_attach_org2(field) %> +
+ <% 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 image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %> + <% else %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %> + <% end %> + <% else %> + <%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %> + <% end %> +
+ <% end %> +<% end %> diff --git a/app/views/organizations/_org_subfield_rightT.html.erb b/app/views/organizations/_org_subfield_rightT.html.erb new file mode 100644 index 000000000..e93031991 --- /dev/null +++ b/app/views/organizations/_org_subfield_rightT.html.erb @@ -0,0 +1,223 @@ +
+

<%= field.name %>更多

+<% if is_default_field?(field) %> + <% case field.name %> + <% when 'course' %> + <% if @course_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_rightT_default', :locals => {:field => field} %> + <% else %> + <% @course_acts.first(4).each do |act| %> + <% if act.org_act_type == "HomeworkCommon" %> + <% activity = HomeworkCommon.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/right_top.jpg", :width => "330", :height => "210"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "active-title" %> +

+ <%= format_date activity.updated_at %> +
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

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

+ <%= format_date 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) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "active-title" %> +

+ <%= format_date activity.created_on %> +
+ <% elsif act.org_act_type == "Poll" %> + <% activity = Poll.find(act.org_act_id) %> + <% has_commit = has_commit_poll?(activity.id ,User.current)%> + <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> + <% iamge_path = get_image_path_from_content(activity.polls_description) %> + <% if ( activity.polls_status==2) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <% if has_commit %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "active-title" %> + <% else %> + <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "active-title" %> + <% end %> +

+ <%= format_date activity.published_at %> +
+ <% end %> + <% end %> + <% end %> + <% end %> + <% when 'project' %> + <% if @project_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %> + <% else %> + <% @project_acts.first(4).each do |act| %> + <% if act.org_act_type == "Issue" %> + <% activity = Issue.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.description) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "active-title" %> +

+ <%= format_date activity.updated_on %> +
+ <% elsif act.org_act_type == "Message" %> + <% activity = Message.find(act.org_act_id) %> + <% iamge_path = get_image_path_from_content(activity.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

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

+ <%= format_date 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) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "active-title" %> +

+ <%= format_date activity.created_on %> +
+ <% end %> + <% end %> + <% end %> + <% end %> +<% else %> + <% if field.field_type == "Post" %> + <% org_acts = get_subfield_acts field %> + <% if org_acts.blank? %> + <%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %> + <% else %> + <% org_acts.first(4).each do |activity| %> + <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> + <% document = activity.org_act %> + <% org_subfield_id = params[:org_subfield_id] %> + <% flag = 2 %> + <% iamge_path = get_image_path_from_content(document.content) %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "active-title" %> +

+ <%= format_date 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 = Message.find(activity.org_act_id) %> + <% if message.parent_id.nil? %> + <% content = message.content%> + <% else %> + <% content = message.parent.content%> + <% end %> + <% 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/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

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

+ <%= format_date message.created_on %> +
+ <% else %> +
+ <% if iamge_path.nil? %> + <%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <% if message.parent_id.nil? %> + <%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "active-title" %> + <% else %> + <%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "active-title" %> + <% end %> +

+ <%= format_date message.created_on %> +
+ <% 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/files-default.jpg", :width => "330", :height => "210"), news_path(news), :target => "_blank", :class =>"sn-activeimg" %> + <% else %> + <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), news_path(news), :target => "_blank", :class =>"sn-activeimg" %> + <% end %> +

+ <%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "active-title" %> +

+ <%= format_date news.created_on %> +
+ <% end %> + <% end %> + <% end %> + <% end %> + <% 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 2c679eb3d..5f605f6d9 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -24,7 +24,7 @@
  • 默认
  • <% if field.name == "activity" %> - 默认 + 默认 <% else %> <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
    @@ -60,18 +60,18 @@
  • 新增
  • <% if field.field_type == "Resource" %> - 列表 + 列表 <% else %> - <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> -
    - -
    - <%= select( :name,:group_id, subfield_status_option, - { :include_blank => false,:selected => field.status}, - {:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %> - <% end %> + <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> +
    + +
    + <%= select( :name,:group_id, subfield_status_option, + { :include_blank => false,:selected => field.status}, + {:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %> + <% end %> - <% end %> + <% end %>
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>
  • \ No newline at end of file diff --git a/app/views/users/_course_newslist.html.erb b/app/views/users/_course_newslist.html.erb new file mode 100644 index 000000000..5df06b16f --- /dev/null +++ b/app/views/users/_course_newslist.html.erb @@ -0,0 +1,64 @@ +
    +
    +
    +

    通知列表

    +
    + 排序: + <%= link_to "时间", {:controller => 'news', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %> + <% if @type.to_i == 1 %> + <%= link_to "", {:controller => 'news', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %> + <% end %> + <%= link_to "人气", {:controller => 'news', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %> + <% if @type.to_i == 2 %> + <%= link_to "", {:controller => 'news', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %> + <% end %> +
    +
    +
    + <% topics.each do |activity| %> +
    +
    + <%= link_to activity.title.to_s, news_path(activity), :class => "list-title fl" %> + <% if activity.sticky == 1 %> + + <% end%> + <% u = User.where("id=?",activity.author_id).first%> + + 发布者: <%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %> + +
    +
    +
    +

    <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54} %>

    +
    +
    + 发布时间:<%= format_time(activity.created_on) %> + 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %> + <% count=0 %> + <% count=activity.comments.count %> +

    <%= count>0 ? "#{count}" : "0" %>回复|<%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %>

    +
    +
    +
    + <% end %> +
    +
      + <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> +
    +
    +
    +
    +
    +
    + \ No newline at end of file diff --git a/app/views/users/_homework_repository.html.erb b/app/views/users/_homework_repository.html.erb index 1ed8ae688..72211a0d9 100644 --- a/app/views/users/_homework_repository.html.erb +++ b/app/views/users/_homework_repository.html.erb @@ -19,7 +19,9 @@ <%= homework.name%> - 私有 + <% if homework.course.is_public == 0 %> + 私有 + <% end %>
  • @@ -35,7 +37,20 @@
  • <%= homework.quotes %>
  • <%=format_date homework.publish_time %>
  • -
  • 提交申请
  • + <% if homework.course.is_public == 0 && homework.user_id != User.current.id %> +
  • + <% ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, homework.id).first %> + <% if ah.nil? %> + <%= link_to("提交申请", apply_for_homework_user_path(User.current.id,:homework_id => homework.id), :remote => true) %> + <% elsif ah.status == 1 %> + 待审核 + <% elsif ah.status == 2 %> + 可引用 + <% end %> +
  • + <% else %> +
  • --
  • + <% end %> <% end %>
    \ No newline at end of file diff --git a/app/views/users/_intro_content_ex.html.erb b/app/views/users/_intro_content_ex.html.erb new file mode 100644 index 000000000..ae88fc6ac --- /dev/null +++ b/app/views/users/_intro_content_ex.html.erb @@ -0,0 +1,17 @@ +
    +
    + <%= content.to_s.html_safe%> +
    +
    + \ No newline at end of file diff --git a/app/views/users/_project_boardlist.html.erb b/app/views/users/_project_boardlist.html.erb new file mode 100644 index 000000000..a36020e3d --- /dev/null +++ b/app/views/users/_project_boardlist.html.erb @@ -0,0 +1,80 @@ +
    +
    +
    +

    讨论区列表

    +
    + 排序: + <%= link_to "时间", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %> + <% if @type.to_i == 1 %> + <%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %> + <% end %> + <%= link_to "人气", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %> + <% if @type.to_i == 2 %> + <%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %> + <% end %> +
    +
    +
    + <% topics.each do |activity| %> +
    +
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %> + <% end %> + <% if activity.sticky == 1 %> + + <% end%> + <% if activity.locked %> + + <% end %> + <% u = User.where("id=?",activity.author_id).first%> + + 发帖人:<%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %> + +
    +
    +
    + <% if activity.parent_id.nil? %> + <% content = activity.content %> + <% else %> + <% content = activity.parent.content %> + <% end %> +

    <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54 } %>

    +
    +
    + 发帖时间:<%= format_time(activity.created_on) %> + 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %> + <% count=0 %> + <% if activity.parent %> + <% count=activity.parent.children.count%> + <% else %> + <% count=activity.children.count%> + <% end %> +

    <%= count>0 ? "#{count}" : "0" %>回复|<%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %>

    +
    +
    +
    + <% end %> +
    +
      + <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> +
    +
    +
    +
    +
    +
    + \ No newline at end of file diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 69d209df9..b7df824a4 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -65,7 +65,11 @@ <% case user_activity.act_type.to_s %> <% when 'HomeworkCommon' %> <%# cache (act) do %> - <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> + <% hidden_courses = Setting.find_by_name("hidden_courses") %> + <% unvisiable = hidden_courses && hidden_courses.value == "1"%> + <% if !unvisiable %> + <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> + <% end %> <%# end %> <% when 'News' %> <%# cache [act, act.comments.count] do %> diff --git a/app/views/users/_user_course_list.html.erb b/app/views/users/_user_course_list.html.erb new file mode 100644 index 000000000..ca9420f7d --- /dev/null +++ b/app/views/users/_user_course_list.html.erb @@ -0,0 +1,66 @@ +
    +

    课程列表

    +
    + 排序: + <%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %> + <% if @type.to_i == 1 %> + <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %> + <% end %> + <%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %> + <% if @type.to_i == 2 %> + <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %> + <% end %> +
    +
    + +
    + <% @courses.each do |course|%> +
      +
    • + + <%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "list-title fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}", + :style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%> + <% teacher = User.where("id=?",course.tea_id).first%> + + <%='主讲老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %> + +
    • +
      +
    • + + 创建时间:<%= format_time(course.created_at) %> + + + 开课学期:  <%= current_time_and_term course %> + + <% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %> + <% homework_num = course.homework_commons.count %> + <% else %> + <% homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count %> + <% end %> +

      <%= homework_num %>作业| <%= visable_attachemnts_incourse(course).count %>资源

      +
    • +
      +
    + <% end %> +
    +
      + <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index ccd329852..cfde9d4bd 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -229,7 +229,36 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 5 %> + + <% end %> <% if ma.course_message_type == "Poll" %>