You are here

function node_gallery_menu in Node Gallery 6.3

Same name and namespace in other branches
  1. 6 node_gallery.module \node_gallery_menu()
  2. 6.2 node_gallery.module \node_gallery_menu()

Implements hook_menu().

File

./node_gallery.module, line 111
Node gallery module file.

Code

function node_gallery_menu() {
  $items = array();
  if (module_exists('plupload') && variable_get('node_gallery_plupload_integration', TRUE) && variable_get('node_gallery_plupload_wizard', TRUE)) {
    foreach (node_gallery_get_all_relationships() as $relationship) {
      $types = node_get_types('types');
      $image_type = $types[$relationship['image_type']];
      $gallery_type = $types[$relationship['gallery_type']];
      $type_url_str = str_replace('_', '-', $relationship['image_type']);
      $name = check_plain($image_type->name);
      $items['node/add/ng-wizard/' . $relationship['image_type']] = array(
        'title' => 'New !gallery of !image images using the bulk upload tool',
        'title arguments' => array(
          '!gallery' => $gallery_type->name,
          '!image' => $image_type->name,
        ),
        'page callback' => 'node_gallery_upload_image_to_new_gallery_form',
        'page arguments' => array(
          3,
        ),
        'access callback' => 'node_gallery_multi_node_access',
        'access arguments' => array(
          array(
            'create',
            'create',
          ),
          array(
            $relationship['image_type'],
            $relationship['gallery_type'],
          ),
        ),
        'description' => 'Upload multiple images at once, and then assign them to a new gallery.',
        'file' => 'node_gallery.pages.inc',
      );
    }
  }
  $items['admin/settings/node_gallery'] = array(
    'title' => 'Node Gallery',
    'description' => 'Create and manage your Node Gallery relationships.',
    'page callback' => 'node_gallery_relationship_list',
    'access arguments' => array(
      NODE_GALLERY_PERM_ADMIN_GALLERY,
    ),
    'file' => 'node_gallery.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/settings/node_gallery/list'] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/settings/node_gallery/settings'] = array(
    'title' => 'Global Settings',
    'description' => "Manage node gallery's global settings.",
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'node_gallery_settings_form',
    ),
    'access arguments' => array(
      NODE_GALLERY_PERM_ADMIN_GALLERY,
    ),
    'file' => 'node_gallery.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/settings/node_gallery/add'] = array(
    'title' => 'Add a Gallery Relationship',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'node_gallery_relationship_content_types_form',
    ),
    'access arguments' => array(
      NODE_GALLERY_PERM_ADMIN_GALLERY,
    ),
    'file' => 'node_gallery.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/settings/node_gallery/relationship/content_types/%node_gallery_relationship'] = array(
    'title' => 'Node Gallery - Edit Relationship Content Types',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'node_gallery_relationship_content_types_form',
      5,
    ),
    'access arguments' => array(
      NODE_GALLERY_PERM_ADMIN_GALLERY,
    ),
    'file' => 'node_gallery.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items['admin/settings/node_gallery/relationship/settings/%node_gallery_relationship'] = array(
    'title' => 'Node Gallery - Edit Relationship Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'node_gallery_relationship_settings_form',
      5,
    ),
    'access arguments' => array(
      NODE_GALLERY_PERM_ADMIN_GALLERY,
    ),
    'file' => 'node_gallery.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items['admin/settings/node_gallery/delete/%node_gallery_relationship'] = array(
    'title' => 'Node Gallery - Delete Configuration',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'node_gallery_relationship_delete_form',
      4,
    ),
    'access arguments' => array(
      NODE_GALLERY_PERM_ADMIN_GALLERY,
    ),
    'file' => 'node_gallery.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items['node/%node_gallery_gallery/browse'] = array(
    'title' => 'Browse Images',
    'page callback' => 'node_gallery_browse_images',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      NODE_GALLERY_PERM_VIEW_GALLERY,
    ),
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_CALLBACK,
  );
  $items['node/%node_gallery_gallery/sort'] = array(
    'title' => 'Sort Images',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'node_gallery_sort_images_form',
      1,
      3,
    ),
    'access callback' => 'node_gallery_user_access',
    'access arguments' => array(
      'edit image',
      1,
    ),
    'file' => 'node_gallery.pages.inc',
    'weight' => -4,
    'type' => MENU_LOCAL_TASK,
  );
  $items['node-gallery/json/gallery/create/%/%'] = array(
    'page callback' => 'node_gallery_json_create_gallery',
    'page arguments' => array(
      4,
      5,
    ),
    'access callback' => TRUE,
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_CALLBACK,
  );
  $items['node-gallery/json/gallery/%node_gallery_gallery/sort'] = array(
    'page callback' => 'node_gallery_json_get_sorted_images',
    'page arguments' => array(
      3,
      5,
      6,
    ),
    'access callback' => 'node_gallery_user_access',
    'access arguments' => array(
      'edit image',
      3,
    ),
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_CALLBACK,
  );
  $items['node-gallery/json/gallery/%node_gallery_gallery/images'] = array(
    'page callback' => 'node_gallery_json_get_images',
    'page arguments' => array(
      3,
      5,
      6,
      7,
    ),
    'access callback' => 'node_gallery_user_access',
    'access arguments' => array(
      'view',
      3,
    ),
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_CALLBACK,
  );
  $items['node/%node_gallery_gallery/images'] = array(
    'title' => 'Manage Images',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'node_gallery_manage_images_form',
      1,
    ),
    'access callback' => 'node_gallery_user_access',
    'access arguments' => array(
      'edit image',
      1,
    ),
    'file' => 'node_gallery.pages.inc',
    'weight' => -3,
    'type' => MENU_LOCAL_TASK,
  );

  // Alias /manage to /images
  $items['node/%node_gallery_gallery/manage'] = $items['node/%node_gallery_gallery/images'];
  $items['node/%node_gallery_gallery/manage']['type'] = MENU_CALLBACK;

  // Callback for AHAH add more buttons.
  $items['node-gallery/json/js_add_more'] = array(
    'page callback' => 'node_gallery_content_add_more_js',
    'access arguments' => array(
      'access content',
    ),
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_CALLBACK,
  );
  $items['node/%node_gallery_gallery/upload'] = array(
    'title' => 'Upload New Images',
    'page callback' => 'node_gallery_upload_image_form',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'node_gallery_user_access',
    'access arguments' => array(
      'upload',
      1,
    ),
    'file' => 'node_gallery.pages.inc',
    'weight' => -2,
    'type' => MENU_LOCAL_TASK,
  );
  if (module_exists('imagefield_import')) {
    $items['node/%node_gallery_gallery/import'] = array(
      'title' => 'Import Images',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'imagefield_import_form',
      ),
      'access callback' => 'node_gallery_user_access',
      'access arguments' => array(
        'upload',
        1,
      ),
      'weight' => -1,
      'type' => MENU_LOCAL_TASK,
    );
  }
  $items['galleries'] = array(
    'title' => 'Gallery List',
    'page callback' => 'node_gallery_list_galleries',
    'access arguments' => array(
      NODE_GALLERY_PERM_VIEW_GALLERY,
    ),
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['my-galleries/%user_uid_optional'] = array(
    'title' => 'My Galleries',
    'page callback' => 'node_gallery_list_galleries',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'node_gallery_user_access',
    'access arguments' => array(
      'view My Galleries',
      1,
    ),
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['galleries/%user'] = array(
    'title' => 'User Galleries',
    'title callback' => 'node_gallery_list_galleries_title',
    'title arguments' => array(
      1,
      2,
    ),
    'page callback' => 'node_gallery_list_galleries',
    'page arguments' => array(
      1,
      2,
    ),
    'access arguments' => array(
      NODE_GALLERY_PERM_VIEW_GALLERY,
    ),
    'file' => 'node_gallery.pages.inc',
    'type' => MENU_CALLBACK,
  );
  return $items;
}