提交 63a8bc92 编写于 作者: W wjprakash

Merging HUDSON-1467

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@35828 71c3de6d-444a-0410-be80-ed276b4c234a
上级 de7f60f5
......@@ -67,6 +67,8 @@ import hudson.util.Iterators;
import hudson.scm.SCM;
import hudson.scm.SCMDescriptor;
import hudson.util.Secret;
import hudson.views.MyViewsTabBar;
import hudson.views.ViewsTabBar;
import org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken;
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.JellyTagException;
......@@ -670,6 +672,14 @@ public class Functions {
return ParameterDefinition.all();
}
public static List<Descriptor<ViewsTabBar>> getViewsTabBarDescriptors() {
return ViewsTabBar.all();
}
public static List<Descriptor<MyViewsTabBar>> getMyViewsTabBarDescriptors() {
return MyViewsTabBar.all();
}
public static List<NodePropertyDescriptor> getNodePropertyDescriptors(Class<? extends Node> clazz) {
List<NodePropertyDescriptor> result = new ArrayList<NodePropertyDescriptor>();
Collection<NodePropertyDescriptor> list = (Collection) Hudson.getInstance().getDescriptorList(NodeProperty.class);
......
/*
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
......@@ -127,6 +127,10 @@ import hudson.util.VersionNumber;
import hudson.util.XStream2;
import hudson.util.Service;
import hudson.util.IOUtils;
import hudson.views.DefaultMyViewsTabBar;
import hudson.views.DefaultViewsTabBar;
import hudson.views.MyViewsTabBar;
import hudson.views.ViewsTabBar;
import hudson.widgets.Widget;
import net.sf.json.JSONObject;
import org.acegisecurity.AccessDeniedException;
......@@ -338,6 +342,16 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
private transient volatile DependencyGraph dependencyGraph;
/**
* Currently active Vies tab bar.
*/
private volatile ViewsTabBar viewsTabBar = new DefaultViewsTabBar();
/**
* Currently active My Views tab bar.
*/
private volatile MyViewsTabBar myViewsTabBar = new DefaultMyViewsTabBar();
/**
* All {@link ExtensionList} keyed by their {@link ExtensionList#extensionType}.
*/
......@@ -556,7 +570,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
/**
* @param pluginManager
* If non-null, use existing plugin manager. Otherwise create a new one.
* If non-null, use existing plugin manager. create a new one.
*/
public Hudson(File root, ServletContext context, PluginManager pluginManager) throws IOException, InterruptedException, ReactorException {
// As hudson is starting, grant this process full control
......@@ -1295,6 +1309,14 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
views.remove(view);
save();
}
public ViewsTabBar getViewsTabBar() {
return viewsTabBar;
}
public MyViewsTabBar getMyViewsTabBar() {
return myViewsTabBar;
}
/**
* Returns true if the current running Hudson is upgraded from a version earlier than the specified version.
......@@ -2332,11 +2354,23 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
if (json.has("csrf")) {
JSONObject csrf = json.getJSONObject("csrf");
setCrumbIssuer(CrumbIssuer.all().newInstanceFromRadioList(csrf, "issuer"));
setCrumbIssuer(CrumbIssuer.all().newInstanceFromRadioList(csrf, "issuer"));
} else {
setCrumbIssuer(null);
}
if (json.has("viewsTabBar")) {
viewsTabBar = req.bindJSON(ViewsTabBar.class,json.getJSONObject("viewsTabBar"));
} else {
viewsTabBar = new DefaultViewsTabBar();
}
if (json.has("myViewsTabBar")) {
myViewsTabBar = req.bindJSON(MyViewsTabBar.class,json.getJSONObject("myViewsTabBar"));
} else {
myViewsTabBar = new DefaultMyViewsTabBar();
}
primaryView = json.has("primaryView") ? json.getString("primaryView") : getViews().iterator().next().getViewName();
noUsageStatistics = json.has("usageStatisticsCollected") ? null : true;
......
......@@ -29,6 +29,8 @@ import hudson.model.Descriptor.FormException;
import hudson.security.ACL;
import hudson.security.Permission;
import hudson.util.FormValidation;
import hudson.views.MyViewsTabBar;
import hudson.views.ViewsTabBar;
import java.io.IOException;
import java.text.ParseException;
......@@ -239,6 +241,14 @@ public class MyViewsProperty extends UserProperty implements ViewGroup, Action {
views.add(new AllView(Messages.Hudson_ViewName(), this));
return this;
}
public ViewsTabBar getViewsTabBar() {
return Hudson.getInstance().getViewsTabBar();
}
public MyViewsTabBar getMyViewsTabBar() {
return Hudson.getInstance().getMyViewsTabBar();
}
@Extension
public static class GlobalAction implements RootAction {
......
......@@ -27,6 +27,7 @@ import hudson.model.Descriptor.FormException;
import hudson.util.CaseInsensitiveComparator;
import hudson.Indenter;
import hudson.Extension;
import hudson.views.ViewsTabBar;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
......@@ -171,4 +172,8 @@ public class TreeView extends View implements ViewGroup {
return "Tree View";
}
}
public ViewsTabBar getViewsTabBar() {
return Hudson.getInstance().getViewsTabBar();
}
}
......@@ -25,6 +25,7 @@
package hudson.model;
import hudson.security.AccessControlled;
import hudson.views.ViewsTabBar;
import java.io.IOException;
import java.util.Collection;
......@@ -78,4 +79,13 @@ public interface ViewGroup extends Saveable, ModelObject, AccessControlled {
* {@linkplain Hudson#checkGoodName(String) legal view name}.
*/
void onViewRenamed(View view, String oldName, String newName);
/**
* Gets the TabBar for the views
*
* TabBar for views can be provided by extension. Only one TabBar can be active
* at a given time (Selectable by user in the global Configuration page)
* Default TabBar is provided by Hudson Platform
*/
ViewsTabBar getViewsTabBar();
}
/*
* The MIT License
*
* Copyright (c) 2010, Winston.Prakash@Oracle.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.views;
import hudson.Extension;
import org.kohsuke.stapler.DataBoundConstructor;
/**
* The Default MyViewsTabBar Extension for {@link MyViewsTabBar}.
*
* @author Winston Prakash
* @since 1.378
* @see MyViewsTabBar
*/
public class DefaultMyViewsTabBar extends MyViewsTabBar {
@DataBoundConstructor
public DefaultMyViewsTabBar() {
}
@Extension
public static class DescriptorImpl extends MyViewsTabBarDescriptor {
@Override
public String getDisplayName() {
return Messages.DefaultMyViewsTabsBar_DisplayName();
//return "Default My Views TabsBar";
}
}
}
/*
* The MIT License
*
* Copyright (c) 2010, Winston.Prakash@Oracle.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.views;
import hudson.Extension;
import org.kohsuke.stapler.DataBoundConstructor;
/**
* The Default ViewsTabBar Extension for {@link ViewsTabBar}.
*
* @author Winston Prakash
* @since 1.378
* @see ViewsTabBar
*/
public class DefaultViewsTabBar extends ViewsTabBar {
@DataBoundConstructor
public DefaultViewsTabBar() {
}
@Extension
public static class DescriptorImpl extends ViewsTabBarDescriptor {
@Override
public String getDisplayName() {
return Messages.DefaultViewsTabsBar_DisplayName();
//return "Default Views TabsBar";
}
}
}
/*
* The MIT License
*
* Copyright (c) 2010, Winston.Prakash@oracle.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.views;
import hudson.DescriptorExtensionList;
import hudson.ExtensionPoint;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.model.Hudson;
import hudson.model.MyViewsProperty;
/**
* Extension point for adding a MyViewsTabBar header to Projects {@link MyViewsProperty}.
*
* <p>
* This object must have the <tt>myViewTabs.jelly</tt>. This view
* is called once when the My Views main panel is built.
* The "views" attribute is set to the "Collection of views".
*
* <p>
* There also must be a default constructor, which is invoked to create a My Views TabBar in
* the default configuration.
*
* @author Winston Prakash
* @since 1.378
* @see MyViewsTabBarDescriptor
*/
public abstract class MyViewsTabBar extends AbstractDescribableImpl<MyViewsTabBar> implements ExtensionPoint {
/**
* Returns all the registered {@link ListViewColumn} descriptors.
*/
public static DescriptorExtensionList<MyViewsTabBar, Descriptor<MyViewsTabBar>> all() {
return Hudson.getInstance().<MyViewsTabBar, Descriptor<MyViewsTabBar>>getDescriptorList(MyViewsTabBar.class);
}
public MyViewsTabBarDescriptor getDescriptor() {
return (MyViewsTabBarDescriptor)super.getDescriptor();
}
}
/*
* The MIT License
*
* Copyright (c) 2010, Winston.Prakash@oracle.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.views;
import hudson.model.Descriptor;
/**
* {@link Descriptor} for {@link MyViewsTabBar}.
*
* @author Winston Prakash
* @since 1.378
*/
public abstract class MyViewsTabBarDescriptor extends Descriptor<MyViewsTabBar> {
// so far nothing different from plain Descriptor
// but it may prove useful for future expansion
}
/*
* The MIT License
*
* Copyright (c) 2010, Winston.Prakash@oracle.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.views;
import hudson.DescriptorExtensionList;
import hudson.ExtensionPoint;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.model.Hudson;
import hudson.model.ListView;
/**
* Extension point for adding a ViewsTabBar header to Projects {@link ListView}.
*
* <p>
* This object must have the <tt>viewTabs.jelly</tt>. This view
* is called once when the project views main panel is built.
* The "views" attribute is set to the "Collection of views".
*
* <p>
* There also must be a default constructor, which is invoked to create a Views TabBar in
* the default configuration.
*
* @author Winston Prakash
* @since 1.378
* @see ViewsTabBarDescriptor
*/
public abstract class ViewsTabBar extends AbstractDescribableImpl<ViewsTabBar> implements ExtensionPoint {
/**
* Returns all the registered {@link ListViewColumn} descriptors.
*/
public static DescriptorExtensionList<ViewsTabBar, Descriptor<ViewsTabBar>> all() {
return Hudson.getInstance().<ViewsTabBar, Descriptor<ViewsTabBar>>getDescriptorList(ViewsTabBar.class);
}
public ViewsTabBarDescriptor getDescriptor() {
return (ViewsTabBarDescriptor)super.getDescriptor();
}
}
/*
* The MIT License
*
* Copyright (c) 2010, Winston.Prakash@oracle.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.views;
import hudson.model.Descriptor;
/**
* {@link Descriptor} for {@link ViewsTabBar}.
*
* @author Winston Prakash
* @since 1.378
*/
public abstract class ViewsTabBarDescriptor extends Descriptor<ViewsTabBar> {
// so far nothing different from plain Descriptor
// but it may prove useful for future expansion
}
......@@ -57,6 +57,34 @@ THE SOFTWARE.
<f:textbox clazz="number" name="retry_count" value="${it.scmCheckoutRetryCount}"/>
</f:entry>
<j:if test="${size(h.viewsTabBarDescriptors) gt 1}">
<f:dropdownList name="viewsTabBar" title="${%Views Tab Bar}" help="/help/project-config/viewsTabBar.html">
<!-- Loop through available Views TabBar Descriptors -->
<j:forEach var="descriptor" items="${h.viewsTabBarDescriptors}" varStatus="loop">
<f:dropdownListBlock title="${descriptor.displayName}" value="${loop.index}"
selected="${descriptor==it.viewsTabBar.descriptor}"
staplerClass="${descriptor.clazz.name}">
<!-- Include config.jelly for this Views TabBar type -->
<st:include page="${descriptor.configPage}" from="${descriptor}" optional="true"/>
</f:dropdownListBlock>
</j:forEach>
</f:dropdownList>
</j:if>
<j:if test="${size(h.myViewsTabBarDescriptors) gt 1}">
<f:dropdownList name="myViewsTabBar" title="${%My Views Tab Bar}" help="/help/project-config/myViewsTabBar.html">
<!-- Loop through available My Views TabBar Descriptors -->
<j:forEach var="descriptor" items="${h.myViewsTabBarDescriptors}" varStatus="loop">
<f:dropdownListBlock title="${descriptor.displayName}" value="${loop.index}"
selected="${descriptor==it.myViewsTabBar.descriptor}"
staplerClass="${descriptor.clazz.name}">
<!-- Include config.jelly for this Views TabBar type -->
<st:include page="${descriptor.configPage}" from="${descriptor}" optional="true"/>
</f:dropdownListBlock>
</j:forEach>
</f:dropdownList>
</j:if>
<j:if test="${size(it.views) gt 1}">
<f:entry title="${%Default view}" help="/help/project-config/defaultView.html">
<select class="setting-input" name="primaryView">
......@@ -117,7 +145,7 @@ THE SOFTWARE.
</f:entry>
</f:optionalBlock>
</j:if>
<f:optionalBlock name="usageStatisticsCollected" checked="${it.usageStatisticsCollected}"
title="${%statsBlurb}"
help="/help/system-config/usage-statistics.html" />
......
......@@ -23,29 +23,29 @@ THE SOFTWARE.
-->
<st:compress xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<j:if test="${request.servletPath=='/' || request.servletPath==''}">
<st:header name="X-Hudson" value="${servletContext.getAttribute('version')}" />
<j:if test="${app.tcpSlaveAgentListener!=null}">
<j:if test="${request.servletPath=='/' || request.servletPath==''}">
<st:header name="X-Hudson" value="${servletContext.getAttribute('version')}" />
<j:if test="${app.tcpSlaveAgentListener!=null}">
<!-- advertize the CLI TCP port -->
<st:header name="X-Hudson-CLI-Port" value="${app.tcpSlaveAgentListener.port}" />
<st:header name="X-Hudson-CLI-Port" value="${app.tcpSlaveAgentListener.port}" />
</j:if>
</j:if>
</j:if>
<j:new var="h" className="hudson.Functions" /><!-- instead of JSP functions -->
<l:layout title="${it.class.name=='hudson.model.AllView' ? '%Dashboard' : it.viewName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<div id="view-message">
<t:editableDescription permission="${app.ADMINISTER}"/>
</div>
<j:set var="items" value="${it.items}"/>
<st:include page="main.jelly" />
</l:main-panel>
<l:header>
<j:new var="h" className="hudson.Functions" /><!-- instead of JSP functions -->
<l:layout title="${it.class.name=='hudson.model.AllView' ? '%Dashboard' : it.viewName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<div id="view-message">
<t:editableDescription permission="${app.ADMINISTER}"/>
</div>
<j:set var="items" value="${it.items}"/>
<st:include page="main.jelly" />
</l:main-panel>
<l:header>
<!-- for screen resolution detection -->
<l:yui module="cookie" suffix="-beta" />
<script>
<l:yui module="cookie" suffix="-beta" />
<script>
YAHOO.util.Cookie.set("screenResolution", screen.width+"x"+screen.height);
</script>
</l:header>
</l:layout>
</script>
</l:header>
</l:layout>
</st:compress>
\ No newline at end of file
......@@ -23,19 +23,29 @@ THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<j:choose>
<j:when test="${empty(items)}">
<j:if test="${!empty(app.items)}">
<st:include page="viewTabs.jelly" />
<br/>
</j:if>
<st:include page="noJob.jelly" />
</j:when>
<j:otherwise>
<!-- set @jobBaseUrl="" so that links to jobs will be under this view. -->
<t:projectView jobs="${items}" jobBaseUrl="" showViewTabs="true" columnExtensions="${it.columns}">
<st:include page="viewTabs.jelly" />
</t:projectView>
</j:otherwise>
</j:choose>
<j:choose>
<j:when test="${empty(items)}">
<j:if test="${!empty(app.items)}">
<j:set var="views" value="${it.owner.views}"/>
<j:set var="currentView" value="${it}"/>
<st:include page="viewTabs.jelly" it="${it.owner.viewsTabBar}"/>
</j:if>
<st:include page="noJob.jelly" />
</j:when>
<j:otherwise>
<!-- set @jobBaseUrl="" so that links to jobs will be under this view. -->
<t:projectView jobs="${items}" jobBaseUrl="" showViewTabs="true" columnExtensions="${it.columns}">
<j:set var="views" value="${it.owner.views}"/>
<j:set var="currentView" value="${it}"/>
<j:choose>
<j:when test="${it.owner.class.name=='hudson.model.MyViewsProperty'}">
<st:include page="myViewTabs.jelly" it="${it.owner.myViewsTabBar}"/>
</j:when>
<j:otherwise>
<st:include page="viewTabs.jelly" it="${it.owner.viewsTabBar}"/>
</j:otherwise>
</j:choose>
</t:projectView>
</j:otherwise>
</j:choose>
</j:jelly>
......@@ -23,7 +23,16 @@ THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core">
<div>
<style type="text/css">
#noJobDiv {
padding: 10px;
text-align: center;
border-width: 0px 1px 1px;
border-style: none solid solid;
border-color: #BBBBBB;
}
</style>
<div id="noJobDiv">
${%description_1}
<j:if test="${it.hasPermission(it.CONFIGURE)}">
${%description_2}
......
<!--
The MIT License
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<!-- view tab bar -->
<l:tabBar>
<j:forEach var="v" items="${views}">
<l:tab name="${v.viewName}" active="${v==currentView}" href="${rootURL}/${v.url}" />
</j:forEach>
<j:if test="${currentView.hasPermission(currentView.CREATE)}">
<l:tab name="+" href="${rootURL}/${currentView.owner.url}newView" active="false"
title="${%New View}" />
</j:if>
</l:tabBar>
</j:jelly>
......@@ -25,11 +25,11 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<!-- view tab bar -->
<l:tabBar>
<j:forEach var="v" items="${it.owner.views}">
<l:tab name="${v.viewName}" active="${v==it}" href="${rootURL}/${v.url}" />
<j:forEach var="v" items="${views}">
<l:tab name="${v.viewName}" active="${v==currentView}" href="${rootURL}/${v.url}" />
</j:forEach>
<j:if test="${it.hasPermission(it.CREATE)}">
<l:tab name="+" href="${rootURL}/${it.owner.url}newView" active="false"
<j:if test="${currentView.hasPermission(currentView.CREATE)}">
<l:tab name="+" href="${rootURL}/${currentView.owner.url}newView" active="false"
title="${%New View}" />
</j:if>
</l:tabBar>
......
......@@ -28,3 +28,5 @@ LastStableColumn.DisplayName=Last Stable
LastSuccessColumn.DisplayName=Last Success
StatusColumn.DisplayName=Status
WeatherColumn.DisplayName=Weather
DefaultViewsTabsBar.DisplayName=Default Views TabBar
DefaultMyViewsTabsBar.DisplayName=Default My Views TabBar
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer, Erik Ramfelt, Stephen Connolly, Tom Huybrechts
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>pom</artifactId>
<version>1.378-SNAPSHOT</version>
</parent>
<artifactId>multiline-tabbar-plugin</artifactId>
<packaging>hpi</packaging>
<name>Multiline Views TabBar Plugin</name>
<description>This plug-in provides a multi-line TabBar extension Extension to Views Tababar</description>
<dependencies>
<dependency>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>hudson-core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>hudson-war</artifactId>
<type>war</type>
<version>1.378-SNAPSHOT<!-- replace this with the version you want-->
</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!--
Since new versions need to overwrite old versions, it's better
not to have version number in the .hpi file name.
-->
<finalName>${project.artifactId}</finalName>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<groupId>org.jvnet.hudson.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>1.54</version>
<extensions>true</extensions>
<configuration>
<showDeprecation>true</showDeprecation>
<disabledTestInjection>true</disabledTestInjection>
</configuration>
</plugin>
<plugin>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>maven-stapler-plugin</artifactId>
<version>1.12</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.jvnet.localizer</groupId>
<artifactId>maven-localizer-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<fileMask>Messages.properties</fileMask>
<outputDirectory>target/generated-sources/localizer</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
/*
* The MIT License
*
* Copyright (c) 2010, Winston.Prakash@Oracle.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.views.tabbar;
import hudson.Extension;
import hudson.views.ViewsTabBar;
import hudson.views.ViewsTabBarDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;
/**
* The Multi-line ViewsTabBar Extension for {@link ViewsTabBar}.
*
* @author Winston Prakash
* @since 1.378
* @see ViewsTabBar
*/
public class MultilineViewsTabBar extends ViewsTabBar {
@DataBoundConstructor
public MultilineViewsTabBar() {
}
@Extension
public static class DescriptorImpl extends ViewsTabBarDescriptor {
@Override
public String getDisplayName() {
//return Messages.DefaultViewsTabsBar_DisplayName();
//return "Multiline Views TabBar";
return "Multi-row Views TabBar";
}
}
}
<!--
The MIT License
Copyright (c) 2010, Winston.Prakash@Oracle.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
<%@ attribute name="it" required="true" type="<Your Plugin Class>" %>
<%@ attribute name="views" required="true" type="java.util.Collection<hudson.model.View>" %>
<%@ attribute name="currentView" required="true" type="hudson.model.View" %>
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:lc="/lib/layout/tabbar" >
<!-- view tab bar -->
<lc:tabBar>
<j:forEach var="v" items="${views}">
<lc:tab name="${v.viewName}" active="${v==currentView}" href="${rootURL}/${v.url}" />
</j:forEach>
<j:if test="${currentView.hasPermission(currentView.CREATE)}">
<lc:tab name="+" href="${rootURL}/${currentView.owner.url}newView" active="false"
title="${%New View}" />
</j:if>
</lc:tabBar>
</j:jelly>
<!--
The MIT License
Copyright (c) 2010, Winston.Prakash@Oracle.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
<%@ attribute name="name" required="true" type="java.lang.String" %>
<%@ attribute name="href" required="true" type="java.lang.String" %>
<%@ attribute name="active" required="true" type="java.lang.Boolean" %>
<%@ attribute name="title" required="false" type="java.lang.String" %>
-->
<j:jelly xmlns:j="jelly:core">
<j:choose>
<j:when test="${active}">
<li id="active">
<a id="current" href="${href}" title="${attrs.title}">${name}</a>
</li>
</j:when>
<j:otherwise>
<li>
<a href="${href}" title="${attrs.title}">${name}</a>
</li>
</j:otherwise>
</j:choose>
</j:jelly>
<!--
The MIT License
Copyright (c) 2010, Winston.Prakash@Oracle.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core" xmlns:d="jelly:define" xmlns:st="jelly:stapler">
<style type="text/css">
/* CSS Tabs */
#tabBarContainer {
background: #E6E6E6;
margin: 10px auto 0;
padding: 3px;
border: 1px solid #BBBBBB;
}
/* to stretch the container div to contain floated list */
#tabBarContainer:after {
content: ".";
display: block;
line-height: 1px;
font-size: 1px;
clear: both;
}
ul#tabList {
list-style: none;
padding: 0;
margin: 0 auto;
width: 100%;
}
ul#tabList li {
display: block;
float: left;
/*width: 10%;*/
margin: 0;
padding: 0;
text-align: center
}
ul#tabList li a {
display: block;
width: 100%;
padding: 6px;
border-width: 1px;
border-color: #ffe #aaab9c #ccc #fff;
border-style: solid;
color: #777;
text-decoration: none;
background: #FEFEEE;
}
#tabBarContainer>ul#tabList li a { width: auto; }
ul#tabList li#active a {
background: #E0E0F0;
color: #800000;
}
ul#tabList li a:hover, ul#tabList li#active a:hover {
color: #800000;
background: transparent;
border-color: #aaab9c #fff #fff #ccc;
}
</style>
<div id="tabBarContainer">
<ul id="tabList">
<j:set var="tab" value="${tabs}" />
<d:invokeBody />
</ul>
</div>
</j:jelly>
\ No newline at end of file
Tag files used in project pages
\ No newline at end of file
......@@ -43,6 +43,7 @@ THE SOFTWARE.
<module>remoting</module>
<module>core</module>
<module>maven-plugin</module>
<module>multiline-tabbar-plugin</module>
<module>ui-samples-plugin</module>
<module>maven-agent</module>
<module>maven-interceptor</module>
......
......@@ -184,12 +184,21 @@ THE SOFTWARE.
<systemProperty>
<!-- load view resources from the source directly, again for real time change -->
<name>stapler.resourcePath</name>
<value>../core/src/main/resources;../ui-samples-plugin/src/main/resources;../maven-plugin/src/main/resources</value>
<value>
../core/src/main/resources;
../ui-samples-plugin/src/main/resources;
../multiline-tabbar-plugin/src/main/resources;
../maven-plugin/src/main/resources
</value>
</systemProperty>
<systemProperty>
<!-- enable the plugins in main by default -->
<name>hudson.bundled.plugins</name>
<value>${basedir}/../maven-plugin/target/test-classes/the.hpl,${basedir}/../ui-samples-plugin/target/test-classes/the.hpl</value>
<value>
${basedir}/../maven-plugin/target/test-classes/the.hpl,
${basedir}/../ui-samples-plugin/target/test-classes/the.hpl,
${basedir}/../multiline-tabbar-plugin/target/test-classes/the.hpl
</value>
</systemProperty>
<systemProperty>
<!-- stat collection pointless -->
......
<div>
If you have multiple views defined in My Views, then the default Views TabBar becomes too long. The MyViewsTabBar
Extension Point provides facility for plugins to provide their own implementation of My Views TabBar.
This DropDown, lists all the available My Views TabBar implementation. Only one TabBar implementation can
be active at a time for My Views. Select one from the DropDown list.
</div>
\ No newline at end of file
<div>
If you have multiple views defined, then the default Views TabBar becomes too long. The ViewsToolBar
Extension Point provides facility for plugins to provide their own implementation of Views TabBar.
This DropDown, lists all the available Views TabBar implementation. Only one TabBar implementation can
be active at a time. Select one from the DropDown list.
</div>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册