Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ protected function addAclRules()
public function setPublicAppLayout(Event $event)
{
$routeName = $event->getRouteMatch()->getMatchedRouteName();
if (0 !== strpos($routeName, 'scripto')) {
if (0 !== strpos($routeName, 'site/scripto')) {
// Not a public application Scripto route.
return;
}
Expand Down
532 changes: 260 additions & 272 deletions config/module.config.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Api/Representation/ScriptoItemRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function url($action = null, $canonical = false)
}
$urlHelper = $this->getViewHelper('Url');
return $urlHelper(
'scripto-item-id',
'site/scripto-item-id',
[
'action' => $action,
'project-id' => $this->resource->getScriptoProject()->getId(),
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Representation/ScriptoMediaRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function url($action = null, $canonical = false)
}
$urlHelper = $this->getViewHelper('Url');
return $urlHelper(
'scripto-media-id',
'site/scripto-media-id',
[
'action' => $action,
'project-id' => $this->resource->getScriptoItem()->getScriptoProject()->getId(),
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Representation/ScriptoProjectRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function url($action = null, $canonical = false)
}
$urlHelper = $this->getViewHelper('Url');
return $urlHelper(
'scripto-project-id',
'site/scripto-project-id',
[
'action' => $action,
'project-id' => $this->resource->getId(),
Expand Down
3 changes: 2 additions & 1 deletion src/Controller/PublicApp/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public function indexAction()
$userInfo = $this->scripto()->apiClient()->queryUserInfo();
$user = $this->scripto()->apiClient()->queryUser($userInfo['name']);


$userCons = [];
$watchlist = [];
if ($this->scripto()->apiClient()->userIsLoggedIn()) {
Expand Down Expand Up @@ -49,7 +50,7 @@ public function createAccountAction()
$formData['email'], $formData['realname']
);
$this->messenger()->addSuccess('Your Scripto account has been created! Please check your email for a link to activate your account.'); // @translate
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto', ['action' => 'index'], [], true);
} catch (CreateaccountException $e) {
$this->messenger()->addError($e->getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/PublicApp/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function browseAction()
{
$project = $this->scripto()->getRepresentation($this->params('project-id'));
if (!$project) {
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

$this->setBrowseDefaults('id');
Expand Down Expand Up @@ -39,7 +39,7 @@ public function browseAction()
public function showAction()
{
return $this->redirect()->toRoute(
'scripto-media',
'site/scripto-media',
['action' => 'browse'],
['query' => $this->params()->fromQuery()],
true
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/PublicApp/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function browseAction()
$this->params('item-id')
);
if (!$sItem) {
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

$this->setBrowseDefaults('position', 'asc');
Expand Down Expand Up @@ -102,7 +102,7 @@ public function handleShow($namespace)
$this->params('media-id')
);
if (!$sMedia) {
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

$sItem = $sMedia->scriptoItem();
Expand Down Expand Up @@ -133,7 +133,7 @@ public function handleEdit($namespace)
$this->params('media-id')
);
if (!$sMedia) {
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

$action = (0 === $namespace) ? 'show' : 'talk';
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/PublicApp/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function guidelinesAction()
{
$project = $this->scripto()->getRepresentation($this->params('project-id'));
if (!$project) {
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

$view = new ViewModel;
Expand All @@ -34,7 +34,7 @@ public function guidelinesAction()
public function showAction()
{
return $this->redirect()->toRoute(
'scripto-item',
'site/scripto-item',
['action' => 'browse'],
['query' => $this->params()->fromQuery()],
true
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/PublicApp/RevisionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handleBrowse($namespace)
$this->params('media-id')
);
if (!$sMedia) {
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

$response = $sMedia->pageRevisions($namespace, 100, $this->params()->fromQuery('continue'));
Expand Down Expand Up @@ -87,7 +87,7 @@ public function handleShow($namespace)
$this->params('media-id')
);
if (!$sMedia) {
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

try {
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/PublicApp/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public function watchlistAction()
{
if (!$this->scripto()->apiClient()->userIsLoggedIn()) {
// User must be logged in.
return $this->redirect()->toRoute('scripto');
return $this->redirect()->toRoute('site/scripto');
}

$userName = $this->params('user-id');
$currentUser = $this->scripto()->apiClient()->queryUserInfo();
if ($userName !== $currentUser['name']) {
// Logged in user must be current user.
return $this->redirect()->toRoute('scripto-user-watchlist', ['user-id' => $currentUser['name']]);
return $this->redirect()->toRoute('site/scripto-user-watchlist', ['user-id' => $currentUser['name']]);
}

$hours = $this->params()->fromQuery('hours', 720); // 30 days
Expand Down
2 changes: 1 addition & 1 deletion src/Site/Navigation/Link/Scripto.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getLabel(array $data, SiteRepresentation $site)
public function toZend(array $data, SiteRepresentation $site)
{
return [
'route' => 'scripto-project-id',
'route' => 'site/scripto-project-id',
'params' => [
'site-slug' => $site->slug(),
'site-project-id' => $data['project_id'],
Expand Down
20 changes: 11 additions & 9 deletions src/ViewHelper/Scripto.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function publicAppProjectLink()
? $this->publicAppProject->link($view->translate('Project'), null, ['class' => 'page-link'])
: $view->hyperlink(
$view->translate('Projects'),
$view->url('scripto-project', ['action' => 'browse'], true),
$view->url('site/scripto-project', ['action' => 'browse'], true),
['class' => 'page-link']
);
}
Expand Down Expand Up @@ -263,9 +263,10 @@ public function loginBar()
$userInfo = $this->apiClient->queryUserInfo();
$form = $this->formElementManager->get(ScriptoLogoutForm::class);
$form->setAttribute('action', $view->url(
'scripto',
'site/scripto',
['action' => 'logout'],
['query' => ['redirect' => $this->getCurrentUrl()]]
['query' => ['redirect' => $this->getCurrentUrl()]],
true
));
return sprintf(
'<div class="user logged-in">
Expand All @@ -280,17 +281,18 @@ public function loginBar()
%s',
$view->translate('User menu'), // @translate
sprintf($view->translate('Logged in to Scripto as %s'), sprintf('<span class="username">%s</span>', $userInfo['name'])),
$view->hyperlink($view->translate('Dashboard'), $view->url('scripto', ['action' => 'index'], true)),
$view->hyperlink($view->translate('Contributions'), $view->url('scripto-user-contributions', ['action' => 'contributions', 'user-id' => $userInfo['name']], true)),
$view->hyperlink($view->translate('Watchlist'), $view->url('scripto-user-watchlist', ['action' => 'watchlist', 'user-id' => $userInfo['name']], true)),
$view->hyperlink($view->translate('Dashboard'), $view->url('site/scripto', ['action' => 'index'], true)),
$view->hyperlink($view->translate('Contributions'), $view->url('site/scripto-user-contributions', ['action' => 'contributions', 'user-id' => $userInfo['name']], true)),
$view->hyperlink($view->translate('Watchlist'), $view->url('site/scripto-user-watchlist', ['action' => 'watchlist', 'user-id' => $userInfo['name']], true)),
$view->form($form)
);
} else {
$form = $this->formElementManager->get(ScriptoLoginForm::class);
$form->setAttribute('action', $view->url(
'scripto',
'site/scripto',
['action' => 'login'],
['query' => ['redirect' => $this->getCurrentUrl()]]
['query' => ['redirect' => $this->getCurrentUrl()]],
true
));
return sprintf(
'<div class="user logged-out"><a href="#" class="user-toggle page-link menu-toggle">%s</a><div class="user-menu">%s</div></div>',
Expand Down Expand Up @@ -609,7 +611,7 @@ public function getUserSignature()
$userInfo = $this->apiClient->queryUserInfo();
return sprintf(
'-- [%s %s] ~~~~~',
$view->url('scripto-user-contributions', ['user-id' => $userInfo['name']], ['force_canonical' => true]),
$view->url('site/scripto-user-contributions', ['user-id' => $userInfo['name']], ['force_canonical' => true], true),
$userInfo['name']
);
}
Expand Down
2 changes: 1 addition & 1 deletion view/common/block-layout/scripto-block.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<p><?php echo $this->hyperlink(
$project->title(),
$this->url(
'scripto-project-id',
'site/scripto-project-id',
[
'site-slug' => $site->slug(),
'site-project-id' => $project->id(),
Expand Down
4 changes: 2 additions & 2 deletions view/common/media-head.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<div class="tab-actions">
<?php if ($userCanEdit): ?>
<?php echo $sMedia->link($this->scripto()->translate($project->contentType(), 'Edit'), 'edit'); ?>
<?php echo $this->hyperlink($this->translate('Browse revision history'), $this->url('scripto-revision', ['action' => 'browse'], true)); ?>
<?php echo $this->hyperlink($this->translate('Browse revision history'), $this->url('site/scripto-revision', ['action' => 'browse'], true)); ?>
<?php endif; ?>
<?php echo $sMedia->link($this->translate('View notes'), 'show-talk'); ?>
<?php echo $this->scripto()->watchlistToggle($sMedia, $project->mediaType()); ?>
</div>
<?php echo $this->scripto()->mediaPagination(); ?>
</div>
</div>
4 changes: 2 additions & 2 deletions view/layout/layout-scripto-public-app.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $this->headScript()->appendFile($this->assetUrl('js/public-app.js', 'Scripto'));
</head>
<header class="site-header" role="banner">
<div class="wrapper">
<?php echo $this->hyperlink($title, $this->url('scripto', ['action' => 'index'], true), ['class' => 'site-title']); ?>
<?php echo $this->hyperlink($title, $this->url('site/scripto', ['action' => 'index'], true), ['class' => 'site-title']); ?>
<nav class="top-nav">
<input type="checkbox" id="nav-trigger" class="nav-trigger" aria-label="<?php echo $this->translate('Toggle menu'); ?>"/>
<label for="nav-trigger">
Expand All @@ -37,7 +37,7 @@ $this->headScript()->appendFile($this->assetUrl('js/public-app.js', 'Scripto'));
<?php echo $this->scripto()->publicAppSiteLink(); ?>
<?php echo $this->scripto()->loginBar(); ?>
<?php if (!$this->scripto()->apiClient()->userIsLoggedIn()): ?>
<?php echo $this->hyperlink($this->translate('Create account'), $this->url('scripto', ['action' => 'create-account'], true), ['class' => 'page-link']); ?>
<?php echo $this->hyperlink($this->translate('Create account'), $this->url('site/scripto', ['action' => 'create-account'], true), ['class' => 'page-link']); ?>
<?php endif; ?>
</div>
<?php if (isset($project)): ?>
Expand Down
20 changes: 10 additions & 10 deletions view/scripto/public-app/index/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h4>
<?php echo $this->translate('Your recent contributions'); ?>
<?php if (!isset($user['invalid'])): ?>
<?php echo $this->hyperlink($this->translate('View your contributions'), $this->url('scripto-user-contributions', ['action' => 'contributions', 'user-id' => $user['name']], true), ['class' => 'button']); ?>
<?php echo $this->hyperlink($this->translate('View your contributions'), $this->url('site/scripto-user-contributions', ['action' => 'contributions', 'user-id' => $user['name']], true), ['class' => 'button']); ?>
<?php endif; ?>
</h4>
<?php if (!isset($user['invalid']) && $userCons): ?>
Expand All @@ -27,7 +27,7 @@
'%s: %s (%s) (%s | %s) %s (%s) <i>%s</i>',
$this->scripto()->translate($project->itemType(), 'Item'),
$this->hyperlink($sItem->item()->displayTitle(), $this->url(
$isTalk ? 'scripto-talk-media-id' : 'scripto-media-id',
$isTalk ? 'site/scripto-talk-media-id' : 'site/scripto-media-id',
[
'action' => 'show',
'project-id' => $project->id(),
Expand All @@ -41,7 +41,7 @@
: sprintf($this->scripto()->translate($project->mediaType(), 'Media #%s'), $sMedia->position()),
$userCon['parentid']
? $this->hyperlink($this->translate('diff'), $this->url(
$isTalk ? 'scripto-talk-revision-compare' : 'scripto-revision-compare',
$isTalk ? 'site/scripto-talk-revision-compare' : 'site/scripto-revision-compare',
[
'action' => 'compare',
'project-id' => $project->id(),
Expand All @@ -54,7 +54,7 @@
))
: $this->translate('diff'),
$this->hyperlink($this->translate('hist'), $this->url(
$isTalk ? 'scripto-talk-revision' : 'scripto-revision',
$isTalk ? 'site/scripto-talk-revision' : 'site/scripto-revision',
[
'action' => 'browse',
'project-id' => $project->id(),
Expand All @@ -64,7 +64,7 @@
true
)),
$this->hyperlink($date, $this->url(
$isTalk ? 'scripto-talk-revision-id' : 'scripto-revision-id',
$isTalk ? 'site/scripto-talk-revision-id' : 'site/scripto-revision-id',
[
'action' => 'show',
'project-id' => $project->id(),
Expand Down Expand Up @@ -96,7 +96,7 @@
<h4>
<?php echo $this->translate('Your recent watchlist'); ?>
<?php if (!isset($user['invalid'])): ?>
<?php echo $this->hyperlink($this->translate('View your watchlist'), $this->url('scripto-user-watchlist', ['action' => 'watchlist', 'user-id' => $user['name']], true), ['class' => 'button']); ?>
<?php echo $this->hyperlink($this->translate('View your watchlist'), $this->url('site/scripto-user-watchlist', ['action' => 'watchlist', 'user-id' => $user['name']], true), ['class' => 'button']); ?>
<?php endif; ?>
</h4>
<?php if (!isset($user['invalid']) && $watchlist): ?>
Expand All @@ -122,7 +122,7 @@
'%s: %s (%s) (%s | %s) %s (%s) <i>%s</i>',
$this->scripto()->translate($project->itemType(), 'Item'),
$this->hyperlink($sItem->item()->displayTitle(), $this->url(
$isTalk ? 'scripto-talk-media-id' : 'scripto-media-id',
$isTalk ? 'site/scripto-talk-media-id' : 'site/scripto-media-id',
[
'action' => 'show',
'project-id' => $project->id(),
Expand All @@ -136,7 +136,7 @@
: sprintf($this->scripto()->translate($project->mediaType(), 'Media #%s'), $sMedia->position()),
$page['old_revid']
? $this->hyperlink($this->translate('diff'), $this->url(
$isTalk ? 'scripto-talk-revision-compare' : 'scripto-revision-compare',
$isTalk ? 'site/scripto-talk-revision-compare' : 'site/scripto-revision-compare',
[
'action' => 'compare',
'project-id' => $project->id(),
Expand All @@ -149,7 +149,7 @@
))
: $this->translate('diff'),
$this->hyperlink($this->translate('hist'), $this->url(
$isTalk ? 'scripto-talk-revision' : 'scripto-revision',
$isTalk ? 'site/scripto-talk-revision' : 'site/scripto-revision',
[
'action' => 'browse',
'project-id' => $project->id(),
Expand All @@ -159,7 +159,7 @@
true
)),
$this->hyperlink($date, $this->url(
$isTalk ? 'scripto-talk-revision-id' : 'scripto-revision-id',
$isTalk ? 'site/scripto-talk-revision-id' : 'site/scripto-revision-id',
[
'action' => 'show',
'project-id' => $project->id(),
Expand Down
2 changes: 1 addition & 1 deletion view/scripto/public-app/media/show-talk.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $this->scripto()->postSubtitle(sprintf($this->translate('Original title: %s'), $
<ul class="note-actions">
<?php if ($userCanEdit): ?>
<li><?php echo $sMedia->link($this->translate('Edit'), 'edit-talk'); ?></li>
<li><?php echo $this->hyperlink($this->translate('Browse notes history'), $this->url('scripto-talk-revision', ['action' => 'browse-talk'], true)); ?></li>
<li><?php echo $this->hyperlink($this->translate('Browse notes history'), $this->url('site/scripto-talk-revision', ['action' => 'browse-talk'], true)); ?></li>
<?php endif; ?>
</ul>
</div>
Expand Down
Loading