提交 86c610f6 编写于 作者: K Kohsuke Kawaguchi

added a tag to override the currentDescriptorByNameUrl

上级 793a6719
......@@ -1317,4 +1317,19 @@ public class Functions {
public static String createRenderOnDemandProxy(JellyContext context, String attributesToCapture) {
return Stapler.getCurrentRequest().createJavaScriptProxy(new RenderOnDemandClosure(context,attributesToCapture));
}
public static String getCurrentDescriptorByNameUrl() {
return Descriptor.getCurrentDescriptorByNameUrl();
}
public static String setCurrentDescriptorByNameUrl(String value) {
String o = getCurrentDescriptorByNameUrl();
Stapler.getCurrentRequest().setAttribute("currentDescriptorByNameUrl", value);
return o;
}
public static void restoreCurrentDescriptorByNameUrl(String old) {
Stapler.getCurrentRequest().setAttribute("currentDescriptorByNameUrl", old);
}
}
<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">
<st:documentation>
Execute the body with a temporary currentDescriptorByNameUrl value
<st:attribute name="value" use="required">
</st:attribute>
</st:documentation>
<j:set var="old" value="${h.setCurrentDescriptorByNameUrl(attrs.value)}"/>
<d:invokeBody/>
<j:set var="_" value="${h.restoreCurrentDescriptorByNameUrl(old)}"/>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册