summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-25 05:38:02 (EST)
committer Winston Prakash2011-12-01 20:47:37 (EST)
commitbf4f6110b1facba137021e52b379342e194a7176 (patch)
treefaf88225260125e8e17d5cf8bd7bf07d5df5575b
parent41b1e17985ecfd3b4d68c0cce4afa8c15f14a35b (diff)
downloadorg.eclipse.hudson.core-bf4f6110b1facba137021e52b379342e194a7176.zip
org.eclipse.hudson.core-bf4f6110b1facba137021e52b379342e194a7176.tar.gz
org.eclipse.hudson.core-bf4f6110b1facba137021e52b379342e194a7176.tar.bz2
Block deleting external job if it has cascading children. Introduce cascadingJobDeleteForm.jelly tag
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/resources/hudson/model/AbstractProject/deleteConfirmationPanel.jelly45
-rw-r--r--hudson-core/src/main/resources/hudson/model/ExternalJob/deleteConfirmationPanel.jelly10
-rw-r--r--hudson-core/src/main/resources/hudson/model/ExternalJob/sidepanel.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/layout/jobDeleteForm.jelly57
4 files changed, 63 insertions, 51 deletions
diff --git a/hudson-core/src/main/resources/hudson/model/AbstractProject/deleteConfirmationPanel.jelly b/hudson-core/src/main/resources/hudson/model/AbstractProject/deleteConfirmationPanel.jelly
index 9b669c1..7b79e51 100644
--- a/hudson-core/src/main/resources/hudson/model/AbstractProject/deleteConfirmationPanel.jelly
+++ b/hudson-core/src/main/resources/hudson/model/AbstractProject/deleteConfirmationPanel.jelly
@@ -15,46 +15,5 @@
#************************************************************************** -->
<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">
- <script type="text/javascript">
- function onDeleteClick() {
- jQuery.ajax({
- url: "${rootUrl}/${it.url}api/json",
- dataType: 'json',
- cache: false,
- success: function(data) {
- jQuery('#confirmDialog').show();
- jQuery('#childrenList').hide();
- var cascadingChildren = data.cascadingChildrenNames;
- if (cascadingChildren.length != 0) {
- var jobList = jQuery("#jobList");
- jobList.html("");
- cascadingChildren.sort();
- for (var i = 0; i &lt; cascadingChildren.length; i++) {
- jobList.append("<li>" + cascadingChildren[i] + "</li>");
- }
- jQuery('#confirmDialog').hide();
- jQuery('#childrenList').show();
- }
- }
- });
- onLinkClick("question");
- }
- </script>
-
- <div>
- <form method="post" action="doDelete" id="deleteForm">
- <div id="confirmDialog">
- <h4>Are you sure you want to delete the Job?.</h4>
- <input type="submit" class="yes" value="${%Yes}"/>
- <input type="button" class="no" value="${%No}"/>
- </div>
- <div id="childrenList" class="deleteJobDialog" style="display:none">
- <h4>${%You can't delete this job because it has cascading children:}</h4>
- <ul id="jobList">
- </ul>
- <input type="button" class="no" value="${%Ok}" />
- </div>
- </form>
- </div>
-
-</j:jelly>
+ <l:jobDeleteForm />
+</j:jelly> \ No newline at end of file
diff --git a/hudson-core/src/main/resources/hudson/model/ExternalJob/deleteConfirmationPanel.jelly b/hudson-core/src/main/resources/hudson/model/ExternalJob/deleteConfirmationPanel.jelly
index 2b16fc9..8bf592a 100644
--- a/hudson-core/src/main/resources/hudson/model/ExternalJob/deleteConfirmationPanel.jelly
+++ b/hudson-core/src/main/resources/hudson/model/ExternalJob/deleteConfirmationPanel.jelly
@@ -15,10 +15,6 @@
#************************************************************************** -->
-<div>
- <form method="post" action="doDelete">
- <h4>Are you sure you want to delete the Job?.</h4>
- <input type="submit" class="yes" value="Yes" />
- <input type="button" class="no" value="No" />
- </form>
-</div>
+<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:jobDeleteForm />
+</j:jelly>
diff --git a/hudson-core/src/main/resources/hudson/model/ExternalJob/sidepanel.jelly b/hudson-core/src/main/resources/hudson/model/ExternalJob/sidepanel.jelly
index 51d7887..589369d 100644
--- a/hudson-core/src/main/resources/hudson/model/ExternalJob/sidepanel.jelly
+++ b/hudson-core/src/main/resources/hudson/model/ExternalJob/sidepanel.jelly
@@ -27,7 +27,7 @@
<l:task icon="images/24x24/up.png" href="${rootURL}/" title="${%Back to Dashboard}" />
<l:task icon="images/24x24/search.png" href="." title="${%Status}" />
<l:isAdmin>
- <l:taskWithDialog icon="images/24x24/edit-delete.png" dialogPanel="deleteConfirmationPanel.jelly" href="delete" title="${%Delete Job}" />
+ <l:taskWithDialog icon="images/24x24/edit-delete.gif" dialogPanel="deleteConfirmationPanel.jelly" href="delete" title="${%Delete Job}" onclick="onDeleteClick(); return false;"/>
<l:task icon="images/24x24/setting.png" href="configure" title="${%Configure}" />
</l:isAdmin>
<st:include page="actions.jelly" />
diff --git a/hudson-core/src/main/resources/lib/layout/jobDeleteForm.jelly b/hudson-core/src/main/resources/lib/layout/jobDeleteForm.jelly
new file mode 100644
index 0000000..9c5dc44
--- /dev/null
+++ b/hudson-core/src/main/resources/lib/layout/jobDeleteForm.jelly
@@ -0,0 +1,57 @@
+<!-- **************************************************************************
+#
+# Copyright (c) 2011 Oracle Corporation.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#
+# Nikita Levyankov
+#
+#
+#************************************************************************** -->
+<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">
+ <script type="text/javascript">
+ function onDeleteClick() {
+ jQuery.ajax({
+ url: "${rootUrl}/${it.url}api/json",
+ dataType: 'json',
+ cache: false,
+ success: function(data) {
+ jQuery('#confirmDialog').show();
+ jQuery('#childrenList').hide();
+ var cascadingChildren = data.cascadingChildrenNames;
+ if (cascadingChildren.length != 0) {
+ var jobList = jQuery("#jobList");
+ jobList.html("");
+ cascadingChildren.sort();
+ for (var i = 0; i &lt; cascadingChildren.length; i++) {
+ jobList.append("<li>" + cascadingChildren[i] + "</li>");
+ }
+ jQuery('#confirmDialog').hide();
+ jQuery('#childrenList').show();
+ }
+ }
+ });
+ onLinkClick("question");
+ }
+ </script>
+ <div>
+ <form method="post" action="doDelete" id="deleteForm">
+ <div id="confirmDialog">
+ <h4>Are you sure you want to delete the Job?.</h4>
+ <input type="submit" class="yes" value="${%Yes}"/>
+ <input type="button" class="no" value="${%No}"/>
+ </div>
+ <div id="childrenList" class="deleteJobDialog" style="display:none">
+ <h4>${%You can't delete this job because it has cascading children:}</h4>
+ <ul id="jobList">
+ </ul>
+ <input type="button" class="no" value="${%Ok}" />
+ </div>
+ </form>
+ </div>
+</j:jelly> \ No newline at end of file