提交 9dbcc518 编写于 作者: K kohsuke

fixed a part of #193.

<l:layout> tag now takes norefresh="true", indicating that this page should not be auto-refreshed. The user setting will be still retained, so as soon as the user moves to other pages, it will take effect again.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1329 71c3de6d-444a-0410-be80-ed276b4c234a
上级 1320d9c6
......@@ -209,7 +209,17 @@ public class Functions {
private static final SimpleFormatter formatter = new SimpleFormatter();
public static void configureAutoRefresh(HttpServletRequest request, HttpServletResponse response) {
/**
* Used by <tt>layout.jelly</tt> to control the auto refresh behavior.
*
* @param noAutoRefresh
* On certain pages, like a page with forms, will have annoying interference
* with auto refresh. On those pages, disable auto-refresh.
*/
public static void configureAutoRefresh(HttpServletRequest request, HttpServletResponse response, boolean noAutoRefresh) {
if(noAutoRefresh)
return;
String param = request.getParameter("auto_refresh");
boolean refresh = isAutoRefresh(request);
if (param != null) {
......
......@@ -2,7 +2,7 @@
Config page
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
<l:layout>
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<s:form method="post" action="configSubmit">
......
......@@ -2,7 +2,7 @@
New View page
-->
<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">
<l:layout>
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>
......
......@@ -2,7 +2,7 @@
Displays two projects side by side and show their relationship
-->
<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">
<l:layout>
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1><img src="${rootURL}/images/48x48/search.gif" />Project Relationship</h1>
......
......@@ -2,7 +2,7 @@
Config page. derived class specific entries should go to configure-entries.jsp
-->
<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">
<l:layout>
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<f:form method="post" action="configSubmit">
......
......@@ -2,7 +2,7 @@
Config page
-->
<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">
<l:layout>
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<f:form method="post" action="configSubmit">
......
......@@ -2,7 +2,7 @@
Edit View Page
-->
<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">
<l:layout>
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<f:form method="post" action="configSubmit">
......
......@@ -4,7 +4,7 @@
This belongs to a build view.
-->
<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">
<l:layout>
<l:layout norefresh="true">
<st:include it="${it.build}" page="sidepanel.jelly" />
<l:main-panel>
<h1>Build #${it.build.number}</h1>
......
......@@ -2,13 +2,15 @@
Outermost page layout. This is used with nested <side-panel> and <main-panel>
to form Hudson's basic HTML layout.
<%@attribute name="title" required="true" %>
Attributes:
title : controls the HTML page title. Mandatory.
norefresh : set to "true" to disable auto refresh for this page.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<st:contentType value="text/html;charset=UTF-8" />
<j:set var="rootURL" value="${request.contextPath}" />
<j:new var="h" className="hudson.Functions" /><!-- instead of JSP functions -->
<j:set var="_" value="${h.configureAutoRefresh(request, response)}"/>
<j:set var="_" value="${h.configureAutoRefresh(request, response, attrs.norefresh!=null)}"/>
<html>
<head>
<title>${h.appendIfNotNull(title, ' [Hudson]', 'Hudson')}</title>
......@@ -78,16 +80,18 @@
</j:forEach>
</td>
<td id="right-top-nav">
<span class="smallfont">
<j:choose>
<j:when test="${h.isAutoRefresh(request)}">
<a href="?auto_refresh=false">DISABLE AUTO REFRESH</a>
</j:when>
<j:otherwise>
<a href="?auto_refresh=true">ENABLE AUTO REFRESH</a>
</j:otherwise>
</j:choose>
</span>
<j:if test="${attrs.norefresh==null}">
<span class="smallfont">
<j:choose>
<j:when test="${h.isAutoRefresh(request)}">
<a href="?auto_refresh=false">DISABLE AUTO REFRESH</a>
</j:when>
<j:otherwise>
<a href="?auto_refresh=true">ENABLE AUTO REFRESH</a>
</j:otherwise>
</j:choose>
</span>
</j:if>
</td>
</tr>
</table>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册