diff --git a/bl-kernel/admin/controllers/edit-content.php b/bl-kernel/admin/controllers/edit-content.php index 0566ea95..0b5ba1d2 100644 --- a/bl-kernel/admin/controllers/edit-content.php +++ b/bl-kernel/admin/controllers/edit-content.php @@ -64,11 +64,28 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { try { $pageKey = $layout['parameters']; $page = new Page($pageKey); - $uuid = $page->uuid(); } catch (Exception $e) { Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$pageKey, LOG_TYPE_ERROR); Redirect::page('content'); } +// Images prefix directory +define('PAGE_IMAGES_KEY', $page->uuid()); + +// Images and thubmnails directories +if (IMAGE_RESTRICT) { + define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/')); + define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/')); + define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.DS.'thumbnails'.DS); + define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/'); + define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/'); +} else { + define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS)); + define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS)); + define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_THUMBNAILS); + define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_THUMBNAILS); + define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_THUMBNAILS); +} + // Title of the page $layout['title'] .= ' - '.$L->g('Edit content').' - '.$page->title(); \ No newline at end of file diff --git a/bl-kernel/admin/controllers/new-content.php b/bl-kernel/admin/controllers/new-content.php index 908a4d2a..38486fbc 100644 --- a/bl-kernel/admin/controllers/new-content.php +++ b/bl-kernel/admin/controllers/new-content.php @@ -35,5 +35,26 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // UUID of the page is need it for autosave and media manager $uuid = $pages->generateUUID(); +// Images prefix directory +define('PAGE_IMAGES_KEY', $uuid); + +// Images and thubmnails directories +if (IMAGE_RESTRICT) { + define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/')); + define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/')); + define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.DS.'thumbnails'.DS); + define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/'); + define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/'); + + // Create the directory to store the images + Filesystem::mkdir(PAGE_THUMBNAILS_DIRECTORY, true); +} else { + define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS)); + define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS)); + define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_THUMBNAILS); + define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_THUMBNAILS); + define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_THUMBNAILS); +} + // Title of the page $layout['title'] = $L->g('New content').' - '.$layout['title']; \ No newline at end of file diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php index d6f3c125..5018f4b9 100644 --- a/bl-kernel/admin/views/edit-content.php +++ b/bl-kernel/admin/views/edit-content.php @@ -24,7 +24,7 @@ echo Bootstrap::formOpen(array( // The UUID is generated in the controller echo Bootstrap::formInputHidden(array( 'name'=>'uuid', - 'value'=>$uuid + 'value'=>$page->uuid() )); // Type = published, draft, sticky, static @@ -61,20 +61,8 @@ echo Bootstrap::formOpen(array(
- - - - -
- draft()?'checked':'') ?>> - - draft()?'checked':'') ?>> - - -
-
+ + draft()?$L->g('Draft'):$L->g('Publish')) ?>
scheduled()): ?> @@ -125,7 +113,7 @@ echo Bootstrap::formOpen(array( 'selected'=>'', 'class'=>'', 'value'=>$page->description(), - 'rows'=>3, + 'rows'=>5, 'placeholder'=>$L->get('this-field-can-help-describe-the-content') )); ?> @@ -395,10 +383,21 @@ $(document).ready(function() { }; } + // Button switch + $("#jsswitchButton").on("click", function() { + if ($(this).data("switch")=="publish") { + $(this).html(' p('Draft') ?>'); + $(this).data("switch", "draft"); + } else { + $(this).html(' p('Publish') ?>'); + $(this).data("switch", "publish"); + } + }); + // Button Save $("#jsbuttonSave").on("click", function() { // If the switch is setted to "published", get the value from the selector - if ($("#jsPublishSwitch").is(':checked')) { + if ($("#jsswitchButton").data("switch")=="publish") { var value = $("#jstypeSelector option:selected").val(); $("#jstype").val(value); } else { diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php index 51e58e9c..32e4ae82 100644 --- a/bl-kernel/admin/views/new-content.php +++ b/bl-kernel/admin/views/new-content.php @@ -49,21 +49,14 @@ echo Bootstrap::formOpen(array(
- - + +
- -
- - - - - -
-
+ + p('Publish') ?>