| author | akozak | 2011-11-23 01:24:53 (EST) |
|---|---|---|
| committer | Winston Prakash | 2011-12-01 20:47:03 (EST) |
| commit | 79f524074e134371bd4d7c6fef7b6d521a7ef301 (patch) (side-by-side diff) | |
| tree | 6a148b53b916ef33dad73022614e7d47db76ed21 | |
| parent | f0f5cb0973d44bd017ad00778b66dae915d3bda5 (diff) | |
| download | org.eclipse.hudson.core-79f524074e134371bd4d7c6fef7b6d521a7ef301.zip org.eclipse.hudson.core-79f524074e134371bd4d7c6fef7b6d521a7ef301.tar.gz org.eclipse.hudson.core-79f524074e134371bd4d7c6fef7b6d521a7ef301.tar.bz2 | |
Draft implementation of revert functionality for optionalBlock element. Add License to cascading.js
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
9 files changed, 49 insertions, 0 deletions
diff --git a/hudson-core/src/main/resources/lib/form/optionalBlock.jelly b/hudson-core/src/main/resources/lib/form/optionalBlock.jelly index 5c042b7..649fd6b 100644 --- a/hudson-core/src/main/resources/lib/form/optionalBlock.jelly +++ b/hudson-core/src/main/resources/lib/form/optionalBlock.jelly @@ -44,6 +44,9 @@ <st:attribute name="inline"> if present, the foldable section will not be grouped into a separate JSON object upon submission </st:attribute> + <st:attribute name="resetUrl"> + If present, Redo icon will rendered and Reset will be available. + </st:attribute> <st:attribute name="isPropertyOverridden"> if present and true - value is overridden </st:attribute> @@ -62,6 +65,13 @@ <f:checkbox name="${attrs.name}" onclick="javascript:updateOptionalBlock(this,true)" negative="${attrs.negative}" checked="${attrs.checked}" field="${attrs.field}" title="${title}" /> </td> + <j:if test="${attrs.isPropertyOverridden and !empty(attrs.resetUrl)}"> + <td> + <a href="#" class="reset-button" resetURL="${resetUrl}"> + <img src="${imagesURL}/16x16/undo.png" alt="Reset ${title}" /> + </a> + </td> + </j:if> <j:if test="${attrs.help!=null}"> <td> <a href="#" class="help-button" helpURL="${rootURL}${attrs.help}"><img src="${imagesURL}/16x16/help.gif" alt="Help for feature: ${title}" /></a> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly index 702b202..a8f5c5f 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly @@ -24,5 +24,6 @@ title="${%Block build when downstream project is building}" help="/help/project-config/block-downstream-building.html" checked="${blockBuildWhenDownstreamBuilding}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.BLOCK_BUILD_WHEN_DOWNSTREAM_BUILDING_PROPERTY_NAME}" isPropertyOverridden="${blockBuildWhenDownstreamBuildingProperty.isOverridden()}"/> </j:jelly>
\ No newline at end of file diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly index 2fbe35c..701d0e3 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly @@ -24,5 +24,6 @@ title="${%Block build when upstream project is building}" help="/help/project-config/block-upstream-building.html" checked="${blockBuildWhenUpstreamBuilding}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.BLOCK_BUILD_WHEN_UPSTREAM_BUILDING_PROPERTY_NAME}" isPropertyOverridden="${blockBuildWhenUpstreamBuildingProperty.isOverridden()}"/> </j:jelly> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly index df76183..a3fada1 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly @@ -21,6 +21,7 @@ <j:set var="cleanWorkspaceRequired" value="${cleanWorkspaceRequiredProperty.getValue()}"/> <f:optionalBlock name="cleanWorkspaceRequired" title="${%Clean workspace before build}" checked="${cleanWorkspaceRequired}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.CLEAN_WORKSPACE_REQUIRED_PROPERTY_NAME}" isPropertyOverridden="${cleanWorkspaceRequiredProperty.isOverridden()}" help="/help/project-config/cleanWorkspace.html" /> </j:jelly> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly index 2bd8b1f..7ddbd5e 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly @@ -21,6 +21,7 @@ <j:set var="customWorkspace" value="${customWorkspaceProperty.getValue()}"/> <f:optionalBlock name="customWorkspace" title="${%Use custom workspace}" checked="${customWorkspace!=null}" isPropertyOverridden="${customWorkspaceProperty.isOverridden()}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.CUSTOM_WORKSPACE_PROPERTY_NAME}" help="/help/project-config/custom-workspace.html"> <f:entry title="${%Directory}"> <f:textbox name="customWorkspace.directory" value="${customWorkspace}" /> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly index 014c34c..7b9c41a 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly @@ -22,6 +22,7 @@ <f:optionalBlock name="hasCustomQuietPeriod" title="${%Quiet period}" checked="${quietPeriod!=null and quietPeriod!=quietPeriodProperty.getDefaultValue()}" isPropertyOverridden="${quietPeriodProperty.isOverridden()}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.QUIET_PERIOD_PROPERTY_NAME}" help="/help/project-config/quietPeriod.html"> <f:entry title="${%Quiet period}" description="${%Number of seconds}"> diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly index d4f8de9..d053055 100644 --- a/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly +++ b/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly @@ -22,6 +22,7 @@ <f:optionalBlock name="hasCustomScmCheckoutRetryCount" title="${%Retry Count}" checked="${scmCheckoutRetryCount!=null and scmCheckoutRetryCount!=scmCheckoutRetryCountProperty.getDefaultValue()}" isPropertyOverridden="${scmCheckoutRetryCountProperty.isOverridden()}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME}" help="/help/project-config/scmCheckoutRetryCount.html"> <f:entry title="${%SCM checkout retry count}"> <f:textbox name="scmCheckoutRetryCount" value="${scmCheckoutRetryCount}"/> diff --git a/hudson-war/src/main/webapp/images/16x16/undo.png b/hudson-war/src/main/webapp/images/16x16/undo.png Binary files differnew file mode 100644 index 0000000..28227c3 --- a/dev/null +++ b/hudson-war/src/main/webapp/images/16x16/undo.png diff --git a/hudson-war/src/main/webapp/scripts/cascading.js b/hudson-war/src/main/webapp/scripts/cascading.js index 14b6329..4c3cb50 100644 --- a/hudson-war/src/main/webapp/scripts/cascading.js +++ b/hudson-war/src/main/webapp/scripts/cascading.js @@ -1,3 +1,36 @@ + +/******************************************************************************* + * + * Copyright (c) 2004-2010 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, Anton Kozak + * + *******************************************************************************/ + +hudsonRules["A.reset-button"] = function(e) { + e.onclick = function() { + new Ajax.Request(this.getAttribute("resetURL"), { + method : 'get', + onSuccess : function(x) { + location.reload(true); + }, + onFailure : function(x) { + + } + }); + return false; + } + e.tabIndex = 9999; // make help link unnavigable from keyboard + e = null; // avoid memory leak +} + jQuery(document).ready(function(){ jQuery('select[name=cascadingProjectName]').change(function() { var url = window.location.href; |

