Merge remote-tracking branch 'dignajar/master'

This commit is contained in:
Alexander K 2016-05-28 08:50:19 -04:00
commit f5d481beab
11 changed files with 137 additions and 70 deletions

View File

@ -140,6 +140,11 @@ legend.first-child {
padding: 15px 10px;
}
.uk-table td.children {
padding: 15px 10px 15px 25px;
}
.uk-badge {
margin-right: 5px !important;
font-size: 0.9em;
@ -153,6 +158,7 @@ a {
.uk-panel-box {
background: #F9F9F9 !important;
border: 0;
}
.uk-container {

View File

@ -1,6 +1,10 @@
/* ----------- UIKIT HACKs FOR BLUDIT ----------- */
html {
background: #f1f1f1;
background: #F7F7F7;
}
.uk-form * {
border-radius: 2px !important;
}
.uk-button-primary {
@ -13,8 +17,9 @@ html {
input[type="text"],
input[type="password"] {
border-color: #FFF !important;
background: #FFF;
border-color: #EBEBEB !important;
border-radius: 2px !important;
color: #333;
}
input:disabled {
@ -22,7 +27,7 @@ input:disabled {
}
.uk-vertical-align-middle {
margin-top: -100px;
margin-top: -150px;
}
.uk-panel {

View File

@ -1,6 +1,6 @@
/* ----------- UIKIT HACKs FOR BLUDIT ----------- */
html {
background: #f3f3f3;
background: #F7F7F7;
}
* {
@ -17,8 +17,9 @@ html {
input[type="text"],
input[type="password"] {
border-color: #FFF !important;
border-color: #EBEBEB !important;
border-radius: 2px !important;
color: #333;
}
.uk-alert {
@ -49,7 +50,7 @@ div.login-form > h2 {
}
a.login-email {
border: 1px solid #eeeeee;
border: 0;
color: #777;
display: block;
margin: 20px 0;

View File

@ -1,7 +1,6 @@
<!DOCTYPE HTML>
<html lang="<?php echo $Site->language() ?>">
<html>
<head>
<base href="<?php echo HTML_PATH_ADMIN_THEME ?>">
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex,nofollow">
@ -9,23 +8,22 @@
<title><?php echo $layout['title'] ?></title>
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="./img/favicon.png">
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png' ?>">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="./css/uikit/uikit.almost-flat.min.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="./css/uikit/upload.almost-flat.min.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="./css/uikit/form-file.almost-flat.min.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="./css/uikit/placeholder.almost-flat.min.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="./css/uikit/progress.almost-flat.min.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="./css/default.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="./css/jquery.datetimepicker.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/uikit.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/upload.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/form-file.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/placeholder.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/progress.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/default.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/jquery.datetimepicker.css?version='.BLUDIT_VERSION ?>">
<!-- Javascript -->
<script charset="utf-8" src="./js/jquery.min.js?version=<?php echo BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="./js/uikit/uikit.min.js?version=<?php echo BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="./js/uikit/upload.min.js?version=<?php echo BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="./js/jquery.datetimepicker.js?version=<?php echo BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/jquery.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/uikit/uikit.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/uikit/upload.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/jquery.datetimepicker.js?version='.BLUDIT_VERSION ?>"></script>
<!-- Plugins -->
<?php Theme::plugins('adminHead') ?>

View File

@ -7,7 +7,6 @@ echo '
<thead>
<tr>
<th>'.$L->g('Title').'</th>
<th>'.$L->g('Parent').'</th>
<th class="uk-text-center">'.$L->g('Position').'</th>
<th>'.$L->g('Friendly URL').'</th>
</tr>
@ -15,26 +14,33 @@ echo '
<tbody>
';
unset($pagesParents[NO_PARENT_CHAR]);
foreach($pagesParents as $parentKey=>$pageList)
{
// Parent page
$Page = $pages[$parentKey];
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$Page->key() : '/'.$Url->filters('page').'/'.$Page->key();
echo '<tr>';
echo '<td>';
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label-draft">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a>';
echo '</td>';
echo '<td class="uk-text-center">'.$Page->position().'</td>';
echo '<td><a target="_blank" href="'.$Page->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
// Children
foreach($pageList as $Page)
{
if($parentKey!==NO_PARENT_CHAR) {
$parentTitle = $pages[$Page->parentKey()]->title();
}
else {
$parentTitle = '';
}
echo '<tr>';
echo '<td>'.($Page->parentKey()?'- ':'').'<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label-draft">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a></td>';
echo '<td>'.$parentTitle.'</td>';
echo '<td class="uk-text-center">'.$Page->position().'</td>';
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$Page->key() : '/'.$Url->filters('page').'/'.$Page->key();
echo '<tr class="children">';
echo '<td class="children">';
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label-draft">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a>';
echo '</td>';
echo '<td class="uk-text-center">'.$Page->position().'</td>';
echo '<td><a target="_blank" href="'.$Page->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
}

View File

@ -7,14 +7,18 @@
// Array with all pages.
$pages = array();
$pagesPublished = array();
// Array with all pages, order by parent.
$pagesParents = array(NO_PARENT_CHAR=>array());
$pagesParentsPublished = array();
// ============================================================================
// Functions
// ============================================================================
function sortPages($a, $b)
function sortPages2($a, $b)
{
if ($a->position() == $b->position()) {
return 0;
@ -23,6 +27,15 @@ function sortPages($a, $b)
return ($a->position() < $b->position()) ? -1 : 1;
}
function sortPages($a, $b)
{
if ($a['position'] == $b['position']) {
return 0;
}
return ($a['position'] < $b['position']) ? -1 : 1;
}
function buildPage($key)
{
global $dbPages;
@ -81,63 +94,62 @@ function buildPage($key)
function buildAllPages()
{
global $pagesParents;
global $pagesParentsPublished;
global $pagesPublished;
global $dbPages;
// Get the page list
$list = $dbPages->getDB();
// Clean pages array.
$pages = array();
// Remove the error page
unset($list['error']);
// Sorte pages
uasort($list, 'sortPages');
foreach($list as $key=>$db)
{
$Page = buildPage($key);
if($Page!==false)
{
// --- Order pages by parents ---
// Filter pages, with and without parent
// Generate all posible parents.
if( $Page->parentKey()===false )
{
// If the page doesn't have a father, it's a parent page :P
if( $Page->parentKey()===false ) {
// Add the parent key in the dbPages
$dbPages->addParentKey($Page->key());
// Add the page as a parent page in the array
$pagesParents[NO_PARENT_CHAR][$Page->key()] = $Page;
// If the page is published
if($Page->published()) {
$pagesParentsPublished[NO_PARENT_CHAR][$Page->key()] = $Page;
}
}
else
{
else {
$pagesParents[$Page->parentKey()][$Page->key()] = $Page;
// If the page is published
if($Page->published()) {
$pagesParentsPublished[$Page->parentKey()][$Page->key()] = $Page;
}
}
// --- All pages in 1 array ---
// All pages in one array
$pages[$Page->key()] = $Page;
// If the page is published
if($Page->published()) {
$pagesPublished[$Page->parentKey()][$Page->key()] = $Page;
}
}
}
// --- SORT PAGES ---
// Sort parents.
$parents = $pagesParents[NO_PARENT_CHAR];
uasort($parents, 'sortPages');
// Sort children.
unset($pagesParents[NO_PARENT_CHAR]);
$children = $pagesParents;
$tmpPageWithParent = array();
foreach($children as $parentKey=>$childrenPages)
{
// If the child doesn't have a valid parent, then doesn't included them.
if(isset($pages[$parentKey]))
{
$tmpPageWithParent[$parentKey] = $childrenPages;
uasort($tmpPageWithParent[$parentKey], 'sortPages');
}
}
$pagesParents = array(NO_PARENT_CHAR=>$parents) + $tmpPageWithParent;
return $pages;
}
@ -193,3 +205,4 @@ if($Url->notFound())
// Build all pages
$pages = buildAllPages();

View File

@ -16,6 +16,30 @@ h1, h2, h3, h4, h5, h6 {
letter-spacing: 0;
}
h1 {
font-size: 1.5em;
}
h2 {
font-size: 1.4em;
}
h3 {
font-size: 1.3em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1.1em;
}
h6 {
font-size: 1em;
}
#header {
background-color: #f7f7f7;
border-bottom: 0;
@ -57,6 +81,10 @@ header p {
border: 0;
}
.post a {
color: #2672ec;
}
.post > header {
border-bottom-color: #F7F7F7;
margin-bottom: 1.3em;
@ -77,6 +105,10 @@ header p {
margin-bottom: 5px;
}
.post > header .title h1 a {
color: #3c3b3b;
}
.post > footer .stats {
margin: 0;
}

View File

@ -13,7 +13,7 @@
<nav class="links">
<ul>
<?php
$parents = $pagesParents[NO_PARENT_CHAR];
$parents = $pagesParentsPublished[NO_PARENT_CHAR];
foreach($parents as $Parent) {
echo '<li><a href="'.$Parent->permalink().'">'.$Parent->title().'</a></li>';
}

View File

@ -6,7 +6,7 @@
<!-- Post's header -->
<header>
<div class="title">
<h2><a href="<?php echo $Page->permalink() ?>"><?php echo $Page->title() ?></a></h2>
<h1><a href="<?php echo $Page->permalink() ?>"><?php echo $Page->title() ?></a></h1>
<p><?php echo $Page->description() ?></p>
</div>
</header>

View File

@ -7,7 +7,6 @@
<header>
<div class="title">
<h1><a href="<?php echo $Post->permalink() ?>"><?php echo $Post->title() ?></a></h1>
<p><?php echo $Post->description() ?></p>
</div>
<div class="meta">
<?php

View File

@ -26,6 +26,7 @@ define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
define('PATH_PLUGINS_DATABASES',PATH_CONTENT.'databases'.DS.'plugins'.DS);
@ -308,6 +309,12 @@ function install($adminPassword, $email, $timezone)
error_log($errorText, 0);
}
if(!mkdir(PATH_TMP, $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_TMP;
error_log($errorText, 0);
}
if(!mkdir(PATH_UPLOADS_THUMBNAILS, $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_THUMBNAILS;