Same name and namespace in other branches
- 4.7.x modules/node.module \node_page()
Menu callback; dispatches control to the appropriate operation handler.
2 string references to 'node_page'
- fileupload_link in developer/
examples/ fileupload.module - Integrate with Drupal
- node_menu in modules/
node.module - Implementation of hook_menu().
File
- modules/
node.module, line 1677 - The core that allows content to be submitted to the site.
Code
function node_page() {
global $user;
$op = $_POST['op'] ? $_POST['op'] : arg(1);
$edit = $_POST['edit'];
if (is_numeric($op)) {
$op = arg(2) && !is_numeric(arg(2)) ? arg(2) : 'view';
}
switch ($op) {
case 'feed':
node_feed();
return;
case 'add':
print theme('page', node_add(arg(2)));
break;
case 'edit':
print theme('page', node_edit(arg(1)));
break;
case 'revisions':
print theme('page', node_revision_overview(arg(1)));
break;
case t('Revert'):
case 'rollback-revision':
node_revision_rollback(arg(1), arg(3));
break;
case t('Delete revision'):
case 'delete-revision':
node_revision_delete(arg(1), arg(3));
break;
case 'view':
if (is_numeric(arg(1))) {
$node = node_load(array(
'nid' => arg(1),
), $_GET['revision']);
if ($node->nid) {
drupal_set_title(check_plain($node->title));
print theme('page', node_show($node, arg(2)));
}
else {
if (db_result(db_query('SELECT nid FROM {node} WHERE nid = %d', arg(1)))) {
drupal_access_denied();
}
else {
drupal_not_found();
}
}
}
break;
case t('Preview'):
$edit = node_validate($edit);
drupal_set_title(t('Preview'));
print theme('page', node_preview($edit));
break;
case t('Submit'):
if ($nid = node_submit($edit)) {
if (node_access('view', $edit)) {
drupal_goto('node/' . $nid);
}
else {
if (db_result(db_query('SELECT nid FROM {node} WHERE nid = %d', arg(1)))) {
drupal_access_denied();
}
else {
drupal_goto();
}
}
}
else {
drupal_set_title(t('Submit'));
print theme('page', node_preview($edit));
}
break;
case 'delete':
case t('Delete'):
$edit['nid'] = $edit['nid'] ? $edit['nid'] : arg(1);
$node = node_load(array(
'nid' => $edit['nid'],
));
$breadcrumb[] = array(
'path' => 'node/' . $edit['nid'],
'title' => $node->title,
);
$breadcrumb[] = array(
'path' => 'node/' . arg(1) . '/delete',
'title' => t('delete'),
);
menu_set_location($breadcrumb);
$output = node_delete($edit);
if (!$output) {
drupal_set_message(t('The node has been deleted.'));
drupal_goto('admin/node');
}
print theme('page', node_delete($edit));
break;
default:
drupal_set_title('');
print theme('page', node_page_default());
}
}