aboutsummaryrefslogtreecommitdiff
path: root/mod/pages
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-06-18 19:56:33 -0400
committerBrett Profitt <brett.profitt@gmail.com>2011-06-18 19:56:33 -0400
commitec7b94a64aef23b85866ecdac8e8acc712d29bb6 (patch)
treea108205c3fa0b694d8ce0ebaafd259480d6b530a /mod/pages
parentc80ba5aa03264dd64c20ed8ae222e87f9371a44d (diff)
parent2b68a4d217c35a5587c462620789493cf2804ba2 (diff)
downloadelgg-ec7b94a64aef23b85866ecdac8e8acc712d29bb6.tar.gz
elgg-ec7b94a64aef23b85866ecdac8e8acc712d29bb6.tar.bz2
Merge branch 'master' of github.com:Elgg/Elgg
Diffstat (limited to 'mod/pages')
-rw-r--r--mod/pages/actions/pages/delete.php2
-rw-r--r--mod/pages/manifest.xml1
-rw-r--r--mod/pages/pages/pages/history.php2
-rw-r--r--mod/pages/pages/pages/revision.php2
-rw-r--r--mod/pages/pages/pages/view.php4
-rw-r--r--mod/pages/start.php17
-rw-r--r--mod/pages/views/default/input/write_access.php35
-rw-r--r--mod/pages/views/default/object/page_top.php11
-rw-r--r--mod/pages/views/default/pages/group_module.php2
9 files changed, 64 insertions, 12 deletions
diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php
index 077561b1e..dfa0de98d 100644
--- a/mod/pages/actions/pages/delete.php
+++ b/mod/pages/actions/pages/delete.php
@@ -33,7 +33,7 @@ if ($page) {
}
}
if (elgg_instanceof($container, 'group')) {
- forward("pages/group/$container->guid/owner");
+ forward("pages/group/$container->guid/all");
} else {
forward("pages/owner/$container->username");
}
diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml
index e5e23f546..4b5e5c747 100644
--- a/mod/pages/manifest.xml
+++ b/mod/pages/manifest.xml
@@ -5,6 +5,7 @@
<version>1.8</version>
<category>bundled</category>
<category>content</category>
+ <category>widget</category>
<description>Elgg Pages</description>
<website>http://www.elgg.org</website>
<copyright>See COPYRIGHT.txt</copyright>
diff --git a/mod/pages/pages/pages/history.php b/mod/pages/pages/pages/history.php
index 7ed5ad7f7..a7ef57b6b 100644
--- a/mod/pages/pages/pages/history.php
+++ b/mod/pages/pages/pages/history.php
@@ -20,7 +20,7 @@ if (!$container) {
elgg_set_page_owner_guid($container->getGUID());
if (elgg_instanceof($container, 'group')) {
- elgg_push_breadcrumb($container->name, "pages/group/$container->guid/owner");
+ elgg_push_breadcrumb($container->name, "pages/group/$container->guid/all");
} else {
elgg_push_breadcrumb($container->name, "pages/owner/$container->username");
}
diff --git a/mod/pages/pages/pages/revision.php b/mod/pages/pages/pages/revision.php
index f542f5201..83d72286c 100644
--- a/mod/pages/pages/pages/revision.php
+++ b/mod/pages/pages/pages/revision.php
@@ -27,7 +27,7 @@ if (!$container) {
$title = $page->title . ": " . elgg_echo('pages:revision');
if (elgg_instanceof($container, 'group')) {
- elgg_push_breadcrumb($container->name, "pages/group/$container->guid/owner");
+ elgg_push_breadcrumb($container->name, "pages/group/$container->guid/all");
} else {
elgg_push_breadcrumb($container->name, "pages/owner/$container->username");
}
diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php
index d3503709d..b73bc985c 100644
--- a/mod/pages/pages/pages/view.php
+++ b/mod/pages/pages/pages/view.php
@@ -22,7 +22,7 @@ if (!$container) {
$title = $page->title;
if (elgg_instanceof($container, 'group')) {
- elgg_push_breadcrumb($container->name, "pages/group/$container->guid/owner");
+ elgg_push_breadcrumb($container->name, "pages/group/$container->guid/all");
} else {
elgg_push_breadcrumb($container->name, "pages/owner/$container->username");
}
@@ -33,7 +33,7 @@ $content = elgg_view_entity($page, true);
$content .= elgg_view_comments($page);
$buttons = '';
-if ($page->canEdit()) {
+if (elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) {
$url = "pages/add/$page->guid";
$buttons = elgg_view('output/url', array(
'text' => elgg_echo('pages:newchild'),
diff --git a/mod/pages/start.php b/mod/pages/start.php
index a8df99bef..744306649 100644
--- a/mod/pages/start.php
+++ b/mod/pages/start.php
@@ -25,7 +25,7 @@ function pages_init() {
// Register a url handler
elgg_register_entity_url_handler('object', 'page_top', 'pages_url');
elgg_register_entity_url_handler('object', 'page', 'pages_url');
- register_extender_url_handler('pages_revision_url', 'annotation', 'page');
+ elgg_register_annotation_url_handler('page', 'pages_revision_url');
// Register some actions
$action_base = elgg_get_plugins_path() . 'pages/actions/pages';
@@ -65,7 +65,7 @@ function pages_init() {
'description' => 'longtext',
'tags' => 'tags',
'access_id' => 'access',
- 'write_access_id' => 'access',
+ 'write_access_id' => 'write_access',
));
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'pages_owner_block_menu');
@@ -95,7 +95,7 @@ function pages_init() {
* Edit page: pages/edit/<guid>
* History of page: pages/history/<guid>
* Revision of page: pages/revision/<id>
- * Group pages: pages/group/<guid>/owner
+ * Group pages: pages/group/<guid>/all
*
* Title is ignored
*
@@ -208,7 +208,7 @@ function pages_owner_block_menu($hook, $type, $return, $params) {
$return[] = $item;
} else {
if ($params['entity']->pages_enable != "no") {
- $url = "pages/group/{$params['entity']->guid}/owner";
+ $url = "pages/group/{$params['entity']->guid}/all";
$item = new ElggMenuItem('pages', elgg_echo('pages:group'), $url);
$return[] = $item;
}
@@ -231,6 +231,15 @@ function pages_entity_menu_setup($hook, $type, $return, $params) {
return $return;
}
+ // remove delete if not owner or admin
+ if (!elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != $entity->getOwnerGuid()) {
+ foreach ($return as $index => $item) {
+ if ($item->getName() == 'delete') {
+ unset($return[$index]);
+ }
+ }
+ }
+
$options = array(
'name' => 'history',
'text' => elgg_echo('pages:history'),
diff --git a/mod/pages/views/default/input/write_access.php b/mod/pages/views/default/input/write_access.php
new file mode 100644
index 000000000..69277ca20
--- /dev/null
+++ b/mod/pages/views/default/input/write_access.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Write access
+ *
+ * Removes the public option found in input/access
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['options_values']
+ * @uses $vars['name'] The name of the input field
+ * @uses $vars['entity'] Optional. The entity for this access control (uses write_access_id)
+ */
+
+$options = get_write_access_array();
+unset($options[ACCESS_PUBLIC]);
+
+$defaults = array(
+ 'class' => 'elgg-input-access',
+ 'disabled' => FALSE,
+ 'value' => get_default_access(),
+ 'options_values' => $options,
+);
+
+if (isset($vars['entity'])) {
+ $defaults['value'] = $vars['entity']->write_access_id;
+ unset($vars['entity']);
+}
+
+$vars = array_merge($defaults, $vars);
+
+if ($vars['value'] == ACCESS_DEFAULT) {
+ $vars['value'] = get_default_access();
+}
+$vars['value'] = ($vars['value'] == ACCESS_PUBLIC) ? ACCESS_LOGGED_IN : $vars['value'];
+
+echo elgg_view('input/dropdown', $vars);
diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php
index 756c542b4..2ad44e38c 100644
--- a/mod/pages/views/default/object/page_top.php
+++ b/mod/pages/views/default/object/page_top.php
@@ -18,6 +18,13 @@ if (!$page) {
return TRUE;
}
+// pages used to use Public for write access
+if ($page->write_access_id == ACCESS_PUBLIC) {
+ // this works because this metadata is public
+ $page->write_access_id = ACCESS_LOGGED_IN;
+}
+
+
if ($revision) {
$annotation = $revision;
} else {
@@ -75,7 +82,7 @@ if ($full) {
'subtitle' => $subtitle,
'tags' => $tags,
);
- $list_body = elgg_view('page/components/summary', $params);
+ $list_body = elgg_view('object/elements/summary', $params);
$info = elgg_view_image_block($page_icon, $list_body);
@@ -96,7 +103,7 @@ HTML;
'tags' => $tags,
'content' => $excerpt,
);
- $list_body = elgg_view('page/components/summary', $params);
+ $list_body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($page_icon, $list_body);
}
diff --git a/mod/pages/views/default/pages/group_module.php b/mod/pages/views/default/pages/group_module.php
index 6befb1c65..1d3437e18 100644
--- a/mod/pages/views/default/pages/group_module.php
+++ b/mod/pages/views/default/pages/group_module.php
@@ -13,7 +13,7 @@ if ($group->pages_enable == "no") {
}
$all_link = elgg_view('output/url', array(
- 'href' => "pages/group/$group->guid/owner",
+ 'href' => "pages/group/$group->guid/all",
'text' => elgg_echo('link:view:all'),
));