| author | akozak | 2011-11-25 05:38:02 (EST) |
|---|---|---|
| committer | Winston Prakash | 2011-12-01 20:47:37 (EST) |
| commit | 4377c2ac2ed49644ed10a95234792064c50d3d4c (patch) (side-by-side diff) | |
| tree | a3eeca63e34839b52aad8baa008c34a362dc1680 | |
| parent | a77aa78e5b772f1eaf61742467dcc587e15db804 (diff) | |
| download | org.eclipse.hudson.core-4377c2ac2ed49644ed10a95234792064c50d3d4c.zip org.eclipse.hudson.core-4377c2ac2ed49644ed10a95234792064c50d3d4c.tar.gz org.eclipse.hudson.core-4377c2ac2ed49644ed10a95234792064c50d3d4c.tar.bz2 | |
Block deleting external job if it has cascading children. Introduce cascadingJobDeleteForm.jelly tag
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
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 < 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 --- a/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 < 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 |

