Skip to content

Commit 50c9589

Browse files
committed
fix page reordering anomaly
1 parent 095a655 commit 50c9589

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

framework/modules/navigation/controllers/navigationController.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,24 @@ function manage() {
778778
global $db, $router, $user;
779779

780780
expHistory::set('manageable', $router->params);
781+
782+
// Fix page ranks to be sequential beginning at 1
783+
$sect = new section();
784+
$pages = $sect->find('all','parent!=-1','parent,rank');
785+
$rank = 1;
786+
$oldparent = $pages[0]->parent;
787+
foreach ($pages as $page) {
788+
if ($oldparent !== $page->parent) {
789+
$rank = 1;
790+
$oldparent = $page->parent;
791+
}
792+
if ($page->rank != $rank) {
793+
$page->rank = $rank;
794+
$page->update();
795+
}
796+
$rank++;
797+
}
798+
781799
assign_to_template(array(
782800
'canManageStandalones' => self::canManageStandalones(),
783801
'sasections' => $db->selectObjects('section', 'parent=-1'),

0 commit comments

Comments
 (0)