提交 6d4e363e 编写于 作者: K Kohsuke Kawaguchi

Inline html to report the plugin that implemented the feature.

上级 e3cf9858
......@@ -65,6 +65,8 @@ Upcoming changes</a>
Added UI component to show notification bar at the top of the page
<li class="rfe">
Users can configure search to be case insensitive.
<li class="rfe">
Inline help now reports the plugin that contributes the said feature.
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -24,6 +24,7 @@
package hudson.model;
import hudson.DescriptorExtensionList;
import hudson.PluginWrapper;
import hudson.RelativePath;
import hudson.XmlFile;
import hudson.BulkChange;
......@@ -779,6 +780,16 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
return new XmlFile(new File(Jenkins.getInstance().getRootDir(),getId()+".xml"));
}
/**
* Returns the plugin in which this descriptor is defined.
*
* @return
* null to indicate that this descriptor came from the core.
*/
protected PluginWrapper getPlugin() {
return Jenkins.getInstance().getPluginManager().whichPlugin(clazz);
}
/**
* Serves <tt>help.html</tt> from the resource of {@link #clazz}.
*/
......@@ -788,6 +799,14 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
path = path.replace('/','-');
PluginWrapper pw = getPlugin();
if (pw!=null) {
rsp.setHeader("X-Plugin-Short-Name",pw.getShortName());
rsp.setHeader("X-Plugin-Long-Name",pw.getLongName());
rsp.setHeader("X-Plugin-From", Messages.Descriptor_From(
pw.getLongName().replace("Hudson","Jenkins").replace("hudson","jenkins"), pw.getUrl()));
}
for (Klass<?> c= getKlass(); c!=null; c=c.getSuperClass()) {
RequestDispatcher rd = Stapler.getCurrentRequest().getView(c, "help"+path);
if(rd!=null) {// template based help page
......
......@@ -103,6 +103,9 @@ ComputerSet.NoSuchSlave=No such slave: {0}
ComputerSet.SlaveAlreadyExists=Slave called ''{0}'' already exists
ComputerSet.SpecifySlaveToCopy=Specify which slave to copy
ComputerSet.DisplayName=nodes
Descriptor.From=(from <a href="{1}">{0}</a>)
Executor.NotAvailable=N/A
ExternalJob.DisplayName=Monitor an external job
......
......@@ -562,6 +562,11 @@ LABEL.attach-previous {
margin-bottom: 1em;
}
.help .from-plugin {
text-align: right;
color: #666;
}
.help-area {
/* this marker class is used by JavaScript to locate the area to display help text. */
}
......
......@@ -715,7 +715,8 @@ var hudsonRules = {
new Ajax.Request(this.getAttribute("helpURL"), {
method : 'get',
onSuccess : function(x) {
div.innerHTML = x.responseText;
var from = x.getResponseHeader("X-Plugin-From");
div.innerHTML = x.responseText+(from?"<div class='from-plugin'>"+from+"</div>":"");
layoutUpdateCallback.call();
},
onFailure : function(x) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册