]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merge pull request #5325 into 1.8 branch
authorcash <cash.costello@gmail.com>
Sat, 20 Apr 2013 00:28:51 +0000 (20:28 -0400)
committercash <cash.costello@gmail.com>
Sat, 20 Apr 2013 00:28:51 +0000 (20:28 -0400)
1  2 
mod/pages/start.php

index c1183c9bfcd6412e8dcab3644075113fc1c3e28a,780d3d9a7296eaf2391cbbd50d2bb8f7b7d9e214..f9c34cd85f4f22d4950ef06c5008e367659ebb78
@@@ -80,10 -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');
  }
  
  /**
@@@ -364,14 -366,72 +368,3 @@@ function pages_ecml_views_hook($hook, $
  
        return $return_value;
  }
--
--/**
-  * Process upgrades for the pages plugin
 - * 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_run_upgrades() {
-       $path = elgg_get_plugins_path() . 'pages/upgrades/';
-       $files = elgg_get_upgrade_files($path);
-       foreach ($files as $file) {
-               include "$path{$file}";
 -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;
--}