Reorder Requirements Modernized - sebiboga/testlink-upgraded GitHub Wiki
Modernization of the Reorder Requirements sub-screen of the Requirement
Specification Viewer β lib/requirements/reqSpecView.php?doAction=reorder / the
reorder action of reqReorder.php (toolbar entry "Reorder requirements"
in the spec viewer). This was the last legacy requirements-ordering bit still
served by a lib/requirements/*.php controller print path; now a standalone
Dashio screen + REST BFF.


| Feature | Legacy behavior | Modernized |
|---|---|---|
| Route |
doAction=reorder on lib/functions/reqSpecView.php (frame submit) |
gui/templates/requirements/reqReorder.html + BFF api/reqreorder/index.php
|
| Reorder list |
get_requirements_ordered-style drag list (Dashio) |
modern DataTable + drag-and-drop rows (Sortable.js), each with Up/Down buttons |
| Persist | legacy lib/requirements/reqReorder.php updates node_order on nodes_hierarchy
|
BFF POST ?action=reorder&req_spec_id=&tproject_id= with nodes_order[] (0-based index) β writes node_order on the matching nodes_hierarchy rows (id = requirement node id) |
| Order source | legacy reqSpecView.php get_requirements query |
BFF GET ?action=init returns the spec's requirements ordered by node_order (latest version rows) incl. doc_id (from requirements.req_doc_id), title, node_order, canReorder (grant) |
| Rights |
mgt_view_req / mgt_modify_req on the owning project |
BFF gates every route: mgt_view_req reads, mgt_modify_req writes β 401 anon / 403 no right / 400 bad params / 404 unknown spec, JSON contract |
| Back link | legacy doViewOptions / history |
"Back to spec viewer" β reqSpecView.html?id=<spec>&tproject_id=<tproject>
|
| Locale | server strings.txt
|
reqro.* (15) + footers.reqReorder keys in all 10 TLi18n bundles; per-screen locale switcher (verified ro + en) |
GET api/reqreorder/index.php?action=init&req_spec_id=<id>&tproject_id=<id>
POST api/reqreorder/index.php?action=reorder&req_spec_id=<id>&tproject_id=<id>
Content-Type: application/json, body {"nodes_order":[<node_id>,β¦]}.
Rights: mgt_view_req (init) / mgt_modify_req (reorder) on the owning
project β 401 unauthenticated, 403 no right, 400 missing/invalid params, 404
unknown spec, 405 non-POST/GET, JSON {status, message} on every path.
| File | Purpose |
|---|---|
gui/templates/requirements/reqReorder.html |
modernized Dashio screen (TLi18n, drag-drop list, Up/Down, Save, Back, locale switcher) |
api/reqreorder/index.php |
BFF: init (ordered requirements + grant) / reorder (persist node_order) |
gui/templates/requirements/reqSpecView.html |
toolbar Reorder requirements button (#reorderLink) β opens reqReorder.html?req_spec_id=&tproject_id=
|
lib/functions/common.php |
$actions->reqReorder link switch |
gui/templates/i18n/{de,en,es,fr,it,ja,pt,ro,ru,zh}.json |
reqro.* + footers.reqReorder in all 10 bundles |
Dependency commits (bugs found + fixed during modernization):
-
e574c90b3βgui/templates/requirements/reqReorder.html+lib/functions/common.php$actions->reqReorder+api/reqreorder/index.php; wiring + toolbar button +reqSpecView.htmlreorder entry. -
61a170343β rewritereqReorder.htmlwith TLi18n i18n keys; fixdown21(undefined drag-item ReferenceError kept the list from rendering). - (BFF fixes in
api/reqreorder/index.php) β instantiate$tprojMgr(was NULL β 500 on init); init requirement/version query (versions are children of requirement nodes;req_doc_idlives onrequirements); persistnode_orderonnodes_hierarchy(legacy wrote torequirementstable by mistake β parity bug, fixed tonodes_hierarchy).
Regression suite 1488 (appended to tmp/TLU_Test_Cases.md) β 11/11 PASS:
init order parity (D,C,B,A), drag-and-drop + Up/Down reorder, Save β persisted
node_order re-verified in DB + Event Viewer clean, guest 403 / anon 401 /
no-right 403, locale switching (ro + en render; no raw keys), Back link,
toolbar button entry. Browser-verified end-to-end; Event Viewer shows no new
Error/Warning rows; console clean.
Bugfix commit 8ef9694d3 (Issue #1487, 2026-09-15) regressed the wiring:
$actions->reqReorder was reverted from lib/functions/common.php and the
#reorderLink toolbar button + JS href wiring were deleted from
gui/templates/requirements/reqSpecView.html, orphaning the modernized
screen. Restored per pre-gut parity (36d667658):
-
lib/functions/common.phpβ re-added$actions->reqReorder -
gui/templates/requirements/reqSpecView.htmlβ re-added the toolbar<a id="reorderLink" data-i18n="reqro.toolbarLink">Reorder requirements</a>and itshrefwiring inshowHideActions().
Regression suite 1518 appended to tmp/TLU_Test_Cases.md β 14/14 PASS:
php -l clean, both wiring leaves present, BFF init 200 (reorder grant),
anon 401, bad-spec 404, browser toolbar link resolves to
reqReorder.html?req_spec_id=2&tproject_id=1, Up/Down reorder + Save persist
nodes_hierarchy.node_order (Alpha=1, Gamma=0, Beta=2), Event Viewer clean
(0 Error/Warning), reqro.* + footers.reqReorder present in all 10 bundles,
enβro locale switch renders "Reordonare cerinΘe". Screenshots:
issue-1518-reorder-screen.png, issue-1518-reorder-ro.png.
Mirror-source: docs/MODERNIZATION-STATUS.md row 24f (#1488) +
Section 5 restore (#1518). CHANGELOG: CHANGELOG (2.0.1 KEY BUGFIX line).