diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 03b5967fe..7d815512b 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -19,34 +19,51 @@ require 'SVG/Graph/Bar' require 'SVG/Graph/BarHorizontal' require 'digest/sha1' require 'redmine/scm/adapters/abstract_adapter' +require 'tempfile' class ChangesetNotFound < Exception; end class InvalidRevisionParam < Exception; end class RepositoriesController < ApplicationController - layout 'base_projects' menu_item :repository menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers] default_search_scope :changesets - - before_filter :find_project_by_project_id, :only => [:new, :create] + + before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo] before_filter :find_repository, :only => [:edit, :update, :destroy, :committers] - before_filter :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers] + before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo] before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] - before_filter :authorize + before_filter :authorize , :except => [:newrepo,:newcreate] accept_rss_auth :revisions + rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed - def new scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first @repository = Repository.factory(scm) @repository.is_default = @project.repository.nil? @repository.project = @project end - + + def newrepo + scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first + @repository = Repository.factory(scm) + @repository.is_default = @project.repository.nil? + @repository.project = @project + end + def create attrs = pickup_extra_info + if(params[:repository]["upassword"]) + params[:repository]["password"]=params[:repository]["upassword"] + if(params[:repository_scm]=="Subversion") + + params[:repository]["url"]='svn://10.0.47.245/'+params[:repository]["identifier"] + end + if(params[:repository_scm]=="Git") + params[:repository]["url"]=params[:repository]["identifier"]+'@10.0.47.245://'+params[:repository]["identifier"] + end + end @repository = Repository.factory(params[:repository_scm]) @repository.safe_attributes = params[:repository] if attrs[:attrs_extra].keys.any? @@ -54,12 +71,29 @@ class RepositoriesController < ApplicationController end @repository.project = @project if request.post? && @repository.save + if(params[:repository]["upassword"]&¶ms[:repository_scm]=="Git") + system "htpasswd -mb /home/pdl/redmine-2.3.2-0/apache2/trustie2.passwd #{params[:repository]["identifier"]} #{params[:repository]["upassword"]}" + system "git init --bare /home/pdl/redmine-2.3.2-0/apache2/htdocs/#{params[:repository]["identifier"]}.git" + system "mv /home/pdl/redmine-2.3.2-0/apache2/htdocs/#{params[:repository]["identifier"]}.git/hooks/post-update{.sample,}" + system "./home/pdl/redmine-2.3.2-0/apache2/htdocs/#{params[:repository]["identifier"]}.git/hooks/post-update" + } + #system "C:/Users/ta/Desktop/modify.bat #{params[:repository]["identifier"]} #{params[:repository]["upassword"]}" + # system("mkdir c:/test/svn123") + # system("git init --bare c:/test/svn123/#{params[:repository]["identifier"]}") + + end + if(params[:repository]["upassword"]&¶ms[:repository_scm]=="Subversion") + system("svnadmin create c:/test/#{@project}/#{params[:repository]["identifier"]}") + end redirect_to settings_project_path(@project, :tab => 'repositories') - else - render :action => 'new' + else if(params[:repository]["upassword"]) + render :action => 'newrepo' + else + render :action => 'new' + end end end - + def edit end @@ -370,7 +404,7 @@ class RepositoriesController < ApplicationController graph = SVG::Graph::Bar.new( :height => 300, - :width => 650, + :width => 800, :fields => fields.reverse, :stack => :side, :scale_integers => true, @@ -413,7 +447,7 @@ class RepositoriesController < ApplicationController graph = SVG::Graph::BarHorizontal.new( :height => 400, - :width => 650, + :width => 800, :fields => fields, :stack => :side, :scale_integers => true, diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6cc7fd1b8..0e005690e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -403,7 +403,8 @@ class UsersController < ApplicationController def user_watchlist end ###add by huang - def user_fanslist + def user_fanslist + end private diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 75f1421e1..c06d4d65f 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -17,7 +17,6 @@ class WelcomeController < ApplicationController caches_action :robots - def index @news = News.latest User.current diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index ae45d2a58..e100b1317 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -126,7 +126,15 @@ module RepositoriesHelper send(method, form, repository) end end - + # by xianbo + def repository_field_tags_new(form, repository) + method = repository.class.name.demodulize.underscore + "_field_tags_new" + if repository.is_a?(Repository) && + respond_to?(method) && method != 'repository_field_tags_new' + send(method, form, repository) + end + end + def scm_select_tag(repository) scm_options = [["--- #{l(:actionview_instancetag_blank_option)} ---", '']] Redmine::Scm::Base.all.each do |scm| @@ -154,37 +162,40 @@ module RepositoriesHelper :disabled => !repository.safe_attribute?('url')) + '
'.html_safe + '(file:///, http://, https://, svn://, svn+[tunnelscheme]://)') + - content_tag('p', form.text_field(:login, :size => 30)) + + content_tag('p', form.text_field(:login, :size => 30))+ content_tag('p', form.password_field( :password, :size => 30, :name => 'ignore', :value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)), :onfocus => "this.value=''; this.name='repository[password]';", :onchange => "this.name='repository[password]';")) end + # by xianbo + def subversion_field_tags_new(form, repository) - def darcs_field_tags(form, repository) - content_tag('p', form.text_field( - :url, :label => l(:field_path_to_repository), - :size => 60, :required => true, - :disabled => !repository.safe_attribute?('url'))) + - content_tag('p', form.select( - :log_encoding, [nil] + Setting::ENCODINGS, - :label => l(:field_commit_logs_encoding), :required => true)) end + # def darcs_field_tags(form, repository) + # content_tag('p', form.text_field( + # :url, :label => l(:field_path_to_repository), + # :size => 60, :required => true, + # :disabled => !repository.safe_attribute?('url'))) + + # content_tag('p', form.select( + # :log_encoding, [nil] + Setting::ENCODINGS, + # :label => l(:field_commit_logs_encoding), :required => true)) + # end - def mercurial_field_tags(form, repository) - content_tag('p', form.text_field( - :url, :label => l(:field_path_to_repository), - :size => 60, :required => true, - :disabled => !repository.safe_attribute?('url') - ) + - '
'.html_safe + l(:text_mercurial_repository_note)) + - content_tag('p', form.select( - :path_encoding, [nil] + Setting::ENCODINGS, - :label => l(:field_scm_path_encoding) - ) + - '
'.html_safe + l(:text_scm_path_encoding_note)) - end + # def mercurial_field_tags(form, repository) + # content_tag('p', form.text_field( + # :url, :label => l(:field_path_to_repository), + # :size => 60, :required => true, + # :disabled => !repository.safe_attribute?('url') + # ) + + # '
'.html_safe + l(:text_mercurial_repository_note)) + + # content_tag('p', form.select( + # :path_encoding, [nil] + Setting::ENCODINGS, + # :label => l(:field_scm_path_encoding) + # ) + + # '
'.html_safe + l(:text_scm_path_encoding_note)) + # end def git_field_tags(form, repository) content_tag('p', form.text_field( @@ -204,37 +215,43 @@ module RepositoriesHelper :label => l(:label_git_report_last_commit) )) end - - def cvs_field_tags(form, repository) - content_tag('p', form.text_field( - :root_url, - :label => l(:field_cvsroot), - :size => 60, :required => true, - :disabled => !repository.safe_attribute?('root_url'))) + - content_tag('p', form.text_field( - :url, - :label => l(:field_cvs_module), - :size => 30, :required => true, - :disabled => !repository.safe_attribute?('url'))) + - content_tag('p', form.select( - :log_encoding, [nil] + Setting::ENCODINGS, - :label => l(:field_commit_logs_encoding), :required => true)) + - content_tag('p', form.select( - :path_encoding, [nil] + Setting::ENCODINGS, - :label => l(:field_scm_path_encoding) - ) + - '
'.html_safe + l(:text_scm_path_encoding_note)) +# by xianbo + def git_field_tags_new(form, repository) + content_tag('p', form.check_box( + :extra_report_last_commit, + :label => l(:label_git_report_last_commit) + )) end + # def cvs_field_tags(form, repository) + # content_tag('p', form.text_field( + # :root_url, + # :label => l(:field_cvsroot), + # :size => 60, :required => true, + # :disabled => !repository.safe_attribute?('root_url'))) + + # content_tag('p', form.text_field( + # :url, + # :label => l(:field_cvs_module), + # :size => 30, :required => true, + # :disabled => !repository.safe_attribute?('url'))) + + # content_tag('p', form.select( + # :log_encoding, [nil] + Setting::ENCODINGS, + # :label => l(:field_commit_logs_encoding), :required => true)) + + # content_tag('p', form.select( + # :path_encoding, [nil] + Setting::ENCODINGS, + # :label => l(:field_scm_path_encoding) + # ) + + # '
'.html_safe + l(:text_scm_path_encoding_note)) + # end - def bazaar_field_tags(form, repository) - content_tag('p', form.text_field( - :url, :label => l(:field_path_to_repository), - :size => 60, :required => true, - :disabled => !repository.safe_attribute?('url'))) + - content_tag('p', form.select( - :log_encoding, [nil] + Setting::ENCODINGS, - :label => l(:field_commit_logs_encoding), :required => true)) - end + # def bazaar_field_tags(form, repository) + # content_tag('p', form.text_field( + # :url, :label => l(:field_path_to_repository), + # :size => 60, :required => true, + # :disabled => !repository.safe_attribute?('url'))) + + # content_tag('p', form.select( + # :log_encoding, [nil] + Setting::ENCODINGS, + # :label => l(:field_commit_logs_encoding), :required => true)) + # end def filesystem_field_tags(form, repository) content_tag('p', form.text_field( @@ -276,7 +293,7 @@ module RepositoriesHelper space ||= index_head(0, commits.first, commits_by_scmid) return commits_by_scmid, space end - + def index_head(space, commit, commits_by_scmid) stack = [[space, commits_by_scmid[commit.scmid]]] max_space = space @@ -295,3 +312,5 @@ module RepositoriesHelper max_space end end + + diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 704597c29..26abb6600 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -62,9 +62,9 @@ <%= @project.issues.count %> <%= @project.attachments.count %> - <%= link_to(l(:label_member), project_member_path(@project), :class => 'project_infor_tag') %> - <%= link_to(l(:label_project_defects), project_issues_path(@project), :class => 'project_infor_tag') %> - <%= link_to(l(:label_attachment), project_files_path(@project), :class => 'project_infor_tag') %> + <%= link_to(l(:label_member), project_member_path(@project), :class => 'project_infor_tag') %> + <%= link_to(l(:label_project_defects), project_issues_path(@project), :class => 'project_infor_tag') %> + <%= link_to(l(:label_attachment), project_files_path(@project), :class => 'project_infor_tag') %>
@@ -75,7 +75,7 @@
<%= l(:label_project_overview) %>
-
+
<%= textilizable @project.description %> @@ -92,24 +92,24 @@
<%= l(:label_project_tool)%>
-
+ - - - - - diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 0da3d1ac7..6c65e1507 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -29,11 +29,12 @@
+ <%=image_tag("/images/sidebar/tool_tag2.png", weight:"15px", height:"15px") %> <%= link_to l(:project_module_documents),project_documents_path(@project) %> + <%=image_tag("/images/sidebar/tool_tag2.png", weight:"15px", height:"15px") %> <%= link_to l(:project_module_wiki),project_wiki_path(@project) %>
+ <%=image_tag("/images/sidebar/tool_tag2.png", weight:"15px", height:"15px") %> <%= link_to l(:project_module_calendar),project_calendar_path(@project) %> + <%=image_tag("/images/sidebar/tool_tag2.png", weight:"15px", height:"15px") %> <%= link_to l(:project_module_gantt) ,project_gantt_path(@project) %>
+ <%=image_tag("/images/sidebar/tool_tag2.png", weight:"15px", height:"15px") %> <%= link_to l(:project_module_boards) ,project_boards_path(@project) %>
- + +
<%= link_to image_tag(url_to_avatar(@user), :class => 'avatar'), :class => "avatar" %><%= link_to image_tag(url_to_avatar(@user), :class => 'avatar2'), :class => "avatar" %> - +
<%= h @user.name%> <%= h @user.name%> <%=image_tag("/images/sidebar/male.png", weight:"11px", height:"11px") %> +
<% unless User.current == @user %> @@ -43,12 +44,15 @@
+ <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @user,:show_flag => false,:user_id =>User.current.id}%> +
- <%= l(:label_user_watcher) %> (<%=link_to User.watched_by(@user.id).count %>)   + <%= l(:label_user_watcher) %> (<%=link_to User.watched_by(@user.id).count ,:controller=>"users", :action=>"user_watchlist"%>)   <%= render :partial => "watchers/fans_num",:locals => {:fans_num => get_fans_num(@user) }%> - <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @user,:show_flag => false,:user_id =>User.current.id}%> +
diff --git a/app/views/projects/settings/_repositories.html.erb b/app/views/projects/settings/_repositories.html.erb index 4492165c9..6b6f9a064 100644 --- a/app/views/projects/settings/_repositories.html.erb +++ b/app/views/projects/settings/_repositories.html.erb @@ -39,3 +39,8 @@ <% if User.current.allowed_to?(:manage_repository, @project) %>

<%= link_to l(:label_repository_new), new_project_repository_path(@project), :class => 'icon icon-add' %>

<% end %> + +<% if User.current.allowed_to?(:manage_repository, @project) %> +

<%= l(:label_repository_no) %> + <%= link_to l(:label_repository_new_repos), newrepo_project_repository_path(@project), :class => 'icon icon-add' %>

+<% end %> \ No newline at end of file diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 459e30691..307eb9493 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -36,5 +36,7 @@ <%= l(:label_project_un) %> <% else %><%= l(:label_project_unadd) %><%= link_to"新建",:controller=>'projects',:action=>'new'%> <% end %> + <% end %> -<%= call_hook :view_account_left_bottom, :user => @user %>
\ No newline at end of file +<%= call_hook :view_account_left_bottom, :user => @user %> + diff --git a/app/views/watchers/_fans_num.html.erb b/app/views/watchers/_fans_num.html.erb index 010bf52e2..7c7f03691 100644 --- a/app/views/watchers/_fans_num.html.erb +++ b/app/views/watchers/_fans_num.html.erb @@ -1,3 +1,3 @@ -<%= l(:label_user_fans) %>(<%= fans_num %>) +<%= l(:label_user_fans) %>(<%=link_to fans_num %>) \ No newline at end of file diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index b129db12a..b1528602b 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -139,10 +139,10 @@ -
+
- @@ -269,7 +269,7 @@
Trustieforge +
Trustie 是一个社交化的项目管理、软件开发和众包平台。
Trustieforge is a socialized collaboration platform for project management, software development and software crowdsourcing.
在这里您可以可以看见任何一个版本的工程!
-
+
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index b90867e20..9a8217b02 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1055,7 +1055,9 @@ zh: zero: 0 问题 one: 1 问题 other: "%{count} 问题" - label_repository_new: 新建版本库 + label_repository_new: 配置版本库 + label_repository_no: 还没有版本库? + label_repository_new_repos: 新建版本库 field_repository_is_default: 主版本库 label_copy_attachments: 复制附件 label_item_position: "%{position}/%{count}" @@ -1229,4 +1231,4 @@ zh: label_in_issues: 在问题: label_in_bids: 在需求: label_in_users: 在用户: - label_have_respond: 进行了反馈 \ No newline at end of file + label_have_respond: 进行了反馈 diff --git a/config/routes.rb b/config/routes.rb index 0562cba47..72e8ca27c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -204,7 +204,12 @@ RedmineApp::Application.routes.draw do match 'committers', :via => [:get, :post] end end - + resources :repositories, :except => [:index, :show] do + member do + get 'newrepo', :via => [:get, :post] + # get 'create', :via=>[:get, :post] + end + end match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do member do diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 87e61e2d5..fe008c51c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -63,7 +63,7 @@ ul.tool li{list-style-type:none; color:#7e7e7e; } .content_frame{ - padding-top: 0px; + padding-bottom: 30px; float: left; }