提交 043a6718 编写于 作者: M mindless

[FIXED HUDSON-5443] Fixes for sidepanel link for People.

Link to top level /people/ for AllView, otherwise to people for this view.
Hide link only for non-default, non-All view that would list no people.
Add heading on People page and a link to top level /people/ when appropriate.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@27129 71c3de6d-444a-0410-be80-ed276b4c234a
上级 4102c9f0
......@@ -455,9 +455,9 @@ public abstract class View extends AbstractModelObject implements AccessControll
public People(Hudson parent) {
this.parent = parent;
// for Hudson, really load all users
Map<User,UserInfo> users = getUserInfo(parent.getPrimaryView());
Map<User,UserInfo> users = getUserInfo(parent.getItems());
User unknown = User.getUnknown();
for(User u : User.getAll()) {
for (User u : User.getAll()) {
if(u==unknown) continue; // skip the special 'unknown' user
if(!users.containsKey(u))
users.put(u,new UserInfo(u,null,null));
......@@ -467,12 +467,12 @@ public abstract class View extends AbstractModelObject implements AccessControll
public People(View parent) {
this.parent = parent;
this.users = toList(getUserInfo(parent));
this.users = toList(getUserInfo(parent.getItems()));
}
private Map<User,UserInfo> getUserInfo(View parent) {
private Map<User,UserInfo> getUserInfo(Collection<? extends Item> items) {
Map<User,UserInfo> users = new HashMap<User,UserInfo>();
for (Item item : parent.getItems()) {
for (Item item : items) {
for (Job job : item.getAllJobs()) {
if (job instanceof AbstractProject) {
AbstractProject<?,?> p = (AbstractProject) job;
......
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, id:cactusman
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, id:cactusman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -27,6 +27,13 @@ THE SOFTWARE.
<st:include page="sidepanel.jelly" it="${it.parent}" />
<t:setIconSize/>
<l:main-panel>
<h1>
<img src="${imagesURL}/48x48/user.gif" alt=""/>
${%People}
<j:set var="viewType" value="${it.parent.class.simpleName}"/>
<j:set var="isAll" value="${viewType=='Hudson' or viewType=='AllView'}"/>
<j:if test="${!isAll}"> - ${it.parent.displayName}</j:if>
</h1>
<table class="sortable pane bigtable" id="people">
<tr>
<th />
......@@ -44,7 +51,13 @@ THE SOFTWARE.
</tr>
</j:forEach>
</table>
<t:iconSize/>
<t:iconSize>
<j:if test="${!isAll}">
<div style="float:right">
<a href="${rootURL}/people/">${%All People}</a><st:nbsp/>
</div>
</j:if>
</t:iconSize>
</l:main-panel>
</l:layout>
</j:jelly>
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer, id:cactusman, Tom Huybrechts
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer,
id:cactusman, Tom Huybrechts, Alan Harder
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -36,9 +37,14 @@ THE SOFTWARE.
<l:tasks>
<l:task icon="images/24x24/new-package.gif" href="${rootURL}/${it.viewUrl}newJob" title="${%New Job}" permission="${it.itemCreatePermission}" />
<l:task icon="images/24x24/setting.gif" href="${rootURL}/manage" title="${%Manage Hudson}" permission="${app.ADMINISTER}" />
<j:if test="${it.hasPeople()}">
<l:task icon="images/24x24/user.gif" href="${rootURL}/people/" title="${%People}" />
</j:if>
<j:choose>
<j:when test="${it.class.name=='hudson.model.AllView'}">
<l:task icon="images/24x24/user.gif" href="${rootURL}/people/" title="${%People}" />
</j:when>
<j:when test="${it.isDefault() or it.hasPeople()}">
<l:task icon="images/24x24/user.gif" href="${rootURL}/${it.viewUrl}people/" title="${%People}" />
</j:when>
</j:choose>
<l:task icon="images/24x24/notepad.gif" href="${rootURL}/${it.url}builds" title="${%Build History}"/>
<j:if test="${it.isEditable()}">
<!-- /configure URL on Hudson object is overloaded with Hudson's system config, so always use the explicit name. -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册