1
0
mirror of https://github.com/typemill/typemill.git synced 2025-10-17 07:36:24 +02:00

Version 1.2.2 Draft Management

This commit is contained in:
Sebastian
2018-07-24 19:53:51 +02:00
parent c38783c4f6
commit 84880b3c0c
7 changed files with 45 additions and 24 deletions

View File

@@ -28,13 +28,13 @@ class ContentBackendController extends ContentController
# set item
if(!$this->setItem()){ die('no item'); return $this->render404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); }
# set the status for published and drafted
$this->setPublishStatus();
# set path
$this->setItemPath($this->item->fileType);
# add the modified date for the file
$this->item->modified = ($this->item->published OR $this->item->drafted) ? filemtime($this->settings['contentFolder'] . $this->path) : false;

View File

@@ -143,7 +143,7 @@ abstract class ContentController
# search for the url in the structure
$item = Folder::getItemForUrl($this->structure, $this->params['url']);
}
if($item)
{
if($item->elementType == 'file')
@@ -161,7 +161,7 @@ abstract class ContentController
$this->item = $item;
return true;
}
$this->errors = ['errors' => ['message' => 'requested page-url not found']];
return false;
}
@@ -170,13 +170,13 @@ abstract class ContentController
protected function setItemPath($fileType)
{
$this->path = $this->item->pathWithoutType . '.' . $fileType;
}
}
protected function setPublishStatus()
{
$this->item->published = false;
$this->item->drafted = false;
if(file_exists($this->settings['rootPath'] . $this->settings['contentFolder'] . $this->item->pathWithoutType . '.md'))
{
$this->item->published = true;
@@ -184,14 +184,16 @@ abstract class ContentController
# add file-type in case it is a folder
$this->item->fileType = "md";
}
elseif(file_exists($this->settings['rootPath'] . $this->settings['contentFolder'] . $this->item->pathWithoutType . '.txt'))
if(file_exists($this->settings['rootPath'] . $this->settings['contentFolder'] . $this->item->pathWithoutType . '.txt'))
{
$this->item->drafted = true;
# add file-type in case it is a folder
$this->item->fileType = "txt";
}
elseif($this->item->elementType == "folder")
if(!$this->item->drafted && !$this->item->published && $this->item->elementType == "folder")
{
# set txt as default for a folder, so that we can create an index.txt for a folder.
$this->item->fileType = "txt";
@@ -217,7 +219,7 @@ abstract class ContentController
}
protected function setContent()
{
{
# if the file exists
if($this->item->published OR $this->item->drafted)
{

View File

@@ -43,7 +43,7 @@ class Settings
'contentFolder' => 'content',
'cache' => true,
'cachePath' => $rootPath . 'cache',
'version' => '1.2.1',
'version' => '1.2.2',
'setup' => true,
'welcome' => true
];

View File

@@ -17,7 +17,7 @@
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20180706" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20180724" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/color-picker.min.css" />
</head>
<body>
@@ -35,7 +35,7 @@
<footer></footer>
</div>
<script src="{{ base_url }}/system/author/js/vue.min.js"></script>
<script src="{{ base_url }}/system/author/js/vue-editor.js?20180706"></script>
<script src="{{ base_url }}/system/author/js/author.js?20180706"></script>
<script src="{{ base_url }}/system/author/js/vue-editor.js?20180724"></script>
<script src="{{ base_url }}/system/author/js/author.js?20180724"></script>
</body>
</html>