diff --git a/plugins/box/pages/pages.admin.php b/plugins/box/pages/pages.admin.php index 83bfda9..7146ddf 100755 --- a/plugins/box/pages/pages.admin.php +++ b/plugins/box/pages/pages.admin.php @@ -1,10 +1,63 @@ updateWhere('[slug="'.Request::post('slug').'"]', array('expand' => Request::post('expand'))); + Request::shutdown(); + } + } + + + /** + * _themeHeaders + */ + public static function _themeHeaders() { + echo (''); + } + /** * Pages admin function @@ -19,6 +72,8 @@ $errors = array(); $pages = new Table('pages'); + PagesAdmin::$pages = $pages; + $users = new Table('users'); $user = $users->select('[id='.Session::get('user_id').']', null); @@ -428,7 +483,12 @@ // Delete page and update fields if ($pages->deleteWhere('[slug="'.$page['slug'].'" ]')) { - $pages->updateWhere('[parent="'.$page['slug'].'"]', array('parent' => '')); + + $_pages = $pages->select('[parent="'.$page['slug'].'"]', 'all'); + foreach($_pages as $_page) { + $pages->updateWhere('[slug="'.$_page['slug'].'"]', array('parent' => '')); + } + File::delete(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'); Notification::set('success', __('Page :page deleted', 'pages', array(':page' => Html::toText($page['title'])))); } @@ -458,7 +518,7 @@ $count = 0; // Get pages - $pages_list = $pages->select(null, 'all', null, array('slug', 'title', 'status', 'date', 'author', 'parent')); + $pages_list = $pages->select(null, 'all', null, array('slug', 'title', 'status', 'date', 'author', 'expand', 'parent')); // Loop foreach ($pages_list as $page) { @@ -468,6 +528,7 @@ $pages_array[$count]['status'] = $status_array[$page['status']]; $pages_array[$count]['date'] = $page['date']; $pages_array[$count]['author'] = $page['author']; + $pages_array[$count]['expand'] = $page['expand']; $pages_array[$count]['slug'] = $page['slug']; if (isset($page['parent'])) { diff --git a/plugins/box/pages/views/backend/index.view.php b/plugins/box/pages/views/backend/index.view.php index ce7687c..e99609f 100755 --- a/plugins/box/pages/views/backend/index.view.php +++ b/plugins/box/pages/views/backend/index.view.php @@ -18,6 +18,7 @@ + @@ -32,12 +33,28 @@ if ($page['parent'] != '') { $dash = Html::arrow('right').'  '; } else { $dash = ""; } ?> - + select('[slug="'.(string)$page['parent'].'"]', null); + if ($page['parent'] !== '' && isset($expand['expand']) && $expand['expand'] == '1') { $visibility = 'style="display:none;"'; } else { $visibility = ''; } + ?> + rel="children_" > + +
+ select('[parent="'.(string)$page['slug'].'"]', 'all')) > 0) { + if (isset($page['expand']) && $page['expand'] == '1') { + echo '+'; + } else { + echo '-'; + } + } + ?> + '_blank')); + echo $dash.Html::anchor(Html::toText($page['title']), $site_url.$parent.$page['slug'], array('target' => '_blank', 'rel' => 'children_'.$_parent)); ?> @@ -68,6 +85,7 @@