You are here

function shoutbox_menu in Shoutbox 5

Same name and namespace in other branches
  1. 6.2 shoutbox.module \shoutbox_menu()
  2. 6 shoutbox.module \shoutbox_menu()
  3. 7.2 shoutbox.module \shoutbox_menu()
  4. 7 shoutbox.module \shoutbox_menu()

Implementation of hook_menu().

File

./shoutbox.module, line 30
shoutbox module displays a block for users to create short messages for thw whole site. Uses AHAH to update the database and display content.

Code

function shoutbox_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'shoutbox/js/view',
      'title' => t('View Shouts'),
      'callback' => 'shoutbox_js_view',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/shoutbox',
      'title' => t('Shoutbox'),
      'description' => t('Settings for displaying and deleting shouts'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'shoutbox_admin_settings',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'shoutbox',
      'title' => t('All Shouts'),
      'callback' => 'shoutbox_page_view',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    $items[] = array(
      'path' => 'shoutbox/' . arg(1) . '/edit',
      'title' => t('Edit Shout'),
      'callback' => 'shoutbox_callback',
      'callback arguments' => array(
        arg(1),
        'edit',
      ),
      'access' => shoutbox_access_callback('edit own shouts', arg(1)),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'shoutbox/' . arg(1) . '/delete',
      'title' => t('Delete Shout'),
      'callback' => 'shoutbox_callback',
      'callback arguments' => array(
        arg(1),
        'delete',
      ),
      // BUGBUG - what should the access be
      'access' => shoutbox_access_callback('delete own shouts', arg(1)),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'shoutbox/' . arg(1) . '/publish',
      'title' => t('Publish Shout'),
      'callback' => 'shoutbox_callback',
      'callback arguments' => array(
        arg(1),
        'publish',
      ),
      'access' => shoutbox_access_callback('moderate shoutbox', arg(1)),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'shoutbox/' . arg(1) . '/unpublish',
      'title' => t('Unpublish Shout'),
      'callback' => 'shoutbox_callback',
      'callback arguments' => array(
        arg(1),
        'unpublish',
      ),
      'access' => shoutbox_access_callback('moderate shoutbox', arg(1)),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}