Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
This commit is contained in:
commit
933fc6cb33
|
@ -0,0 +1,31 @@
|
|||
app/models/setting.rb :165
|
||||
# fixed domain url in development. tantantan's bug
|
||||
if Rails.env.development?
|
||||
methods.map do |m|
|
||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||
end
|
||||
end
|
||||
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
|
||||
为了开发方便,使之功能在development模式下失效。
|
||||
# => nyan
|
||||
================================================================================
|
||||
app/controller/projects_controller.rb ===> projects#fake
|
||||
fake filter: 修改了传到页面中的Count后缀的数量
|
||||
改为正确的数量,删掉fake过滤器即可
|
||||
================================================================================
|
||||
#导航栏匹配域名显示和改变
|
||||
app\helper\application_helper.rb
|
||||
# rewrite navigation
|
||||
|
||||
app\views\layouts\_base_header.html.erb
|
||||
# reset navigation by domain name and url through regular match
|
||||
================================================================================
|
||||
#首页根据域名匹配进入不同的页面
|
||||
app\controller\welcome_controller.rb
|
||||
def entry_select_user
|
||||
if request.original_url.match(/user\.trustie\.net/)
|
||||
redirect_to(:controller => "users", :action => "index")
|
||||
return 0
|
||||
end
|
||||
end
|
||||
================================================================================
|
|
@ -1,11 +0,0 @@
|
|||
app\models\setting.rb :165
|
||||
# fixed domain url in development. tantantan's bug
|
||||
if Rails.env.development?
|
||||
methods.map do |m|
|
||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||
end
|
||||
end
|
||||
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
|
||||
为了开发方便,使之功能在development模式下失效。
|
||||
# => nyan
|
||||
================================================================================
|
|
@ -37,15 +37,11 @@ class AccountController < ApplicationController
|
|||
end
|
||||
|
||||
# Log out current user and redirect to welcome page
|
||||
# cookies[:login_flag] 是为了配合毛xx
|
||||
# 退出再登录的话直接跳转到用户首页而不是登陆前的页面
|
||||
# 相应处理方法在application_helper#is_logout? :1106
|
||||
def logout
|
||||
if User.current.anonymous?
|
||||
redirect_to home_url
|
||||
elsif request.post?
|
||||
logout_user
|
||||
cookies[:login_flag] = 1
|
||||
redirect_to home_url
|
||||
end
|
||||
# display the logout form
|
||||
|
|
|
@ -353,14 +353,13 @@ class ApplicationController < ActionController::Base
|
|||
url
|
||||
end
|
||||
|
||||
def redirect_back_or_default(default)
|
||||
def redirect_back_or_default(default, options={})
|
||||
back_url = params[:back_url].to_s
|
||||
if back_url.present?
|
||||
begin
|
||||
uri = URI.parse(back_url)
|
||||
# do not redirect user to another host or to the login or register page
|
||||
#by young
|
||||
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)}) && (uri.path!='/')
|
||||
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
|
||||
redirect_to(back_url)
|
||||
return
|
||||
end
|
||||
|
@ -368,6 +367,9 @@ class ApplicationController < ActionController::Base
|
|||
logger.warn("Could not redirect to invalid URL #{back_url}")
|
||||
# redirect to default
|
||||
end
|
||||
elsif options[:referer]
|
||||
redirect_to_referer_or default
|
||||
return
|
||||
end
|
||||
redirect_to default
|
||||
false
|
||||
|
|
|
@ -20,6 +20,8 @@ class AttachmentsController < ApplicationController
|
|||
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
|
||||
before_filter :delete_authorize, :only => :destroy
|
||||
before_filter :authorize_global, :only => :upload
|
||||
|
||||
before_filter :require_login, only: [:download]
|
||||
|
||||
accept_api_auth :show, :download, :upload
|
||||
|
||||
|
|
|
@ -20,6 +20,17 @@ class BidsController < ApplicationController
|
|||
include ApplicationHelper
|
||||
helper :projects
|
||||
helper :words
|
||||
helper :welcome
|
||||
|
||||
def homework_ajax_modal
|
||||
@bid = Bid.find_by_id(params[:id])
|
||||
# find_bid
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@project_type = params[:project_type]
|
||||
# Modified by nie
|
||||
|
@ -735,12 +746,12 @@ class BidsController < ApplicationController
|
|||
@homework.save_attachments(params[:attachments])
|
||||
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
if @homework.save
|
||||
@homework_flag = l(:label_bidding_homework_succeed)
|
||||
else
|
||||
@homework_flag = l(:label_bidding_homework_failed)
|
||||
end
|
||||
|
||||
@homework_flag = if @homework.save
|
||||
l(:label_bidding_homework_succeed)
|
||||
else
|
||||
l(:label_bidding_homework_failed)
|
||||
end
|
||||
|
||||
if @homework.attachments.empty?
|
||||
@homework.delete
|
||||
|
@ -754,7 +765,9 @@ class BidsController < ApplicationController
|
|||
@homework_list = @bid.homeworks
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
redirect_to project_for_bid_path, notice: @homework_flag.to_s
|
||||
#redirect_to project_for_bid_path, notice: @homework_flag.to_s
|
||||
flash[:notice] = @homework_flag.to_s
|
||||
redirect_back_or_default(project_for_bid_path)
|
||||
}
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -218,8 +218,10 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def search
|
||||
#modified by nie
|
||||
@projects = Project.visible
|
||||
@projects = @projects.visible.where('project_type = ?', params[:project_type]).like(params[:name]) if params[:name].present?
|
||||
project_type = params[:project_type]
|
||||
projects_all = (project_type.eql? Project::ProjectType_project) ? Project.project_entities : Project.course_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']
|
||||
|
@ -346,7 +348,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@project_type = params[:project_type]
|
||||
@project_type = params[:project_type] ||= params[:course]
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
|
||||
|
@ -360,9 +362,9 @@ class ProjectsController < ApplicationController
|
|||
@course_tag = params[:course]
|
||||
@course = Course.new
|
||||
@course.safe_attributes = params[:course]
|
||||
else
|
||||
render_404
|
||||
return -1
|
||||
else # default Project
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
end
|
||||
render :layout => 'base'
|
||||
end
|
||||
|
@ -849,8 +851,7 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def select_project_layout
|
||||
project = Project.find_by_id(params[:id])
|
||||
project ||= @project
|
||||
project ||= @course
|
||||
project ||= @project ||= @course ||= params[:course] ||= params[:project_type]
|
||||
(project.try(:project_type) == Project::ProjectType_project) ? 'base_projects' : 'base_courses'
|
||||
end
|
||||
|
||||
|
|
|
@ -144,7 +144,6 @@ class TagsController < ApplicationController
|
|||
@taggable_type = numbers_to_object_type(params[:taggable_type])
|
||||
|
||||
@obj = get_object(@taggable_id,params[:taggable_type])
|
||||
logger.debug "==========================================#{@obj}"
|
||||
@object_flag = params[:taggable_type]
|
||||
|
||||
# if can_remove_tag?(User.current,@taggable_id,@taggable_type)
|
||||
|
|
|
@ -17,56 +17,16 @@
|
|||
|
||||
class WelcomeController < ApplicationController
|
||||
caches_action :robots
|
||||
before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
|
||||
|
||||
def index
|
||||
# @news = News.latest User.current
|
||||
# @projects = Project.latest User.current
|
||||
#by young
|
||||
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
|
||||
if request.get?
|
||||
session[:auth_source_registration] = nil
|
||||
@user = User.new(:language => current_language.to_s)
|
||||
else
|
||||
user_params = params[:user] || {}
|
||||
@user = User.new
|
||||
@user.safe_attributes = user_params
|
||||
@user.admin = false
|
||||
@user.register
|
||||
if session[:auth_source_registration]
|
||||
@user.activate
|
||||
@user.login = session[:auth_source_registration][:login]
|
||||
@user.auth_source_id = session[:auth_source_registration][:auth_source_id]
|
||||
if @user.save
|
||||
session[:auth_source_registration] = nil
|
||||
self.logged_user = @user
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
redirect_to my_account_path
|
||||
end
|
||||
else
|
||||
@user.login = params[:user][:login]
|
||||
unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank?
|
||||
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
|
||||
end
|
||||
projectActive = Project.project_entities.active
|
||||
@projectCount = projectActive.count
|
||||
@projectPublicCount = projectActive.all_public.count
|
||||
@projectHidenCount = @projectCount - @projectPublicCount
|
||||
|
||||
case Setting.self_registration
|
||||
when '1'
|
||||
register_by_email_activation(@user)
|
||||
when '3'
|
||||
register_automatically(@user)
|
||||
else
|
||||
register_manually_by_administrator(@user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#add by huang
|
||||
# @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
|
||||
# events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
|
||||
# @events_by_day = events.group_by(&:event_date)
|
||||
|
||||
#
|
||||
@developerCount = User.developer.count
|
||||
end
|
||||
|
||||
def robots
|
||||
|
@ -75,9 +35,9 @@ class WelcomeController < ApplicationController
|
|||
end
|
||||
|
||||
def course
|
||||
@course = Project.course_entities
|
||||
@teacher = User.teacher
|
||||
@student = User.student
|
||||
@courseCount = Project.course_entities.count
|
||||
@teacherCount = User.teacher.count
|
||||
@studentCount = User.student.count
|
||||
end
|
||||
|
||||
def contest
|
||||
|
@ -126,9 +86,31 @@ class WelcomeController < ApplicationController
|
|||
end
|
||||
|
||||
def entry_select_user
|
||||
if request.original_url.match(/user\.trustie\.net/)
|
||||
if request.original_url.match(/user\.trustie\.net$/)
|
||||
redirect_to(:controller => "users", :action => "index")
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
def render(*args)
|
||||
_fake if @fake_filter
|
||||
super
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fake
|
||||
@fake_filter = true
|
||||
end
|
||||
|
||||
# 骗子方法
|
||||
def _fake
|
||||
instance_variables.map { |variable|
|
||||
if variable.to_s =~ /Count$/
|
||||
self.instance_variable_set(variable.to_sym,
|
||||
("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1103,14 +1103,6 @@ module ApplicationHelper
|
|||
url
|
||||
end
|
||||
|
||||
# 完成毛 功能
|
||||
# 具体信息参考account_controller#logout
|
||||
def is_logout?
|
||||
ret = cookies[:login_flag] == 1 ? true : false
|
||||
cookies.delete(:login_flag)
|
||||
ret
|
||||
end
|
||||
|
||||
def back_url_hidden_field_tag
|
||||
url = back_url
|
||||
hidden_field_tag('back_url', url, :id => nil) unless url.blank?
|
||||
|
@ -1482,12 +1474,20 @@ module ApplicationHelper
|
|||
|
||||
|
||||
def hadcommittedhomework(cur,curb)
|
||||
@attaches=HomeworkAttach.find_by_sql("select * from homework_attaches where(bid_id = #{curb})")
|
||||
@attaches.each do |attach|
|
||||
if attach.user_id == cur
|
||||
return true
|
||||
end
|
||||
bid = Bid.find_by_id(curb)
|
||||
return true if bid.nil?
|
||||
|
||||
case bid.homework_type
|
||||
when Bid::HomeworkFile
|
||||
attaches = HomeworkAttach.where(bid_id: curb)
|
||||
attaches.map(&:user_id).include? cur
|
||||
when Bid::HomeworkProject
|
||||
attaches = BidingProject.where(user_id: User.current, bid_id: bid)
|
||||
attaches.count > 0 # > 0 则有提交记录
|
||||
else
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def render_dynamic_nav
|
||||
|
|
|
@ -70,15 +70,6 @@ module AttachmentsHelper
|
|||
User.current.logged? && (container.author == user || user.admin?)
|
||||
end
|
||||
|
||||
def hadcommittedhomework(cur,curb)
|
||||
@attaches=HomeworkAttach.find_by_sql("select * from homework_attaches where(bid_id = #{curb})")
|
||||
@attaches.each do |attach|
|
||||
if attach.user_id == cur
|
||||
retrun true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# this method is used to get all projects that tagged one tag
|
||||
# added by william
|
||||
def get_attachments_by_tag(tag_name)
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
####by fq
|
||||
=begin
|
||||
bid一类多用,根据reward_type字段分类
|
||||
reward == 1 企业众包需求
|
||||
reward == 2 创新竞赛
|
||||
reward == 3 课程中布置的作业
|
||||
reward_type == 1 企业众包需求
|
||||
reward_type == 2 创新竞赛
|
||||
reward_type == 3 课程中布置的作业
|
||||
|
||||
homework_type作业类型
|
||||
homework_type == 1 文件提交
|
||||
homework_type == 2 Project提交
|
||||
=end
|
||||
class Bid < ActiveRecord::Base
|
||||
Enterprise = 1
|
||||
Contest = 2
|
||||
Homework = 3
|
||||
HomeworkFile = 1
|
||||
HomeworkProject = 2
|
||||
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ class Project < ActiveRecord::Base
|
|||
validates_presence_of :name, :identifier
|
||||
validates_uniqueness_of :identifier
|
||||
validates_associated :repository, :wiki
|
||||
validates_length_of :description, :maximum => 255
|
||||
# validates_length_of :description, :maximum => 255
|
||||
validates_length_of :name, :maximum => 255
|
||||
validates_length_of :homepage, :maximum => 255
|
||||
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
|
||||
|
|
|
@ -82,6 +82,7 @@ class User < Principal
|
|||
|
||||
#####fq
|
||||
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
|
||||
has_many :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy
|
||||
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
|
||||
|
@ -123,10 +124,16 @@ class User < Principal
|
|||
## end
|
||||
|
||||
scope :teacher, -> {
|
||||
joins(:user_extensions).where('user_extensions.identity = ?', 0)
|
||||
joins(:user_extensions).where('user_extensions.identity = ?', UserExtensions::TEACHER)
|
||||
}
|
||||
scope :student, -> {
|
||||
joins(:user_extensions).where('user_extensions.identity = ?', 1)
|
||||
joins(:user_extensions).where('user_extensions.identity = ?', UserExtensions::STUDENT)
|
||||
}
|
||||
scope :developer, -> {
|
||||
joins(:user_extensions).where('user_extensions.identity = ?', UserExtensions::DEVELOPER)
|
||||
}
|
||||
scope :enterprise, -> {
|
||||
joins(:user_extensions).where('user_extensions.identity = ?', UserExtensions::ENTERPRISE)
|
||||
}
|
||||
|
||||
attr_accessor :password, :password_confirmation
|
||||
|
|
|
@ -287,7 +287,7 @@
|
|||
<% end %>
|
||||
<span id = 'name' style = 'display:none'>
|
||||
<p><%= f.text_field :firstname, :required => true %></p>
|
||||
<!--<p><%= f.text_field :lastname, :required => true %></p>-->
|
||||
<p><%= f.text_field :lastname, :required => true %></p>
|
||||
</span>
|
||||
<span id = 'enterprise' style = 'display:none'>
|
||||
<p><table><tr><td class="info" align="right" style="width: 90px"><strong>企业名<span class="required"> *</span></strong></td>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
暂无作业!
|
||||
<% else %>
|
||||
<% bids.each do |bid|%>
|
||||
|
||||
<table class="content-text-list">
|
||||
<tr><td colspan="2" valign="top" width="50" ><%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %></td>
|
||||
<td>
|
||||
|
@ -14,6 +13,8 @@
|
|||
<span class="font_lighter"><%= l(:label_user_create_project_homework) %></span>
|
||||
<span><%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></span>
|
||||
<span style="float: right">
|
||||
<%# 提交作业按钮 %>
|
||||
<%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@project) %>
|
||||
<% if (User.current.admin?||User.current.id==bid.author_id) %>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
|
@ -29,7 +30,6 @@
|
|||
) %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><span class="font_lighter">
|
||||
|
@ -61,7 +61,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px" ><span class="font_description"><%= bid.description %></span></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><span class="font_lighter"><span> <%= l(:label_create_time) %> : <%=format_time bid.created_on %></span><span style="float: right"> <%= l(:field_deadline) %> : <%=bid.deadline %></span></td>
|
||||
<td></td>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<td>
|
||||
<table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong> <%= link_to homework.user, user_path(homework.user)%></strong> <span class="font_lighter">提交了作业</span></td>
|
||||
<td colspan="2" valign="top"><strong> <%= link_to homework.user, user_path(homework.user)%></strong> <span class="font_lighter">已提交</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
$('#OpenWindow-content').html(' <%=
|
||||
j(render partial: "projects/homeworkupload", locals: {bid: @bid})
|
||||
%>');
|
|
@ -14,7 +14,7 @@
|
|||
<% else %>
|
||||
<% end %>
|
||||
<div class="bid_description">
|
||||
<%= @bid.description %>
|
||||
<%= textilizable(@bid, :description) %>
|
||||
<% if @bid.attachments.any?%>
|
||||
<% options = {:author => true} %>
|
||||
<%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<!--add by huang-->
|
||||
<div class="clearfix"></div>
|
||||
<div id="footer" style="margin-left:-5px;padding-top: 50px;clear: both;">
|
||||
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div>
|
||||
<div class="base_footer"><div align="center">
|
||||
|
|
|
@ -1,34 +1,26 @@
|
|||
<%
|
||||
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
|
||||
realUrl = request.original_url
|
||||
if (realUrl.match(/users/))
|
||||
@nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
elsif (realUrl.match(/contest/))
|
||||
@nav_dispaly_contest_label = 1
|
||||
elsif (realUrl.match(/calls/))
|
||||
@nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_bid_label = 1
|
||||
elsif (realUrl.match(/forums/))
|
||||
@nav_dispaly_forum_label = 1
|
||||
elsif (realUrl.match(/forge\.trustie\.net\/*/))
|
||||
if (realUrl.match(/forge\.trustie\.net\/*/))
|
||||
@nav_dispaly_project_label = 1
|
||||
@nav_dispaly_forum_label = 1
|
||||
elsif (realUrl.match(/course\.trustie\.net\/*/))
|
||||
@nav_dispaly_course_all_label = 1
|
||||
@nav_dispaly_forum_label = 1
|
||||
@nav_dispaly_course_label = nil
|
||||
@nav_dispaly_store_all_label = 1
|
||||
elsif (realUrl.match(/user\.trustie\.net\/*/))
|
||||
@nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
else
|
||||
@nav_dispaly_project_all_label = 1
|
||||
@nav_dispaly_course_all_label = 1
|
||||
@nav_dispaly_forum_label = 1
|
||||
@nav_dispaly_bid_label = 1
|
||||
@nav_dispaly_contest_label = 1
|
||||
@nav_dispaly_store_all_label = 1
|
||||
@nav_dispaly_user_label = 1
|
||||
end
|
||||
%>
|
||||
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<%= 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 -->
|
||||
|
@ -42,7 +43,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%=link_to request.host()+"/course", :controller => 'projects', :action => 'course' %></a></td>
|
||||
<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>
|
||||
|
@ -78,8 +79,8 @@
|
|||
<%= render :partial => 'courses/set_course_time', :locals => {:project => @project}%>
|
||||
<% else %>
|
||||
|
||||
<%= join_in_course(@project, User.current) %></div>
|
||||
<% end %> </div>
|
||||
<%= join_in_course(@project, User.current) %>
|
||||
<% end %>
|
||||
<% unless User.current.member_of?(@project) %>
|
||||
<!-- <%= image_tag "/images/fav.png" %> -->
|
||||
<div style="padding-right: 10px">
|
||||
|
@ -87,7 +88,7 @@
|
|||
<%= watcher_link(@project, User.current) %></span></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</td></tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -232,8 +233,8 @@
|
|||
<!-- <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))%>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
|
|
|
@ -82,6 +82,9 @@
|
|||
<tr>
|
||||
<td><%= l(:label_limit_time) %>: <%= @bid.deadline %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>作业类型: <%=@bid.homework_type==Bid::HomeworkFile ? "提交文件" : "提交项目"%></td>
|
||||
</tr>
|
||||
<% unless @bid.parent_id.nil?%>
|
||||
<tr>
|
||||
<td>
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<% journals_for_messages_count = @user.journals_for_messages.count %>
|
||||
<% journals_for_messages_count = @user.journals_messages.count %>
|
||||
<% activities_count = @user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
|
||||
<div style="float: right"><%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %></div>
|
||||
</div>
|
||||
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div id="reply" style="display:none;">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
<div id="comments" style="margin-bottom:16px;">
|
||||
|
||||
<div style="margin-bottom:15px">
|
||||
<span class="font_description"> <%= @news.description %> </span>
|
||||
<div style="margin:15px">
|
||||
<span class="font_description"> <%= textilizable(@news, :description) %> </span>
|
||||
<br/>
|
||||
<%= link_to_attachments @news %>
|
||||
<br/>
|
||||
|
@ -74,7 +74,7 @@
|
|||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><span class="font_lighter"> <%= @news.created_on %></span></td>
|
||||
<td align="left"><span class="font_lighter"> <%= format_time(comment.created_on) %></span></td>
|
||||
<td width="200" align="right" class="a"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
|
||||
</tr>
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
</p>
|
||||
<div class="buttons_for_course" style="margin-top:30px;margin-left:144px">
|
||||
<span class="info"></span>
|
||||
<% if @project.project_type==Project::ProjectType_course %>
|
||||
<% if(course_endTime_timeout? @project) %>
|
||||
<span class="font_lighter">
|
||||
课程学期已结束
|
||||
|
@ -54,6 +55,7 @@
|
|||
<% else %>
|
||||
<%= join_in_course_for_list(@project, User.current,['regular'])%>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<div style='width:100%;'>
|
||||
<% if hadcommittedhomework(User.current.id, bid.id) %>
|
||||
<div style='width:150px; margin:10px auto;'>
|
||||
<span class="font_color_orange" > 作业已经提交 </span>
|
||||
<%= link_to "查看详情", project_for_bid_path(bid) %>
|
||||
</div>
|
||||
|
||||
<% elsif bid.reward_type==Bid::Homework &&
|
||||
bid.homework_type==Bid::HomeworkFile %>
|
||||
<%= render partial: 'projects/homeworkupload_homeworkfile', locals: {bid: bid} %>
|
||||
|
||||
<% elsif bid.reward_type==Bid::Homework &&
|
||||
bid.homework_type==Bid::HomeworkProject %>
|
||||
<%= render partial: 'projects/homeworkupload_homeworkproject', locals: {bid: bid} %>
|
||||
|
||||
|
||||
<% else %>
|
||||
<div style='width:150px; margin:10px auto;'>
|
||||
<span class="font_color_orange" > Unkown Error </span>
|
||||
<%= link_to "我要反馈" , suggestion_send_path, target: '_blank' %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
|
@ -0,0 +1,17 @@
|
|||
<%= form_for HomeworkAttach.new,
|
||||
:url => {:controller => 'bids', :action => 'add_homework', id: bid.id, back_url: homework_project_path(bid.try(:courses).try(:first)) },
|
||||
:update => "bidding_project_list",
|
||||
:complete => '$("#put-bid-form").hide();',
|
||||
:html => {:multipart => true, :id => 'add_homework_form'} do |f| %>
|
||||
<div style="padding: 20px 0 10px;" >
|
||||
<fieldset>
|
||||
<legend>
|
||||
作业文件上传
|
||||
</legend>
|
||||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
<%= submit_tag l(:button_create), :onclick => "return true" %>
|
||||
<% end %>
|
|
@ -0,0 +1,41 @@
|
|||
<%
|
||||
membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
option = []
|
||||
membership.each do |member|
|
||||
unless(member.project.project_type==1)
|
||||
member.member_roles.each{|role|
|
||||
if(role.role_id == 3)
|
||||
option << member.project
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
<div id="put-bid-form">
|
||||
<%= form_for "bid_for_save",
|
||||
|
||||
:url => {:controller => 'bids', :action => 'add'},
|
||||
:update => "bidding_project_list" do |f| %>
|
||||
<table id="bidding_table" border="0" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<%= select_tag 'bid', options_for_select(select_option_helper(option)), :name => 'bid', :class => 'grayline', style:'width:83%;' %>
|
||||
<div class="font_lighter" style="display:inline-block;font-size: 13px;">
|
||||
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason_homework), :style => "resize: none;", :class => 'noline'%></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">
|
||||
<%= submit_tag l(:label_commit_homework), :name => nil , :class => "enterprise"%>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,3 +1,9 @@
|
|||
<style type="text/css">
|
||||
#attachments_fields input.description {
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<!-- fq -->
|
||||
<!--modified by huang-->
|
||||
<div class="content-title-top">
|
||||
|
@ -9,4 +15,45 @@
|
|||
<%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
|
||||
</div>
|
||||
|
||||
<div id="OpenWindow">
|
||||
<div id="signup-ct">
|
||||
<div id="OpenWindow-header">
|
||||
<h1> 课程: <%= @project.name%> </h1>
|
||||
<p id='bid-desc'> 上传作业 </p>
|
||||
<a href="javascript:void(0);" class="modal_close"></a>
|
||||
</div>
|
||||
<div id="OpenWindow-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("a[rel*=leanModal]").leanModal({
|
||||
top:100,
|
||||
closeButton: ".modal_close"
|
||||
});
|
||||
|
||||
function showSubH(/* ... */){
|
||||
var id, name, numargs = arguments.length;
|
||||
|
||||
id = arguments[0];
|
||||
name = arguments[1];
|
||||
|
||||
$("#OpenWindow").find("#bid-desc").html('作业名: '+name);
|
||||
|
||||
post_url = '/bids/' + id + '/homework_ajax_modal.js'
|
||||
function deal_post (data, textStatus, xhr) {
|
||||
if(textStatus == 'success'){
|
||||
eval(data);
|
||||
}
|
||||
if(textStatus != 'success'){
|
||||
$('#OpenWindow-content').html('<span class=\"font_color_orange\" > ' + textStatus + ' <\/span>\n');
|
||||
}
|
||||
}
|
||||
function deal_error (argument) {
|
||||
$('#OpenWindow-content').html('<strong>Network Error</strong><span class=\"font_color_orange\" > <br/>http_status:' + argument.status + '<br/>statusText:' + argument.statusText + ' <\/span>\n');
|
||||
}
|
||||
$.post(post_url,{}, deal_post).error(deal_error);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2">
|
||||
<% if User.current.logged? %>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type =>( @project_type||=0)}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td rowspan="2" >
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<tr>
|
||||
<td colspan="2" width="580px" >
|
||||
<p class="info-break">
|
||||
<%= h (truncate(e.event_description, :length => 240)) %>
|
||||
<%= h(truncate(strip_tags(e.event_description).gsub(/ /,' '), length: 30, omission:'...')) %>
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<!-- added by bai -->
|
||||
<% journals_for_messages_count = @user.journals_for_messages.count %>
|
||||
<% journals_for_messages_count = @user.journals_messages.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_count = @user.activities.count %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
<% finall_activity_score = journals_for_messages_score + activities_score %>
|
||||
<div><%= l(:label_message_number) %> * 0.05 = <%= @user.journals_for_messages.count %> * 0.05 = <%= format("%.2f" , journals_for_messages_score).to_f %></div>
|
||||
<div><%= l(:label_message_number) %> * 0.05 = <%= @user.journals_messages.count %> * 0.05 = <%= format("%.2f" , journals_for_messages_score).to_f %></div>
|
||||
<div><%= l(:label_activity_number) %> * 0.2 = <%= @user.activities.count %> * 0.2 = <%= format("%.2f" , activities_score).to_f %></div>
|
||||
<div><%= l(:label_user_score_of_activity) %> = <%= format("%.2f" , journals_for_messages_score).to_f %> + <%= format("%.2f" , activities_score).to_f %>
|
||||
= <%= format("%.2f" , finall_activity_score).to_f %></div>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<% journals_for_messages_count = @user.journals_for_messages.count %>
|
||||
<% journals_for_messages_count = @user.journals_messages.count %>
|
||||
<% activities_count = @user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<% journals_for_messages_count = @user.journals_for_messages.count %>
|
||||
<% journals_for_messages_count = @user.journals_messages.count %>
|
||||
<% activities_count = @user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<% journals_for_messages_count = user.journals_for_messages.count %>
|
||||
<% journals_for_messages_count = user.journals_messages.count %>
|
||||
<% activities_count = user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
<% unless @activity.empty? %>
|
||||
<div id="activity">
|
||||
<% @activity.each do |e| %>
|
||||
<%# 以下一行代码解决有未知的活动无法转换成Model报错%>
|
||||
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next; ) if e.act_type.safe_constantize.nil? %>
|
||||
<% act = e.act %>
|
||||
<% unless act.nil? %>
|
||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<!--add by huang-->
|
||||
<p>温馨提示:这里显示的是您创建或参与的所有项目。</p>
|
||||
<div class="content-title-top-project">
|
||||
<% if @user == User.current %>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
|
||||
<span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span>
|
||||
<%= watch_projects @state %>
|
||||
<% unless @memberships.empty? %>
|
||||
<div class="content_frame">
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<p>温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</p>
|
||||
<% if @user == User.current %>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||
<% end %>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
|
||||
<span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span>
|
||||
<%= watch_projects @state%>
|
||||
<% if @watch_projects.nil?&&watch_projects.project.nil? %>
|
||||
<% if @watch_projects.count > 0 %>
|
||||
<% for watch_project in @watch_projects %>
|
||||
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
||||
<tr>
|
||||
|
@ -11,7 +9,7 @@
|
|||
<td>
|
||||
<table width="580" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong> <%= link_to_user(@user) if watch_project.respond_to?(:user) %></strong><span class="font_lighter"> <%= @user.name%><%= l(:label_watch_project) %></span> <%= link_to_project(watch_project.project) %></td>
|
||||
<td colspan="2" valign="top"><strong> <%= link_to_user(@user) if watch_project.respond_to?(:user) %></strong><span class="font_lighter"> <%= link_to_project(watch_project.project) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580" >
|
||||
|
|
|
@ -161,15 +161,15 @@
|
|||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>课程总量: <%=@course.count%></td>
|
||||
<td>教师数量: <%=@teacher.count%></td>
|
||||
<td>课程总量: <%#=@course.count%></td>
|
||||
<td>教师数量: <%#=@teacher.count%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>用户总量: <%=User.count%></td>
|
||||
<td>学生数量: <%=@student.count%></td>
|
||||
<td>用户总量: <%#=User.count%></td>
|
||||
<td>学生数量: <%#=@student.count%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>资源总量: <%=Attachment.count%></td>
|
||||
<td>资源总量: <%#=Attachment.count%></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -208,7 +208,16 @@
|
|||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div style="padding-top: 40px"></div>
|
||||
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div style="width:600px;margin:0px auto;margin-top:80px;">
|
||||
<table style="width:600px;font-size:15px; color: #e8770d;">
|
||||
<tr>
|
||||
<td><strong>当前网站状态</strong></td>
|
||||
<td>活跃课程: <%=@courseCount%></td>
|
||||
<td>高校: 2个</td>
|
||||
<td>教师: <%=@teacherCount%> 名</td>
|
||||
<td>学生: <%=@studentCount%> 名<td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
|
@ -191,7 +191,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- <div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||
<h3 style="margin-left: 5px; color: color: (51, 119, 51);"><strong>热门竞赛</strong></h3>
|
||||
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'bids', :action => 'contest', :project_type => 1, :host => Setting.contest_domain}, :target => "_blank" %></span>
|
||||
|
@ -234,12 +234,24 @@
|
|||
|
||||
|
||||
|
||||
<br/><br/><br/><br/><br/><br/><br/>
|
||||
|
||||
<div class="clr">
|
||||
</div>
|
||||
|
||||
|
||||
<br/><br/><br/><br/><br/><br/><br/>
|
||||
<div style="padding-top: 40px"></div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
|
||||
<div style="width:100%;">
|
||||
<div style="width:600px;margin:0px auto;margin-top:80px;">
|
||||
<table style="width:600px;font-size:15px; color: #e8770d;">
|
||||
<tr>
|
||||
<td><strong>当前网站状态</strong></td>
|
||||
<td>活跃项目:<%=@projectCount%>个</td>
|
||||
<td>私有项目: <%=@projectHidenCount%>个</td>
|
||||
<td>开发者:<%=@developerCount%>个 </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -171,7 +171,11 @@ RedmineApp::Application.routes.draw do
|
|||
post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
|
||||
delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
|
||||
|
||||
resources :bids, :only=>[:edit,:update,:show]
|
||||
resources :bids, :only=>[:edit,:update,:show] do
|
||||
member do
|
||||
match 'homework_ajax_modal'
|
||||
end
|
||||
end
|
||||
resources :projects do
|
||||
member do
|
||||
post 'finishcourse'
|
||||
|
|
|
@ -8,17 +8,15 @@ BEGIN
|
|||
DECLARE user_changesets_count int(10);
|
||||
DECLARE _done tinyint(1) DEFAULT 0;
|
||||
DECLARE cur_user CURSOR FOR
|
||||
SELECT
|
||||
user_id,
|
||||
COUNT(*)
|
||||
FROM changesets
|
||||
WHERE user_id != ''
|
||||
GROUP BY user_id;
|
||||
SELECT
|
||||
users.id
|
||||
FROM users
|
||||
WHERE users.type = 'User' AND users.status = 1 AND users.admin = 0;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
|
||||
OPEN cur_user;
|
||||
loop_xxx:
|
||||
LOOP
|
||||
FETCH cur_user INTO user_uid, user_changesets_count;
|
||||
FETCH cur_user INTO user_uid ;
|
||||
IF _done = 1 THEN
|
||||
LEAVE loop_xxx;
|
||||
END IF;
|
||||
|
@ -35,7 +33,7 @@ LOOP
|
|||
SELECT
|
||||
COUNT(*) INTO journals_for_messages_count
|
||||
FROM journals_for_messages
|
||||
WHERE user_id = user_uid;
|
||||
WHERE user_id = user_uid ;
|
||||
SELECT
|
||||
COUNT(*) INTO journals_count
|
||||
FROM journals
|
||||
|
@ -60,6 +58,12 @@ LOOP
|
|||
COUNT(*) INTO activities_count
|
||||
FROM activities
|
||||
WHERE user_id = user_uid;
|
||||
SELECT
|
||||
COUNT(*) INTO user_changesets_count
|
||||
FROM changesets
|
||||
WHERE changesets.user_id = user_uid;
|
||||
|
||||
|
||||
|
||||
SET total_count = journals_for_messages_count * 0.05 +
|
||||
journals_count * 0.1 +
|
||||
|
@ -94,26 +98,16 @@ BEGIN
|
|||
|
||||
DECLARE cur_project CURSOR FOR
|
||||
SELECT
|
||||
project_id,
|
||||
COUNT(*)
|
||||
FROM (SELECT
|
||||
project_id,
|
||||
repositories.id
|
||||
FROM repositories
|
||||
INNER JOIN changesets
|
||||
WHERE repositories.id = changesets.repository_id
|
||||
AND project_id IN (SELECT
|
||||
projects.id
|
||||
FROM projects
|
||||
WHERE (((projects.status <> 9)
|
||||
AND (projects.is_public = 1))))) t
|
||||
GROUP BY project_id;
|
||||
WHERE projects.status <> 9
|
||||
AND projects.is_public = 1 AND projects.project_type = 0 ;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
|
||||
OPEN cur_project;
|
||||
loop_xxx:
|
||||
LOOP
|
||||
FETCH cur_project INTO project_uid, project_changesets_count;
|
||||
FETCH cur_project INTO project_uid;
|
||||
IF _done = 1 THEN
|
||||
LEAVE loop_xxx;
|
||||
END IF;
|
||||
|
@ -315,17 +309,12 @@ LOOP
|
|||
SUM(boards.messages_count) INTO boards_messages_count
|
||||
FROM boards
|
||||
WHERE project_id = project_uid;
|
||||
|
||||
IF boards_messages_count IS NULL THEN
|
||||
SET boards_messages_count = 0;
|
||||
SET total_count = issues_count * 0.2 +
|
||||
issues_jour_count_total * 0.1 +
|
||||
news_count * 0.1 +
|
||||
news_jour_count_total * 0.1 +
|
||||
documents_count * 0.1 +
|
||||
project_changesets_count * 0.3 +
|
||||
boards_messages_count * 0.1;
|
||||
ELSE
|
||||
SELECT
|
||||
COUNT(*) INTO project_changesets_count
|
||||
FROM `changesets`
|
||||
INNER JOIN `repositories` ON `changesets`.`repository_id` = `repositories`.`id`
|
||||
WHERE `repositories`.`project_id` = project_uid AND (is_default = 1);
|
||||
|
||||
SET total_count = issues_count * 0.2 +
|
||||
issues_jour_count_total * 0.1 +
|
||||
news_count * 0.1 +
|
||||
|
@ -333,7 +322,7 @@ LOOP
|
|||
documents_count * 0.1 +
|
||||
project_changesets_count * 0.3 +
|
||||
boards_messages_count * 0.1;
|
||||
END IF;
|
||||
|
||||
|
||||
IF total_count IS NOT NULL THEN
|
||||
|
||||
|
|
106
db/schema.rb
106
db/schema.rb
|
@ -13,14 +13,6 @@
|
|||
|
||||
ActiveRecord::Schema.define(:version => 20140320022724) do
|
||||
|
||||
create_table "a_user_watchers", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "member_id"
|
||||
end
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
t.string "act_type", :null => false
|
||||
|
@ -303,9 +295,9 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
|
||||
|
||||
create_table "issue_relations", :force => true do |t|
|
||||
t.integer "issue_from_id", :null => false
|
||||
t.integer "issue_to_id", :null => false
|
||||
t.string "relation_type", :null => false
|
||||
t.integer "issue_from_id", :null => false
|
||||
t.integer "issue_to_id", :null => false
|
||||
t.string "relation_type", :default => "", :null => false
|
||||
t.integer "delay"
|
||||
end
|
||||
|
||||
|
@ -473,22 +465,6 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
|
||||
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
||||
|
||||
create_table "messages_for_bids", :force => true do |t|
|
||||
t.string "message"
|
||||
t.integer "user_id"
|
||||
t.integer "bid_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "messages_for_users", :force => true do |t|
|
||||
t.integer "messager_id"
|
||||
t.integer "user_id"
|
||||
t.string "message"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "news", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.string "title", :limit => 60, :default => "", :null => false
|
||||
|
@ -548,23 +524,11 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
t.integer "watchers_count"
|
||||
t.integer "project_id"
|
||||
t.integer "project_type"
|
||||
t.integer "gitlab_group_id", :limit => 8
|
||||
t.float "grade", :default => 0.0
|
||||
t.integer "course_ac_para", :default => 0
|
||||
t.float "grade", :default => 0.0
|
||||
t.integer "course_ac_para", :default => 0
|
||||
end
|
||||
|
||||
add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count"
|
||||
add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
|
||||
add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count"
|
||||
|
||||
create_table "project_tags", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "tag_id"
|
||||
t.string "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
|
@ -610,18 +574,17 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
add_index "queries", ["user_id"], :name => "index_queries_on_user_id"
|
||||
|
||||
create_table "repositories", :force => true do |t|
|
||||
t.integer "project_id", :default => 0, :null => false
|
||||
t.string "url", :default => "", :null => false
|
||||
t.string "login", :limit => 60, :default => ""
|
||||
t.string "password", :default => ""
|
||||
t.string "root_url", :default => ""
|
||||
t.integer "project_id", :default => 0, :null => false
|
||||
t.string "url", :default => "", :null => false
|
||||
t.string "login", :limit => 60, :default => ""
|
||||
t.string "password", :default => ""
|
||||
t.string "root_url", :default => ""
|
||||
t.string "type"
|
||||
t.string "path_encoding", :limit => 64
|
||||
t.string "log_encoding", :limit => 64
|
||||
t.string "path_encoding", :limit => 64
|
||||
t.string "log_encoding", :limit => 64
|
||||
t.text "extra_info"
|
||||
t.string "identifier"
|
||||
t.boolean "is_default", :default => false
|
||||
t.string "git_project_id"
|
||||
t.boolean "is_default", :default => false
|
||||
end
|
||||
|
||||
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
||||
|
@ -642,6 +605,26 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "seems_rateable_cached_ratings", :force => true do |t|
|
||||
t.integer "cacheable_id", :limit => 8
|
||||
t.string "cacheable_type"
|
||||
t.float "avg", :null => false
|
||||
t.integer "cnt", :null => false
|
||||
t.string "dimension"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "seems_rateable_rates", :force => true do |t|
|
||||
t.integer "rater_id", :limit => 8
|
||||
t.integer "rateable_id"
|
||||
t.string "rateable_type"
|
||||
t.float "stars", :null => false
|
||||
t.string "dimension"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "settings", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
t.text "value"
|
||||
|
@ -652,9 +635,9 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
|
||||
create_table "shares", :force => true do |t|
|
||||
t.date "created_on"
|
||||
t.string "title"
|
||||
t.string "share_type"
|
||||
t.string "url"
|
||||
t.string "title"
|
||||
t.integer "share_type"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "project_id"
|
||||
|
@ -662,12 +645,6 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
t.string "description"
|
||||
end
|
||||
|
||||
create_table "students", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "students_for_courses", :force => true do |t|
|
||||
t.integer "student_id"
|
||||
t.integer "course_id"
|
||||
|
@ -726,7 +703,7 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
create_table "tokens", :force => true do |t|
|
||||
t.integer "user_id", :default => 0, :null => false
|
||||
t.string "action", :limit => 30, :default => "", :null => false
|
||||
t.string "value", :limit => 40
|
||||
t.string "value", :limit => 40, :default => "", :null => false
|
||||
t.datetime "created_on", :null => false
|
||||
end
|
||||
|
||||
|
@ -752,13 +729,12 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
t.integer "zip_code"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "identity"
|
||||
t.string "technical_title"
|
||||
t.integer "identity"
|
||||
t.string "student_id"
|
||||
t.string "teacher_realname"
|
||||
t.string "student_realname"
|
||||
t.string "location_city"
|
||||
t.string "git_token"
|
||||
end
|
||||
|
||||
create_table "user_grades", :force => true do |t|
|
||||
|
@ -795,14 +771,6 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
|
|||
add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
|
||||
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
|
||||
|
||||
create_table "user_tags", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "tag_id"
|
||||
t.string "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "login", :default => "", :null => false
|
||||
t.string "hashed_password", :limit => 40, :default => "", :null => false
|
||||
|
|
|
@ -264,7 +264,7 @@ end
|
|||
# end
|
||||
|
||||
Redmine::MenuManager.map :account_menu do |menu|
|
||||
menu.push :login, {:controller => 'account', :action => 'login', :host => Setting.user_domain}, :if => Proc.new { !User.current.logged? }
|
||||
menu.push :login, {:controller => 'account', :action => 'login'}, :if => Proc.new { !User.current.logged? }
|
||||
menu.push :register, {:controller => 'account', :action => 'register'}, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
|
||||
# menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
|
||||
menu.push :logout, {:controller => 'account', :action => 'logout'}, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? }
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 188 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 425 B |
|
@ -0,0 +1,5 @@
|
|||
// leanModal v1.1 by Ray Stone - http://finelysliced.com.au
|
||||
// Dual licensed under the MIT and GPL
|
||||
|
||||
(function($){$.fn.extend({leanModal:function(options){var defaults={top:100,overlay:0.5,closeButton:null};var overlay=$("<div id='lean_overlay'></div>");$("body").append(overlay);options=$.extend(defaults,options);return this.each(function(){var o=options;$(this).click(function(e){var modal_id=$(this).attr("href");$("#lean_overlay").click(function(){close_modal(modal_id)});$(o.closeButton).click(function(){close_modal(modal_id)});var modal_height=$(modal_id).outerHeight();var modal_width=$(modal_id).outerWidth();
|
||||
$("#lean_overlay").css({"display":"block",opacity:0});$("#lean_overlay").fadeTo(200,o.overlay);$(modal_id).css({"display":"block","position":"fixed","opacity":0,"z-index":100,"left":50+"%","margin-left":-(modal_width/2)+"px","top":o.top+"px"});$(modal_id).fadeTo(200,1);e.preventDefault()})});function close_modal(modal_id){$("#lean_overlay").fadeOut(200);$(modal_id).css({"display":"none"})}}})})(jQuery);
|
|
@ -58,11 +58,115 @@
|
|||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
.font_color_orange{
|
||||
color: #E8770D;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: Helvetica, Tahoma, Arial, "Microsoft YaHei", "微软雅黑", SimSun, "宋体", STXihei, "华文细黑", Heiti, "黑体", sans-serif;
|
||||
}
|
||||
|
||||
/* 模态窗口
|
||||
*******************************************************************************/
|
||||
|
||||
#lean_overlay{
|
||||
position: fixed;
|
||||
z-index: 80;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: #000;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#OpenWindow {
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
|
||||
display: none;
|
||||
padding-bottom: 2px;
|
||||
width: 404px;
|
||||
z-index: 100;
|
||||
left: 50%;
|
||||
margin-left: -202px;
|
||||
opacity: 1;
|
||||
position: fixed;
|
||||
top: 200px;
|
||||
}
|
||||
#OpenWindow-header {
|
||||
background: url("/images/showmodal/hd-bg.png") repeat scroll 0 0 transparent;
|
||||
border-bottom: 1px solid #CCCCCC;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
padding: 18px 18px 14px;
|
||||
}
|
||||
#OpenWindow-content{
|
||||
-webkit-transition: all 0.2s linear 1s;
|
||||
-o-transition: all 0.2s linear 1s;
|
||||
-moz-transition: all 0.2s linear 1s;
|
||||
transition: all 0.2s linear 1s;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
padding: 18px 18px 14px;
|
||||
}
|
||||
|
||||
.modal_close {
|
||||
background: url("/images/showmodal/modal_close.png") repeat scroll 0 0 transparent;
|
||||
display: block;
|
||||
height: 14px;
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
top: 12px;
|
||||
width: 14px;
|
||||
z-index: 2;
|
||||
}
|
||||
body {
|
||||
/*font-size: 13px;*/
|
||||
}
|
||||
#OpenWindow .txt-fld {
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
padding: 14px 20px;
|
||||
position: relative;
|
||||
text-align: right;
|
||||
width: 364px;
|
||||
}
|
||||
#OpenWindow .txt-fld input {
|
||||
background: none repeat scroll 0 0 #F7F7F7;
|
||||
border-color: #CCCCCC #E7E6E6 #E7E6E6 #CCCCCC;
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
color: #222222;
|
||||
font-family: "Helvetica Neue";
|
||||
font-size: 1.2em;
|
||||
outline: medium none;
|
||||
padding: 8px;
|
||||
width: 244px;
|
||||
}
|
||||
#OpenWindow .txt-fld input.good_input {
|
||||
background: url("/images/showmodal/good.png") no-repeat scroll 236px center #DEF5E1;
|
||||
}
|
||||
#OpenWindow .btn-fld {
|
||||
overflow: hidden;
|
||||
padding: 12px 20px 12px 130px;
|
||||
width: 254px;
|
||||
}
|
||||
#OpenWindow button {
|
||||
background: none repeat scroll 0 0 #3F9D4A;
|
||||
border: medium none;
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
color: #FFFFFF;
|
||||
float: right;
|
||||
font-family: Verdana;
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
overflow: visible;
|
||||
padding: 7px 10px;
|
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
|
||||
width: auto;
|
||||
}
|
||||
|
||||
|
||||
/* 按钮
|
||||
*******************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue