-
Notifications
You must be signed in to change notification settings - Fork 11
/
history.php
76 lines (73 loc) · 3.59 KB
/
history.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
$head = array('title' => html_escape('Scripto'));
head($head);
?>
<h1><?php echo $head['title']; ?></h1>
<div id="primary">
<?php echo flash(); ?>
<div id="scripto-history" class="scripto">
<!-- navigation -->
<p>
<?php if ($this->scripto->isLoggedIn()): ?>
Logged in as <a href="<?php echo html_escape(uri('scripto')); ?>"><?php echo $this->scripto->getUserName(); ?></a>
(<a href="<?php echo html_escape(uri('scripto/logout')); ?>">logout</a>)
| <a href="<?php echo html_escape(uri('scripto/watchlist')); ?>">Your watchlist</a>
<?php else: ?>
<a href="<?php echo html_escape(uri('scripto/login')); ?>">Log in to Scripto</a>
<?php endif; ?>
| <a href="<?php echo html_escape(uri('scripto/recent-changes')); ?>">Recent changes</a>
| <a href="<?php echo html_escape(uri(array('controller' => 'items', 'action' => 'show', 'id' => $this->doc->getId()), 'id')); ?>">View item</a>
| <a href="<?php echo html_escape(uri(array('controller' => 'files', 'action' => 'show', 'id' => $this->doc->getPageId()), 'id')); ?>">View file</a>
| <a href="<?php echo html_escape(uri(array('action' => 'transcribe', 'item-id' => $this->doc->getId(), 'file-id' => $this->doc->getPageId()), 'scripto_action_item_file')); ?>">Transcribe page</a>
</p>
<h2><?php if (1 == $this->namespaceIndex): ?>Discussion<?php else: ?>Transcription<?php endif; ?> Page History</h2>
<h3><?php echo $this->doc->getPageName(); ?></h3>
<!-- page history -->
<?php if (empty($this->history)): ?>
<p>This page has not yet been created.</p>
<?php else: ?>
<table>
<thead>
<tr>
<th>Compare Changes</th>
<th>Changed on</th>
<th>Changed by</th>
<th>Size (bytes)</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->history as $revision): ?>
<?php
$urlCurrent = uri(array('item-id' => $this->doc->getId(),
'file-id' => $this->doc->getPageId(),
'namespace-index' => $this->namespaceIndex,
'old-revision-id' => $revision['revision_id'],
'revision-id' => $this->info['last_revision_id']),
'scripto_diff');
$urlPrevious = uri(array('item-id' => $this->doc->getId(),
'file-id' => $this->doc->getPageId(),
'namespace-index' => $this->namespaceIndex,
'old-revision-id' => $revision['parent_id'],
'revision-id' => $revision['revision_id']),
'scripto_diff');
$urlRevert = uri(array('item-id' => $this->doc->getId(),
'file-id' => $this->doc->getPageId(),
'namespace-index' => $this->namespaceIndex,
'revision-id' => $revision['revision_id']),
'scripto_revision');
?>
<tr>
<td>(<?php if ($revision['revision_id'] != $this->info['last_revision_id']): ?><a href="<?php echo html_escape($urlCurrent); ?>">current</a><?php else: ?>current<?php endif; ?> | <?php if (0 != $revision['parent_id']): ?><a href="<?php echo html_escape($urlPrevious); ?>">previous</a><?php else: ?>previous<?php endif; ?>)</td>
<td><a href="<?php echo html_escape($urlRevert); ?>"><?php echo date('H:i:s M d, Y', strtotime($revision['timestamp'])); ?></a></td>
<td><?php echo $revision['user']; ?></td>
<td><?php echo $revision['size']; ?></td>
<td><?php echo $revision['action']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div><!-- #scripto-history -->
</div>
<?php foot(); ?>