memcached_alan
huang 10 years ago
commit cea43cb045

1
.gitignore vendored

@ -22,3 +22,4 @@
.DS_Store
public/api_doc/
/.metadata
vendor/cache

@ -1,5 +1,4 @@
source 'http://rubygems.org'
#source 'http://ruby.taobao.com'
source 'http://ruby.taobao.org'
#source 'http://ruby.sdutlinux.org/'
unless RUBY_PLATFORM =~ /w32/
@ -11,11 +10,11 @@ end
gem 'grape', '~> 0.9.0'
gem 'grape-entity'
gem 'seems_rateable', path: 'lib/seems_rateable'
gem 'seems_rateable', '~> 1.0.13'
gem "rails", "3.2.13"
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6"
gem 'coderay', '~> 1.1.0'
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
@ -28,11 +27,16 @@ gem 'rails_kindeditor'
group :development do
gem 'grape-swagger'
#gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
#gem 'puma'
gem 'puma' if RbConfig::CONFIG['host_os'] =~ /linux/
gem 'pry-rails'
gem 'pry-byebug'
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
if RUBY_VERSION >= '2.0.0'
gem 'pry-byebug'
else
gem 'pry-debugger'
end
gem 'pry-stack_explorer'
gem 'better_errors', '~> 1.1.0'
gem 'rack-mini-profiler', '~> 0.9.3'
end
group :test do

@ -873,13 +873,15 @@ class CoursesController < ApplicationController
"show_course_news" => true,
"show_course_messages" => true,
"show_bids" => true,
"show_course_journals_for_messages" => true
"show_course_journals_for_messages" => true,
"show_homeworks" => true
}
@date_to ||= Date.today + 1
#
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
#@date_from = @date_to - @days-1.years
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
@author ||= @course.teacher
# 决定显示所用用户或单个用户活动
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
:with_subprojects => false,

@ -26,10 +26,12 @@ class DiscussDemosController < ApplicationController
def destroy
asset = Kindeditor::Asset.find_by_owner_id(params[:id])
filepath = File.join(Rails.root,"public","files","uploads",
asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s,
asset[:asset].to_s)
File.delete(filepath) if File.exist?filepath
if !asset.nil?
filepath = File.join(Rails.root,"public","files","uploads",
asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s,
asset[:asset].to_s)
File.delete(filepath) if File.exist?filepath
end
DiscussDemo.destroy(params[:id])
redirect_to :controller=> 'discuss_demos',:action => 'index'
end

@ -0,0 +1,9 @@
class GitCallbackController < ApplicationController
def post_update
@repository = Repository.find_by_root_url(params[:root_url])
@repository.fetch_changesets
render :text => 'success'
end
end

@ -58,7 +58,7 @@ class IssuesController < ApplicationController
def index
retrieve_query
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns)
@query.sort_criteria = sort_criteria.to_a
@ -162,7 +162,8 @@ class IssuesController < ApplicationController
respond_to do |format|
format.html {
render_attachment_warning_if_needed(@issue)
flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.subject}", issue_path(@issue), :title => @issue.subject))
flash[:notice] = l(:label_successful_create)
#flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.subject}", issue_path(@issue), :title => @issue.subject))
#flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
if params[:continue]
attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
@ -381,7 +382,7 @@ class IssuesController < ApplicationController
def retrieve_previous_and_next_issue_ids
retrieve_query_from_session
if @query
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns, 'issues_index_sort')
limit = 500
issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])

@ -92,6 +92,22 @@ class RepositoriesController < ApplicationController
render :action => 'show', :layout => 'base_projects'
end
HOOK_TEMPLATE = %Q{#!/bin/sh
exec sh -c '
function update()
{
CMD_PATH=`dirname $0`;
cd $CMD_PATH;
PY_PATH=$PWD/../../git_refresh_changes.py;
[[ -s "$PY_PATH" ]] && $(which python) $PY_PATH $PWD;
cd -;
}
git update-server-info
update
'
}
def create
if params[:repository_scm].to_s == 'Gitlab'
# add by nwb
@ -127,7 +143,6 @@ class RepositoriesController < ApplicationController
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
#by xianbo
@repository.project = @project
if request.post? && @repository.save
@ -145,12 +160,11 @@ class RepositoriesController < ApplicationController
"</Limit> \n ' >> "+
@root_path+"htdocs/"+ @repository_name+"/.htaccess"
system "cd "+@project_path+" ;git update-server-info"
# if(create_repo_file&&create_passwd&&create_group&&init_repository&&add_privilege&&init_server_info)
# else
# logger.info "An error occured when authenticating "+"create passwd"+@creat_passwd+"create_group"+
# crate_group+"create repository file "+create_repo_file+"init repository"+init_repostory+
# "aad privilege to rpository"+add_privilege+"init server infos"+init_server_info
# end
File.open(@project_path+"/hooks/post-update", "w+") do |f|
f.write(HOOK_TEMPLATE)
end
@repository.update_attributes(:login => User.current.login.to_s)
end
redirect_to settings_project_url(@project, :tab => 'repositories')
@ -160,6 +174,8 @@ class RepositoriesController < ApplicationController
render :action => 'new', :layout =>'base_projects'
end
end
end
end

@ -445,15 +445,15 @@ class UsersController < ApplicationController
else
activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
end
activity = activity.reject { |e|
e.act.nil? ||
(!User.current.admin? && !e.act.nil?
(((e.act_type == "Issue") && !e.act.project.visible?(User.current)) ||
(e.act_type == "Bid" && !e.act.courses.first.nil? && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) ||
(e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) ||
(e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) ||
(e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course))))))
}
# activity = activity.reject { |e|
# e.act.nil? ||
# (!User.current.admin? && !e.act.nil?
# (((e.act_type == "Issue") && !e.act.project.visible?(User.current)) ||
# (e.act_type == "Bid" && !e.act.courses.first.nil? && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) ||
# (e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) ||
# (e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) ||
# (e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course))))))
# }
@activity_count = activity.count
@activity_pages = Paginator.new @activity_count, pre_count, params['page']
@activity = activity.slice(@activity_pages.offset,@activity_pages.per_page)

@ -1994,4 +1994,10 @@ module ApplicationHelper
end
technical_title
end
def ie8?
request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/
end
end

@ -61,14 +61,21 @@ class Bid < ActiveRecord::Base
end
}
scope :course_visible, lambda {|*args|
includes(:courses).where(Course.allowed_to_condition(args.shift || User.current, :view_homeworks, *args))
}
acts_as_watchable
acts_as_taggable
acts_as_event :title => Proc.new {|o| "#{l(:label_requirement)} ##{o.id}: #{o.name}" },
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}}
acts_as_activity_provider :type => 'homeworks',
:author_key => :author_id
acts_as_activity_provider :find_options => {:include => [:projects, :author]},
:author_key => :author_id

@ -778,7 +778,7 @@ class User < Principal
(block_given? ? yield(role, self) : true)
}
#添加课程相关的权限判断
elsif context && context.is_a?(Course)
elsif context && context.is_a?(Course)
return false unless context.allows_to?(action)
# Admin users are authorized for anything else
return true if admin?

@ -1,6 +1,6 @@
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<% container.saved_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 => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
@ -34,7 +34,6 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
</span>
<script type='text/javascript'>
@ -49,19 +48,21 @@
<span class="add_attachment" style="font-weight:normal;">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()' %>
<%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()', :style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => 'display:none',
:style => ie8? ? '' : 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js',:project =>project),
:description_placeholder => l(:label_optional_description)
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure)
} %>
<span id="upload_file_count">
<%= l(:label_no_file_uploaded)%>

@ -22,13 +22,13 @@
</span>
</div>
<button name="button" class="f_l ml10" onclick="_file.click()" onmouseover="this.focus()" type="button" style="width:20%; height:26%;"><%= l(:label_browse)%></button>
<button name="button" class="f_l ml10" onclick="_file.click()" onmouseover="this.focus()" type="button" style="<%= ie8? ? 'display:none' : '' %>; width:20%; height:26%;"><%= l(:label_browse)%></button>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => 'display:none',
:style => ie8? ? '': 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),

@ -4,7 +4,8 @@
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form") do %>
<%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
<div class="cl"></div>

@ -93,7 +93,7 @@
<%= image_tag(url_to_avatar(@project), :style => 'width:61px; height:61px;') %>
</div>
<div class="pr_info_id fl mb5">
项目ID:<%= @project.id %>
<%= l(:label_project_id)%><%= @project.id %>
</div>
<!--关注、申请加入/退出项目-->
<div id="join_exit_project_div">

@ -31,9 +31,9 @@ en:
#
# 左边栏
#
label_id: "ID:"
label_project_id: "Projcet ID:"
label_apply_project: Apply to Join
label_apply_project: "+Apply to Join"
label_exit_project: Exit
label_apply_project_waiting: "Application has been processed, please wait for administrator review."
label_unapply_project: Cancel the application
@ -51,6 +51,7 @@ en:
project_module_boards: Forums
project_module_boards_post: New Post
project_module_files: Resources
label_upload_files: New File
project_module_repository: Repository
project_module_create_repository: New Repository
@ -102,9 +103,6 @@ en:
#
lable_file_sharingarea: Resources
label_upload_files: New file
# 资源库(附件)公用
label_relation_files: Select an existing resource
label_search_by_keyword: "Search by keywords"
@ -138,6 +136,7 @@ en:
# 项目托管平台
#
# 问题跟踪
label_successful_create: Successfully created
#

@ -10,9 +10,8 @@ zh:
#
# 公共类
#
label_apply_project: 申请加入
label_project_new: 新建项目
label_join_project: 加入项目
label_project_new: "新建项目"
label_join_project: "加入项目"
#
@ -34,9 +33,9 @@ zh:
#
# 左边栏
#
label_id: "ID:"
label_project_id: "项目ID:"
label_apply_project: 申请加入
label_apply_project: "+申请加入"
label_exit_project: 退出项目
label_apply_project_waiting: 已处理申请,请等待管理员审核
label_unapply_project: 取消申请
@ -140,6 +139,7 @@ zh:
# 项目托管平台
#
# 问题跟踪
label_successful_create: 创建成功
#

@ -863,6 +863,11 @@ RedmineApp::Application.routes.draw do
match 'system_log/clear'
##ended by lizanle
resources :git_callback do
collection do
post 'post_update'
end
end
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb")

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save