aboutsummaryrefslogtreecommitdiff
path: root/mod/pages
diff options
context:
space:
mode:
Diffstat (limited to 'mod/pages')
-rw-r--r--mod/pages/lib/pages.php26
-rw-r--r--mod/pages/pages/pages/history.php7
-rw-r--r--mod/pages/pages/pages/view.php7
-rw-r--r--mod/pages/start.php5
-rw-r--r--mod/pages/views/default/object/page_top.php3
-rw-r--r--mod/pages/views/default/pages/sidebar/navigation.php6
6 files changed, 32 insertions, 22 deletions
diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php
index dbf7b8917..9a9ba12e9 100644
--- a/mod/pages/lib/pages.php
+++ b/mod/pages/lib/pages.php
@@ -81,6 +81,10 @@ function pages_register_navigation_tree($container) {
'limit' => 0,
));
+ if (!$top_pages) {
+ return;
+ }
+
foreach ($top_pages as $page) {
elgg_register_menu_item('pages_nav', array(
'name' => $page->getGUID(),
@@ -99,16 +103,18 @@ function pages_register_navigation_tree($container) {
'metadata_value' => $parent->getGUID(),
'limit' => 0,
));
-
- foreach ($children as $child) {
- elgg_register_menu_item('pages_nav', array(
- 'name' => $child->getGUID(),
- 'text' => $child->title,
- 'href' => $child->getURL(),
- 'parent_name' => $parent->getGUID(),
- ));
- array_push($stack, $child);
+
+ if ($children) {
+ foreach ($children as $child) {
+ elgg_register_menu_item('pages_nav', array(
+ 'name' => $child->getGUID(),
+ 'text' => $child->title,
+ 'href' => $child->getURL(),
+ 'parent_name' => $parent->getGUID(),
+ ));
+ array_push($stack, $child);
+ }
}
}
}
-} \ No newline at end of file
+}
diff --git a/mod/pages/pages/pages/history.php b/mod/pages/pages/pages/history.php
index a63b37a7a..872596179 100644
--- a/mod/pages/pages/pages/history.php
+++ b/mod/pages/pages/pages/history.php
@@ -30,7 +30,12 @@ elgg_push_breadcrumb(elgg_echo('pages:history'));
$title = $page->title . ": " . elgg_echo('pages:history');
-$content = list_annotations($page_guid, 'page', 20, false);
+$content = elgg_list_annotations(array(
+ 'guid' => $page_guid,
+ 'annotation_name' => 'page',
+ 'limit' => 20,
+ 'order_by' => "n_table.time_created desc"
+));
$body = elgg_view_layout('content', array(
'filter' => '',
diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php
index 81477a8d4..e1c3fdbfd 100644
--- a/mod/pages/pages/pages/view.php
+++ b/mod/pages/pages/pages/view.php
@@ -8,7 +8,9 @@
$page_guid = get_input('guid');
$page = get_entity($page_guid);
if (!$page) {
- forward();
+ register_error(elgg_echo('noaccess'));
+ $_SESSION['last_forward_from'] = current_page_url();
+ forward('');
}
elgg_set_page_owner_guid($page->getContainerGUID());
@@ -32,7 +34,8 @@ elgg_push_breadcrumb($title);
$content = elgg_view_entity($page, array('full_view' => true));
$content .= elgg_view_comments($page);
-if (elgg_is_admin_logged_in() || elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) {
+// can add subpage if can edit this page and write to container (such as a group)
+if ($page->canEdit() && $container->canWriteToContainer(0, 'object', 'page')) {
$url = "pages/add/$page->guid";
elgg_register_menu_item('title', array(
'name' => 'subpage',
diff --git a/mod/pages/start.php b/mod/pages/start.php
index 834e98870..6b0ad38b0 100644
--- a/mod/pages/start.php
+++ b/mod/pages/start.php
@@ -30,7 +30,6 @@ function pages_init() {
// Register some actions
$action_base = elgg_get_plugins_path() . 'pages/actions/pages';
elgg_register_action("pages/edit", "$action_base/edit.php");
- elgg_register_action("pages/editwelcome", "$action_base/editwelcome.php");
elgg_register_action("pages/delete", "$action_base/delete.php");
// Extend the main css view
@@ -106,10 +105,6 @@ function pages_page_handler($page) {
elgg_load_library('elgg:pages');
- // add the jquery treeview files for navigation
- elgg_load_js('jquery-treeview');
- elgg_load_css('jquery-treeview');
-
if (!isset($page[0])) {
$page[0] = 'all';
}
diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php
index e78289f28..945a22eed 100644
--- a/mod/pages/views/default/object/page_top.php
+++ b/mod/pages/views/default/object/page_top.php
@@ -45,7 +45,6 @@ $editor_link = elgg_view('output/url', array(
$date = elgg_view_friendly_time($annotation->time_created);
$editor_text = elgg_echo('pages:strapline', array($date, $editor_link));
-$tags = elgg_view('output/tags', array('tags' => $page->tags));
$categories = elgg_view('output/categories', $vars);
$comments_count = $page->countComments();
@@ -82,7 +81,6 @@ if ($full) {
'entity' => $page,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
);
$params = $params + $vars;
$summary = elgg_view('object/elements/summary', $params);
@@ -104,7 +102,6 @@ if ($full) {
'entity' => $page,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
'content' => $excerpt,
);
$params = $params + $vars;
diff --git a/mod/pages/views/default/pages/sidebar/navigation.php b/mod/pages/views/default/pages/sidebar/navigation.php
index fe017b1a7..65eb500c8 100644
--- a/mod/pages/views/default/pages/sidebar/navigation.php
+++ b/mod/pages/views/default/pages/sidebar/navigation.php
@@ -5,6 +5,11 @@
* @uses $vars['page'] Page object if manually setting selected item
*/
+// add the jquery treeview files for navigation
+elgg_load_js('jquery-treeview');
+elgg_load_css('jquery-treeview');
+
+
$selected_page = elgg_extract('page', $vars, false);
if ($selected_page) {
$url = $selected_page->getURL();
@@ -51,4 +56,3 @@ if ($selected_page) {
});
</script>
-