diff --git a/system/admin/admin.php b/system/admin/admin.php index 2543fed..dabc20a 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -1009,9 +1009,9 @@ function find_draft_page($static = null) $posts = get_draft_pages(); $tmp = array(); - + $counter = config('views.counter'); - + if ($counter == 'true') { $viewsFile = "content/data/views.json"; if (file_exists($viewsFile)) { @@ -1079,9 +1079,9 @@ function find_draft_subpage($static = null, $sub_static = null) $posts = get_draft_subpages($static); $tmp = array(); - + $counter = config('views.counter'); - + if ($counter == 'true') { $viewsFile = "content/data/views.json"; if (file_exists($viewsFile)) { @@ -1626,3 +1626,27 @@ function reorder_subpages($subpages = null) rebuilt_cache(); } + +// Return image gallery in pager. +function image_gallery($images, $page = 1, $perpage = 0) +{ + if (empty($images)) { + $images = get_gallery(); + } + $pagination = has_pagination(count($images), $perpage, $page); + $tmp = ''; + $images = array_slice($images, ($page - 1) * $perpage, $perpage); + $tmp .= '
'; + foreach ($images as $index => $v) { + $tmp .= '
'; + } + $tmp .= '

'; + if (!empty($pagination['prev'])) { + $tmp .= '← '. i18n('Prev') .''; + } + if (!empty($pagination['next'])) { + $tmp .= ''. i18n('Next') .' →'; + } + $tmp .= '
'; + return $tmp; +} diff --git a/system/admin/editor/js/editor.js b/system/admin/editor/js/editor.js index 3a19298..fdc4cac 100644 --- a/system/admin/editor/js/editor.js +++ b/system/admin/editor/js/editor.js @@ -11,6 +11,8 @@ $('#insertImageDialogFile').val(''); $('#insertMediaDialogURL').val(''); $('#insertMediaDialogFile').val(''); + $('#gallery-1').html(initial_image); + $('#gallery-2').html(initial_image); }; $('#insertImageDialogInsert').click( function() { callbackFunc( $('#insertImageDialogURL').val().length > 0 ? $('#insertImageDialogURL').val() : null ); diff --git a/system/admin/views/add-content.html.php b/system/admin/views/add-content.html.php index 38105cb..6a6147d 100644 --- a/system/admin/views/add-content.html.php +++ b/system/admin/views/add-content.html.php @@ -24,7 +24,7 @@ if (file_exists($tagslang)) { file_put_contents($tagslang, print_r($tmp, true), LOCK_EX); } -$images = get_gallery(); +$images = image_gallery(null, 1, 40); ?> @@ -227,18 +227,12 @@ $( function() {