diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-11-29 03:18:57 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-11-29 03:18:57 +0000 |
commit | b9415b4b9cbc518594ded57a8aa9524319057bc1 (patch) | |
tree | 9823011416e9d3852d8a79bfaa1757e37514d0df /modules/node/node.module | |
parent | 670e835772e6583fd99a60ac0a8d8e8aaf6c72a6 (diff) | |
download | brdo-b9415b4b9cbc518594ded57a8aa9524319057bc1.tar.gz brdo-b9415b4b9cbc518594ded57a8aa9524319057bc1.tar.bz2 |
- #7940: Remember publishing options when editing node
Diffstat (limited to 'modules/node/node.module')
-rw-r--r-- | modules/node/node.module | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index d6c66b7c8..1e7b2f4f1 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1609,26 +1609,46 @@ function node_form($node) { // Get the node-specific bits. $form = array_merge($form, node_invoke($node, 'form')); - /** - * Node author information - */ + // If this is a new node, fill in the default values. + $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); + if (!isset($node->status)) { + $node->status = in_array('status', $node_options); + } + if (!isset($node->moderate)) { + $node->moderate = in_array('moderate', $node_options); + } + if (!isset($node->promote)) { + $node->promote = in_array('promote', $node_options); + } + if (!isset($node->sticky)) { + $node->sticky = in_array('sticky', $node_options); + } + if (!isset($node->revision)) { + $node->revision = in_array('revision', $node_options); + } if (user_access('administer nodes')) { + // Node author information $form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -5); $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#required' => TRUE, '#default_value' => $node->name, '#weight' => -1); $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#required' => TRUE, '#default_value' => $node->date); - $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); - /** - * Node options - */ + // Node options for administrators $form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -5); - $form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => in_array('status', $node_options)); - $form['options']['moderate'] = array('#type' => 'checkbox', '#title' => t('In moderation queue'), '#default_value' => in_array('moderate', $node_options)); - $form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => in_array('promote', $node_options)); - $form['options']['sticky'] = array('#type' => 'checkbox', '#title' =>t('Sticky at top of lists'), '#default_value' => in_array('sticky', $node_options)); - $form['options']['revision'] = array('#type' => 'checkbox', '#title' =>t('Create new revision'), '#default_value' => in_array('revision', $node_options)); + $form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status); + $form['options']['moderate'] = array('#type' => 'checkbox', '#title' => t('In moderation queue'), '#default_value' => $node->moderate); + $form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote); + $form['options']['sticky'] = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->sticky); + $form['options']['revision'] = array('#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => $node->revision); + } + else { + // Don't show node options because the user doesn't have admin access. + $form['status'] = array('#type' => 'value', '#value' => $node->status); + $form['moderate'] = array('#type' => 'value', '#value' => $node->moderate); + $form['promote'] = array('#type' => 'value', '#value' => $node->promote); + $form['sticky'] = array('#type' => 'value', '#value' => $node->sticky); + $form['revision'] = array('#type' => 'value', '#value' => $node->revision); } $nodeapi = node_invoke_nodeapi($node, 'form'); |