diff --git a/core/src/main/java/hudson/model/Cause.java b/core/src/main/java/hudson/model/Cause.java index a4ac6325d5..90a64f2c2e 100644 --- a/core/src/main/java/hudson/model/Cause.java +++ b/core/src/main/java/hudson/model/Cause.java @@ -23,7 +23,6 @@ */ package hudson.model; -import org.kohsuke.stapler.Stapler; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; @@ -39,11 +38,6 @@ public abstract class Cause { @Exported(visibility=3) abstract public String getShortDescription(); - public String getHTMLDescription() { - // Default to same as ShortDescription; subclasses can override - return getShortDescription(); - } - public static class LegacyCodeCause extends Cause { private StackTraceElement [] stackTrace; public LegacyCodeCause() { @@ -68,17 +62,23 @@ public abstract class Cause { CauseAction ca = up.getAction(CauseAction.class); upstreamCause = ca == null ? null : ca.getCause(); } + + public String getUpstreamProject() { + return upstreamProject; + } + + public int getUpstreamBuild() { + return upstreamBuild; + } + + public String getUpstreamUrl() { + return upstreamUrl; + } @Override public String getShortDescription() { return Messages.Cause_UpstreamCause_ShortDescription(upstreamProject, upstreamBuild); } - - @Override - public String getHTMLDescription() { - // upstreamUrl added in 1.284, so handle missing value - return upstreamUrl==null ? getShortDescription() : Messages.Cause_UpstreamCause_HTMLDescription(upstreamProject, upstreamBuild, upstreamUrl, Stapler.getCurrentRequest().getContextPath()); - } } public static class UserCause extends Cause { @@ -87,15 +87,14 @@ public abstract class Cause { this.authenticationName = Hudson.getAuthentication().getName(); } + public String getUserName() { + return authenticationName; + } + @Override public String getShortDescription() { return Messages.Cause_UserCause_ShortDescription(authenticationName); } - - @Override - public String getHTMLDescription() { - return Messages.Cause_UserCause_HTMLDescription(authenticationName, Stapler.getCurrentRequest().getContextPath()); - } } public static class RemoteCause extends Cause { @@ -109,6 +108,5 @@ public abstract class Cause { public String getShortDescription() { return Messages.Cause_RemoteCause_ShortDescription(addr); } - } } diff --git a/core/src/main/java/hudson/model/CauseAction.java b/core/src/main/java/hudson/model/CauseAction.java index f0e0aa9461..5100de90ed 100644 --- a/core/src/main/java/hudson/model/CauseAction.java +++ b/core/src/main/java/hudson/model/CauseAction.java @@ -39,10 +39,6 @@ public class CauseAction implements Action { return cause.getShortDescription(); } - public String getHTMLDescription() { - return cause.getHTMLDescription(); - } - public CauseAction(Cause c) { this.cause = c; } diff --git a/core/src/main/resources/hudson/model/Cause/UpstreamCause/description.jelly b/core/src/main/resources/hudson/model/Cause/UpstreamCause/description.jelly new file mode 100644 index 0000000000..c3dadc02e8 --- /dev/null +++ b/core/src/main/resources/hudson/model/Cause/UpstreamCause/description.jelly @@ -0,0 +1,27 @@ + + + +

${h.ifThenElse(it.upstreamUrl!=null,"%started_by_project(it.upstreamProject,it.upstreamBuild,it.upstreamUrl,rootURL)",it.shortDescription)}

+
diff --git a/core/src/main/resources/hudson/model/Cause/UpstreamCause/description.properties b/core/src/main/resources/hudson/model/Cause/UpstreamCause/description.properties new file mode 100644 index 0000000000..e831286f98 --- /dev/null +++ b/core/src/main/resources/hudson/model/Cause/UpstreamCause/description.properties @@ -0,0 +1,24 @@ +# The MIT License +# +# Copyright (c) 2004-2009, Sun Microsystems, Inc., 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 +# 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. + +started_by_project=Started by upstream project {0} build number {1} + diff --git a/core/src/main/resources/hudson/model/Cause/UserCause/description.jelly b/core/src/main/resources/hudson/model/Cause/UserCause/description.jelly new file mode 100644 index 0000000000..26fc063296 --- /dev/null +++ b/core/src/main/resources/hudson/model/Cause/UserCause/description.jelly @@ -0,0 +1,26 @@ + + +

${%started_by_user(it.userName,rootURL)}

+
diff --git a/core/src/main/resources/hudson/model/Cause/UserCause/description.properties b/core/src/main/resources/hudson/model/Cause/UserCause/description.properties new file mode 100644 index 0000000000..7635fd78fa --- /dev/null +++ b/core/src/main/resources/hudson/model/Cause/UserCause/description.properties @@ -0,0 +1,24 @@ +# The MIT License +# +# Copyright (c) 2004-2009, Sun Microsystems, Inc., 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 +# 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. + +started_by_user=Started by user {0} + diff --git a/core/src/main/resources/hudson/model/Cause/description.jelly b/core/src/main/resources/hudson/model/Cause/description.jelly new file mode 100644 index 0000000000..2b9174c5ee --- /dev/null +++ b/core/src/main/resources/hudson/model/Cause/description.jelly @@ -0,0 +1,26 @@ + + +

${it.shortDescription}

+
diff --git a/core/src/main/resources/hudson/model/CauseAction/summary.jelly b/core/src/main/resources/hudson/model/CauseAction/summary.jelly index a548495a48..b080c01bb8 100644 --- a/core/src/main/resources/hudson/model/CauseAction/summary.jelly +++ b/core/src/main/resources/hudson/model/CauseAction/summary.jelly @@ -1,7 +1,7 @@ - -

${it.HTMLDescription}

-
+ + +
diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties index 24671b69e7..145482ca88 100644 --- a/core/src/main/resources/hudson/model/Messages.properties +++ b/core/src/main/resources/hudson/model/Messages.properties @@ -180,7 +180,5 @@ LoadStatistics.Legends.QueueLength=Queue length Cause.LegacyCodeCause.ShortDescription=Legacy code started this job. No cause information is available Cause.UpstreamCause.ShortDescription=Started by upstream project "{0}" build number {1} -Cause.UpstreamCause.HTMLDescription=Started by upstream project {0} build number {1} Cause.UserCause.ShortDescription=Started by user {0} -Cause.UserCause.HTMLDescription=Started by user {0} Cause.RemoteCause.ShortDescription=Started from remote {0}