Replies: 2 comments 6 replies
-
I would like to upvote this.
to
makes the tree on the left ordered alphabetically and you can "move" the pages putting a number before them (10, 20...) The problem is still present in the dropdown, where the absence of grouping puts everything on the same level Still I find this preferable than having everything shuffled together. I don't know PHP, anyway I'll try something on the WE to make the dropdown show something similar to a tree... Hope this can help. NB: I didn't see any countereffect modifying the query, but I use just a fraction of LT potential. From what I can say you are already working on manual sorting (the sortindex column make me thinking this...) Thanks for your work. |
Beta Was this translation helpful? Give feedback.
-
I updated the code to prevent circular references. I managed to have a result.... The lines are referenced to version 3.4.9 What is needed is to modify the query on app/domain/wiki/repositories/wiki.php, line 134 from Then in <?php
foreach ($__data as $var => $val) {
$$var = $val; // necessary for blade refactor
}
$currentArticle = $tpl->get('article');
/*
Original line:
$wikiHeadlines = $tpl->get('wikiHeadlines');
The following block orders and formats the headlines in the combobox.
*/
// --------------------------
$wikiHL = $tpl->get('wikiHeadlines');
$wikiHeadlines = [];
// Adds to $wikiHeadlines all the options and suboptions from $wikiHL for articles with parent $parentId.
// The method is called recursively.
// $id: current page Id.
// $parentId: the id of parent article.
// $wikiHeadline: the output, ordered array. will be modified inside the method.
// $wikiHL: the array returned from Service.getAllWikiHeadlines.
// Even if it is passed by reference for performance the method will not modify it.
// $indent is the string to put before the title, any level will add a space.
function createTree($id, $parentId, &$wikiHeadlines, &$wikiHL, $indent) {
// Finds the first article
$articles = array_filter($wikiHL, function($v) use($parentId) { return $v->parent == $parentId; });
if (count($articles) > 0) {
usort ($articles, function($a1, $a2) { return $a1->title > $a2->title; });
if ($parentId != null) {
$indent = $indent . "-";
}
foreach ($articles as $article) {
// This check prevents circular references by hiding the current page and its childs from list.
if ($article->id != $id) {
$art = $article;
$art->title = $indent . $article->title;
$wikiHeadlines[] = $art;
createTree($id, $article->id, $wikiHeadlines, $wikiHL, $indent);
}
}
}
//var_dump($articles);
}
// --------------------------
// The following is the second original php block
if (! isset($_GET['closeModal'])) {
echo $tpl->displayNotification();
}
$id = '';
if (isset($currentArticle->id)) {
$id = $currentArticle->id;
}
// Populates the options tree
createTree($id, null, $wikiHeadlines, $wikiHL, "");
?> Then the combobox will look this way The numbers are there to order and left from previous tests, on the sublevels there is no need for the parent number. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Question regarding the WIKI. Is it possible to do an individual sorting here?
The wiki is created "on the fly" and it can happen that a new entry should be higher up in the list. However, the entries are sorted from top to bottom according to the “creation date” or “ID”.
So e.g.
ID 1
ID2
ID3
ID4
ID5
But I would like to enter a new Wiki entry ID 6 between ID 2 and ID 3, but I can't manage that. In order for me to be able to do this currently, I would have to delete ID 3, ID 4, ID 5 - create the new entry ID 6, then create ID 3 (which would then be ID 7), recreate ID 4 (which would then be ID 8) and then ID 5 (which then becomes ID 9).
The bigger the wiki gets, the more complex it becomes. Can you please activate manual sorting here? Move Drap/Drop, or rearrange using the up/down arrow?
That would be great if this could be done in one of the next versions.
Beta Was this translation helpful? Give feedback.
All reactions