修复版本库
This commit is contained in:
parent
a11b1676ff
commit
9b8c0f81b2
|
@ -99,6 +99,8 @@ class AccountController < ApplicationController
|
|||
|
||||
# User self-registration
|
||||
def register
|
||||
@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
|
||||
|
@ -123,6 +125,15 @@ 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:"+
|
||||
" "+user_params[:password]+"' >> "+@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
|
||||
|
|
|
@ -87,7 +87,9 @@ 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
|
||||
|
@ -96,6 +98,8 @@ class MyController < ApplicationController
|
|||
if request.post?
|
||||
if @user.check_password?(params[:password])
|
||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||
system "sed -i /"+@middle+"/{d} "+@root_path+"user.passwd"
|
||||
system "htpasswd -mb "+@root_path+"user.passwd "+@user.login.to_s+" "+params[:new_password]
|
||||
if @user.save
|
||||
flash[:notice] = l(:notice_account_password_updated)
|
||||
redirect_to my_account_path
|
||||
|
|
|
@ -143,7 +143,9 @@ class ProjectsController < ApplicationController
|
|||
unless User.current.admin?
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
@project.members << m
|
||||
@projec.project_infos << project
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
|
|
@ -73,12 +73,12 @@ class RepositoriesController < ApplicationController
|
|||
def create
|
||||
##xianbo
|
||||
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
|
||||
@repository_name=params[:project_id]+"/"+params[:repository][:identifier]+".git"
|
||||
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
|
||||
@project_path=@root_path+"htdocs/"+@repository_name
|
||||
@upasswd=params[:repository][:upassword]
|
||||
@repository_tag=params[:repository][:url]
|
||||
attrs = pickup_extra_info
|
||||
if(params[:repository][:upassword]!="")
|
||||
params[:repository][:password]=params[:repository][:upassword]
|
||||
if(!@repository_tag)
|
||||
# params[:repository][:password]=params[:repository][:upassword]
|
||||
if(params[:repository_scm]=="Git")
|
||||
params[:repository][:url]=@project_path
|
||||
end
|
||||
|
@ -96,24 +96,16 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
@repository.project = @project
|
||||
if request.post? && @repository.save
|
||||
if(params[:repository][:upassword]&¶ms[:repository_scm]=="Git")
|
||||
system "htpasswd -mb "+@root_path+"user.passwd "+params[:repository][:identifier]+" "+@upasswd
|
||||
system "echo -e '\n"+params[:project_id]+"-"+params[:repository][:identifier]+"-write:"+
|
||||
" "+params[:repository][:identifier]+"' >> "+@root_path+"group.passwd"
|
||||
if(!@repository_tag &¶ms[: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 "cd "+@project_path+"/hooks/"
|
||||
system "./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 "+params[:project_id]+"-"+params[:repository][:identifier]+"-write \n "+
|
||||
"</Limit> \n ' >>"+
|
||||
@project_path+"/.htaccess"
|
||||
|
||||
system "cd "+@project_path+"/"
|
||||
system "git update-server-info"
|
||||
@repository.update_attributes(:login => User.current.login.to_s)
|
||||
end
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
else if(@upasswd)
|
||||
else if(!@repository_tag)
|
||||
render :action => 'newrepo', :layout =>'base_projects'
|
||||
else
|
||||
render :action => 'new', :layout =>'base_projects'
|
||||
|
@ -168,8 +160,13 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@root_path="/home/pdl/redmine-2.3.2-0/apache2/"
|
||||
@repository_name=User.current.login.to_s+"/"+@repository.identifier.to_s+".git"
|
||||
@repository.destroy if request.delete?
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
if(@repository.type=="Repository::Git")
|
||||
system "rm -r "+@repository_name
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -180,11 +177,12 @@ class RepositoriesController < ApplicationController
|
|||
if request.xhr?
|
||||
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
||||
else
|
||||
(show_error_not_found; return) unless @entries
|
||||
#Modified by young
|
||||
# (show_error_not_found; return) unless @entries
|
||||
@changesets = @repository.latest_changesets(@path, @rev)
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@repositories = @project.repositories
|
||||
render :action => 'show'
|
||||
render :action => 'show', :layout => 'base_projects'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -196,6 +194,7 @@ class RepositoriesController < ApplicationController
|
|||
@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
def revisions
|
||||
|
@ -210,7 +209,7 @@ class RepositoriesController < ApplicationController
|
|||
all
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false if request.xhr? }
|
||||
format.html { render :layout => 'base_projects' }
|
||||
format.atom { render_feed(@changesets, :title => "#{@project.name}: #{l(:label_revision_plural)}") }
|
||||
end
|
||||
end
|
||||
|
@ -339,9 +338,11 @@ class RepositoriesController < ApplicationController
|
|||
@changeset_to = @rev_to ? @repository.find_changeset_by_name(@rev_to) : nil
|
||||
@diff_format_revisions = @repository.diff_format_revisions(@changeset, @changeset_to)
|
||||
end
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
def stats
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
def graph
|
||||
|
@ -431,7 +432,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
graph = SVG::Graph::Bar.new(
|
||||
:height => 300,
|
||||
:width => 800,
|
||||
:width => 600,
|
||||
:fields => fields.reverse,
|
||||
:stack => :side,
|
||||
:scale_integers => true,
|
||||
|
@ -474,7 +475,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
graph = SVG::Graph::BarHorizontal.new(
|
||||
:height => 400,
|
||||
:width => 800,
|
||||
:width => 600,
|
||||
:fields => fields,
|
||||
:stack => :side,
|
||||
:scale_integers => true,
|
||||
|
|
|
@ -76,10 +76,16 @@
|
|||
<!-- 在这里添加赞和踩-->
|
||||
<span id="praise_tread" style="float: right"> <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => issue,:show_flag => true,:user_id =>User.current.id}%> </span>
|
||||
|
||||
<% if issue.tracker.name == 'Bug' %>
|
||||
<% if issue.tracker_id == 1 %>
|
||||
<%= image_tag("/images/task.png", :class => "img-tag-issues") %>
|
||||
<% end %>
|
||||
<% if issue.tracker.name == '任务'%>
|
||||
<% if issue.tracker_id == 2 %>
|
||||
<%= image_tag("/images/feature.png", :class => "img-tag-issues") %>
|
||||
<% end %>
|
||||
<% if issue.tracker_id == 3 %>
|
||||
<%= image_tag("/images/support.png", :class => "img-tag-issues") %>
|
||||
<% end %>
|
||||
<% if issue.tracker_id == 4 %>
|
||||
<%= image_tag("/images/issues.png", :class => "img-tag-issues") %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% project_path_cut = 40 %>
|
||||
<% ip = "222.247.54.100" %><!--Added by tanxianbo For formatting project's path-->
|
||||
<% ip = "repository.trustie.net" %><!--Added by tanxianbo For formatting project's path-->
|
||||
<% if @project.repositories.any? %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<td align="center"><%= checked_image repository.is_default? %></td>
|
||||
<td><%=h repository.scm_name %></td>
|
||||
<%if repository.scm_name=="Git"%>
|
||||
<td>http://<%= repository.identifier%>@<%= ip %><%=h repository.url.slice(project_path_cut, repository.url.length) %></td><!--Modified by tanxianbo-->
|
||||
<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 %>
|
||||
|
@ -29,10 +29,18 @@
|
|||
<td class="buttons">
|
||||
<% if repository.scm_name=="Subversion"%>
|
||||
<%if User.current.allowed_to?(:manage_repository, @project) %>
|
||||
<%= link_to(l(:button_edit), edit_repository_path(repository),
|
||||
:class => 'icon icon-edit') %>
|
||||
<%= link_to(l(:label_user_plural), committers_repository_path(repository),
|
||||
:class => 'icon icon-user') %>
|
||||
<%= delete_link repository_path(repository) %>
|
||||
<% end %>
|
||||
<% elsif repository.scm_name=="Git"%>
|
||||
<%if User.current.allowed_to?(:manage_repository, @project) %>
|
||||
<!-- <%= link_to(l(:button_edit), edit_repository_path(repository),
|
||||
:class => 'icon icon-edit') %> -->
|
||||
<%= link_to(l(:label_user_plural), committers_repository_path(repository),
|
||||
:class => 'icon icon-user') %>
|
||||
<%= link_to(l(:button_edit), edit_repository_path(repository),
|
||||
:class => 'icon icon-edit') %>
|
||||
<%= delete_link repository_path(repository) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</p>
|
||||
|
||||
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
|
||||
<p><%= f.text_field :identifier, :disabled => @repository.identifier_frozen? %>
|
||||
<p><%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen? %>
|
||||
<% unless @repository.identifier_frozen? %>
|
||||
<em class="info"><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_repository_identifier_info).html_safe %></em>
|
||||
<% end %></p>
|
||||
|
|
|
@ -28,7 +28,7 @@ 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 %></p> -->
|
||||
</div>
|
||||
<p>
|
||||
<%= submit_tag(@repository.new_record? ? l(:button_create) : l(:button_save)) %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h3 style="padding-top: 40px;"><%= l(:label_statistics) %></h3>
|
||||
<h3><%= l(:label_statistics) %></h3>
|
||||
|
||||
<p>
|
||||
<%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %>
|
||||
|
|
Loading…
Reference in New Issue