commit
7d0a53ec86
@ -0,0 +1,46 @@
|
||||
module Mobile
|
||||
module Entities
|
||||
class Message < Grape::Entity
|
||||
include ApplicationHelper
|
||||
include ApiHelper
|
||||
def self.message_expose(f)
|
||||
expose f do |u,opt|
|
||||
if u.is_a?(Hash) && u.key?(f)
|
||||
u[f]
|
||||
elsif u.is_a?(::Message)
|
||||
if u.respond_to?(f)
|
||||
if f == :created_on
|
||||
format_time( u.send(f))
|
||||
else
|
||||
u.send(f)
|
||||
end
|
||||
else
|
||||
# case f
|
||||
# when :xx
|
||||
# #
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
expose :user, using: Mobile::Entities::User do |c, opt|
|
||||
if c.is_a?(::Message)
|
||||
c.author
|
||||
end
|
||||
end
|
||||
message_expose :board_id
|
||||
message_expose :subject
|
||||
message_expose :content
|
||||
message_expose :replies_count
|
||||
message_expose :created_on
|
||||
message_expose :id
|
||||
expose :message_children,using:Mobile::Entities::Message do |c,opt|
|
||||
if c.is_a? (::Message)
|
||||
c.children
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,45 @@
|
||||
module Mobile
|
||||
module Entities
|
||||
class StudentWork < Grape::Entity
|
||||
include ApplicationHelper
|
||||
include ApiHelper
|
||||
def self.student_work_expose(f)
|
||||
expose f do |u,opt|
|
||||
if u.is_a?(Hash) && u.key?(f)
|
||||
u[f]
|
||||
elsif u.is_a?(::StudentWork)
|
||||
if u.respond_to?(f)
|
||||
if f == :created_at
|
||||
format_time(u.send(:created_at))
|
||||
else
|
||||
u.send(f)
|
||||
end
|
||||
|
||||
else
|
||||
case f
|
||||
when :student_id
|
||||
u.user.user_extensions.student_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
expose :user, using: Mobile::Entities::User do |c, opt|
|
||||
if c.is_a?(::StudentWork)
|
||||
c.user
|
||||
end
|
||||
end
|
||||
student_work_expose :student_id
|
||||
student_work_expose :id
|
||||
student_work_expose :name
|
||||
student_work_expose :description
|
||||
student_work_expose :final_score
|
||||
student_work_expose :teacher_score
|
||||
student_work_expose :student_score
|
||||
student_work_expose :teacher_asistant_score
|
||||
student_work_expose :created_at
|
||||
end
|
||||
end
|
||||
end
|
@ -1,149 +1,149 @@
|
||||
module HomeworkAttachHelper
|
||||
#判断是否具有删除的权限
|
||||
def attach_delete(project)
|
||||
if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
#作业添加、编辑界面的tab页
|
||||
def homework_settings_tabs f
|
||||
@f = f
|
||||
tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
||||
{:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
||||
]
|
||||
end
|
||||
|
||||
#作业可选成员列表分页
|
||||
def render_new_members_for_homework members
|
||||
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
||||
#scope = project.members
|
||||
#principals = paginateHelper members,10
|
||||
#principals = members
|
||||
#principal_count = members.count
|
||||
#limit = 10
|
||||
#principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||
#offset ||= principal_pages.offset
|
||||
#principals = members[offset, limit]
|
||||
users = members.map(&:user)
|
||||
s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', users), :id => 'principals')
|
||||
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||
link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@homework)), :remote => true }
|
||||
return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
||||
end
|
||||
|
||||
#扩展的checkbox生成
|
||||
def member_check_box_tags_ex(name, principals)
|
||||
s = ''
|
||||
principals.each do |member|
|
||||
s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.name }</label><br/>"
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
||||
def paginateHelper obj, pre_size=20
|
||||
@obj_count = obj.count
|
||||
@obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
|
||||
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
|
||||
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
|
||||
elsif obj.kind_of? Array
|
||||
obj[@obj_pages.offset, @obj_pages.per_page]
|
||||
else
|
||||
logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
|
||||
raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||
end
|
||||
end
|
||||
|
||||
def user_projects_option
|
||||
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||
memberships = User.current.memberships.all(:conditions => cond)
|
||||
projects = memberships.map(&:project)
|
||||
not_have_project = []
|
||||
not_have_project << Setting.please_chose
|
||||
not_have_project << 0
|
||||
type = []
|
||||
type << not_have_project
|
||||
projects.each do |project|
|
||||
if project != nil
|
||||
option = []
|
||||
option << project.name
|
||||
option << project.id
|
||||
type << option
|
||||
end
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#判断指定用户是不是已经赞过该作业
|
||||
def is_praise_homework user_id, obj_id
|
||||
PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").empty?
|
||||
end
|
||||
|
||||
#获取赞的总数
|
||||
def praise_homework_count obj_id
|
||||
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
|
||||
end
|
||||
|
||||
#获取用户对作业的评分
|
||||
def get_homework_score user, homework
|
||||
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
|
||||
@m_score = temp.nil? ? 0:temp.stars.to_i
|
||||
end
|
||||
|
||||
#获取评分对应的评论
|
||||
def get_homework_review homework,is_teacher,user
|
||||
homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
|
||||
end
|
||||
|
||||
def convert_array array
|
||||
ary = "("
|
||||
if array.nil? || array.count == 0
|
||||
return "()"
|
||||
end
|
||||
array.length.times do |i|
|
||||
if i == array.length - 1
|
||||
ary += array[i].id.to_s + ")"
|
||||
else
|
||||
if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "")
|
||||
ary += array[i].id.to_s + ","
|
||||
end
|
||||
end
|
||||
end
|
||||
#array.each do |member|
|
||||
# if member == array.last
|
||||
# ary += member.id.to_s + ")"
|
||||
# else
|
||||
# ary += member.id.to_s + ","
|
||||
# end
|
||||
#end
|
||||
ary
|
||||
end
|
||||
|
||||
def get_student_batch_homework_list bid,user
|
||||
student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC")
|
||||
student_batch_homework_list
|
||||
end
|
||||
|
||||
#########################################################
|
||||
#sw
|
||||
#获取学生未进行匿评的数量
|
||||
#param: bid => 作业 user => 用户
|
||||
#return 指定用户未进行匿评的作业的数量
|
||||
#user必须是学生用户
|
||||
#######################################################
|
||||
def get_student_not_batch_homework_list bid,user
|
||||
HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id}) AS table1
|
||||
WHERE table1.m_score IS NULL").count
|
||||
end
|
||||
# #判断是否具有删除的权限
|
||||
# def attach_delete(project)
|
||||
# if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
# #作业添加、编辑界面的tab页
|
||||
# def homework_settings_tabs f
|
||||
# @f = f
|
||||
# tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
||||
# {:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
||||
# ]
|
||||
# end
|
||||
#
|
||||
# #作业可选成员列表分页
|
||||
# def render_new_members_for_homework members
|
||||
# #scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
||||
# #scope = project.members
|
||||
# #principals = paginateHelper members,10
|
||||
# #principals = members
|
||||
# #principal_count = members.count
|
||||
# #limit = 10
|
||||
# #principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||
# #offset ||= principal_pages.offset
|
||||
# #principals = members[offset, limit]
|
||||
# users = members.map(&:user)
|
||||
# s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', users), :id => 'principals')
|
||||
# links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||
# link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@homework)), :remote => true }
|
||||
# return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
||||
# end
|
||||
#
|
||||
# #扩展的checkbox生成
|
||||
# def member_check_box_tags_ex(name, principals)
|
||||
# s = ''
|
||||
# principals.each do |member|
|
||||
# s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.name }</label><br/>"
|
||||
# end
|
||||
# s.html_safe
|
||||
# end
|
||||
#
|
||||
# def paginateHelper obj, pre_size=20
|
||||
# @obj_count = obj.count
|
||||
# @obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
|
||||
# if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
|
||||
# obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
|
||||
# elsif obj.kind_of? Array
|
||||
# obj[@obj_pages.offset, @obj_pages.per_page]
|
||||
# else
|
||||
# logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
|
||||
# raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def user_projects_option
|
||||
# cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||
# memberships = User.current.memberships.all(:conditions => cond)
|
||||
# projects = memberships.map(&:project)
|
||||
# not_have_project = []
|
||||
# not_have_project << Setting.please_chose
|
||||
# not_have_project << 0
|
||||
# type = []
|
||||
# type << not_have_project
|
||||
# projects.each do |project|
|
||||
# if project != nil
|
||||
# option = []
|
||||
# option << project.name
|
||||
# option << project.id
|
||||
# type << option
|
||||
# end
|
||||
# end
|
||||
# type
|
||||
# end
|
||||
#
|
||||
# #判断指定用户是不是已经赞过该作业
|
||||
# def is_praise_homework user_id, obj_id
|
||||
# PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").empty?
|
||||
# end
|
||||
#
|
||||
# #获取赞的总数
|
||||
# def praise_homework_count obj_id
|
||||
# PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
|
||||
# end
|
||||
#
|
||||
# #获取用户对作业的评分
|
||||
# def get_homework_score user, homework
|
||||
# temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
|
||||
# @m_score = temp.nil? ? 0:temp.stars.to_i
|
||||
# end
|
||||
#
|
||||
# #获取评分对应的评论
|
||||
# def get_homework_review homework,is_teacher,user
|
||||
# homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
|
||||
# end
|
||||
#
|
||||
# def convert_array array
|
||||
# ary = "("
|
||||
# if array.nil? || array.count == 0
|
||||
# return "()"
|
||||
# end
|
||||
# array.length.times do |i|
|
||||
# if i == array.length - 1
|
||||
# ary += array[i].id.to_s + ")"
|
||||
# else
|
||||
# if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "")
|
||||
# ary += array[i].id.to_s + ","
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# #array.each do |member|
|
||||
# # if member == array.last
|
||||
# # ary += member.id.to_s + ")"
|
||||
# # else
|
||||
# # ary += member.id.to_s + ","
|
||||
# # end
|
||||
# #end
|
||||
# ary
|
||||
# end
|
||||
#
|
||||
# def get_student_batch_homework_list bid,user
|
||||
# student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
|
||||
# (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
|
||||
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score
|
||||
# FROM homework_attaches
|
||||
# INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
# WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC")
|
||||
# student_batch_homework_list
|
||||
# end
|
||||
#
|
||||
# #########################################################
|
||||
# #sw
|
||||
# #获取学生未进行匿评的数量
|
||||
# #param: bid => 作业 user => 用户
|
||||
# #return 指定用户未进行匿评的作业的数量
|
||||
# #user必须是学生用户
|
||||
# #######################################################
|
||||
# def get_student_not_batch_homework_list bid,user
|
||||
# HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
|
||||
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score
|
||||
# FROM homework_attaches
|
||||
# INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
# WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id}) AS table1
|
||||
# WHERE table1.m_score IS NULL").count
|
||||
# end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class Dts < ActiveRecord::Base
|
||||
attr_accessible :Category, :Defect, :Description, :File, :IPLine, :IPLineCode, :Method, :Num, :PreConditions, :Review, :StartLine, :TraceInfo, :Variable, :project_id
|
||||
|
||||
belongs_to :project
|
||||
end
|
@ -0,0 +1,42 @@
|
||||
# encoding: utf-8
|
||||
class StudentWorkTest < ActiveRecord::Base
|
||||
attr_accessible :student_work_id, :homework_test_id, :result
|
||||
|
||||
belongs_to :homework_test
|
||||
belongs_to :student_work
|
||||
|
||||
def status_to_s
|
||||
case self.result.to_i
|
||||
when -1
|
||||
'编译出错'
|
||||
when -2
|
||||
'答题错误'
|
||||
when -3
|
||||
'答案错误'
|
||||
when 1
|
||||
'运行出错'
|
||||
when 2
|
||||
'超时'
|
||||
when 3
|
||||
'内存超出'
|
||||
when 4
|
||||
'输出超出'
|
||||
when 5
|
||||
'禁用函数'
|
||||
when 6
|
||||
'其他错误'
|
||||
when 0
|
||||
'成功'
|
||||
else
|
||||
'未知错误'
|
||||
end
|
||||
end
|
||||
|
||||
def test_score
|
||||
if self.result.to_i == 0
|
||||
format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count)
|
||||
else
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
class Visitor < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
end
|
@ -0,0 +1,76 @@
|
||||
<div class="contextual">
|
||||
<%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
|
||||
</div>
|
||||
|
||||
<h3>
|
||||
<%=l(:label_course_all)%>
|
||||
</h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset>
|
||||
<label for='name'>
|
||||
课程:
|
||||
</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<a class="icon icon-reload" onclick="$('#name').val('')" style="cursor: pointer;text-decoration: none;">
|
||||
<%= l(:button_clear)%>
|
||||
</a>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
课程
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
主讲老师
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
学时
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
<%=l(:field_is_public)%>
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
<%=l(:field_created_on)%>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= course.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
|
||||
<span>
|
||||
<%= link_to(course.name, course_path(course.id)) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= course.class_period %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= checked_image course.is_public? %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(course.created_at) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_course_all)) -%>
|
@ -1,4 +1,8 @@
|
||||
<% if @source_type=='User' %>
|
||||
var imgSpan = $("img[nhname='avatar_image']");
|
||||
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
|
||||
<% else %>
|
||||
var imgSpan = jQuery('#avatar_image');
|
||||
|
||||
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
|
||||
|
||||
<% end %>
|
@ -1,10 +1,10 @@
|
||||
<!-- huang -->
|
||||
<h3><%=l(:label_newtype_contest)%></h3>
|
||||
<!--<!– huang –>-->
|
||||
<!--<h3><%=l(:label_newtype_contest)%></h3>-->
|
||||
|
||||
<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %>
|
||||
<div class="box tabular">
|
||||
<%= render :partial => 'form_contest', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %>-->
|
||||
<!--<div class="box tabular">-->
|
||||
<!--<%= render :partial => 'form_contest', :locals => { :f => f } %>-->
|
||||
<!--<%= submit_tag l(:button_create) %>-->
|
||||
<!--<%= javascript_tag "$('#bid_name').focus();" %>-->
|
||||
<!--<% end %>-->
|
||||
<!--</div>-->
|
@ -1,44 +1,48 @@
|
||||
<script>$(function(){$("img").removeAttr("alt");});</script>
|
||||
<div class="borad-topic-count">共有 <%=link_to @forum.memos.count %> 个贴子</div>
|
||||
<div style="padding-top: 10px">
|
||||
<% if memos.any? %>
|
||||
<% memos.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr><td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%></td>
|
||||
<td>
|
||||
<table width="630px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px" class="<%= topic.sticky ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %></td>
|
||||
<td align="right" rowspan="3">
|
||||
<table class="borad-count">
|
||||
<tr>
|
||||
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">回答</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" ><span class="font_description"> </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
|
||||
<span class="font_description2">
|
||||
<% author = topic.last_reply.try(:author)%>
|
||||
<% if author%>
|
||||
最后回复:<%=link_to_user author %>
|
||||
<% end%>
|
||||
</span>
|
||||
<br />
|
||||
</span></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
<% if memos.any? %>
|
||||
<% memos.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" style="width: 50px;">
|
||||
<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%>
|
||||
</td>
|
||||
<td>
|
||||
<table width="630px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px" class="<%= topic.sticky ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %></td>
|
||||
<td align="right" rowspan="3">
|
||||
<table class="borad-count">
|
||||
<tr>
|
||||
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">回答</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" ><span class="font_description"> </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
|
||||
<span class="font_description2">
|
||||
<% author = topic.last_reply.try(:author)%>
|
||||
<% if author%>
|
||||
最后回复:<%=link_to_user author %>
|
||||
<% end%>
|
||||
</span>
|
||||
<br />
|
||||
</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
@ -1,54 +1,42 @@
|
||||
<!-- added by fq -->
|
||||
<div id="add-memo" class='lz' style="<% unless @memo.errors.any?%>display: none;<% end %> padding: 20px;">
|
||||
<h3>
|
||||
<%=l(:label_memo_new)%>
|
||||
</h3>
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
|
||||
<div class="actions" style="max-width:680px">
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<p>
|
||||
<%= f.text_field :subject, :required => true, :maxlength => 50%>
|
||||
</p>
|
||||
<p style="max-width:680px">
|
||||
<%= f.kindeditor :content, :required => true %>
|
||||
</p>
|
||||
<!--<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>-->
|
||||
<p style="color: #ff0000">
|
||||
(<%= l(:label_memos_max_length) %>)
|
||||
</p>
|
||||
<p class="fl" style="margin-top: 5px;">
|
||||
<%= l(:label_attachment_plural) %>
|
||||
<br />
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<%= f.submit :value => l(:label_memo_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h3>
|
||||
<%=l(:label_memo_new)%>
|
||||
</h3>
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
|
||||
<div class="actions" style="max-width:680px">
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<p>
|
||||
<%= f.text_field :subject, :required => true, :maxlength => 50%>
|
||||
</p>
|
||||
<p style="max-width:680px">
|
||||
<%= f.kindeditor :content, :required => true %>
|
||||
</p>
|
||||
<!--<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>-->
|
||||
<p style="color: #ff0000">
|
||||
(<%= l(:label_memos_max_length) %>)
|
||||
</p>
|
||||
<p class="fl" style="margin-top: 5px;">
|
||||
<%= l(:label_attachment_plural) %>
|
||||
<br />
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<%= f.submit :value => l(:label_memo_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--modified by huang-->
|
||||
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
||||
<span class="contextual-borad">
|
||||
<%= link_to(
|
||||
image_tag('edit.png')+l(:label_forum_edit),
|
||||
{:action => 'edit', :id => @forum},
|
||||
:method => 'get',
|
||||
:title => l(:button_edit)
|
||||
) if @forum.editable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
image_tag('delete.png')+'删除讨论区',
|
||||
{:action => 'destroy', :id => @forum},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
<%= link_to(image_tag('edit.png')+l(:label_forum_edit),{:action => 'edit', :id => @forum}, :method => 'get', :title => l(:button_edit)) if @forum.editable_by?(User.current) %>
|
||||
<%= link_to(image_tag('delete.png')+'删除讨论区', {:action => 'destroy', :id => @forum}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete)
|
||||
) if @forum.destroyable_by?(User.current) %>
|
||||
</span>
|
||||
<span>
|
||||
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
|
||||
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
|
||||
</span>
|
||||
|
||||
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>
|
||||
|
@ -0,0 +1,30 @@
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= error_messages_for 'homework_common' %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_course_homework_new)%>
|
||||
</h2>
|
||||
</div>
|
||||
<% if @homework_type == "1"%>
|
||||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<% elsif @homework_type == "2"%>
|
||||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= hidden_field_tag "homework_common[homework_type]","2"%>
|
||||
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
@ -0,0 +1,13 @@
|
||||
<div id="Footer">
|
||||
<ul class="copyright" style="text-align:center;">
|
||||
<li><%= @organizer.description.html_safe %></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<ul class="footlogo">
|
||||
<% @companies && @companies.each do |company| %>
|
||||
<li class="fl" style="margin:0 8px;">
|
||||
<a href="<%= company.url %>" target="_blank" title="<%=company.name%>"><img src="<%= url_to_avatar(company) %>" width="100" height="30" alt="<%=company.name%>" /></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
@ -0,0 +1,77 @@
|
||||
<div id="Header" >
|
||||
<div class="logo fl" >
|
||||
<%=link_to image_tag("/images/logo.png",weight:"35px", height: "30px")%>
|
||||
</div>
|
||||
<div id="TopNav" class="fl">
|
||||
<%= render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
|
||||
</div>
|
||||
<div id="TopUser" class="fr">
|
||||
<div id="menu">
|
||||
<ul class="menu">
|
||||
<% if User.current.logged? %>
|
||||
<li>
|
||||
<%=link_to_user(User.current)%><!--<a href="javascript:void(0);" class="parent">用户名称</a>-->
|
||||
<ul>
|
||||
<% hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||
visiable = hidden_non_project && hidden_non_project.value == "0"%>
|
||||
<% if @show_course == 1 && !visiable %>
|
||||
<%# if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
||||
<% hasCourse=false %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<% hasCourse=true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if hasCourse %>
|
||||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
|
||||
<ul>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<%# end -%>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.projects.count>0 %>
|
||||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
|
||||
<ul>
|
||||
<% User.current.projects.each do |project| %>
|
||||
<li title="<%=project.name%>"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>"><%=project.name%></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><a href="<%= url_for(:controller => 'my', :action => 'account') %>">编辑资料</a></li>
|
||||
<!--<li><a href="javascript:void(0);" class="parent">我的课程</a>-->
|
||||
<!--<ul>-->
|
||||
<!--<li><a href="javascript:void(0);">新建课程</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的课程0我的课程我的课程01我的课程011</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
|
||||
<!--</ul><!–-level3 end-–>-->
|
||||
<!--</li><!–-level2 end-–>-->
|
||||
<!--<li><a href="javascript:void(0);" class="parent">我的项目</a>-->
|
||||
<!--<ul>-->
|
||||
<!--<li><a href="javascript:void(0);">新建项目</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的项目01</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的项目0</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);">我的项目02</a></li>-->
|
||||
<!--</ul><!–-level3 end-–>-->
|
||||
<!--</li><!–-level2 end-–>-->
|
||||
<!--<li><a href="javascript:void(0);">我的主页</a></li>-->
|
||||
</ul>
|
||||
</li><!---level1 end--->
|
||||
<!--<li ><a href="javascript:void(0);">退出</a></li>-->
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= render_menu :account_menu -%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue