Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
71997559
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
71997559
编写于
4月 10, 2013
作者:
V
Vincent Latombe
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into views_include_jobs_folder
Conflicts: changelog.html
上级
609487a0
9eb69772
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
190 addition
and
22 deletion
+190
-22
changelog.html
changelog.html
+4
-1
core/src/main/java/hudson/model/ManagementLink.java
core/src/main/java/hudson/model/ManagementLink.java
+12
-0
core/src/main/java/jenkins/management/ReloadLink.java
core/src/main/java/jenkins/management/ReloadLink.java
+5
-0
core/src/main/java/jenkins/model/Jenkins.java
core/src/main/java/jenkins/model/Jenkins.java
+1
-0
core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
...c/main/java/jenkins/model/ModelObjectWithContextMenu.java
+17
-0
core/src/main/resources/jenkins/model/Jenkins/manage.jelly
core/src/main/resources/jenkins/model/Jenkins/manage.jelly
+15
-4
core/src/main/resources/jenkins/model/Jenkins/manage.properties
...rc/main/resources/jenkins/model/Jenkins/manage.properties
+23
-0
core/src/main/resources/lib/layout/breadcrumbs.js
core/src/main/resources/lib/layout/breadcrumbs.js
+14
-1
core/src/main/resources/lib/layout/confirmationLink.jelly
core/src/main/resources/lib/layout/confirmationLink.jelly
+52
-0
core/src/main/resources/lib/layout/task.jelly
core/src/main/resources/lib/layout/task.jelly
+47
-16
未找到文件。
changelog.html
浏览文件 @
71997559
...
...
@@ -56,7 +56,10 @@ Upcoming changes</a>
<div
id=
"trunk"
style=
"display:none"
>
<!--=TRUNK-BEGIN=-->
<ul
class=
image
>
<li
class=
rfe
>
Views can now include jobs located within folders
Views can now include jobs located within folders
<li
class=
rfe
>
Added confirmation dialog before reloading configuration from disk.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-15340"
>
issue 15340
</a>
)
<li
class=
rfe
>
Different text than “Build Now” for parameterized jobs.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-10738"
>
issue 10738
</a>
)
...
...
core/src/main/java/hudson/model/ManagementLink.java
浏览文件 @
71997559
...
...
@@ -31,6 +31,7 @@ import hudson.security.Permission;
import
jenkins.model.Jenkins
;
import
java.util.List
;
import
org.kohsuke.stapler.interceptor.RequirePOST
;
/**
* Extension point to add icon to <tt>http://server/hudson/manage</tt> page.
...
...
@@ -80,6 +81,17 @@ public abstract class ManagementLink implements ExtensionPoint, Action {
*/
public
abstract
String
getUrlName
();
/**
* Allows implementations to request that this link show a confirmation dialog, and use POST if confirmed.
* Suitable for links which perform an action rather than simply displaying a page.
* @return true if this link takes an action
* @see RequirePOST
* @since 1.512
*/
public
boolean
getRequiresConfirmation
()
{
return
false
;
}
/**
* All registered instances.
* @deprecated as of 1.286
...
...
core/src/main/java/jenkins/management/ReloadLink.java
浏览文件 @
71997559
...
...
@@ -51,4 +51,9 @@ public class ReloadLink extends ManagementLink {
public
String
getUrlName
()
{
return
"reload"
;
}
@Override
public
boolean
getRequiresConfirmation
()
{
return
true
;
}
}
core/src/main/java/jenkins/model/Jenkins.java
浏览文件 @
71997559
...
...
@@ -3015,6 +3015,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
* Reloads the configuration.
*/
@CLIMethod
(
name
=
"reload-configuration"
)
@RequirePOST
public
synchronized
HttpResponse
doReload
()
throws
IOException
{
checkPermission
(
ADMINISTER
);
...
...
core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
浏览文件 @
71997559
...
...
@@ -106,6 +106,17 @@ public interface ModelObjectWithContextMenu extends ModelObject {
return
this
;
}
/** @since 1.512 */
public
ContextMenu
add
(
String
url
,
String
icon
,
String
text
,
boolean
post
,
boolean
requiresConfirmation
)
{
if
(
text
!=
null
&&
icon
!=
null
&&
url
!=
null
)
{
MenuItem
item
=
new
MenuItem
(
url
,
icon
,
text
);
item
.
post
=
post
;
item
.
requiresConfirmation
=
requiresConfirmation
;
items
.
add
(
item
);
}
return
this
;
}
/**
* Default implementation of the context menu generation.
*
...
...
@@ -184,6 +195,12 @@ public interface ModelObjectWithContextMenu extends ModelObject {
*/
@Exported
public
boolean
post
;
/**
* True to require confirmation after a click.
* @since 1.512
*/
@Exported
public
boolean
requiresConfirmation
;
/**
* If this is a submenu, definition of subitems.
*/
...
...
core/src/main/resources/jenkins/model/Jenkins/manage.jelly
浏览文件 @
71997559
...
...
@@ -32,10 +32,21 @@ THE SOFTWARE.
<!-- table to show a map -->
<d:tag name="feature">
<j:set var="iconUrl" value="${icon.startsWith('/') ? resURL+icon : imagesURL+'/48x48/'+icon}"/>
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href,iconUrl,title) : null}
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href,iconUrl,title,requiresConfirmation,requiresConfirmation) : null}
<!-- XXX summary.jelly should be modified to accept requiresConfirmation so the icon link can be included -->
<j:set var="_href" value="${href}"/>
<t:summary icon="${icon}"
href="${href}" iconOnly="true">
<div class="link"><a href="${href}">${title}</a></div>
href="${requiresConfirmation ? null : href}" iconOnly="true">
<div class="link">
<j:choose>
<j:when test="${requiresConfirmation}">
<l:confirmationLink href="${_href}" post="true" message="${%are.you.sure(title)}">${title}</l:confirmationLink>
</j:when>
<j:otherwise>
<a href="${_href}">${title}</a>
</j:otherwise>
</j:choose>
</div>
<div style="color:gray; text-decoration:none;">
<d:invokeBody />
</div>
...
...
@@ -74,7 +85,7 @@ THE SOFTWARE.
<j:forEach var="m" items="${it.managementLinks}">
<l:hasPermission permission="${m.requiredPermission}">
<j:if test="${m.iconFileName!=null}">
<local:feature icon="${m.iconFileName}" href="${m.urlName}" title="${m.displayName}">
<local:feature icon="${m.iconFileName}" href="${m.urlName}" title="${m.displayName}"
requiresConfirmation="${m.requiresConfirmation}"
>
<j:out value="${m.description}"/>
<st:include it="${m}" page="info.jelly" optional="true"/>
</local:feature>
...
...
core/src/main/resources/jenkins/model/Jenkins/manage.properties
0 → 100644
浏览文件 @
71997559
# The MIT License
#
# Copyright 2013 Jesse Glick.
#
# 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.
are.you.sure
=
{0}: are you sure?
core/src/main/resources/lib/layout/breadcrumbs.js
浏览文件 @
71997559
...
...
@@ -53,6 +53,16 @@ var breadcrumbs = (function() {
}
}
function
requireConfirmation
(
action
,
event
,
cfg
)
{
if
(
confirm
(
cfg
.
displayName
+
'
: are you sure?
'
))
{
// XXX I18N
var
form
=
document
.
createElement
(
'
form
'
);
form
.
setAttribute
(
'
method
'
,
cfg
.
post
?
'
POST
'
:
'
GET
'
);
form
.
setAttribute
(
'
action
'
,
cfg
.
url
);
document
.
body
.
appendChild
(
form
);
form
.
submit
();
}
}
/**
* Wraps a delayed action and its cancellation.
*/
...
...
@@ -158,7 +168,10 @@ var breadcrumbs = (function() {
e
.
text
=
makeMenuHtml
(
e
.
icon
,
e
.
displayName
);
if
(
e
.
subMenu
!=
null
)
e
.
subMenu
=
{
id
:
"
submenu
"
+
(
iota
++
),
itemdata
:
e
.
subMenu
.
items
.
each
(
fillMenuItem
)};
if
(
e
.
post
)
{
if
(
e
.
requiresConfirmation
)
{
e
.
onclick
=
{
fn
:
requireConfirmation
,
obj
:
{
url
:
e
.
url
,
displayName
:
e
.
displayName
,
post
:
e
.
post
}};
delete
e
.
url
;
}
else
if
(
e
.
post
)
{
e
.
onclick
=
{
fn
:
postRequest
,
obj
:
e
.
url
};
delete
e
.
url
;
}
...
...
core/src/main/resources/lib/layout/confirmationLink.jelly
0 → 100644
浏览文件 @
71997559
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2013 Jesse Glick.
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.
-->
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j=
"jelly:core"
xmlns:st=
"jelly:stapler"
xmlns:d=
"jelly:define"
>
<st:documentation>
Produces a hyperlink which when clicked first asks for confirmation, then goes to that URL if confirmed.
The body is displayed as the link text.
@since 1.512
<st:attribute
name=
"href"
use=
"required"
>
The URL to go to.
</st:attribute>
<st:attribute
name=
"post"
>
Use POST rather than GET (recommended).
</st:attribute>
<st:attribute
name=
"message"
use=
"required"
>
A confirmation dialog message.
</st:attribute>
</st:documentation>
<j:set
var=
"id"
value=
"${h.generateId()}"
/>
<form
method=
"${post ? 'POST' : 'GET'}"
action=
"${attrs.href}"
name=
"${id}"
/>
<a
href=
"#"
onclick=
"confirmPOST('${id}', '${message}')"
><d:invokeBody/></a>
<script>
function confirmPOST(id, message) {
if (confirm(message)) {
document[id].submit();
}
return false;
}
</script>
</j:jelly>
core/src/main/resources/lib/layout/task.jelly
浏览文件 @
71997559
...
...
@@ -23,7 +23,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout"
>
<st:documentation>
This tag inside <l:tasks> tag renders the left navigation bar of Hudson.
Each <task> tag gets an icon and link.
...
...
@@ -61,6 +61,12 @@ THE SOFTWARE.
(onclick supersedes this except in the context menu.)
(since 1.504)
</st:attribute>
<st:attribute name="requiresConfirmation" type="boolean">
If true, require confirmation before clicking.
Generally used with post="true".
(onclick supersedes this except in the context menu.)
(since 1.512)
</st:attribute>
</st:documentation>
<!--
...
...
@@ -103,9 +109,9 @@ THE SOFTWARE.
<j:otherwise>
<div class="task">
<j:set var="icon" value="${rootURL}${icon.startsWith('images/') || icon.startsWith('plugin/') ? h.resourcePath : ''}/${icon}"/>
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href, icon, title, post == 'true') : null}
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href, icon, title, post == 'true'
, requiresConfirmation == 'true'
) : null}
<j:if test="${attrs.onclick == null
&& post
}">
<j:if test="${attrs.onclick == null
and post and not requiresConfirmation
}">
<script>
function postRequest(a) {
new Ajax.Request(a.href);
...
...
@@ -115,21 +121,46 @@ THE SOFTWARE.
</script>
</j:if>
<a href="${href}" onclick="${attrs.onclick ?: (post ? 'postRequest(this)' : null)}">
<img width="24" height="24" style="margin: 2px;" alt="" src="${icon}"/>
</a>
<j:choose>
<j:when test="${requiresConfirmation and not attrs.onClick}">
<l:confirmationLink href="${href}" post="${post}">
<img width="24" height="24" style="margin: 2px;" alt="" src="${icon}"/>
</l:confirmationLink>
</j:when>
<j:otherwise>
<a href="${href}" onclick="${attrs.onclick ?: (post ? 'postRequest(this)' : null)}">
<img width="24" height="24" style="margin: 2px;" alt="" src="${icon}"/>
</a>
</j:otherwise>
</j:choose>
<st:nbsp />
<a href="${href}" onclick="${attrs.onclick ?: (post ? 'postRequest(this)' : null)}">
<j:choose>
<j:when test="${match}">
<b>${title}</b>
</j:when>
<j:otherwise>
${title}
</j:otherwise>
</j:choose>
</a>
<j:choose>
<j:when test="${requiresConfirmation and not attrs.onClick}">
<l:confirmationLink href="${href}" post="${post}">
<j:choose>
<j:when test="${match}">
<b>${title}</b>
</j:when>
<j:otherwise>
${title}
</j:otherwise>
</j:choose>
</l:confirmationLink>
</j:when>
<j:otherwise>
<a href="${href}" onclick="${attrs.onclick ?: (post ? 'postRequest(this)' : null)}">
<j:choose>
<j:when test="${match}">
<b>${title}</b>
</j:when>
<j:otherwise>
${title}
</j:otherwise>
</j:choose>
</a>
</j:otherwise>
</j:choose>
<j:if test="${match}">
<div class="subtasks">
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录