Merge branch 'szzh' into develop

Conflicts:
	app/views/contests/show_attendingcontest.html.erb
	db/schema.rb
This commit is contained in:
yanxd 2014-05-20 14:33:50 +08:00
commit d47facc9e8
73 changed files with 1665 additions and 589 deletions

View File

@ -1,4 +1,4 @@
<html>
<html>
<head>
<title>
@ -8,15 +8,15 @@ Client
<body>
<hr />
<h2>这是一张图片</h2>
<h2>这是一张图片</h2>
<p>photo<a href="http://10.0.47.15:3000/shares/new?access_token='2d3dda45dsd'&comment='verygood'&title=davide&share_type=1&url=http://www.baidu.com"> Share A </a></p>
<hr />
<h2>这是一段视频</h2>
<h2>这是一段视频</h2>
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=kaka&share_type=2&url=http://www.sina.com"> Share B </a></p>
<hr />
<h2>这是一篇文章</h2>
<h2>这是一篇文章</h2>
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=pepe&share_type=3&url=http://www.sina.com"> Share C </a></p>
<hr />

View File

@ -276,10 +276,18 @@ class AccountController < ApplicationController
set_autologin_cookie(user)
end
call_hook(:controller_account_success_authentication_after, {:user => user })
#by young
# redirect_back_or_default my_page_path
redirect_back_or_default User.current
# redirect_to User.current
code = /\d*/
#根据home_url生产正则表达式
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
if code=~params[:back_url]
redirect_to user_activities_path(user)
else
#by young
#redirect_back_or_default my_page_path
redirect_back_or_default User.current
#redirect_to User.current
end
end
def set_autologin_cookie(user)

View File

@ -22,7 +22,6 @@ class AttachmentsController < ApplicationController
before_filter :authorize_global, :only => :upload
before_filter :login_without_softapplication, only: [:download]
accept_api_auth :show, :download, :upload
def show
@ -125,7 +124,7 @@ class AttachmentsController < ApplicationController
end
respond_to do |format|
format.html { redirect_to_referer_or project_path(@project) }
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum,@attachment.container) }
format.js
end
end
@ -224,4 +223,11 @@ private
referer = request.headers['Referer']
require_login unless referer =~ /softapplication/
end
def renderTag
@attachmentNew = Attachment.find(params[:attchmentId])
respond_to do |format|
format.js
end
end
end

View File

@ -18,6 +18,8 @@ class BidsController < ApplicationController
helper :attachments
include AttachmentsHelper
include ApplicationHelper
include BidsHelper
helper :projects
helper :words
helper :welcome
@ -503,10 +505,12 @@ class BidsController < ApplicationController
#删除已提交的项目作业(不删项目)
def delete
binding_project = params[:binding_project]
if BidingProject.delete(binding_project)
redirect_to project_for_bid_path
else
redirect_to 403;
if can_delete_project_homework(BidingProject.find(binding_project),User.current)
if BidingProject.delete(binding_project)
redirect_to project_for_bid_path
else
redirect_to 403;
end
end
end
## 新建留言
@ -728,9 +732,9 @@ class BidsController < ApplicationController
def update
@bid = Bid.find(params[:id])
@project = @bid.courses.first#Project.find(params[:course_id])
if @bid.update_attributes(params[:bid])
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
if @bid.update_attributes(params[:bid]) && @bid.save
flash[:notice] = l(:label_update_homework_succeed)
#@project = Project.find(params[:course_id])
redirect_to project_homework_path(@project)
else
@bid.safe_attributes = params[:bid]

View File

@ -52,16 +52,59 @@ class FilesController < ApplicationController
end
def create
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
attachments = Attachment.attach_filesex(container, params[:attachments],params[:attachment_type])
render_attachment_warning_if_needed(container)
if params[:tag_name]
tag_saveEx
render :text =>"success"
else
@addTag=false
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
attachments = Attachment.attach_filesex(container, params[:attachments],params[:attachment_type])
render_attachment_warning_if_needed(container)
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.attachments_added(attachments[:files]).deliver
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.attachments_added(attachments[:files]).deliver
end
redirect_to project_files_path(@project)
end
redirect_to project_files_path(@project)
end
def tag_saveEx
@tags = params[:tag_name][:name]
@obj_id = params[:object_id]
@obj_flag = params[:object_flag]
case @obj_flag
when '1' then
@obj = User.find_by_id(@obj_id)
when '2' then
@obj = Project.find_by_id(@obj_id)
when '3' then
@obj = Issue.find_by_id(@obj_id)
when '4' then
@obj = Bid.find_by_id(@obj_id)
when '5' then
@obj = Forum.find_by_id(@obj_id)
when '6'
@obj = Attachment.find_by_id(@obj_id)
when '7' then
@obj = Contest.find_by_id(@obj_id)
when '8'
@obj = OpenSourceProject.find_by_id(@obj_id)
else
@obj = nil
end
unless @obj.nil?
@obj.tag_list.add(@tags.split(","))
else
return
end
if @obj.save
## 执行成功的操作。
else
#捕获异常
end
end
# 返回制定资源类型的资源列表
def getattachtype
sort_init 'created_on', 'desc'

View File

@ -0,0 +1,90 @@
class HomeworkAttachController < ApplicationController
#显示作业信息
def show
@homework = HomeworkAttach.find(params[:id])
# 打分统计
stars_reates = @homework.
rates(:quality)
stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
stars_status = stars_reates.select("stars, count(*) as scount").
group("stars")
@stars_status_map = Hash.new(0.0)
stars_status.each do |star_status|
percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f
percent_m = format("%.2f", percent)
@stars_status_map["star#{star_status.stars.to_i}".to_sym] =
percent_m.to_s + "%"
end
@jours = @homework.journals_for_messages.order("created_on DESC")
@limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
end
#删除留言
def destroy
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
#@homework = HomeworkAttach.find(params[:id])
#@jours = @homework.journals_for_messages.order("created_on DESC")
#@limit = 10
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
#@jour = @jours[@offset, @limit]
respond_to do |format|
format.js
end
end
#添加留言
def addjours
@homework = HomeworkAttach.find(params[:jour_id])
@homework.addjours User.current.id, params[:new_form][:user_message],0
@jours = @homework.journals_for_messages.order("created_on DESC")
#@limit = 10
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
#@jour = @jours[@offset, @limit]
respond_to do |format|
format.js
end
end
#获取指定作业的平均得分
def score
#stars_reates = @homework.rates(:quality)
#percent = 0
#stars_reates.each do |star_reates|
# percent = percent + star_reates.stars
#end
#stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
#result = percent * 1.0 / stars_reates_count
#result
end
#添加回复
def add_jour_reply
parent_id = params[:reference_id]
author_id = User.current.id
reply_user_id = params[:reference_user_id]
reply_id = params[:reference_message_id] # 暂时不实现
content = params[:user_notes]
options = {:user_id => author_id,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:is_readed => false}
@jfm = JournalsForMessage.new(options)
@jfm.save
respond_to do |format|
format.js{
@save_succ = true if @jfm.errors.empty?
}
end
end
end

View File

@ -0,0 +1,3 @@
class HomeworkUsersController < ApplicationController
end

View File

@ -15,9 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ProjectsController < ApplicationController
# if @project.project_type == 1
# layout 'base_projects'# by young
layout :select_project_layout
menu_item :overview
menu_item :roadmap, :only => :roadmap
menu_item :settings, :only => :settings
@ -32,18 +31,7 @@ class ProjectsController < ApplicationController
menu_item :feedback, :only => :feedback
menu_item l(:label_course_file), :only => :index
menu_item l(:label_course_news), :only => :index
# end
# layout 'base_courses'# by young
# menu_item :overview
# menu_item l(:label_homework), :only => :homework
# menu_item :files, :only => :files
#
# layout 'base_courses'
# menu_item l(:label_homework), :only => homework
# menu_item l(:label_course_file), :only => files
# menu_item l(:label_settings), :only => settings
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise]
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
@ -52,11 +40,11 @@ class ProjectsController < ApplicationController
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen]
before_filter :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
#by young
# before_filter :member, :file, :statistics, :watcherlist
# modified by fq
before_filter :file, :statistics, :watcherlist
#
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
@ -89,27 +77,6 @@ class ProjectsController < ApplicationController
### added by william
include ActsAsTaggableOn::TagsHelper
# Lists visible projects
# def index
# respond_to do |format|
# format.html {
# scope = Project
# unless params[:closed]
# scope = scope.active
# end
# @projects = scope.visible.order('lft').all
# }
# format.api {
# @offset, @limit = api_offset_and_limit
# @project_count = Project.visible.count
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
# }
# format.atom {
# projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
# render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
# }
# end
# end
def enterprise_course
session[:enterprise_college] = 2
respond_to do |format|
@ -384,36 +351,6 @@ class ProjectsController < ApplicationController
end
#gcmend
# def search
# #modified by nie
# project_type = params[:project_type].to_i
# projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
# @projects = projects_all.visible
# @projects = @projects.visible.like(params[:name]) if params[:name].present?
# @offset, @limit = api_offset_and_limit({:limit => 10})
# @project_count = @projects.visible.count
# @project_pages = Paginator.new @project_count, @limit, params['page']
# @offset ||= @project_pages.offset
# @projects = @projects.visible.offset(@offset).limit(@limit).all
# respond_to do |format|
# format.html {
# render :layout => 'base'
# scope = Project
# unless params[:closed]
# scope = scope.active
# end
# }
# format.api {
# # @offset, @limit = api_offset_and_limit
# # @project_count = Project.visible.count
# # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
# }
# format.atom {
# projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
# render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
# }
# end
# end
# added by fq
def new_join
@ -861,22 +798,7 @@ class ProjectsController < ApplicationController
memberlist
end
# def news
# if @project.project_type == 1
# render :layout => 'base_courses'
# end
# end
def file
# if @project.project_type == 1
# render :layout => 'base_courses'
# end
# @course_tag = params[:course]
# if @course_tag == '1'
# render :layout => 'base_courses'
# end
# User.current
end
def statistics
@ -999,12 +921,8 @@ class ProjectsController < ApplicationController
# end
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
# TODO:#finishcourse and #restartcourse 没有设置权限也就是说任何人的调用都会关闭or重启课程。
# 最好通过用户与项目的权限解决这种事情。还没写
def finishcourse
#course_prefs = Course.find_by_extra(@project.identifier)
# setup_time = Time.parse(course_prefs.setup_time)
# end_time = Time.parse(course_prefs.endup_time)
yesterday = Date.today.prev_day.to_time
@course_prefs.endup_time = yesterday
@ -1016,7 +934,6 @@ class ProjectsController < ApplicationController
end
def restartcourse
#course_prefs = Course.find_by_extra(@project.identifier)
day = Time.parse("3000-01-01")
@course_prefs.endup_time = day
@ -1030,6 +947,14 @@ class ProjectsController < ApplicationController
end
private
def memberAccess
# 是课程,则判断当前用户是否参加了课程
return 0 if @project.project_type == Project::ProjectType_project
currentUser = User.current
render_403 unless currentUser.member_of?(@project)
end
def toggleCourse
@course_prefs = Course.find_by_extra(@project.identifier)
unless (@course_prefs.teacher == User.current || User.current.admin?)

View File

@ -30,7 +30,7 @@ class UsersController < ApplicationController
#Ended by young
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index]
#edit has been deleted by huang, 2013-9-23
@ -39,10 +39,10 @@ class UsersController < ApplicationController
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index]
before_filter :auth_user_extension, only: :show
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
#william
before_filter :require_login, :only => :tag_save
before_filter :require_login, :only => [:tag_save,:tag_saveEx]
helper :sort
@ -209,6 +209,8 @@ class UsersController < ApplicationController
## 判断课程是否过期 [需封装]
@memberships_doing = []
@memberships_done = []
@OwningCouses =[]
@JoinCouses=[]
now_time = Time.now.year
@memberships.map { |e|
end_time = e.project.course_extra.get_time.year
@ -218,6 +220,12 @@ class UsersController < ApplicationController
else
@memberships_doing.push e
end
if e.project.course_extra.tea_id == User.current.id
@OwningCouses.push e
else
@JoinCouses.push e
end
}
# respond_to do |format|
# format.html
@ -683,11 +691,51 @@ class UsersController < ApplicationController
#捕获异常
end
respond_to do |format|
format.html
format.js
end
format.html
end
end
def tag_saveEx
@tags = params[:tag_name][:name]
@obj_id = params[:obj_id]
@obj_flag = params[:obj_flag]
case @obj_flag
when '1' then
@obj = User.find_by_id(@obj_id)
when '2' then
@obj = Project.find_by_id(@obj_id)
when '3' then
@obj = Issue.find_by_id(@obj_id)
when '4' then
@obj = Bid.find_by_id(@obj_id)
when '5' then
@obj = Forum.find_by_id(@obj_id)
when '6'
@obj = Attachment.find_by_id(@obj_id)
when '7' then
@obj = Contest.find_by_id(@obj_id)
when '8'
@obj = OpenSourceProject.find_by_id(@obj_id)
else
@obj = nil
end
unless @obj.nil?
@obj.tag_list.add(@tags.split(","))
else
return
end
if @obj.save
## 执行成功的操作。
else
#捕获异常
end
respond_to do |format|
format.js
format.html
end
end
###add by huang
def user_watchlist
end

View File

@ -193,7 +193,9 @@ class WordsController < ApplicationController
elsif ( referer.match(/contests/) || referer.match(/contests/) ) #new added
obj = Contest.find_by_id(obj_id)
elsif ( referer.match(/softapplications/) || referer.match(/softapplications/) ) #new added
obj = Softapplication.find_by_id(obj_id)
obj = Softapplication.find_by_id(obj_id)
elsif ( referer.match(/homework_attach/) || referer.match(/homework_attach/) ) #new added
obj = HomeworkAttach.find_by_id(obj_id)
else
raise 'create reply obj unknow type.'
end
@ -211,7 +213,9 @@ class WordsController < ApplicationController
elsif obj.kind_of? Contest
obj.add_jour(nil, nil, obj.id, options) #new added
elsif obj.kind_of? Softapplication
obj.add_jour(nil, nil, obj.id, options) #new added
obj.add_jour(nil, nil, obj.id, options) #new added
elsif obj.kind_of? HomeworkAttach
obj.add_jour(nil, nil, obj.id, options) #new added
else
raise 'create reply obj unknow type.'
end

View File

@ -151,4 +151,8 @@ module BidsHelper
tmp
end
def can_delete_project_homework bind_project,current_user
current_user.id == bind_project.user.id || current_user.admin
end
end

View File

@ -31,6 +31,31 @@ module CoursesHelper
# searchStudent(project).count
end
# garble count 混淆数量
# alias projectCountOrigin projectCount
# def projectCount project
# count = projectCountOrigin project
# garble count
# end
alias teacherCountOrigin teacherCount
def teacherCount project
count = teacherCountOrigin project
garble count
end
alias studentCountOrigin studentCount
def studentCount project
count = studentCountOrigin project
garble count
end
def garble count
count = count.round( 1-count.to_s.size ).to_i
return count.to_s if count.to_s.size.eql?(1)
count.to_s << '+'
end
# =====================================================================================
# return people list
def searchTeacherAndAssistant project

View File

@ -0,0 +1,2 @@
module HomeworkUsersHelper
end

View File

@ -154,10 +154,11 @@ module WelcomeHelper
sort_course_by_hot limit
end
def find_all_new_hot_course limit = 9
def find_all_new_hot_course limit = 9 ,school_id = 0
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
time_now = Time.new.strftime("%Y");
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%' and #{Project.table_name}.identifier not in
(select extra from courses where school_id = ?)", 1,school_id).order("course_ac_para DESC").limit(limit).all
end
def find_all_hot_bid

View File

@ -1,10 +1,37 @@
class HomeworkAttach < ActiveRecord::Base
include Redmine::SafeAttributes
#attr_accessible :name, :description, :state, :user_id, :bid_id
belongs_to :user
belongs_to :bid
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :homework_users, :dependent => :destroy
seems_rateable :allow_update => true, :dimensions => :quality
safe_attributes "bid_id",
"user_id"
acts_as_attachable
def addjours user_id,message,status = 0
jfm = self.journals_for_messages.build(:user_id => user_id,:notes =>message,:status => status)
jfm.save
jfm
end
def score
stars_reates = self.rates(:quality)
percent = 0
stars_reates.each do |star_reates|
percent = percent + star_reates.stars
end
result = percent * 1.0 / stars_reates.count
result
end
def add_jours options
jfm = self.journals_for_messages.build(options)
jfm.save
jfm
end
end

View File

@ -0,0 +1,6 @@
class HomeworkUser < ActiveRecord::Base
attr_accessible :homework_attach_id, :user_id
belongs_to :homework_attach
has_one :user
end

View File

@ -21,6 +21,7 @@ class JournalsForMessage < ActiveRecord::Base
belongs_to :jour, :polymorphic => true
belongs_to :user
belongs_to :homework_attach
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
@ -73,7 +74,8 @@ class JournalsForMessage < ActiveRecord::Base
def self.reference_message(user_id)
@user = User.find(user_id)
message = JournalsForMessage.find_by_sql("select * from journals_for_messages where reply_id = #{@user.id} or (jour_type = 'Bid' and jour_id in (select id from bids where author_id = #{@user.id}))")
message = JournalsForMessage.find_by_sql("select * from journals_for_messages where reply_id = #{@user.id}
or (jour_type = 'Bid' and jour_id in (select id from bids where author_id = #{@user.id}))")
message
end

View File

@ -68,6 +68,8 @@ class User < Principal
['none', :label_user_mail_option_none]
]
has_one :homework_user
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
:after_remove => Proc.new {|user, group| group.user_removed(user)}
has_many :changesets, :dependent => :nullify

View File

@ -1,10 +1,15 @@
<!-- #wang -->
<% for attachment in attachments %><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<% if attachment.is_text? %>
<% for attachment in attachments %>
<% if attachments.count > 1 && attachment != attachments.first%>
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments', :action => 'show',
:id => attachment, :filename => attachment.filename %>
<% end %>
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% end -%>

View File

@ -1,11 +1,12 @@
<span id="attachments_fields">
<% if defined?(container) && container && container.saved_attachments %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>">
<span style="width:100px;"><%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename', :maxlength => 10)%>
</span>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 155, :placeholder => l(:label_optional_description), :class => 'description') +
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>

View File

@ -0,0 +1,3 @@
<%if @attachmentNew != nil%>
$("#div-attachments[" + @attachmentNew.id + "]").html('<%= j(render :partial => 'tags/tag', :locals => {:obj => @attachmentNew, :object_flag => "6"})%>');
<%end%>

View File

@ -11,4 +11,7 @@ fileSpan.find('a.remove-upload')
"href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
})
.off('click');
var divattach = fileSpan.find('div.div_attachments');
divattach.html('<%#= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>');
<% end %>

View File

@ -37,5 +37,5 @@
<p><%= hidden_field_tag 'course_id', @project_id %>
</p>
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @homework} %></p>
<div class="tabDiv"><%= render :partial => 'attachments/form', :locals => {:container => @bid} %></div>
</fieldset>

View File

@ -25,8 +25,31 @@
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
<td>
<table width="580px" border="0">
<tr>&nbsp;&nbsp;&nbsp;<strong>作业&nbsp;&nbsp; :</strong>&nbsp;
<% filename = "" %>
<% homework.attachments.map do |attachment| %>
<% filename = attachment.filename %>
<% if homework.attachments.count > 1%>
<% filename += "等#{homework.attachments.count}个文件" %>
<% end %>
<% break %>
<% end %>
<%= link_to filename , homework_attach_path(homework)%>
</tr>
<tr>
<td colspan="1" valign="top"><strong> <%= link_to homework.user, user_path(homework.user)%></strong> <span class="font_lighter">已提交</span></td>
<td colspan="1" valign="top" style="width: 300px">&nbsp;
<strong>发布人:&nbsp; <%= link_to homework.user, user_path(homework.user)%></strong>
</td>
<td>
<strong>作业评分:</strong>
<% stars_reates = homework.rates(:quality) %>
<% sum = 0 %>
<% stars_reates.each do |star_reates| %>
<% sum = sum + star_reates.stars %>
<% end %>
<% stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count %>
<%= sum * 1.0 / stars_reates_count %>
</td>
<td valign="top" align="right">
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %>
<span class="required">迟交</span>
@ -36,7 +59,7 @@
<tr>
<td colspan="2" valign="top">&nbsp;
<% if display_id %>
<strong><%= l(:label_bidding_user_studentcode) %> <%= homework.user.user_extensions.student_id%></strong>
<strong><%= l(:label_bidding_user_studentcode) %>&nbsp; &nbsp;<%= homework.user.user_extensions.student_id%></strong>
<% end %>
</td>
</tr>

View File

@ -154,9 +154,9 @@
<% end %>
</td>
<td align="right">
<% if b_project.user.id == User.current.id || User.current.id == b_project.bid.author.id
<% if can_delete_project_homework b_project,User.current
%>
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => "Are you sure?" %>
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => l(:text_are_you_sure) %>
<% end %>
</td>
</tr>

View File

@ -60,7 +60,6 @@
$("#put-bid-form").hide();
}
</script>
<% if User.current.logged? %>
<!--我要竞标弹出框-->
<div id = 'flash' style="float:left; width: 100%; display: none" ></div>
@ -89,15 +88,15 @@
<tr>
<td><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
</tr>
<% end %>
<% end %>
<tr>
<td align="right">
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
</td>
</tr>
</table>

View File

@ -125,7 +125,7 @@
<br />
<br />
<fieldset style="width: 500px", style="padding-top: 10px">
<fieldset style="width: 500px; padding-top: 10px">
<legend>
上传作品软件包和作品截图
</legend>
@ -144,7 +144,7 @@
</fieldset>
</fieldset></br>
<div class="align-center", style="padding-top: -3px; padding-bottom: 8px">
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<%= submit_tag l(:button_create) %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",

View File

@ -2,25 +2,57 @@
<% versions = project.versions.sort %>
<% attachmenttypes = project.attachmenttypes %>
<%= error_messages_for 'attachment' %>
<%= form_tag(project_files_path(project), :multipart => true, :class => "tabular") do %>
<%= form_tag(project_files_path(project), :multipart => true,:name=>"upload_form", :class => "tabular") do %>
<div class="box">
<p>
<table>
<tr>
<% if versions.any? %>
<td><p><%= l(:field_version) %></p></td>
<td>
<%= select_tag "version_id", content_tag('option', '') +
options_from_collection_for_select(versions, "id", "name"), {style: 'width:100px'} %>
</td>
<% end %>
<% if versions.any? %>
<p><label for="version_id"><%=l(:field_version)%></label>
<%= select_tag "version_id", content_tag('option', '') +
options_from_collection_for_select(versions, "id", "name") %></p>
<% end %>
<% if attachmenttypes.any? %>
<td><%= l(:attachment_type) %></label></td>
<td>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
</td>
<% end %>
</tr>
</table>
<% if attachmenttypes.any? %>
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName") %>
</p>
<% end %>
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</p>
<p><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</div>
<%= submit_tag l(:button_add) %>
<% end %>
<div class="line_under" style="margin:20px 0px;"></div>
<div class="line_under" style="margin:20px 0px;"></div>
<script type='text/javascript'>
function tagAddClick(id,objId,objTag)
{
alert("OK");
$.ajax({
type :"POST",
url :'<%= users_tag_saveEx_path%>',
data: {
tagname: $('tag_name').value,
obj_id: encodeURIComponent(objId),
obj_flag:encodeURIComponent(objTag)
},
success: function(data, textStatus){
alert("OK");
$(id).empty();
$(id).html('123');
$("#" + id + " #name").val("");
}
})
}
</script>

View File

@ -20,6 +20,7 @@
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<%= sort_header_tag('tags', :caption => l(:label_tag), :id => "vzebra-tag") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr>
</thead>
@ -51,15 +52,14 @@
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<tr>
<td class='description' colspan="6">
<td class='filename' style="font-size: 13px; ">
<div class="tags_area">
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div>
</div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
</div>
</td>
</tr>
<% end -%>

View File

@ -20,6 +20,7 @@
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<%= sort_header_tag('tags', :caption => l(:label_tag), :id => "vzebra-tag") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr>
</thead>
@ -47,17 +48,15 @@
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<tr>
<td class='description' colspan="6">
<div class="tags_area">
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div>
</div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
</div>
</td>
<td class='filename' style="font-size: 13px; ">
<div class="tags_area">
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div>
</div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
</div>
</td>
</tr>
<% end -%>
<% end -%>

View File

@ -25,9 +25,10 @@
:onchange => "attachment_contenttypes_searchex(this.value)" %>
<% end %>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {project: @project} %>
</div>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {project: @project} %>
</div>
<div id="relation_file_div" class="relation_file_div hidden">
<fieldset>
<legend>搜索</legend>
@ -185,4 +186,27 @@
}
});
}
</script>
</script>
<script type='text/javascript'>
function tagAddClick(divid,objId,objTag)
{
alert("OK");
$.ajax({
type :"POST",
url :'/users/tag_saveEx',
data: {
tagname: $('tag_name').value,
obj_id: encodeURIComponent(objId),
obj_flag:encodeURIComponent(objTag)
},
success: function(data, textStatus){
alert("OK");
$(divid).empty();
$(divid).html('123');
$("#" + divid + " #name").val("");
}
})
}
</script>

View File

@ -0,0 +1,14 @@
<%= form_tag({:controller => 'homework_attach', :action => 'add_jour_reply'}, :remote => true) do %>
<%= text_area_tag 'user_notes', "", :class => 'noline',
:style => "resize: none;", :rows => 4,
:placeholder => l(:label_projects_feedback_respond_content),
:maxlength => 250 %>
<span style="float: left; margin-top: 1px; margin-right: 4px;"></span>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
<%= submit_tag l(:button_projects_feedback_respond),
:name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%>
<% end %>

View File

@ -0,0 +1,93 @@
<!-- fq -->
<style>
input[type="submit"].bid_btn {
vertical-align: middle;
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
/*margin-right: -4px;*/
}
input[type="button"].bid_btn {
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
</style>
<script type="text/javascript" language="javascript">
function clearInfo(id, content) {
var text = $('#' + id);
if (text.val() == content) {
$('#' + id).val('');
}
}
function showInfo(id, content) {
var text = $('#' + id);
if (text.val() == '') {
$('#' + id).val(content);
}
}
</script>
<%= form_for('new_form', :remote => true, :method => :post,
:url => {:controller => 'homework_attach',
:action => 'addjours',
:jour_id => homework_attach.id,
:sta => sta}) do |f|%>
<div id = 'pre_show'>
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
</div>
<% if User.current.logged? %>
<table border="0" width="525px" align="center" >
<tr>
<td><%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}",
:onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
:onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
:style => "resize: none;", :class => 'noline'%></td>
</tr>
</table>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<table border="0" width="525px" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge),
:name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise",
:onclick => "clearMessage('new_form_user_message');",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
</tr>
</table>
<% else %>
<div style="font-size: 14px;margin:10px;text-align: center">
<%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,6 @@
<% id = "journal_reply_ul_" + journal.id.to_s%>
<ul class="messages-for-user-reply" id = '<%= id %>' >
<% journal.children.each do |reply|%>
<%= render :partial => "journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %>
<% end %>
</ul>

View File

@ -0,0 +1,34 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
<li id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<span class="portrait">
<%= image_tag url_to_avatar(reply.user), :class => "avatar-3" %>
</span>
<div class="message-body">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<p>
<span><%= link_to reply.user.name, user_path(reply.user) %>:&nbsp;</span>
<span class="message-notes"> <%= reply.notes %></span>
</p>
<p>
<span class="time"><%= format_time reply.created_on %></span>
<span style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
<% if reply_allow %>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{m_reply_id.user.name}: '); return false;"}
%>
<% end %>
<% if @user == User.current || User.current.admin? || reply.user.id == User.current.id %>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'homework_attach', :action => 'destroy', :object_id => reply, :user_id => reply.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %>
</span>
</p>
</div>
<div id='<%=id %>' class="respond-form">
<% if reply_allow %>
<%= render :partial => "add_jour_reply", :locals => {:journal => journal, :m_reply_id => m_reply_id} %>
<% end %>
</div>
<div style="clear: both;"></div>
</li>

View File

@ -0,0 +1,11 @@
<!-- fq -->
<% unless content.nil?%>
<table width="60%" style="margin-left: 60px;">
<tr>
<td> <%= textilizable content %></td>
</tr>
<tr>
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
</tr>
</table>
<% end %>

View File

@ -0,0 +1,73 @@
<script>
var W3CDOM = document.createElement && document.getElementsByTagName;
window.onload = setMaxLength;
function setMaxLength() {
if (!W3CDOM) return;
var textareas = document.getElementsByTagName('textarea');
for (var i=0;i<textareas.length;i++) {
var textarea = textareas[i];
setMaxLengthItem(textareas[i]);
}
}
function setMaxLengthItem(textarea){
if (textarea.getAttribute('maxlength')) {
var counter = document.createElement('div');
counter.className = 'counter';
var counterClone = counter.cloneNode(true);
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
textarea.onkeyup = textarea.onchange = checkMaxLength;
textarea.onkeyup();
}
}
function checkMaxLength() {
var maxLength = this.getAttribute('maxlength');
var currentLength = this.value.length;
if (currentLength > maxLength)
this.relatedElement.className = 'toomuch';
else
this.relatedElement.className = '';
this.relatedElement.firstChild.nodeValue = currentLength;
}
</script>
<% if jour.size > 0 %>
<ul class="message-for-user">
<% for journal in jour%>
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
<span class="body">
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
<div> <%= textilizable journal.notes%> </div>
<span class="font_lighter"><%= l(:label_bids_published) %>
&nbsp;<%= time_tag(journal.created_on).html_safe %>&nbsp;
<%= l(:label_bids_published_ago) %>
</span>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
%>
<% if journal.user==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy', :object_id => journal, :user_id => journal.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %>
</span>
</span>
<div style="clear: both;"></div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'add_jour_reply', :locals => {:journal => journal, :m_reply_id => journal} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "jour_reply", :locals => {:journal => journal } %>
</div>
</li>
<% end %>
</ul>
<% end %>

View File

@ -0,0 +1,14 @@
<% if @save_succ %>
var pre_append = $('<%= j(
render :partial => "journal_reply_items",
:locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm}
) %>').hide();
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append);
pre_append.fadeIn(600);
var textarea = $('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea');
textarea.val('');
$('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide();
setMaxLengthItem(pre_append.find('textarea')[0]);
<% else %>
alert("<%= l(:label_feedback_fail) %>");
<% end %>

View File

@ -0,0 +1,4 @@
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jours, :state => false} )) %>');
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");

View File

@ -0,0 +1,8 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% else %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% end %>

View File

@ -0,0 +1,125 @@
<style>
.softapplication-img .soft-application {
float: left;
width: 25%;
height: 200px;
}
</style>
<p id="notice"><%= notice %></p>
<!-- <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> -->
<div style="height: auto; padding-bottom: 10px">
<tr>
<td colspan="2" valign="top" width="320" >
</td>
<td>
<table width="100%" border="0">
<tr style="font-size: 18px">
<td colspan="2" valign="top"><strong>作业基础信息<%=@count %></strong></td>
</tr>
<tr>
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">发布人员:<%= link_to @homework.user, user_path(@homework.user)%></td>
<td>发布时间:<%=format_time @homework.created_at %></td>
</tr>
<tr>
<td style="padding-left: 40px">
<span>作业下载:</span>
<% options = {:author => true } %>
<%= render :partial => 'attachments/app_link', :locals => {:attachments => @homework.attachments, :options => options} %>
</td>
<td style="width: 240px; word-wrap: break-word; word-break: break-all">所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%></td>
</tr>
<tr>
<td style="padding-left: 40px" colspan="2">平均评分:
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
</td>
</tr>
</table>
</td>
</tr>
</div>
<div class="underline-contests_one"></div>
<div style="height: auto; padding-bottom: 10px">
<tr>
<td colspan="2" valign="top" width="320" >
</td>
<td>
<table width="100%" border="0">
<tr>
<td colspan="2" valign="top"><strong><div style="font-size: 15px;">作业描述:</div></strong></td>
</tr>
<% @homework.attachments.map do |attachment| %>
<% if attachment.description != nil && attachment.description != "" %>
<tr>
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">
<div style="padding-top: 5px"> <%= attachment.description %></div>
</td>
</tr>
<% end %>
<% end %>
</table>
</td>
</tr>
</div>
<div class="underline-contests_one"></div>
<div style="height: auto; padding-bottom: 10px">
<div style="font-size: 15px;"><strong>作业得分:</strong></div>
<div style="overflow: hidden">
<div style="margin-left: 15%; float: left">
<div style="padding-left: 45px; padding-bottom: 5px">得分比例</div>
<div>
<% 100.step(20,-20) do |star| %>
<div data-kls="Softapplication" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled" style="height: 20px; width: 115px; overflow: hidden; z-index: 1; position: relative;">
<div class="jRatingColor" style="width: <%=star%>%;"></div>
<div class="jRatingAverage" style="width: 0px; top: -20px;"></div>
<div class="jStar" style="width: 115px; height: 20px; top: -40px; background: url('/images/seems_rateable/stars.png') repeat-x scroll 0% 0% transparent;">
</div>
</div>
<%= @stars_status_map["star#{(star/20).to_s}".to_sym] %>
<br>
<% end %>
</div>
</div>
<div style="float: left; padding-left: 100px; padding-top:35px ">
<div style="padding-left: 25px;">最终得分</div>
<div style="padding-top: 3px">
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
</div>
</div>
<div style="float: left; padding-left: 100px; padding-top:35px ">
<div>打分总人数</div>
<div style="padding-left: 28px; padding-top: 1px; font-size: 25px; color: blue">
<strong>
<%= @homework.raters(:quality).count%>
</strong>
</div>
</div>
</div>
</div>
<div class="underline-contests_one"></div>
<div style="height: 50px">
<div style="font-size: 15px"><strong>作业评论:</strong></div>
<div style="text-align: center;">评分:
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
</div>
</div>
<!--提示登录后对应用进行评价-->
<div id='leave-message'>
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0} %>
</div>
<!-- 留言列表区 -->
<div id="message" style="font-size: 14px;">
<%= render :partial => 'showjour', :locals => {:jour => @jours} %>
</div>
<div>
<%#= link_to '返回竞赛页面', show_softapplication_contest_path(@softapplication.contest) %>
</div>

View File

@ -1,6 +1,6 @@
<!--add by huang-->
<div class="clearfix"></div>
<div id="footer" style="margin-left:-5px;padding-top: 150px;clear: both;font-size: 12px;">
<div id="footer" style="margin-left:-5px;padding-top: 20px;clear: both;font-size: 12px;">
<div style="border-top:solid 1px #C6E9F1;"></div>
<div class="base_footer">
<div align="center">

View File

@ -1,257 +1,272 @@
<% @nav_dispaly_course_label = 1 %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body class="<%= h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%= render :partial => 'layouts/base_header'%>
<div id="main">
<!--added by huang-->
<div class="top-content">
<% @project = Project.find_by_id(@project.id)%>
<% @course = Course.find_by_extra(@project.identifier)%>
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td>
<td style="color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'project_type', @project.project_type %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/course", :controller => 'projects', :action => 'course' %></td>
<td><p class="top-content-list"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %> > <%=link_to @project.name, nil %></p></td>
</tr>
</table>
</div>
<!-- end -->
<!--project page-->
<div id="sidebar">
<div class="spaceleft">
<!--informations-->
<div class="inf_user_image">
<% @project = Project.find_by_id(@project.id) %>
<% @course = Course.find_by_extra(@project.identifier) %>
<table>
<tr><td valign="top">
<% if(@project.project_type==1) %>
<% if get_avatar?(@project) %>
<%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
<% else %>
<%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(@project) %>
<% end %>
<% else %>
<%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
<% end %> </td>
<td>
<table><tr>
<td class="info-course"><%= @project.name %></td>
</tr>
<tr><td align="center">
<div id="join_in_course">
<%if User.current.logged? %>
<% if @course.teacher.id == User.current.id %>
<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
<%= render :partial => 'courses/set_course_time', :locals => {:project => @project}%>
<% else %>
<%= join_in_course(@project, User.current) %>
<% end %>
<% unless User.current.member_of?(@project) %>
<!-- <%= image_tag "/images/fav.png" %> -->
<div style="padding-right: 10px">
<span class="icon-fav icon"></span><span>
<head>
<meta charset="utf-8">
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>"/>
<meta name="keywords" content="issue,bug,tracker"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body class="<%= h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%= render :partial => 'layouts/base_header' %>
<div id="main">
<!--added by huang-->
<div class="top-content">
<% @project = Project.find_by_id(@project.id) %>
<% @course = Course.find_by_extra(@project.identifier) %>
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td>
<td style="color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'project_type', @project.project_type %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%= link_to request.host()+"/course", :controller => 'projects', :action => 'course' %></td>
<td><p class="top-content-list"><%= link_to "主页", home_path %>
> <%= link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %>
> <%= link_to @project.name, nil %></p></td>
</tr>
</table>
</div>
<!-- end -->
<!--project page-->
<div id="sidebar">
<div class="spaceleft">
<!--informations-->
<div class="inf_user_image">
<% @project = Project.find_by_id(@project.id) %>
<% @course = Course.find_by_extra(@project.identifier) %>
<table>
<tr>
<td valign="top">
<% if (@project.project_type==1) %>
<% if get_avatar?(@project) %>
<%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
<% else %>
<%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(@project) %>
<% end %>
<% else %>
<%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
<% end %> </td>
<td>
<table>
<tr>
<td class="info-course"><%= @project.name %></td>
</tr>
<tr>
<td align="center">
<div id="join_in_course">
<% if User.current.logged? %>
<% if @course.teacher.id == User.current.id %>
<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
<%= render :partial => 'courses/set_course_time', :locals => {:project => @project} %>
<% else %>
<%= join_in_course(@project, User.current) %>
<% end %>
<% unless User.current.member_of?(@project) %>
<!-- <%= image_tag "/images/fav.png" %> -->
<div style="padding-right: 10px">
<span class="icon-fav icon"></span><span>
<%= watcher_link(@project, User.current) %></span></div>
<% end %>
<% end %>
</div>
</td></tr></table>
</td>
</tr>
</table>
</div>
<% end %>
<% end %>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--parameter-->
<div class="user_fans">
<!--parameter-->
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<% files_count = @project.attachments.count %>
<% @project.versions.each do |version| %>
<% files_count += version.attachments.count %>
<% end %>
<table width="240" border="0">
<tr align="center" width="80px">
<% files_count = @project.attachments.count %>
<% @project.versions.each do |version| %>
<% files_count += version.attachments.count %>
<% end %>
<td class="font_index">
<!-- %= link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'% -->
<!-- 1 教师; 2 学生0 全部-->
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1) ,:course =>'1'%>
</td>
<td class="font_index">
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2) ,:course =>'1'%>
</td>
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
<tr class="font_aram">
<td align="center" width="80px" id="teacherCount">
<!-- %= l(:label_x_base_courses_member, :count => @project.members.count) % -->
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@project)) %>
</td>
<td align="center" width="80px" id="studentCount">
<%= l(:label_x_base_courses_student, :count => studentCount(@project)) %>
<!-- %= l(:label_x_course_data, :count => files_count) % -->
</td>
<td align="center" width="80px">
<%= l(:label_x_course_data, :count => files_count) %>
</td>
<td class="font_index">
<!-- 1 教师; 2 学生0 全部-->
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1), :course => '1' %>
</td>
<td class="font_index">
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2), :course => '1' %>
</td>
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
<tr class="font_aram">
<td align="center" width="80px" id="teacherCount">
<!-- %= l(:label_x_base_courses_member, :count => @project.members.count) % -->
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@project)) %>
</td>
<td align="center" width="80px" id="studentCount">
<%= l(:label_x_base_courses_student, :count => studentCount(@project)) %>
<!-- %= l(:label_x_course_data, :count => files_count) % -->
</td>
<td align="center" width="80px">
<%= l(:label_x_course_data, :count => files_count) %>
</td>
</tr>
</table>
<div class="user_underline"></div>
</div>
<!--info-->
</tr>
</table>
<div class="user_underline"></div>
</div>
<!--info-->
<div class="inf_user_context">
<table style="font-family:微软雅黑" >
<!-- addedby bai 教师姓名加超链接、加入开课时间、结课时间与课时 -->
<tr>
<td valign="top" style="padding-left: 8px; width:60px"><%= l(:label_main_teacher) %> :</td><td class="font_lighter_sidebar"><%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher)) %></td>
</tr>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;"><%= l(:label_setup_time) %> :</td><td class="font_lighter_sidebar"><%= @course.setup_time %></td>
</tr>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;"><%= l(:label_endup_time) %> :</td><td class="font_lighter_sidebar"><%= @course.endup_time %></td>
</tr>
<div class="inf_user_context">
<table>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_class_period) %> :</td><td class="font_lighter_sidebar"><%= @course.class_period %>&nbsp;<%= l(:label_class_hour)%></td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %> :</td><td class="font_lighter_sidebar"><%= @course.time %> <%= @course.term %></td>
</tr>
<!-- end -->
<!-- addedby bai 教师姓名加超链接、加入开课时间、结课时间与课时 -->
<tr>
<td valign="top" style="padding-left: 8px; width:60px"><%= l(:label_main_teacher) %> :</td>
<td class="font_lighter_sidebar"><%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher)) %></td>
</tr>
<% unless @course.teacher.user_extensions.nil?%>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td><td class="font_lighter_sidebar"><%= @course.teacher.user_extensions.school %></td>
</tr>
<% else %>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td><td class="font_lighter_sidebar"><%= l(:field_course_un) %></td>
</tr>
<% end %>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;"><%= l(:label_setup_time) %> :</td>
<td class="font_lighter_sidebar"><%= @course.setup_time %></td>
</tr>
</table>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;"><%= l(:label_endup_time) %> :</td>
<td class="font_lighter_sidebar"><%= @course.endup_time %></td>
</tr>
</div>
<div class="user_underline"></div>
<!--description-->
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_class_period) %> :</td>
<td class="font_lighter_sidebar"><%= @course.class_period %>&nbsp;<%= l(:label_class_hour) %></td>
</tr>
<div style="padding-bottom: 8px">
<% if @project.description.size>0 %>
<div class="font_lighter_sidebar">
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %> :</td>
<td class="font_lighter_sidebar"><%= @course.time %> <%= @course.term %></td>
</tr>
<!-- end -->
<%= textilizable @project.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_project">
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@project.created_on) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<% unless @course.teacher.user_extensions.nil? %>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<td class="font_lighter_sidebar"><%= @course.teacher.user_extensions.school %></td>
</tr>
<% else %>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<td class="font_lighter_sidebar"><%= l(:field_course_un) %></td>
</tr>
<% end %>
<div class="user_fans">
<!-- added by william -for tag -->
<div class="user_tags">
<div id="tags">
<%= render :partial => 'tags/tag', :locals => {:obj => @project,:object_flag => "2"}%>
</div>
</div>
</div>
</table>
<div class="user_underline"></div>
</div>
</div>
<div id="content">
<div class="tabs_new">
<ul>
<li>
<%= link_to l(:label_course_overview), project_path(@project), :class => link_class(:overview) %>
</li>
<li>
<%= link_to l(:label_homework), homework_project_path(@project), :class => link_class(:homework) ,:project_type => 1 %>
</li>
<li>
<%= link_to l(:label_course_file), project_files_path(@project), :class => link_class(:files)%>
</li>
<li>
<%= link_to l(:label_course_news), {:controller => 'news', :action => 'index', :project_id => @project}, :class => link_class(:news) %>
</li>
<li>
<%= link_to l(:label_course_board), { :controller => 'boards', :action => 'index', :project_id => @project}, :class => link_class(:boards) %>
</li>
<li>
<%= link_to l(:label_course_feedback), project_feedback_path(@project), :class => link_class(:feedback)%>
</li>
<!-- <li><%= link_to(l(:label_course_repository), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%></li> -->
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where('id = ? or id = ?', 7, 9)).size >0))%>
</div>
<div class="user_underline"></div>
<!--description-->
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px">
<% if @project.description.size>0 %>
<div class="font_lighter_sidebar">
<%= textilizable @project.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_project">
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@project.created_on) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<!-- added by william -for tag -->
<div class="user_tags">
<div id="tags">
<%= render :partial => 'tags/tag', :locals => {:obj => @project, :object_flag => "2"} %>
</div>
</div>
</div>
<div class="user_underline"></div>
</div>
</div>
<div id="content">
<div class="tabs_new">
<ul>
<li>
<%= link_to l(:label_course_overview), project_path(@project), :class => link_class(:overview) %>
</li>
<li>
<%= link_to l(:label_homework), homework_project_path(@project), :class => link_class(:homework), :project_type => 1 %>
</li>
<li>
<%= link_to l(:label_course_file), project_files_path(@project), :class => link_class(:files) %>
</li>
<li>
<%= link_to l(:label_course_news), {:controller => 'news', :action => 'index', :project_id => @project}, :class => link_class(:news) %>
</li>
<li>
<%= link_to l(:label_course_board), {:controller => 'boards', :action => 'index', :project_id => @project}, :class => link_class(:boards) %>
</li>
<li>
<%= link_to l(:label_course_feedback), project_feedback_path(@project), :class => link_class(:feedback) %>
</li>
<!-- <li><%= link_to(l(:label_course_repository), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1}) %></li> -->
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where('id = ? or id = ?', 7, 9)).size >0)) %>
<% end %>
</ul>
</div>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<!--gcm-->
</div>
<!--gcm move it mistakenly-->
<%= render :partial => 'layouts/base_footer' %>
</div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</div>
</body>
<% end %>
</ul>
</div>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<!--gcm-->
</div>
<!--gcm move it mistakenly-->
<%= render :partial => 'layouts/base_footer'%>
</div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -66,7 +66,7 @@
<%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %>
<% end %></td>
</tr>
<!-- added by bai 增加个人得分 -->
<% messages_count = @user.messages.count %>
<% messages_score = messages_count * 0.05%>
@ -158,9 +158,12 @@
<tr>
<td style="padding-left: 5px"><%= l(:label_user_login) %></td><td class="font_lighter_sidebar" style="padding-left: 0px"><%= format_time(@user.last_login_on) %></td>
</tr>
<!--
<tr>
<td valign="top" style="padding-left: 5px;"><%= l(:label_user_mail) %></td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
</tr>
-->
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
<!-- modified by linchun 在个人主页里显示“加入时间”,“最后登录”,“邮件地址”后面添加冒号-->
<% unless @user.user_extensions.nil? %>

View File

@ -1,4 +1,4 @@
<em>尊敬的用户,<%= @user %>(<%= @user.mail%>)给你留言了:</em>
<em>尊敬的用户,<%= @user %>给你留言了:</em>
<div><%= @message %></div>
<h1>点击链接查看最新回复<%= link_to(@url, @url) %></h1>

View File

@ -1,3 +1,3 @@
尊敬的用户,<%= @user %>(<%= @user.mail%>)给你留言了:
尊敬的用户,<%= @user %>给你留言了:
<%= @message %>
点击链接查看最新回复<%= link_to(@url, @url) %>

View File

@ -140,3 +140,10 @@
<hr/>
</div>
<% end %>
<script type="text/javascript">
jQuery(document).ready(function($) {
transpotUrl('#main');
});
</script>

View File

@ -185,3 +185,9 @@
<% end %>
<% html_title @topic.subject %>
<script type="text/javascript">
jQuery(document).ready(function($) {
transpotUrl('#content');
});
</script>

View File

@ -1,100 +1,108 @@
<!-- added by huang -->
<%
if @project.project_type == 1
btn_tips = l(:label_news_notice)
label_tips = l(:label_course_news)
else
btn_tips = l(:label_news_new)
label_tips = l(:label_news)
end
if @project.project_type == Project::ProjectType_course
btn_tips = l(:label_news_notice)
label_tips = l(:label_course_news)
else
btn_tips = l(:label_news_new)
label_tips = l(:label_news)
end
%>
<% if @project && User.current.allowed_to?(:manage_news, @project) %>
<div class="content-title-top">
<%= link_to(btn_tips,
new_project_news_path(@project),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
</div>
<div id="add-news" class="add_frame" style="display:none;">
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => { :id => 'news-form', :multipart => true } do |f| %>
<%= render :partial => 'news/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit --> |
<%= preview_link preview_news_path(:project_id => @project), 'news-form' ,target='preview',{:class => 'whiteButton m3p10'}%> |
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()' ,:class => 'whiteButton m3p10' %>
<% end if @project %>
<div id="preview" class="wiki"></div>
</div>
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
<%= label_tips %>
</span>
<%= link_to(btn_tips,
new_project_news_path(@project),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
<% if @project && User.current.allowed_to?(:manage_news, @project) %>
<div id="add-news" class="add_frame" style="display:none;">
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/form', :locals => {:f => f} %>
<%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit --> |
<%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %>
<% end if @project %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<!--add by huang :list news-->
<h3 style="font-weight:400; margin-left:0px; margin-top:-12px; margin-left:-5px; border-bottom:1px solid #f0f0f0"><%=label_tips%></h3>
<div>
<% if @newss.empty? %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% else %>
<% @newss.each do |news| %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %></td>
<td>
<table width="580px" border="0">
<% if @project.project_type == 1 %>
<tr>
<td colspan="2" valign="top"><strong><%= link_to_user(news.author)if news.respond_to?(:author) %></strong><span style="margin-left: 4px;" class="font_lighter"><%= l(:label_project_notice)%></span><span><%= link_to h(news.title), news_path(news) %></span>
<span style="float: right"><%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> </span></td>
</tr>
<% else %>
<tr>
<td colspan="2" valign="top"><strong><%= link_to_user(news.author)if news.respond_to?(:author) %></strong><span style="margin-left: 4px;" class="font_lighter"><%= l(:label_project_newshare)%></span><span> <%= link_to h(news.title), news_path(news) %></span>
<span style="float: right" class='delete_icon'> <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> </span></td>
</tr>
<% end %>
<tr>
<td colspan="2" width="580px" ><span class="font_description"><%= textilizable(news, :description) %></span></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= l :label_update_time %>&nbsp;<%= format_time(news.created_on) %></span></td>
<td width="350" align="right" class="a"><%= link_to l(:label_project_newother),news_path(news)%><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %></td>
</tr>
</table></td>
</tr>
</table>
<% end %>
<% end %>
<% if @newss.empty? %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% else %>
<% @newss.each do |news| %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" width="50"><%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %></td>
<td>
<table width="580px" border="0">
<% if @project.project_type == 1 %>
<tr>
<td colspan="2" valign="top">
<strong><%= link_to_user(news.author) if news.respond_to?(:author) %></strong><span style="margin-left: 4px;" class="font_lighter"><%= l(:label_project_notice) %></span><span><%= link_to h(news.title), news_path(news) %></span>
<span style="float: right"><%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> </span>
</td>
</tr>
<% else %>
<tr>
<td colspan="2" valign="top">
<strong><%= link_to_user(news.author) if news.respond_to?(:author) %></strong><span style="margin-left: 4px;" class="font_lighter"><%= l(:label_project_newshare) %></span><span> <%= link_to h(news.title), news_path(news) %></span>
<span style="float: right" class='delete_icon'> <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> </span>
</td>
</tr>
<% end %>
<tr>
<td colspan="2" width="580px">
<span class="font_description"><%= textilizable(news, :description) %></span></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= l :label_update_time %>
&nbsp;<%= format_time(news.created_on) %></span></td>
<td width="350" align="right" class="a"><%= link_to l(:label_project_newother), news_path(news) %><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %></td>
</tr>
</table>
</td>
</tr>
</table>
<% end %>
<% end %>
</div>
<!--end-->
<div style="padding-right: 10px">
<div class="pagination">
<ul>
<%= pagination_links_full @news_pages %>
</ul>
</div>
<div class="pagination">
<ul>
<%= pagination_links_full @news_pages %>
</ul>
</div>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title(l(:label_news_plural)) -%>
<% html_title(l(:label_news_plural)) -%>
</div>
<script type='text/javascript'>
$(document).ready(function($) {
$('.content-text-list').each(function(){
$(this).find('.delete_icon').hide();
$(this).mouseenter(function(event) {
$(this).find('.delete_icon').show();
});
$(this).mouseleave(function(event) {
$(this).find('.delete_icon').hide();
});
});
});
$(document).ready(function ($) {
$('.content-text-list').each(function () {
$(this).find('.delete_icon').hide();
$(this).mouseenter(function (event) {
$(this).find('.delete_icon').show();
});
$(this).mouseleave(function (event) {
$(this).find('.delete_icon').hide();
});
});
});
</script>

View File

@ -15,7 +15,7 @@
}
</script>
<%= form_for('softapplication_message',
<%= form_for('softapplication_message',
:remote => true, :method => :post,
:url => {:controller => 'softapplications',
:action => 'create_message',
@ -23,19 +23,19 @@
:sta => sta}
) do |f|%>
<div id = 'pre_show'>
<div id = 'pre_show'>
<%= render :partial => 'pre_show', :locals => {:content => @content} %>
</div>
<% if User.current.logged? %>
<table border="0" width="525px" align="center" >
<tr>
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_my_respond), :style => "resize: none;", :class => 'noline'%></td>
</tr>
</table>
<%= f.text_field :reference_user_id, :style=>"display:none"%> <!--what function?-->
<!-- modified by bai -->
<table border="0" width="518px" align="center">
<tr>

View File

@ -44,10 +44,10 @@
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
<div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
<%= form_for "tag_for_save",:remote=>true,:header=>"Accept: application/javascript",:url=>tag_path,
:update => "tags_show",
:complete => "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();" do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:style=>"width: 100px;"%>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>

View File

@ -0,0 +1,165 @@
<script>
window.onload=function (){
$('#upload_form').submit(function() {
$(this).ajaxSubmit( {
target : '#tags_show'
});
return false;
});
}
</script>
<div id="tags">
<%#begin
1 代表是user类型
2 代表是project类型
3 代表是issue类型
4 代表是bid类型
5 代表是forum类型
6 代表是Attachment类型
7 代表是contest类型
8 代表是OpenSourceProject类型
9 代表是RelativeMemo类型
#end%>
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
<% if object_flag == '3' %>
<span><%= image_tag("/images/sidebar/tags.png") %></span>
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<% if User.current.logged? %>
<span> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %></span>
<% end %>
<div id="tags_show_issue">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
<div id="put-tag-form-issue" style="display: none">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form-issue").hide();' do |f| %>
<%= f.text_field :name ,:id => "name-issue",:size=>"30",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>1 %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small"%>
<%= link_to_function l(:button_cancel), '$("#put-tag-form-issue").hide();'%>
<% end %>
</div>
<% elsif object_flag == '6' %>
<span><%#= image_tag("/images/sidebar/tags.png") %></span>
<span>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %>
<%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>
</span>
&nbsp;&nbsp;
<div id="tags_show">
<div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; ">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
<div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none">
<%= text_field "tag_name" ,"name"%>
<input id="object_id" type="text" size="20" name="object_id" value='<%=obj.id%>' class="hidden">
<input id="object_flag" type="text" size="20" name="object_flag" value='<%=object_flag%>' class="hidden">
<%= button_tag "增加", :type=>"button", :onclick=>"tagAddClick(tags_show-"+obj.class.to_s + "-" +obj.id.to_s + ","+ obj.id.to_s + "," + object_flag.to_s + ")" %>
<%#= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%#= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<input type="image" name="button" onclick="submitForm('<%=obj.id%>,<%=object_flag%>')" src="/commit.png"/>
<%= submit_tag "增加", :name=>"add_tag" %>
<div class='hidden'>
<% preTags = @preTags.nil? ? [] : @preTags %>
<% preTags.each do |tag|%>
<%= link_to tag, "
javascript:(function(){
var $tagInputVal = $('#put-tag-form-"+obj.class.to_s+"-"+obj.id.to_s+"').find('#name');
var tagArr = [];
tagArr = tagArr.concat( $tagInputVal[0].value.split(',') );
tagArr = tagArr.concat('"+tag.to_s+"');
tagArr = cleanArray(tagArr);
$tagInputVal.val(tagArr.join(','));
})();
"
%>
<% end%>
</div>
<%#= link_to_function l(:button_cancel), "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();"%>
</div>
</div>
<% else %>
<span><%= image_tag("/images/sidebar/tags.png") %></span>
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<% if User.current.logged? %>
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %></span>
<% end %>
<div id="tags_show">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
<div id="put-tag-form" style="display: none">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form").hide();' do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
<% end %>
</div>
<% end %>
</div>
<script language="JavaScript">
function submitForm(objId,objTag){
alert("OK");
$.ajax({
type :"POST",
url :'<%= users_tag_saveEx_path%>',
data: {
tagname: $('tag_name').value,
obj_id: encodeURIComponent(objId),
obj_flag:encodeURIComponent(objTag)
},
success: function(data, textStatus){
alert("OK");
$(id).empty();
$(id).html('123');
$("#" + id + " #name").val("");
}
})
}
function eval_ajax (xhr, textStatus) {
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
}
</script>
<script type='text/javascript'>
function tagAddClick(id,objId,objTag)
{
alert("OK");
$.ajax({
type :"POST",
url :'<%= users_tag_saveEx_path%>',
data: {
tagname: $('tag_name').value,
obj_id: encodeURIComponent(objId),
obj_flag:encodeURIComponent(objTag)
},
success: function(data, textStatus){
alert("OK");
$(id).empty();
$(id).html('123');
$("#" + id + " #name").val("");
}
})
}
</script>

View File

@ -26,7 +26,7 @@
<%= l(:label_homework) %> (<span class=""><%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %></span>)
&nbsp;&nbsp;
<%= l(:label_course_news)%> (<span style="color: #ed8924"><%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %></span>)
</td>
</span></td>
</tr>
<tr>
<td colspan="2" width="580" >

View File

@ -15,9 +15,14 @@
<span><%=l(:label_course_doing)%>(<%=@memberships_doing.count%>)</span>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %>
</p>
<div>
<%= render :partial => 'course_form', :locals => {:memberships => @memberships_doing}%>
</div>
<p>
<%= l(:label_created_course) %>
<div> <%= render :partial => 'course_form', :locals => {:memberships => @OwningCouses}%>
</div> </p>
<div style="clear:both;"></div>
<p> <%= l(:label_joined_course) %>
<div> <%= render :partial => 'course_form', :locals => {:memberships => @JoinCouses}%>
</div> </p>
<div style="clear:both;"></div>

View File

@ -6,7 +6,7 @@
<div class="splitcontentleft">
<ul>
<% unless @user.pref.hide_mail %>
<% unless @user.pref.hide_mail && @user == User.current %>
<li><%=l(:field_mail)%>: <%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></li>
<% end %>
<% @user.visible_custom_field_values.each do |custom_value| %>
@ -107,9 +107,11 @@
<li style="line-break: 10px">
<h1><%= h @user.name %></h1>
</li>
<% if @user == User.current %>
<li style="line-break: 10px">
<h3><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></h3>
</li>
<% end %>
<li style="line-break: 10px">
<td class="last_active"><%= l(:field_last_login_on)%>: <%= format_date(@user.last_login_on) %></td>
</li>

View File

@ -0,0 +1,20 @@
<% if @obj_flag == '3'%>
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$('#put-tag-form-issue').hide();
$('#name-issue').val("");
<% elsif @obj_flag == '6'%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%>").hide();
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
<% else %>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$('#put-tag-form #name').val("");
//$('#put-tag-form').hide();
<% end %>

View File

@ -0,0 +1,6 @@
<div class="clearfix"></div>
<div class="linkother">
<a href="http://forge.trustie.net" class="link_other_item">项目托管平台</a>
<a href="http://course.trustie.net" class="link_other_item">课程实践平台</a>
<a href="http://contest.trustie.net" class="link_other_item">竞赛托管平台</a>
</div>

View File

@ -9,8 +9,23 @@
$(function(){
$("#main").find("a").attr("target", "_blank");
setCss();
});
//设置div居中
function setCss()
{
var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#J_Slide')[0];
var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
//alert((topHeight - leftHeight)/2 );
}
function showInfo(id, content) {
var text = $('#' + id);
if (text.val() == '') {
@ -96,30 +111,16 @@
<%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
<div class="weixin-content">微信扫码</div>
</div>
<div class="main-content-bar">
<div class="main-content-bar" id="main-content-bar">
<!--文字-->
<div style="float: left">
<%= image_tag '/images/transparent.png', size: "75x75" %>
</div>
<div class="welcome_left" >
<div class="welcome_left" id="welcome_left">
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_contest) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_contest_description) %></span>
</div>
<!--网站状态-->
<!-- <div class="contest_count">
<tr>
<td>竞赛总量:</td>
<td></td>
</tr><br>
<tr>
<td>竞赛总人数:</td>
<td></td>
</tr><br />
<tr>
<td>竞赛项目或应用总数:</td>
<td></td>
</tr>
</div> -->
<!--搜索框-->
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %>
@ -145,7 +146,7 @@
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4"; style="float: left; margin-top: 7px">
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/contest1.png')%>
</div>
@ -177,7 +178,7 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="padding-bottom:px ;margin-left: 5px; color: #e8770d;">
<h3 style="margin-left: 5px; color: #e8770d;">
<strong>问题和反馈动态</strong>
<%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
<%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
@ -192,11 +193,11 @@
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
</span>
<br>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span>
<span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;">
由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %>&nbsp;发表
</span>
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span>
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span>
</div>
</li>
<% end %>
@ -213,7 +214,7 @@
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4"; style="float: left; margin-top: 7px">
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/app1.png')%>
</div>
@ -222,7 +223,7 @@
</div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; margin-bottom:1px; width: 380px;">
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.truncate(50, omission: '...')%></span>
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.to_s.truncate(50, omission: '...')%></span>
</div><br />
<div style="padding-left: 55px; clear: left;">
@ -241,7 +242,7 @@
</div>
<div class="clearfix"></div>
<%= render partial: 'link_to_another' %>

View File

@ -5,8 +5,22 @@
$(function(){
$("#main").find("a").attr("target", "_blank");
setCss();
});
//设置div居中
function setCss()
{
var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#search-bar')[0];
var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
//alert((topHeight - leftHeight)/2 );
}
// 给主页用户弹新页面
$(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank");
@ -19,13 +33,12 @@
<%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
<div class="weixin-content">微信扫码</div>
</div>
<div class="main-content-bar">
<div class="main-content-bar" id="main-content-bar">
<div style="float: left">
<%= image_tag(@logoLink, size:'75x75') %>
</div>
<div class="course welcome_left" >
<br />
<div class="course welcome_left" id="welcome_left" >
<span class="font_welcome_school"> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
<% else%>
<% if params[:school_id] == "0" %>
@ -48,7 +61,7 @@
<% end %>
<% end %>
</div>
<div class="search-bar">
<div class="search-bar" id="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%>
</div>
<div style="clear: both;"></div>
@ -60,7 +73,8 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3><strong>新开课程</strong></h3>
<% if(find_miracle_course(10, 7,params[:school_id]).count == 0) %>
<% school_course = find_miracle_course(10, 7,params[:school_id]) %>
<% if(school_course.count == 0) %>
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
@ -72,7 +86,7 @@
该学校未开设任何课程,您可以查看其他学校课程
</p>
<h1></h1>
<% find_all_new_hot_course(9).map do |project| %>
<% find_all_new_hot_course(9,params[:school_id]).map do |project| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
@ -95,7 +109,7 @@
<div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
(<%= "#{studentCount(project)}人" %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
@ -114,13 +128,21 @@
</ul>
</div>
<% else %>
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span>
<% if school_course.count < 9 %>
<span>
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %>
</span>
<% else %>
<span>
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %>
</span>
<% end %>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
</ul>
<ul class="d-p-projectlist">
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
<% school_course.map do |project| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
@ -139,13 +161,11 @@
<div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
(<%= "#{studentCount(project)}人" %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
<!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
<div class='join_course_link'>
<% if !course_endTime_timeout?(project)%>
<div >
@ -155,6 +175,50 @@
</div>
</li>
<% end; reset_cycle %>
<% if school_course.count < 9 %>
<li>
<h1></h1>
<p id="errorExplanation">
该学校开设课程较少,您可以查看其他学校课程
</p>
</li>
<% find_all_new_hot_course(9 - school_course.count,params[:school_id]).map do |project| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item' >
<span class=''>
<% course = Course.find_by_extra(project.identifier)%>
<% if(course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
<% end %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
<%= "#{studentCount(project)}人" %> )
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
<div>
<% if !course_endTime_timeout?(project)%>
<div >
<%= new_watcher_link(project, User.current)%>
</div>
<% end %>
</div>
</li>
<% end %>
<% end %>
</ul>
</div>
<% end %>
@ -201,4 +265,5 @@
</tr>
</table>
</div>
</div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -4,8 +4,21 @@
$(function(){
$("#main").find("a").attr("target", "_blank");
setCss();
});
//设置div居中
function setCss()
{
var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#search-bar')[0];
var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
//alert((topHeight - leftHeight)/2 );
}
// 给主页用户弹新页面
$(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank");
@ -18,14 +31,14 @@
<%= link_to image_tag('/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" ), home_path %>
<div class="weixin-content">微信扫码</div>
</div>
<div class="main-content-bar">
<div class="main-content-bar" id="main-content-bar">
<div style="float: left">
<%= image_tag '/images/transparent.png', size: "75x75" %>
</div>
<div class="welcome_left" >
<div class="welcome_left" id="welcome_left">
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_project_description) %></span>
</div>
<div class="search-bar">
<div class="search-bar" id="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
</div>
<div style="clear: both;"></div>
@ -136,3 +149,4 @@
</table>
</div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -54,7 +54,7 @@ function checkMaxLength() {
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
%>
<% end %>
<% end %>
<% if @user == User.current || User.current.admin? || journal.user.id == User.current.id %>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>

View File

@ -1122,6 +1122,8 @@ en:
label_activities_settings: Display settings
#end
label_joined_course: Joined Courses
label_created_course: Created Courses
#huang
label_file_new: Download
@ -1611,4 +1613,4 @@ en:
# ajax异步验证
modal_valid_passing: can be used.
modal_valid_passing: can be used.

View File

@ -143,7 +143,7 @@ zh:
attachment_all: "全部"
attachment_sufix_browse: "文件类型"
attachment_browse: "内容类型"
attachment_type: '资源分类'
attachment_type: '分类'
general_text_No: '否'
general_text_Yes: '是'
general_text_no: '否'
@ -1670,7 +1670,9 @@ zh:
label_no_current_participate: 该竞赛暂无参与者
#end
label_joined_course: 参加的课程
label_created_course: 创建的课程
label_course: 课程
label_course_new: 新建课程
label_course_join_student: 加入课程

View File

@ -16,13 +16,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do
resources :homework_users
resources :no_uses
delete 'no_uses', :to => 'no_uses#delete'
resources :apply_project_masters
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
resources :homework_attach do
collection do
match 'addjours', via: [:get, :post]
match 'add_jour_reply', via: [:get,:post]
end
end
resources :open_source_projects do
collection do
match 'search', via: [:get, :post]
@ -37,6 +45,7 @@ RedmineApp::Application.routes.draw do
end
mount SeemsRateable::Engine => '/rateable', :as => :rateable
namespace :zipdown do
match 'assort'
end
@ -225,6 +234,7 @@ RedmineApp::Application.routes.draw do
match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
################# added by william
match 'users/tag_save', :to => 'users#tag_save', :via => :post, :as => 'tag'
match 'users/tag_saveEx', :to => 'users#tag_saveEx', :via => :post
post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
delete 'watchers/watch', :to => 'watchers#unwatch'
@ -460,9 +470,11 @@ RedmineApp::Application.routes.draw do
get 'attachments/autocomplete'
match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post]
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
resources :attachments, :only => [:show, :destroy] do
collection do
match "updateType" , via: [:get, :post]
match "renderTag" , via: [:get, :post]
end
end

View File

@ -0,0 +1,10 @@
class CreateHomeworkUsers < ActiveRecord::Migration
def change
create_table :homework_users do |t|
t.string :homework_attach_id
t.string :user_id
t.timestamps
end
end
end

View File

@ -0,0 +1,7 @@
class AddNameToHomeworkAttach < ActiveRecord::Migration
def change
add_column :homework_attaches, :name, :string
add_column :homework_attaches, :description, :string
add_column :homework_attaches, :state, :int
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140513073801) do
ActiveRecord::Schema.define(:version => 20140519070751) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,14 +52,11 @@ ActiveRecord::Schema.define(:version => 20140513073801) do
add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
create_table "attachmentstypes", :id => false, :force => true do |t|
t.integer "id", :null => false
t.integer "typeId"
create_table "attachmentstypes", :force => true do |t|
t.integer "typeId", :null => false
t.string "typeName", :limit => 50
end
add_index "attachmentstypes", ["id"], :name => "id"
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -325,9 +322,12 @@ ActiveRecord::Schema.define(:version => 20140513073801) do
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
t.string "name"
t.string "description"
t.integer "state"
end
create_table "homework_for_courses", :force => true do |t|
@ -335,6 +335,13 @@ ActiveRecord::Schema.define(:version => 20140513073801) do
t.integer "bid_id"
end
create_table "homework_users", :force => true do |t|
t.string "homework_attach_id"
t.string "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "issue_categories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :limit => 30, :default => "", :null => false
@ -756,7 +763,6 @@ ActiveRecord::Schema.define(:version => 20140513073801) do
t.integer "softapplication_id"
t.integer "is_public"
t.string "application_developers"
t.string "deposit_project_url"
end
create_table "students_for_courses", :force => true do |t|
@ -865,10 +871,8 @@ ActiveRecord::Schema.define(:version => 20140513073801) do
add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id"
create_table "user_levels", :force => true do |t|
t.integer "user_id"
t.integer "level"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "user_id"
t.integer "level"
end
create_table "user_preferences", :force => true do |t|

View File

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

View File

@ -609,6 +609,14 @@ function toggleAndSettingWordsVal(parent_widget, text_widget, value){
text_widget.val(value)
parent_widget.slideToggle(400)
}
function transpotUrl (scope) {
$(scope).each(function(){
var tmpContent = $(this).html();
tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,]+)/gi,"$1<a href='$2$3' target='_blank'>$2$3<\/a>");
// tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,]+)/gi,"$1<a href='http:\/\/$2' style='color:blue' target='_blank'>$2</a>");
$(this).html(tmpContent);
});
}
$(document).ready(setupAjaxIndicator);
$(document).ready(hideOnLoad);

View File

@ -1,6 +1,17 @@
/* Redmine - project management software
Copyright (C) 2006-2013 Jean-Philippe Lang */
function postUpMsg(attachmentId)
{
$.ajax({
url: '/attachments/renderTag',
type: "GET",
data: {
attachmentId: attachmentId
}
})
}
function addFile(inputEl, file, eagerUpload) {
if ($('#attachments_fields').children().length < 10) {
@ -12,14 +23,15 @@ function addFile(inputEl, file, eagerUpload) {
fileSpan.append(
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 255, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
$('<a>&nbsp</a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload)
$('<a>&nbsp</a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
).appendTo('#attachments_fields');
if(eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl);
}
return attachmentId;
if(eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl);
}
return attachmentId;
}
return null;
}
@ -66,7 +78,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
//gcm files count and add delete_all link
var count=$('#attachments_fields>span').length;
var count=$('#attachments_fields>span').length;
$('#upload_file_count').html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
if(count>=1){

View File

@ -1319,7 +1319,7 @@ tr.entry td.filename_no_report { width: 70%; }
tr.entry td.size { text-align: right; font-size: 90%; }
tr.entry td.revision, tr.entry td.author { text-align: center; }
tr.entry td.age { text-align: right; }
tr.entry.file td.filename a { margin-left: 16px; }
tr.entry.file td.filename a { margin-center: 16px; }
tr.entry.file td.filename_no_report a { margin-left: 16px; }
tr span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
@ -1769,6 +1769,14 @@ p.pagination {margin-top:8px; font-size: 90%}
clear:left;
}
.tabular .tabDiv{
margin: 0;
padding: 3px 0 3px 0;
padding-left: 100px; /* width of left column containing the label elements *//*by young*/
/*min-height: 1.8em;*/
clear:left;
}
html>body .tabular p {overflow:hidden;}
.tabular label{
@ -1829,8 +1837,8 @@ fieldset#notified_events .parent { padding-left: 20px; }
span.required {color: #bb0000;}
.summary {font-style: italic;}
#attachments_fields input.description {margin-left:4px; width:340px; }
#attachments_fields span {display:block; white-space:nowrap; font-family:'微软雅黑';}
#attachments_fields input.description {margin-left:4px; width:100px; }
#attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';}
#attachments_fields input.filename {border:0; height:1.8em; width:150px; color:#555; background-color:inherit; background:url(../images/attachment.png) no-repeat 1px 50%; padding-left:18px;}/*Modified by young*/
#attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
#attachments_fields .ajax-loading input.filename {background:url(../images/loading.gif) no-repeat 0px 50%;}

View File

@ -3,6 +3,20 @@
*/
/************************** 某部分开始 *****************************/
/************************** 某部分结束 *****************************/
/************************** 页脚 footer 开始 *****************************/
.linkother{
width: 460px;
margin: 70px auto -35px ;
}
.link_other_item{
width: 150px;
text-align: center;
display: inline-block;
font-size: 14px;
}
/************************** 页脚 footer 结束 *****************************/
.top_bar{
height: auto;
}
@ -312,11 +326,11 @@ a.attachments_list_color {
}
.main-content-bar{
margin: 0;
margin-top: 35px;
margin-top: 12px;
padding: 0;
margin-bottom: 35px;
width: 100%;
height: auto;
margin-bottom: 2px;
width: 100%;
height: 78;
}
.weixin-content{

9
test/fixtures/homework_users.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
homework_attach_id: MyString
user_id: MyString
two:
homework_attach_id: MyString
user_id: MyString