Skip to content
Snippets Groups Projects
Commit 9952a73d authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Resolve "Wiki ab 5.5: Fehler nach dem Merge im Main"

Closes #3652

Merge request !2532
parent 1383328e
No related branches found
No related tags found
No related merge requests found
......@@ -545,6 +545,32 @@ class Course_WikiController extends AuthenticatedController
public function newpages_action()
{
Navigation::activateItem('/course/wiki/listnew');
$this->limit = Config::get()->ENTRIES_PER_PAGE;
$statement = DBManager::get()->prepare("
SELECT COUNT(*) FROM (
SELECT `wiki_pages`.`page_id` AS `id`,
0 AS `is_version`,
`wiki_pages`.`chdate` AS `timestamp`
FROM `wiki_pages`
WHERE `wiki_pages`.`range_id` = :range_id
UNION
SELECT `wiki_versions`.`version_id` AS `id`,
1 AS `is_version`,
`wiki_versions`.`mkdate` AS `timestamp`
FROM `wiki_versions`
JOIN `wiki_pages` USING (`page_id`)
WHERE `wiki_pages`.`range_id` = :range_id
) AS `all_entries`
");
$statement->execute([
'range_id' => $this->range->id
]);
$this->num_entries = $statement->fetch(PDO::FETCH_COLUMN);
$this->page = Request::int('page', 0);
$statement = DBManager::get()->prepare("
SELECT `wiki_pages`.`page_id` AS `id`,
0 AS `is_version`,
......@@ -560,10 +586,13 @@ class Course_WikiController extends AuthenticatedController
FROM `wiki_versions`
JOIN `wiki_pages` USING (`page_id`)
WHERE `wiki_pages`.`range_id` = :range_id
ORDER BY `timestamp`
ORDER BY `timestamp` DESC
LIMIT :offset, :limit
");
$statement->execute([
'range_id' => $this->range->id
'range_id' => $this->range->id,
'offset' => Request::int('page', 0) * $this->limit,
'limit' => $this->limit
]);
$this->versions = [];
foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $row) {
......
......@@ -12,26 +12,24 @@
<thead>
<tr>
<th data-sort="text"><?= _('Seitenname') ?></th>
<th data-sort="text"><?= _('Änderungen') ?></th>
<th data-sort="text"><?= _('Letzte Änderung') ?></th>
<th data-sort="digit"><?= _('Änderungen') ?></th>
<th data-sort="htmldata"><?= _('Letzte Änderung') ?></th>
<th data-sort="text"><?= _('Zuletzt bearbeitet von') ?></th>
</tr>
</thead>
<tbody>
<? foreach ($pages as $page) : ?>
<tr>
<td data-sort-value="<?= htmlReady($page->name) ?>">
<td data-text="<?= htmlReady($page->name) ?>">
<a href="<?= $controller->page($page) ?>">
<?= htmlReady($page->name) ?>
</a>
</td>
<td data-sort-value="<?= count($page->versions) + 1 ?>">
<?= count($page->versions) + 1 ?>
</td>
<td data-sort-value="<?= htmlReady($page->chdate) ?>">
<td><?= count($page->versions) + 1 ?></td>
<td data-sort-value="<?= $page->chdate ?>">
<?= $page->chdate > 0 ? date('d.m.Y H:i:s', $page->chdate) : _('unbekannt') ?>
</td>
<td data-sort-value="<?= htmlReady($page->user ? $page->user->getFullName() : _('unbekannt')) ?>">
<td data-text="<?= htmlReady($page->user ? $page->user->getFullName() : _('unbekannt')) ?>">
<?= Avatar::getAvatar($page->user_id)->getImageTag(Avatar::SMALL) ?>
<?= htmlReady($page->user ? $page->user->getFullName() : _('unbekannt')) ?>
</td>
......
<table class="default sortable-table" data-sortlist="[[3, 0]]">
<table class="default sortable-table" data-sortlist="[[3, 1]]">
<caption>
<?= _('Letzte Änderungen') ?>
</caption>
......@@ -15,4 +15,13 @@
<?= $this->render_partial('course/wiki/versioncompare', ['version' => $version]) ?>
<? endforeach ?>
</tbody>
<? if ($num_entries > $limit) : ?>
<tfoot>
<tr>
<td colspan="4" class="actions">
<?= Pagination::create($num_entries, $page, $limit)->asLinks() ?>
</td>
</tr>
</tfoot>
<? endif ?>
</table>
......@@ -18,11 +18,11 @@
$oldcontent = substr($oldcontent, 0, -1);
}
if ($content) {
echo nl2br(htmlReady($content));
echo nl2br(htmlReady(mila($content, 300)));
} elseif ($oldcontent) {
echo _('Gelöscht') . ': ' . nl2br(htmlReady($oldcontent));
} else {
echo nl2br(strip_tags(wikiReady($version->content)));
echo nl2br(strip_tags(wikiReady(mila($version->content, 300))));
}
?></td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment