bad_request('Missing qualifier') if params[:qualifier].blank?
end
+
+
# POST REQUESTS
def set_users
def set_default_project_groups
bad_request('Missing role') if params[:role].blank?
bad_request('Missing qualifier') if params[:qualifier].blank?
- Property.set("sonar.role.#{params[:role]}.#{params[:qualifier]}.defaultGroups", params[:groups].join(','))
+ group_names = params[:groups] || []
+ Property.set("sonar.role.#{params[:role]}.#{params[:qualifier]}.defaultGroups", group_names.join(','))
redirect
end
def set_default_project_users
bad_request('Missing role') if params[:role].blank?
bad_request('Missing qualifier') if params[:qualifier].blank?
- Property.set("sonar.role.#{params[:role]}.#{params[:qualifier]}.defaultUsers", params[:users].join(','))
+ logins = params[:logins] || []
+ Property.set("sonar.role.#{params[:role]}.#{params[:qualifier]}.defaultUsers", logins.join(','))
redirect
end
def users(role, resource_id=nil)
resource_id=(resource_id.blank? ? nil : resource_id.to_i)
- user_roles=UserRole.find(:all, :include => 'user', :conditions => {:role => role, :resource_id => resource_id})
+ user_roles=UserRole.find(:all, :include => 'user', :conditions => {:role => role, :resource_id => resource_id, :users => {:active => true}})
users = user_roles.map { |ur| ur.user }
Api::Utils.insensitive_sort(users) { |user| user.name }
end
group ? group.name : 'Anyone'
end
- def default_project_groups(role, qualifier)
+ def default_project_group_names(role, qualifier)
property_value=(controller.java_facade.getConfigurationValue("sonar.role.#{role}.#{qualifier}.defaultGroups")||'')
Api::Utils.insensitive_sort(property_value.split(','))
end
def default_project_users(role, qualifier)
property_value=(controller.java_facade.getConfigurationValue("sonar.role.#{role}.#{qualifier}.defaultUsers") || '')
- Api::Utils.insensitive_sort(property_value.split(','))
+ logins=property_value.split(',')
+ users = User.find(:all, :conditions => ['login in (?) and active=?', logins, true])
+ Api::Utils.insensitive_sort(users) { |user| user.name }
end
def role_name(role)
when 'user' then
'Users'
when 'codeviewer' then
- 'Code viewers'
+ 'Code Viewers'
else
role.to_s
end
granted_groups=groups(@role, @project.id)
ungranted_groups=all_groups - granted_groups
%>
-<div class="subtitle">» <a href="<%= url_for :action => 'index', :resource => @project.id -%>">Back to roles</a></div>
-<h1><%= h(@project.name) %></h1>
+<div class="subtitle">» <a href="<%= url_for :action => 'index', :resource => @project.id -%>">Back</a></div>
+<h1>Role Membership Of <%= h(@project.name) %></h1>
<br/>
<div>
<form action="<%= url_for :action => 'grant_groups' -%>" method="post">
<table>
<tbody>
<tr>
- <td style="padding: 5px 0pt;" valign="top">
- <h2>Ungranted groups</h2>
+ <td style="padding: 5px 0" valign="top">
+ <h2>Add Groups</h2>
<select name="from" id="from" size="20" style="margin: 5px 0pt; width: 300px;" multiple="multiple">
<% ungranted_groups.each do |group| %>
<option value="<%= group ? group.id : '' -%>"><%= group_name(group) %></option>
<% end %>
</select>
</td>
- <td style="padding: 0pt 10px;" align="center">
+ <td style="padding: 0 10px;" align="center">
<button id="select_right" onclick="SelectBox.move('from', 'to');SelectBox.sort('to');SelectBox.redisplay('to');return false;">select >></button><br>
<button id="select_right_all" onclick="SelectBox.move_all('from', 'to');return false;">select all >></button><br><br>
<button id="select_left" onclick="SelectBox.move('to', 'from');return false;"><< unselect</button><br>
<td class="box" style="padding: 5px 10px;" valign="top">
<h2>Role: <%= role_name(@role) -%></h2>
- <select name="groups[]" id="to" size="20" multiple="multiple" style="margin: 5px 0pt; width: 300px;">
+ <select name="groups[]" id="to" size="20" multiple="multiple" style="margin: 5px 0; width: 300px;">
<% granted_groups.each do |group| %>
<option value="<%= group ? group.id : '' -%>"><%= group_name(group) %></option>
<% end %>
</select><br>
- <div style="padding: 5px 0pt;">
+ <div style="padding: 5px 0">
<input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
+ <a href="<%= url_for :action => 'index', :resource => @project.id -%>"><%= message 'cancel' -%></a>
</div>
</td>
</tr>
granted_users=users(@role, params[:resource])
ungranted_users=all_users - granted_users
%>
-<div class="subtitle">» <a href="<%= url_for :action => 'index', :resource => @project.id -%>">Back to roles</a></div>
-<h1><%= h(@project.name) %></h1>
+<div class="subtitle">» <a href="<%= url_for :action => 'index', :resource => @project.id -%>">Back</a></div>
+<h1>Role Membership Of <%= h(@project.name) %></h1>
<br/>
<div id="main_content">
<form action="<%= url_for :action => 'grant_users' -%>" method="post">
<table>
<tbody>
<tr>
- <td style="padding: 5px 0pt;" valign="top">
- <h2>Ungranted users</h2>
- <select name="from" id="from" size="30" style="margin: 5px 0pt; width: 300px;" multiple="multiple">
+ <td style="padding: 5px 0;" valign="top">
+ <h2>Add Users</h2>
+ <select name="from" id="from" size="30" style="margin: 5px 0; width: 300px;" multiple="multiple">
<% ungranted_users.sort.each do |user| %>
- <option value="<%= user.id -%>"><%= user.name -%></option>
+ <option value="<%= user.id -%>"><%= h user.name -%></option>
<% end %>
</select>
</td>
- <td style="padding: 0pt 10px;" align="center">
+ <td style="padding: 0 10px;" align="center">
<button id="select_right" onclick="SelectBox.move('from', 'to');SelectBox.sort('to');SelectBox.redisplay('to');return false;">select >></button><br>
<button id="select_right_all" onclick="SelectBox.move_all('from', 'to');return false;">select all >></button><br><br>
<button id="select_left" onclick="SelectBox.move('to', 'from');return false;"><< unselect</button><br>
<%= options_from_collection_for_select(granted_users, "id", "name") %>
</select><br>
- <div style="padding: 5px 0pt;">
+ <div style="padding: 5px 0;">
<input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
+ <a href="<%= url_for :action => 'index', :resource => @project.id -%>"><%= message 'cancel' -%></a>
</div>
</td>
</tr>
-<h1 class="marginbottom10">Project roles</h1>
+<h1 class="marginbottom10">Roles</h1>
<table class="data width100">
<thead>
<tr>
<tr class="even" >
<td valign="top"><b>Administrators</b><br/><span class="small gray">Ability to perform administration functions for a project by accessing its settings.</span></td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= users('admin', params[:resource]).map(&:login).join(', ') %></span>
+ <span><%= users('admin', params[:resource]).map(&:name).join(', ') %></span>
(<%= link_to "select", {:action => 'edit_users', :resource => @project.id, :role => 'admin'}, :class => 'link-action' %>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
<tr class="odd">
<td valign="top"><b>Users</b><br/><span class="small gray">Ability to navigate through every service of a project, except viewing source code and settings.</span></td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= users('user', params[:resource]).map(&:login).join(', ') %></span>
+ <span><%= users('user', params[:resource]).map(&:name).join(', ') %></span>
(<%= link_to "select", {:action => 'edit_users', :resource => @project.id, :role => 'user'}, :class => 'link-action' %>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
<tr class="even" >
<td valign="top"><b>Code viewers</b><br/><span class="small gray">Ability to view source code of a project.</span></td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= users('codeviewer', params[:resource]).map(&:login).join(', ') %></span>
+ <span><%= users('codeviewer', params[:resource]).map(&:name).join(', ') %></span>
(<%= link_to "select", {:action => 'edit_users', :resource => @project.id, :role => 'codeviewer'}, :class => 'link-action' %>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
<%
- granted_groups=default_project_groups(params[:role], params[:qualifier])
+ granted_groups=default_project_group_names(params[:role], params[:qualifier])
all_groups = ['Anyone'].concat(Api::Utils.insensitive_sort(Group.all.map{|group| group.name}))
ungranted_groups=all_groups - granted_groups
%>
<div class="subtitle">» <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>">Back</a></div>
-<h1>TO BE DEFINED</h1>
+<h1>Role Membership For New <%= message("qualifiers.#{params[:qualifier]}") -%></h1>
<br/>
<div>
<form action="<%= url_for :action => 'set_default_project_groups' -%>" method="POST">
<tbody>
<tr>
<td style="padding: 5px 0;" valign="top">
- <h2>Ungranted groups</h2>
+ <h2>Add Groups</h2>
<select name="from" id="from" size="20" style="margin: 5px 0; width: 300px;" multiple="multiple">
<% ungranted_groups.each do |group| %>
<option value="<%= h group -%>"><%= group -%></option>
<div style="padding: 5px 0;">
<input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
+ <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>"><%= message 'cancel' -%></a>
</div>
</td>
</tr>
+<%
+ granted_users=default_project_users(params[:role], params[:qualifier])
+ ungranted_users=all_users - granted_users
+%>
+<div class="subtitle">» <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>">Back</a></div>
+<h1>Role Membership For New <%= message("qualifiers.#{params[:qualifier]}") -%></h1>
+<br/>
+<div>
+ <form action="<%= url_for :action => 'set_default_project_users' -%>" method="POST">
+ <input name="role" value="<%= params[:role] -%>" type="hidden"/>
+ <input name="redirect" value="projects" type="hidden"/>
+ <input name="q" value="<%= params[:q] -%>" type="hidden" />
+ <input name="qualifier" value="<%= params[:qualifier] -%>" type="hidden" />
+ <input name="page" value="<%= params[:page] -%>" type="hidden" />
+ <table>
+ <tbody>
+ <tr>
+ <td style="padding: 5px 0;" valign="top">
+ <h2>Add Users</h2>
+ <select name="from" id="from" size="20" style="margin: 5px 0; width: 300px;" multiple="multiple">
+ <% ungranted_users.each do |user| %>
+ <option value="<%= h user.login -%>"><%= h user.name -%></option>
+ <% end %>
+ </select>
+ </td>
+ <td style="padding: 0 10px;" align="center">
+ <button id="select_right" onclick="SelectBox.move('from', 'to');SelectBox.sort('to');SelectBox.redisplay('to');return false;">select >></button><br>
+ <button id="select_right_all" onclick="SelectBox.move_all('from', 'to');return false;">select all >></button><br><br>
+ <button id="select_left" onclick="SelectBox.move('to', 'from');return false;"><< unselect</button><br>
+ <button id="select_left_all" onclick="SelectBox.move_all('to', 'from');return false;"><< unselect all</button>
+ </td>
+ <td class="box" style="padding: 5px 10px;" valign="top">
+ <h2>Role: <%= role_name(params[:role]) -%></h2>
+
+ <select name="logins[]" id="to" size="20" multiple="multiple" style="margin: 5px 0; width: 300px;">
+ <% granted_users.each do |user| %>
+ <option value="<%= h user.login -%>"><%= h user.name -%></option>
+ <% end %>
+ </select><br>
+
+ <div style="padding: 5px 0;">
+ <input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
+ <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>"><%= message 'cancel' -%></a>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+ <script>
+ SelectBox.init('from');
+ SelectBox.init('to');
+ </script>
+</div>
granted_groups=groups(@role, params[:resource])
ungranted_groups=all_groups - granted_groups
if @project
- title=h(@project.name)
+ title='Role Membership For: ' + h(@project.name)
else
- title='System administrators'
+ title='System Administrators'
end
%>
<div class="subtitle">» <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>">Back</a></div>
<tbody>
<tr>
<td style="padding: 5px 0;" valign="top">
- <h2>Ungranted groups</h2>
+ <h2>Add Groups</h2>
<select name="from" id="from" size="20" style="margin: 5px 0; width: 300px;" multiple="multiple">
<% ungranted_groups.each do |group| %>
<option value="<%= group ? group.id : '' -%>"><%= group_name(group) -%></option>
<div style="padding: 5px 0;">
<input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
+ <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>"><%= message 'cancel' -%></a>
</div>
</td>
</tr>
granted_users=users(@role, params[:resource])
ungranted_users=(all_users - granted_users)
if @project
- title=h(@project.name)
- elsif @role.starts_with?('default-')
- title="Default project #{role_name(@role)}"
+ title='Role Membership For: ' + h(@project.name)
else
- title="Global #{role_name(@role)}"
+ title="System #{role_name(@role)}"
end
%>
<div class="subtitle">» <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>">Back</a></div>
<tbody>
<tr>
<td style="padding: 5px 0;" valign="top">
- <h2>Ungranted users</h2>
+ <h2>Add Users</h2>
<select name="from" id="from" size="30" style="margin: 5px 0; width: 300px;" multiple="multiple">
<% ungranted_users.each do |user| %>
<option value="<%= user.id -%>"><%= user.name -%></option>
<div style="padding: 5px 0;">
<input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
+ <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>"><%= message 'cancel' -%></a>
</div>
</td>
</tr>
<tr class="even" >
<td valign="top"><b>Administrators</b><br/><span class="small gray">Ability to perform all administration functions for the instance: global configuration and personalization of default dashboards.</span></td>
<td valign="top" style="word-break:break-all;width:30%;">
- <span><%= users('admin').map(&:login).join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_users', :role => 'admin', :redirect => 'global'}, :class => 'link-action' %>)
+ <span><%= users('admin').map(&:name).join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_users', :role => 'admin', :redirect => 'global'}, :class => 'link-action' -%>)
</td>
<td valign="top" style="word-break:break-all;width:30%;">
<span><%= groups('admin').map{|g| group_name(g)}.join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_groups', :role => 'admin', :redirect => 'global'}, :class => 'link-action' %>)
+ (<%= link_to "select", {:action => 'edit_groups', :role => 'admin', :redirect => 'global'}, :class => 'link-action' -%>)
</td>
</tr>
</tbody>
<h1 class="marginbottom10"><%= message('roles.page') -%></h1>
<% if @qualifiers.size>1 %>
-<ul class="tabs" id="qualifier-tabs">
- <% @qualifiers.each do |q|
+ <ul class="tabs" id="qualifier-tabs">
+ <% @qualifiers.each do |q|
css_class = (q==@qualifier ? 'selected' : '')
- %>
- <li>
- <%= link_to message("qualifiers.#{q}"), {:action => 'projects', :qualifier => q}, {:class => css_class} -%>
- </li>
- <% end %>
-</ul>
+ %>
+ <li>
+ <%= link_to message("qualifiers.#{q}"), {:action => 'projects', :qualifier => q}, {:class => css_class} -%>
+ </li>
+ <% end %>
+ </ul>
+ <div class="tabs-panel">
<% end %>
<table class="data width100" id="default-project-roles">
<thead>
<tr>
- <th>Default Permissions For New <%= message("qualifiers.#{@qualifier}") -%></th>
+ <th>Role Membership For New <%= message("qualifiers.#{@qualifier}") -%></th>
<th width="35%">Users</th>
<th width="35%">Groups</th>
</tr>
</thead>
<tbody>
+
<tr class="even">
- <td valign="top"><b>Role: Administrators</b><br/><span class="small gray">Ability to perform administration functions for a project by accessing its settings.</span></td>
+ <td valign="top"><b>Role: Administrators</b><br/><span class="small gray">Ability to perform administration functions for a project by accessing its settings.</span>
+ </td>
<td valign="top" style="word-break:break-all;width:35%;">
<div style="vertical-align:top">
- <span><%= default_project_users('admin', @qualifier).join(', ') -%></span>
- (<%= link_to "select", {:action => 'edit_default_project_users', :role => 'admin', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' %>)
+ <span><%= default_project_users('admin', @qualifier).map{|u| h u.name}.join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_default_project_users', :role => 'admin', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' -%>)
</div>
</td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= default_project_groups('admin', @qualifier).join(', ') -%></span>
- (<%= link_to "select", {:action => 'edit_default_project_groups', :role => 'admin', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' %>)
+ <span><%= default_project_group_names('admin', @qualifier).join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_default_project_groups', :role => 'admin', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' -%>)
</td>
</tr>
<tr class="odd">
- <td valign="top"><b>Role: Users</b><br/><span class="small gray">Ability to navigate through every service of a project, except viewing source code and settings.</span></td>
+ <td valign="top"><b>Role: Users</b><br/><span class="small gray">Ability to navigate through every service of a project, except viewing source code and settings.</span>
+ </td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= default_project_users('user', @qualifier).join(', ') -%></span>
- (<%= link_to "select", {:action => 'edit_default_project_users', :role => 'user', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' %>)
+ <span><%= default_project_users('user', @qualifier).map{|u| h u.name}.join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_default_project_users', :role => 'user', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' -%>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= default_project_groups('user', @qualifier).join(', ') -%></span>
- (<%= link_to "select", {:action => 'edit_default_project_groups', :role => 'user', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' %>)
+ <span><%= default_project_group_names('user', @qualifier).join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_default_project_groups', :role => 'user', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' -%>)
</td>
</tr>
<tr class="even">
- <td valign="top"><b>Role: Code viewers</b><br/><span class="small gray">Ability to view source code of a project.</span></td>
+ <td valign="top">
+ <b>Role: Code viewers</b><br/><span class="small gray">Ability to view source code of a project.</span></td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= default_project_users('codeviewer', @qualifier).join(', ') -%></span>
- (<%= link_to "select", {:action => 'edit_default_project_users', :role => 'codeviewer', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' %>)
+ <span><%= default_project_users('codeviewer', @qualifier).map{|u| h u.name}.join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_default_project_users', :role => 'codeviewer', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' -%>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= default_project_groups('codeviewer', @qualifier).join(', ') -%></span>
- (<%= link_to "select", {:action => 'edit_default_project_groups', :role => 'codeviewer', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' %>)
+ <span><%= default_project_group_names('codeviewer', @qualifier).join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_default_project_groups', :role => 'codeviewer', :redirect => 'projects', :qualifier => @qualifier}, :class => 'link-action' -%>)
</td>
</tr>
</tbody>
<br/><br/>
-<div class="<%= @qualifiers.size>1 ? 'tabs-panel' : '' -%>">
+<table class="data width100" id="projects">
+ <thead>
+ <tr>
+ <th>
+ <form action="<%= url_for :action => 'projects', :qualifier => @qualifier -%>" method="GET">
+ <input type="hidden" name="qualifier" value="<%= @qualifier -%>"/>
+ <input type="text" name="q" value="<%= params[:q] -%>" id="search_text"/>
+ <input type="submit" value="Search" id="search_submit"/>
+ </form>
+ </th>
+ <th>Role: Administrators</th>
+ <th>Role: Users</th>
+ <th>Role: Code viewers</th>
+ </tr>
+ </thead>
+
+ <%= render :partial => 'utils/tfoot_pagination', :locals => {:pagination => @pagination, :colspan => 4} %>
- <table class="data width100" id="projects">
- <thead>
- <tr>
- <th>
- <form action="<%= url_for :action => 'projects', :qualifier => @qualifier -%>" method="GET">
- <input type="hidden" name="qualifier" value="<%= @qualifier -%>" />
- <input type="text" name="q" value="<%= params[:q] -%>" id="search_text"/>
- <input type="submit" value="Search" id="search_submit"/>
- </form>
- </th>
- <th>Role: Administrators</th>
- <th>Role: Users</th>
- <th>Role: Code viewers</th>
+ <tbody>
+ <% if @projects.empty? %>
+ <tr class="even">
+ <td colspan="4" align="left"><%= message('no_results') %></td>
</tr>
- </thead>
+ <% end
- <%= render :partial => 'utils/tfoot_pagination', :locals => {:pagination => @pagination, :colspan => 4} %>
+ @projects.each do |project|
+ %>
+ <tr class="<%= cycle('even', 'odd') -%>">
+ <td valign="top"><b><%= h project.name %></b><br/>
+ <span class="small gray"><%= project.key -%></span>
+ </td>
+ <td valign="top">
+ <%
+ users=Api::Utils.insensitive_sort(project.user_roles.select { |ur| ur.role=='admin' }.map { |ur| ur.user.name })
+ groups=Api::Utils.insensitive_sort(project.group_roles.select { |gr| gr.role=='admin' }.map { |gr| group_name(gr.group) })
+ %>
+ <%= users.join(', ') %>
+ (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=admin&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select
+ users</a>)<br/>
+ <%= groups.join(', ') %>
+ (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=admin&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select
+ groups</a>)
+ </td>
+ <td valign="top">
+ <%
+ users=Api::Utils.insensitive_sort(project.user_roles.select { |ur| ur.role=='user' }.map { |ur| ur.user.name })
+ groups=Api::Utils.insensitive_sort(project.group_roles.select { |gr| gr.role=='user' }.map { |gr| group_name(gr.group) })
+ %>
+ <%= users.join(', ') %>
+ (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=user&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select
+ users</a>)<br/>
+ <%= groups.join(', ') %>
+ (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=user&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select
+ groups</a>)
+ </td>
+ <td valign="top">
+ <%
+ users=Api::Utils.insensitive_sort(project.user_roles.select { |ur| ur.role=='codeviewer' }.map { |ur| ur.user.name })
+ groups=Api::Utils.insensitive_sort(project.group_roles.select { |gr| gr.role=='codeviewer' }.map { |gr| group_name(gr.group) })
+ %>
+ <%= users.join(', ') %>
+ (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=codeviewer&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select
+ users</a>)<br/>
+ <%= groups.join(', ') %>
+ (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=codeviewer&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select
+ groups</a>)
+ </td>
+ </tr>
+ <%
+ end %>
+ </tbody>
+</table>
- <tbody>
- <% if @projects.empty? %>
- <tr class="even">
- <td colspan="4" align="left"><%= message('no_results') %></td>
- </tr>
- <% end
+<% if @qualifiers.size>1 %></div><% end %>
- @projects.each do |project|
- %>
- <tr class="<%= cycle('even', 'odd') -%>">
- <td valign="top"><b><%= h project.name %></b><br/>
- <span class="small gray"><%= project.key -%></span>
- </td>
- <td valign="top">
- <%
- users=project.user_roles.select { |ur| ur.role=='admin' }.map { |ur| ur.user.login }
- groups=project.group_roles.select { |gr| gr.role=='admin' }.map { |gr| group_name(gr.group) }
- %>
- <%= users.join(', ') %>
- (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=admin&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select users</a>)<br/>
- <%= groups.join(', ') %>
- (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=admin&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select groups</a>)
- </td>
- <td valign="top">
- <%
- users=project.user_roles.select { |ur| ur.role=='user' }.map { |ur| ur.user.login }
- groups=project.group_roles.select { |gr| gr.role=='user' }.map { |gr| group_name(gr.group) }
- %>
- <%= users.join(', ') %>
- (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=user&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select users</a>)<br/>
- <%= groups.join(', ') %>
- (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=user&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select groups</a>)
- </td>
- <td valign="top">
- <%
- users=project.user_roles.select { |ur| ur.role=='codeviewer' }.map { |ur| ur.user.login }
- groups=project.group_roles.select { |gr| gr.role=='codeviewer' }.map { |gr| group_name(gr.group) }
- %>
- <%= users.join(', ') %>
- (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=codeviewer&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select users</a>)<br/>
- <%= groups.join(', ') %>
- (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=codeviewer&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action">select groups</a>)
- </td>
- </tr>
- <%
- end %>
- </tbody>
- </table>
-</div>
<script>
$('search_text').focus();
</script>
\ No newline at end of file
<tr>
<td colspan="<%= colspan || 1 -%>">
<% if pagination.count>0 %>
- <%= pagination.count -%> <%= message('results').downcase -%>
+ <%= message('x_results', :params => [pagination.count]) -%>
<% end %>
<%
if pagination.pages>1