Skip to content

Commit

Permalink
Merge pull request #112 from zopefoundation/fix-zmi
Browse files Browse the repository at this point in the history
Move to Zope 4+ ZMI-markup standard
  • Loading branch information
jensens committed Dec 1, 2021
2 parents 4f143a3 + 411a05b commit 3b36d8c
Show file tree
Hide file tree
Showing 8 changed files with 295 additions and 256 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog
2.1.5 (unreleased)
------------------

- Nothing changed yet.
- Move several tabs to Zope 4+ ZMI-markup standard. [jensens]


2.1.4 (2021-09-15)
Expand Down
2 changes: 1 addition & 1 deletion src/Products/GenericSetup/browser/addWithPresettings.pt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
 
</td>
<td>
<input class="form-element" type="submit" name="submit_add" value="Add" />
<input class="form-element" type="submit" name="submit_add" value="Add" />
</td>
</tr>
</table>
Expand Down
108 changes: 62 additions & 46 deletions src/Products/GenericSetup/www/setup_upgrades.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,79 @@
prof_uptodate context/listUptodateProfiles;
has_pending_upgrades context/hasPendingUpgrades">

<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:replace="structure context/manage_tabs">TABS</h2>
<span tal:replace="structure context/manage_page_header">PAGE HEADER</span>
<span tal:replace="structure context/manage_tabs">TABS</span>

<strong tal:condition="python:'saved' in request.form">
<span tal:replace="request/saved" /> profile saved.
</strong>
<main class="container-fluid">

<h3>Upgrades</h3>
<div class="alert alert-info" role="alert"
tal:condition="python:'saved' in request.form">
<strong>Info:</strong>
<span tal:replace="structure request/saved" />
profile run.
</div>

<h1>Upgrades</h1>

<div class="alert alert-info" role="alert"
tal:condition="not: prof_with_upgrades">
<strong>Info:</strong> No profiles with registered upgrade steps.
</div>

<tal:pending condition="has_pending_upgrades">
<strong>
<h2>
These profiles have pending upgrades:
</strong>
</h2>
<tal:choose-pending-profile condition="prof_with_pending_upgrades">
<form method="post" action="manage_upgrades">
<select name="profile_id">
<select name="profile_id" class="form-control">
<option tal:repeat="prof_id prof_with_pending_upgrades"
tal:content="prof_id"
tal:attributes="selected python:prof_id == profile_id"/>
</select>
<input type="submit" value="Choose Profile" />
<div class="form-group zmi-controls">
<div class="input-group">
<input class="btn btn-primary" type="submit" value="Choose Profile" />
</div>
</div>
</form>
</tal:choose-pending-profile>
</tal:pending>

<tal:choose-uptodate-profile condition="prof_uptodate">
<strong>
<h2>
These profiles have no pending upgrades, but old steps are
available if needed:
</strong>
<form method="post" action="manage_upgrades">
<select name="profile_id">
</h2>
<form method="post" action="manage_upgrades" id="profile_id_nopending">
<select name="profile_id" class="form-control"
tal:attributes="onchange string:document.getElementById('profile_id_nopending').submit();">
<option tal:repeat="prof_id prof_uptodate"
tal:content="prof_id"
tal:attributes="selected python:prof_id == profile_id"/>
</select>
<input type="submit" value="Choose Profile" />
<div class="form-group zmi-controls">
<div class="input-group">
<input class="btn btn-primary" type="submit" value="Choose Profile" />
</div>
</div>
</form>
</tal:choose-uptodate-profile>

<strong tal:condition="not: prof_with_upgrades">
No profiles with registered upgrade steps.
</strong>


<tal:profile-specified condition="profile_id">

<p class="form-help">
The profile "<span tal:replace="profile_id" />" is currently upgraded to version
<p>
The profile <code tal:content="profile_id" /> is currently upgraded to version
<strong tal:define="version python:context.getLastVersionForProfile(profile_id)"
tal:content="python:test(same_type(version, tuple()), '.'.join(version), version)">
LAST UPGRADED VERSION
</strong>.
</p>

<p class="form-help">
The filesystem version for the "<span tal:replace="profile_id" />" profile is currently
<p>
The filesystem version for the <code tal:content="profile_id" /> profile is currently
<strong tal:content="python:context.getVersionForProfile(profile_id)">
CURRENT FILESYSTEM VERSION
</strong>.
Expand All @@ -69,42 +86,40 @@
upgrades python:context.listUpgrades(profile_id, show_old=show_old)">

<form method="post" action="manage_doUpgrades" tal:condition="upgrades">
<p class="form-help">
<h3>
Available upgrades:
</p>
</h3>
<input type="hidden" name="show_old:int" value="VALUE"
tal:attributes="value show_old" />
<input type="hidden" name="profile_id" value="VALUE"
tal:attributes="value profile_id" />
<table>
<table class="table table-hover">
<tal:block tal:repeat="upgrade_info upgrades">

<tal:single condition="python:not same_type(upgrade_info, [])"
define="info upgrade_info">
<tbody tal:condition="python:not same_type(upgrade_info, [])"
tal:define="info upgrade_info">
<tr valign="top">
<metal:insert-step use-macro="context/upgradeStepMacro/macros/upgrade-step" />
</tr>
</tal:single>

<tal:multiple condition="python: same_type(upgrade_info, [])">
<tr valign="top"><td colspan="4">
<table style="padding-top: 5px; padding-bottom: 5px; width: 100%;
border: 1px dotted;">
<tr>
<th colspan="5" style="text-align: left;">Upgrade Step Group</th>
</tr>
<tr tal:repeat="info upgrade_info">
<td>-></td>
<metal:insert-step use-macro="context/upgradeStepMacro/macros/upgrade-step" />
</tr>
</table>
</td></tr>
</tbody>

<tal:multiple tal:condition="python: same_type(upgrade_info, [])">
<thead>
<tr>
<th colspan="4" style="text-align: left;">Upgrade Step Group</th>
</tr>
</thead>
<tbody>
<tr class="text-left" tal:repeat="info upgrade_info">
<metal:insert-step use-macro="context/upgradeStepMacro/macros/upgrade-step" />
</tr>
</tbody>
</tal:multiple>
</tal:block>

<tr valign="top">
<td colspan="4">
<input class="form-element" type="submit" value="Upgrade" />
<input class="btn btn-primary" type="submit" value="Upgrade" />
</td>
</tr>
</table>
Expand All @@ -115,9 +130,8 @@
</p>

<form method="post" action="manage_upgrades" tal:condition="not:show_old">
<p class="form-help">
Show old upgrades:
<input type="submit" value="Show" />
<p>
<input class="btn btn-primary" type="submit" value="Show old upgrades" />
<input type="hidden" name="show_old:int" value="1" />
<input type="hidden" name="profile_id" value="VALUE"
tal:attributes="value profile_id" />
Expand All @@ -128,6 +142,8 @@

</tal:profile-specified>

</main>

<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>

</html>
82 changes: 37 additions & 45 deletions src/Products/GenericSetup/www/sutExportSteps.zpt
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:replace="structure context/manage_tabs">TABS</h2>
<span tal:replace="structure context/manage_page_header">PAGE HEADER</span>
<span tal:replace="structure context/manage_tabs">TABS</span>

<h3> Site Configuration Export Steps </h3>
<main class="container-fluid">

<h1> Site Configuration Export Steps </h1>

<p class="form-help">

<p class="lead">
Download selected export steps as tarball.
</p>

<h3>Available Export Steps</h3>
<h2>Available Export Steps</h2>

<form action="." method="post" tal:attributes="action context/absolute_url">
<input type="hidden" name="ids:default:tokens" value="" />

<table cellspacing="0" cellpadding="4">
<table class="table table-hover">

<thead>
<tr class="list-header">
<td class="list-item">Sel.</td>
<td class="list-item">#</td>
<td class="list-item">Title / Description</td>
<td class="list-item">Handler</td>
<tr>
<td class="text-center">
<button type="button" class="btn" title="toggle selection" onclick="inputs = document.querySelectorAll('.step_checkbox'); for (var index = 0; index &lt; inputs.length; index++) {inputs[index].checked = inputs[index].checked ? false : true}; return false;"><i class="fa fa-exchange-alt"></i></button>
</td>
<td class="text-right">#</td>
<td>Title / Description</td>
<td>Handler</td>
</tr>
</thead>

Expand All @@ -31,52 +35,40 @@ Download selected export steps as tarball.
tal:define="info python: context.getExportStepMetadata(step_id);"
tal:attributes="class python:
repeat[ 'step_id' ].odd and 'row-normal' or 'row-hilite'" >
<td class="list-item" width="16">
<td class="text-center">
<input type="checkbox" name="ids:list" value="STEP_ID"
class="step_checkbox"
id="STEP_ID"
tal:attributes="id step_id;
tal:attributes="id python:step_id + '__';
value step_id" />
</td>
<td align="right" class="list-item"
<td class="text-right"
tal:content="repeat/step_id/number">1</td>
<td class="list-item">
<label tal:attributes="for step_id"
<td>
<label tal:attributes="for python:step_id + '__'"
tal:content="info/title">STEP TITLE</label><br />
<em tal:content="info/description">STEP DESCRIPTION</em>
<small tal:content="info/description">STEP DESCRIPTION</small>
</td>
<td>
<code tal:content="info/handler">DOTTED.NAME</code>
</td>
<td class="list-item"
tal:content="info/handler">DOTTED.NAME</td>
</tr>
</tal:loop>
</tbody>
</table>
<div class="form-group zmi-controls">
<div class="input-group">
<input class="btn btn-primary" type="submit"
name="manage_exportSelectedSteps:method"
value=" Export selected steps " />

<tr valign="top">
<td colspan="4">
<button type="button" onclick="inputs = document.querySelectorAll('.step_checkbox'); for (var index = 0; index &lt; inputs.length; index++) {inputs[index].checked = inputs[index].checked ? false : true}; return false;">Toggle selection</button>
</td>
</tr>

<tr valign="top" class="list-header">
<td colspan="4">&nbsp;</td>
</tr>

<tr valign="top">
<td />
<td colspan="3">

<input class="form-element" type="submit"
name="manage_exportSelectedSteps:method"
value=" Export selected steps " />
<input class="btn btn-primary ml-2" type="submit"
name="manage_exportAllSteps:method"
value=" Export all steps " />
</div>
</div>

<input class="form-element" type="submit"
name="manage_exportAllSteps:method"
value=" Export all steps " />

</td>
</tr>
</tbody>

</table>
</form>

</main>
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>

0 comments on commit 3b36d8c

Please sign in to comment.