修正版本库

This commit is contained in:
Administrator 2013-08-16 22:43:44 +08:00
parent 6977c851fb
commit 8dd2d4a39a
10 changed files with 115 additions and 91 deletions

View File

@ -99,8 +99,8 @@ class AccountController < ApplicationController
# User self-registration
def register
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
# @root_path="/home/pdl/redmine-2.3.2-0/apache2/"
#
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get?
session[:auth_source_registration] = nil
@ -125,16 +125,16 @@ class AccountController < ApplicationController
@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]
system "htpasswd -mb "+@root_path+"user.passwd "+params[:user][:login]+" "+user_params[:password]
system "echo -e '\n"+params[:user][:login]+"-write:"+
" "+params[:user][:login]+"' >> "+@root_path+"group.passwd"
system "mkdir "+@root_path+"htdocs/"+params[:user][:login]
system "echo -e 'Allow from all \n Order Deny,Allow \n "+
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
"Require group "+params[:user][:login]+"-write \n "+
"</Limit> \n ' >>"+
@root_path+"htdocs/"+params[:user][:login]+"/.htaccess"
# system "htpasswd -mb "+@root_path+"user.passwd "+params[:user][:login]+" "+user_params[:password]
# system "echo -e '\n"+params[:user][:login]+"-write:"+
# " "+params[:user][:login]+"' >> "+@root_path+"group.passwd"
# system "mkdir "+@root_path+"htdocs/"+params[:user][:login]
#
# system "echo -e 'Allow from all \n Order Deny,Allow \n "+
# "<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
# "Require group "+params[:user][:login]+"-write \n "+
# "</Limit> \n ' >>"+
# @root_path+"htdocs/"+params[:user][:login]+"/.htaccess"
end
case Setting.self_registration

View File

@ -87,9 +87,7 @@ class MyController < ApplicationController
# Manage user's password
def password
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
@user = User.current
@middle = "^"+@user.login.to_s+":"
unless @user.change_password_allowed?
flash[:error] = l(:notice_can_t_change_password)
redirect_to my_account_path
@ -98,17 +96,7 @@ class MyController < ApplicationController
if request.post?
if @user.check_password?(params[:password])
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
system "sed -i /"+@middle+"/{d} "+@root_path+"user.passwd"
system "htpasswd -mb "+@root_path+"user.passwd "+@user.login.to_s+" "+params[:new_password]
system "echo -e '\n"+@user.login.to_s+"-write:"+
" "+@user.login.to_s+"' >> "+@root_path+"group.passwd"
system "mkdir "+@root_path+"htdocs/"+@user.login.to_s
system "echo -e 'Allow from all \n Order Deny,Allow \n "+
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
"Require group "+@user.login.to_s+"-write \n "+
"</Limit> \n ' >>"+
@root_path+"htdocs/"+@user.login.to_s+"/.htaccess"
if @user.save
flash[:notice] = l(:notice_account_password_updated)
redirect_to my_account_path

View File

@ -355,7 +355,10 @@ class ProjectsController < ApplicationController
format.html { redirect_to admin_projects_path }
format.api { render_api_ok }
end
else
render :layout => "base"
end
# hide project in layout
@project = nil
end

View File

@ -75,16 +75,10 @@ class RepositoriesController < ApplicationController
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@project_path=@root_path+"htdocs/"+@repository_name
@repository_tag=params[:repository][:url]
@repository_tag=params[:repository][:upassword]
attrs = pickup_extra_info
if(!@repository_tag)
# params[:repository][:password]=params[:repository][:upassword]
if(params[:repository_scm]=="Git")
params[:repository][:url]=@project_path
end
# else
# render_error l(:error_scm_password_not_set); return
# render :action => 'newrepo'
if((@repository_tag!="")&&params[:repository_scm]=="Git")
params[:repository][:url]=@project_path
end
###xianbo
@repository = Repository.factory(params[:repository_scm])
@ -97,10 +91,19 @@ class RepositoriesController < ApplicationController
@repository.project = @project
if request.post? && @repository.save
if(params[:repository_scm]=="Git")
system "git init --bare "+@project_path
system "mv "+@project_path+"/hooks/post-update{.sample,}"
system "chmod a+x "+@project_path+"/hooks/post-update"
system "htpasswd -mb "+@root_path+"user.passwd "+User.current.login.to_s+" "+@repository_tag
system "echo -e '\n"+User.current.login.to_s+"-"+params[:repository][:identifier]+"-write:"+
" "+User.current.login.to_s+"' >> "+@root_path+"group.passwd"
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
system "git init --bare "+@project_path
system "mv "+@project_path+"/hooks/post-update{.sample,}"
system "chmod a+x "+@project_path+"/hooks/post-update"
system "echo -e 'Allow from all \n Order Deny,Allow \n "+
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
"Require group "+User.current.login.to_s+"-"+params[:repository][:identifier]+"-write \n "+
"</Limit> \n ' >> "+
@root_path+"htdocs/"+ @repository_name+"/.htaccess"
puts "before ======================================================================"
puts system "cd "+@project_path+" ;git update-server-info"
flag = system "cd "+@project_path+" ;git update-server-info"
@ -108,7 +111,7 @@ class RepositoriesController < ApplicationController
@repository.update_attributes(:login => User.current.login.to_s)
end
redirect_to settings_project_path(@project, :tab => 'repositories')
else if(!@repository_tag)
else if(@repository_tag)
render :action => 'newrepo', :layout =>'base_projects'
else
render :action => 'new', :layout =>'base_projects'

View File

@ -185,7 +185,7 @@ class VersionsController < ApplicationController
if ids = params[:tracker_ids]
@selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
else
@selected_tracker_ids = (default_trackers || selectable_trackers).collect {|t| t.id.to_s }
@selected_tracker_ids = (selectable_trackers).collect {|t| t.id.to_s }
end
end
end

View File

@ -28,7 +28,8 @@ border:none
<%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>
<!-- <p><%= f.text_field :url, :size => 60, :required => true,:readonly=>true, :class=>'textbg'%></p> -->
<!-- <p><%= f.password_field :upassword, :required =>true, :label=> :field_password %></p> -->
<p><%= f.password_field :upassword, :required =>true, :label=> :field_password %>
<em class="info"><%= l(:label_upassword_info)%></em></p>
</div>
<p>
<%= submit_tag(@repository.new_record? ? l(:button_create) : l(:button_save)) %>

View File

@ -4,10 +4,18 @@
<%= render :partial => 'navigation' %>
</div>
<% project_path_cut = 40 %>
<% ip = "repository.trustie.net" %><!--Added by young For formatting project's path-->
<h3>
<%= render :partial => 'breadcrumbs',
:locals => { :path => @path, :kind => 'dir', :revision => @rev } %>
<div style="font-size:11px;">
<%if @repository.type.to_s=="Repository::Git"%>
<td>http://<%= @repository.login.to_s %>@<%= ip %><%=h @repository.url.slice(project_path_cut, @repository.url.length) %></td><!--Modified by tanxianbo-->
<%else %>
<td><%=h @repository.url %></td>
<% end %>
</div>
<% if @repositories.size > 1 %>
<p style=" word-wrap: break-word; word-break: break-all">
(<%= l(:label_all_revisions) %><%= @repositories.sort.collect {|repo|

View File

@ -1,58 +1,77 @@
<!--modified by young-->
<div class="contextual">
<%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= link_to_if_authorized(l(:button_edit_associated_wikipage, :page_title => @version.wiki_page_title), {:controller => 'wiki', :action => 'edit', :project_id => @version.project, :id => Wiki.titleize(@version.wiki_page_title)}, :class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @version.project.wiki.nil? %>
<%= delete_link version_path(@version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)) if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<div class="contextual" style="padding-right: 10px;">
<%= render :partial => 'navigation' %>
</div>
<h3><%= h(@version.name) %></h3>
<div id="roadmap">
<%= render :partial => 'versions/overview', :locals => {:version => @version} %>
<%= render(:partial => "wiki/content", :locals => {:content => @version.wiki_page.content}) if @version.wiki_page %>
<h3>
<%= render :partial => 'breadcrumbs',
:locals => { :path => @path, :kind => 'dir', :revision => @rev } %>
<% if @repositories.size > 1 %>
<p style=" word-wrap: break-word; word-break: break-all">
(<%= l(:label_all_revisions) %><%= @repositories.sort.collect {|repo|
link_to h(repo.name),
{:controller => 'repositories', :action => 'show',
:id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (repo == @repository ? ' selected' : '')
}.join('&nbsp|&nbsp').html_safe %>)</p>
<% end %>
</h3>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>
<% end %>
<%= render_properties(@properties) %>
<% if @issues.present? %>
<%= form_tag({}) do -%>
<table class="list related-issues">
<caption>&#187;<%= l(:label_related_issues) %></caption>
<%- @issues.each do |issue| -%>
<tr class="hascontextmenu">
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
<td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
</tr>
<% if authorize_for('repositories', 'revisions') %>
<% if @changesets && !@changesets.empty? %>
<h3><%= l(:label_latest_revision_plural) %></h3>
<%= render :partial => 'revisions',
:locals => {:project => @project, :path => @path,
:revisions => @changesets, :entry => nil }%>
<% end %>
<p>
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
sep = '' %>
<% if @repository.supports_all_revisions? && @path.blank? %>
<%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param %>
<% sep = '|' %>
<% end %>
<% if @repository.supports_directory_revisions? &&
( has_branches || !@path.blank? || !@rev.blank? ) %>
<%= sep %>
<%= link_to l(:label_view_revisions),
:action => 'changes',
:path => to_path_param(@path),
:id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev %>
<% end %>
</p>
<% if @repository.supports_all_revisions? %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(
:atom, params.merge(
{:format => 'atom', :action => 'revisions',
:id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom',
:url => {:action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param,
:key => User.current.rss_key} %>
<% end %>
<% end %>
</table>
<% end %>
<%= context_menu issues_context_menu_path %>
<% end %>
<div class="splitcontent">
<% if @version.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %>
<fieldset class="time-tracking"><legend><%= l(:label_time_tracking) %></legend>
<table>
<tr>
<th><%= l(:field_estimated_hours) %></th>
<td class="total-hours"><%= html_hours(l_hours(@version.estimated_hours)) %></td>
</tr>
<% if User.current.allowed_to?(:view_time_entries, @project) %>
<tr>
<th><%= l(:label_spent_time) %></th>
<td class="total-hours"><%= html_hours(l_hours(@version.spent_hours)) %></td>
</tr>
<% end %>
</table>
</fieldset>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>
<div id="status_by" style="margin-top:10px;"><!--by young-->
<%= render_issue_status_by(@version, params[:status_by]) if @version.fixed_issues.count > 0 %>
</div>
</div>
</div>
<%= call_hook :view_versions_show_bottom, :version => @version %>
<% html_title @version.name %>
<% html_title(l(:label_repository)) -%>

View File

@ -1245,4 +1245,5 @@ en:
label_tags_numbers: Tag numbers
label_max_number: Must be at most 25 characters long.
label_all_revisions: All revisions
label_repository_name: Repository name
label_repository_name: Repository name
label_upassword_info: The password can be shared in the group

View File

@ -1257,4 +1257,5 @@ zh:
label_tags_user_mail: 用户邮箱:
label_tags_numbers: Tag统计
label_max_number: 至多25个字符。
label_all_revisions: 所有版本:
label_all_revisions: 所有版本:
label_upassword_info: 该密码在项目组内可共享