Skip to content

Commit

Permalink
Merge pull request #51 from ironcerocloudbees/JENKINS_64341
Browse files Browse the repository at this point in the history
[JENKINS-64341] Removed table, tr and td tags for new Jenkins versions
  • Loading branch information
oleg-nenashev authored Mar 10, 2021
2 parents 7f2b9d9 + ee04d0a commit 341afd8
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,38 @@
~ THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:t="/lib/hudson">
xmlns:f="/lib/form" xmlns:t="/lib/hudson" xmlns:d="jelly:define"
xmlns:local="local">
<d:taglib uri="local">
<d:tag name="blockWrapperTr">
<j:choose>
<j:when test="${divBasedFormLayout}">
<div>
<d:invokeBody/>
</div>
</j:when>
<j:otherwise>
<tr>
<d:invokeBody/>
</tr>
</j:otherwise>
</j:choose>
</d:tag>
<d:tag name="blockWrapperTd">
<j:choose>
<j:when test="${divBasedFormLayout}">
<div>
<d:invokeBody/>
</div>
</j:when>
<j:otherwise>
<td>
<d:invokeBody/>
</td>
</j:otherwise>
</j:choose>
</d:tag>
</d:taglib>
<l:layout title="${it.displayName}" norefresh="true" permission="${it.job.CONFIGURE}">
<st:include it="${it.job}" page="sidepanel" optional="true"/>
<l:main-panel>
Expand All @@ -36,11 +67,11 @@
<p/>
<div class="behavior-loading">${%LOADING}</div>
<f:form action="authorize" method="post" name="config">
<tr>
<td>
<local:blockWrapperTr>
<local:blockWrapperTd>
<input type="hidden" name="stapler-class-bag" value="true"/>
</td>
</tr>
</local:blockWrapperTd>
</local:blockWrapperTr>
<j:set var="instance" value="${it.property}"/>
<j:set var="descriptor" value="${it.propertyDescriptor}"/>
<f:optionalBlock name="${descriptor.jsonSafeClassName}" help="${descriptor.helpFile}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,27 @@ 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" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<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:local="local">
<d:taglib uri="local">
<d:tag name="blockWrapperTable" >
<j:choose>
<j:when test="${divBasedFormLayout}">
<div>

<d:invokeBody/>
</div>
</j:when>
<j:otherwise>
<table width="100%">
<d:invokeBody/>
</table>
</j:otherwise>
</j:choose>
</d:tag>
</d:taglib>
<!-- configurations for AuthorizeProjectStrategy -->
<f:entry title="${%Strategies}">
<table width="100%">
<local:blockWrapperTable>
<j:forEach var="d" items="${descriptor.availableDescriptorList}">
<j:scope>
<j:set var="checked" value="${instance==null?d.enabledByDefault: instance.isStrategyEnabled(d)}" />
Expand All @@ -37,6 +54,6 @@ THE SOFTWARE.
</f:optionalBlock>
</j:scope>
</j:forEach>
</table>
</local:blockWrapperTable>
</f:entry>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,20 @@ Behaviour.specify(".specific-user-authorization", "checkPasswordRequired", 0, fu
var useridField = findFormItem(e, "userid", findChild(e));
var passwordField = findFormItem(e, "password", findChild(e));
var passwordFieldBlock = findAncestor(passwordField, "TR");
/*
[JENKINS-64341] - In Jenkins version greater than 2.263.4
the table tags for fields (in forms) were replaced by div tags.
Since the changes were applied the 'findAncestor(passwordField, "TR")'
method returns null. It is necessary to use the method
'findAncestorClass(passwordField, "tr")' instead of.
*/
if (passwordFieldBlock == null) {
passwordFieldBlock = findAncestorClass(passwordField, "tr");
}

var passwordCheckBlock = findFollowingTR(passwordField, "validation-error-area");
var passwordHelpBlock = findFollowingTR(passwordField, "help-area");

var passwordBlockList = [
passwordFieldBlock,
passwordCheckBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,27 @@ 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" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:block>
<table style="width:100%" class="specific-user-authorization">
<!--
<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:local="local">
<d:taglib uri="local">
<d:tag name="blockWrapperTable" >
<j:choose>
<j:when test="${divBasedFormLayout}">
<div class="specific-user-authorization">

<d:invokeBody/>
</div>
</j:when>
<j:otherwise>
<table style="width:100%" class="specific-user-authorization">
<d:invokeBody/>
</table>
</j:otherwise>
</j:choose>
</d:tag>
</d:taglib>
<f:block>
<local:blockWrapperTable>
<!--
hetero-radio makes entries visible even they are hidden.
So nest it not to handled by hetero-radio.
-->
Expand All @@ -46,7 +63,7 @@ THE SOFTWARE.
<f:checkbox />
</f:entry>
</j:if> <!-- authorizeProjectContext -->
</table>
</local:blockWrapperTable>
<j:if test="${authorizeProjectContext != 'global'}">
<st:once>
<st:adjunct includes="org.jenkinsci.plugins.authorizeproject.strategy.SpecificUsersAuthorizationStrategy.checkPasswordRequested" />
Expand Down

0 comments on commit 341afd8

Please sign in to comment.