diff options
Diffstat (limited to 'mod/pages/start.php')
-rw-r--r-- | mod/pages/start.php | 77 |
1 files changed, 5 insertions, 72 deletions
diff --git a/mod/pages/start.php b/mod/pages/start.php index 780d3d9a7..f9c34cd85 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -81,11 +81,13 @@ function pages_init() { // entity menu elgg_register_plugin_hook_handler('register', 'menu:entity', 'pages_entity_menu_setup'); - // register ecml views to parse - elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook'); - // hook into annotation menu elgg_register_plugin_hook_handler('register', 'menu:annotation', 'pages_annotation_menu_setup'); + + // register ecml views to parse + elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook'); + + elgg_register_event_handler('upgrade', 'system', 'pages_run_upgrades'); } /** @@ -366,72 +368,3 @@ function pages_ecml_views_hook($hook, $entity_type, $return_value, $params) { return $return_value; } - -/** - * Adds items to "page" annotations menu - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $return_value - * @param unknown_type $params - */ -function pages_annotation_menu_setup($hook, $type, $return, $params) { - $annotation = $params['annotation']; - /* @var ElggAnnotation $annotation */ - - $entity = get_entity($annotation->entity_guid); - - if ($annotation->name == 'page' && $entity->canEdit() && $annotation->canEdit()) { - // Get last revision - $revisions = elgg_get_annotations(array( - 'annotation_name' => 'page', - 'limit' => 1, - 'guid' => $annotation->entity_guid, - 'reverse_order_by' => true, - )); - - // Check if this annotation is the last revision - if ($revisions) { - $current_revision = $revisions[0]; - if ($current_revision == $annotation) { - // Don't allow any actions on last revision, just display 'current revision' - $options = array( - 'name' => 'current', - 'href' => false, - 'text' => elgg_echo('pages:current_revision'), - 'encode_text' => false - ); - $return[] = ElggMenuItem::factory($options); - return $return; - } - } - - // Revert - $options = array( - 'name' => 'revert', - 'href' => elgg_http_add_url_query_elements("pages/edit/{$annotation->entity_guid}", array( - 'annotation_id' => $annotation->id - )), - 'text' => elgg_echo('pages:revert'), - 'encode_text' => false - ); - $return[] = ElggMenuItem::factory($options); - - - // Delete - $url = elgg_http_add_url_query_elements('action/annotations/page/delete', array( - 'annotation_id' => $annotation->id, - )); - - $options = array( - 'name' => 'delete', - 'href' => $url, - 'text' => "<span class=\"elgg-icon elgg-icon-delete\"></span>", - 'confirm' => elgg_echo('deleteconfirm'), - 'encode_text' => false - ); - $return[] = ElggMenuItem::factory($options); - } - - return $return; -} |