Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jenskooij committed May 15, 2018
2 parents 72815cd + f3da94a commit 0e236cc
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 243 deletions.
155 changes: 79 additions & 76 deletions src/templates/documents.php
Original file line number Diff line number Diff line change
@@ -1,82 +1,85 @@
<?php include('documents/function.renderDocument.php'); ?>
<?php include('documents/function.renderFolder.php'); ?>
<?php include('documents/function.renderDocumentBreadcrumb.php'); ?>
<?php include(__DIR__ . '/documents/functions.php'); ?>
<section class="documents">
<h2>
<i class="fa fa-file-text-o"></i>
Documents
</h2>
<h2>
<i class="fa fa-file-text-o"></i>
Documents
</h2>
<?php if (isset($infoMessage)) : ?>
<div class="infoMessage <?= isset($infoMessageClass) ? $infoMessageClass : '' ?>">
<div class="content">
<?= $infoMessage ?>
<div class="infoMessage <?= isset($infoMessageClass) ? $infoMessageClass : '' ?>">
<div class="content">
<?= $infoMessage ?>
</div>
</div>
</div>
<?php endif ?>
<div class="search">
<?php if ($searchNeedsUpdate) : ?>
<div class="message warning">
<i class="fa fa-exclamation-triangle"></i>
Search index is no longer in sync with documents.
<a href="<?= $request::$subfolders ?><?= $cmsPrefix ?>/search/update-index?returnUrl=<?= urlencode($request::$subfolders . $cmsPrefix . '/documents') ?>" title="Update Index">Update Index</a>
</div>
<?php else : ?>
<div class="message valid">
<i class="fa fa-check"></i>
Search index is in sync with documents.
</div>
<?php endif ?>
</div>
<nav class="actions">
<ul>
<li>
<a class="btn" href="<?= $request::$subfolders . $cmsPrefix ?>/documents/new-document?path=<?= $path ?>" title="New Document">
+
<i class="fa fa-file-text-o"></i>
</a>
<a class="btn" href="<?= $request::$subfolders . $cmsPrefix ?>/documents/new-folder?path=<?= $path ?>" title="New Folder">
+
<i class="fa fa-folder-o"></i>
</a>
</li>
</ul>
</nav>
<table class="documents">
<tr>
<?php renderDocumentBreadcrumb($path) ?>
</tr>
<?php
$parentPath = substr($path, 0, strrpos( $path, '/'));
if ($path !== '/' && substr_count($path, '/') === 1) {
$parentPath = '/';
}
if (!empty($parentPath)) : ?>
<tr>
<td class="icon" title="folder">
<i class="fa fa-folder-o"></i>
</td>
<td class="icon"></td>
<td>
<a href="?path=<?= $parentPath ?>">..</a>
</td>
<td class="icon context-menu-container"></td>
</tr>
<?php endif ?>
<?php foreach ($documents as $document) : ?>
<tr>
<?php if ($document->type === 'folder') : ?>
<?php renderFolder($document, $path, $request, $cmsPrefix) ?>
<?php else : ?>
<?php renderDocument($document, $path, $request, $cmsPrefix) ?>
<?php endif ?>
</tr>
<?php endforeach ?>
<?php if (count($documents) === 0) : ?>
<div class="search">
<?php if ($searchNeedsUpdate) : ?>
<div class="message warning">
<i class="fa fa-exclamation-triangle"></i>
Search index is no longer in sync with documents.
<a href="<?= $request::$subfolders ?><?= $cmsPrefix ?>/search/update-index?returnUrl=<?= urlencode($request::$subfolders . $cmsPrefix . '/documents') ?>"
title="Update Index">Update Index</a>
</div>
<?php else : ?>
<div class="message valid">
<i class="fa fa-check"></i>
Search index is in sync with documents.
</div>
<?php endif ?>
</div>
<nav class="actions">
<ul>
<li>
<a class="btn"
href="<?= $request::$subfolders . $cmsPrefix ?>/documents/new-document?path=<?= $path ?>"
title="New Document">
+
<i class="fa fa-file-text-o"></i>
</a>
<a class="btn"
href="<?= $request::$subfolders . $cmsPrefix ?>/documents/new-folder?path=<?= $path ?>"
title="New Folder">
+
<i class="fa fa-folder-o"></i>
</a>
</li>
</ul>
</nav>
<table class="documents">
<tr>
<td class="icon" colspan="4">
<i>&lt;Empty&gt;</i>
</td>
<?php include(__DIR__ . '/documents/breadcrumb.php') ?>
</tr>
<?php endif ?>
</table>
</section>
<?php
$parentPath = substr($path, 0, strrpos($path, '/'));
if ($path !== '/' && substr_count($path, '/') === 1) {
$parentPath = '/';
}
if (!empty($parentPath)) : ?>
<tr>
<td class="icon" title="folder">
<i class="fa fa-folder-o"></i>
</td>
<td class="icon"></td>
<td>
<a href="?path=<?= $parentPath ?>">..</a>
</td>
<td class="icon context-menu-container"></td>
</tr>
<?php endif ?>
<?php foreach ($documents as $document) : ?>
<tr>
<?php if ($document->type === 'folder') : ?>
<?php include(__DIR__ . '/documents/folder.php') ?>
<?php else : ?>
<?php include(__DIR__ . '/documents/document.php'); ?>
<?php endif ?>
</tr>
<?php endforeach ?>
<?php if (count($documents) === 0) : ?>
<tr>
<td class="icon" colspan="4">
<i>&lt;Empty&gt;</i>
</td>
</tr>
<?php endif ?>
</table>
</section>
19 changes: 19 additions & 0 deletions src/templates/documents/breadcrumb.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<th colspan="4">
<?php
$pathParts = explode('/', $path);
array_shift($pathParts);
$pathPartsReconstruction = '';
?>
<a href="?path=/">
Documents
</a>
<?php foreach ($pathParts as $part) : ?>
<?php if (!empty($part)) : ?>
<?php $pathPartsReconstruction .= (substr($pathPartsReconstruction, -1) === '/' ? '' : '/') . $part ?>
&raquo;
<a href="?path=<?= $pathPartsReconstruction ?>">
<?= $part ?>
</a>
<?php endif ?>
<?php endforeach ?>
</th>
85 changes: 85 additions & 0 deletions src/templates/documents/document.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<td class="icon" title="<?= $document->type ?>">
<i class="fa fa-file-text-o"></i>
</td>
<td class="icon" title="<?= $document->state ?>">
<i class="fa <?= $document->state === 'published' ? 'fa-check-circle-o' : 'fa-times-circle-o' ?>"></i>
</td>
<td>
<a href="<?= getEditDocumentLink($request, $cmsPrefix, $path, $document) ?>"><?= $document->title ?></a>
<?php if ($document->unpublishedChanges) : ?>
<small class="small unpublished-changes">Unpublished Changes</small>
<?php endif ?>
<small class="small document-type"><?= $document->documentType ?></small>
<div class="details">
<table>
<tr>
<th>Document Type</th>
<td><?= $document->documentType ?></td>
<th>Last Modified By</th>
<td><?= $document->lastModifiedBy ?></td>
</tr>
<tr>
<th>Created</th>
<td title="<?= date('d-m-Y H:i:s',
$document->creationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->creationDate) ?></td>
<th>Last Modified</th>
<td title="<?= date('d-m-Y H:i:s',
$document->lastModificationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->lastModificationDate) ?></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<th>Published</th>
<?php if ($document->state === 'published') : ?>
<td title="<?= date('d-m-Y H:i:s',
$document->publicationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->publicationDate) ?></td>
<?php else : ?>
<td>Not yet</td>
<?php endif ?>
</tr>
</table>
</div>
</td>
<td class="icon context-menu-container">
<div class="context-menu">
<i class="fa fa-ellipsis-v"></i>
<ul>
<li>
<a href="<?= getEditDocumentLink($request, $cmsPrefix, $path, $document) ?>">
<i class="fa fa-pencil"></i>
Edit
</a>
</li>
<?php if ($document->state === 'unpublished' || $document->unpublishedChanges) : ?>
<li>
<a href="<?= getPublishDocumentLink($request, $cmsPrefix, $path, $document) ?>">
<i class="fa fa-check"></i>
Publish
</a>
</li>
<?php endif ?>
<?php if ($document->state === 'published') : ?>
<li>
<a href="<?= getUnpublishDocumentLink($request, $cmsPrefix, $path, $document) ?>">
<i class="fa fa-times"></i>
Unpublish
</a>
</li>
<?php endif ?>
<?php if ($document->state === 'unpublished') : ?>
<li>
<a href="<?= getDeleteDocumentLink($request, $cmsPrefix, $path, $document) ?>"
onclick="return confirm('Are you sure you want to delete this document?');">
<i class="fa fa-trash"></i>
Delete
</a>
</li>
<?php endif ?>
<li>
<a href="#" onclick="return showDocumentDetails(this);">
<i class="fa fa-list-alt"></i>
Details
</a>
</li>
</ul>
</div>
</td>
21 changes: 21 additions & 0 deletions src/templates/documents/folder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<td class="icon" title="<?= $document->type ?>">
<i class="fa fa-folder-o"></i>
</td>
<td class="icon"></td>
<td>
<a href="<?= openFolderLink($path, $document) ?>"><?= $document->title ?></a>
</td>
<td class="icon context-menu-container">
<div class="context-menu">
<i class="fa fa-ellipsis-v"></i>
<ul>
<li>
<a href="<?= getDeleteFolderLink($request, $cmsPrefix, $path, $document) ?>"
onclick="return confirm('Are you sure you want to delete this folder?');">
<i class="fa fa-trash"></i>
Delete
</a>
</li>
</ul>
</div>
</td>
99 changes: 0 additions & 99 deletions src/templates/documents/function.renderDocument.php

This file was deleted.

Loading

0 comments on commit 0e236cc

Please sign in to comment.