Commit b1b1e204 authored by Dries's avatar Dries

- Patch #37798 by Neil: allow non-workflow form elements on the node type settings page.

parent 924dda1f
......@@ -7,14 +7,14 @@ CONTENTS OF THIS FILE
* Installation and configuration:
- Database and user creation
- Drupal schema loading
INTRODUCTION
------------
This file describes how to create a MySQL database for Drupal.
If you control your databases through a web-based control panel,
check its documentation, as the following instructions are for the
If you control your databases through a web-based control panel,
check its documentation, as the following instructions are for the
command line only.
INSTALLATION AND CONFIGURATION
......
......@@ -14,41 +14,41 @@ INTRODUCTION
This file describes how to create a PostgreSQL database for Drupal.
If you control your databases through a web-based control panel,
check its documentation, as the following instructions are for the
If you control your databases through a web-based control panel,
check its documentation, as the following instructions are for the
command line only.
INSTALLATION AND CONFIGURATION
------------------------------
1. CREATE DATABASE USER
This step is only necessary if you don't already have a user setup
(e.g. by your host) or you want to create new user for use with Drupal
only. The following command creates a new user named "username" and
asks for a password for that user:
createuser --pwprompt --encrypted --no-adduser --no-createdb username
If everything works correctly, you'll see a "CREATE USER" notice.
2. CREATE THE DRUPAL DATABASE
This step is only necessary if you don't already have a database
setup (e.g. by your host) or you want to create new database for
setup (e.g. by your host) or you want to create new database for
use with Drupal only. The following command creates a new database
named "databasename", which is owned by previously created "username":
createdb --encoding=SQL_ASCII --owner=username databasename
If everything works correctly, you'll see a "CREATE DATABASE" notice.
3. INSTALL THE PL/pgSQL LANGUAGE
3. INSTALL THE PL/pgSQL LANGUAGE
You must also install the PL/pgSQL language if it does not exist:
createlang plpgsql databasename
If everything works correctly, you won't see any messages. It is
possible that the PL/pgSQL language was already installed; if so,
running the above command would give you the following error:
......@@ -60,7 +60,7 @@ INSTALLATION AND CONFIGURATION
Once the database has been created, load the required tables into it:
psql -q -f database/database.pgsql databasename username
psql -q -f database/database.pgsql databasename username
If everything works correctly, you won't see any messages.
......@@ -60,7 +60,7 @@ INSTALLATION
Depending on the database of your choice, please read either
INSTALL.mysql.txt (for MySQL) or INSTALL.pgsql.txt (for PostgreSQL).
3. CONNECTING DRUPAL
The default configuration can be found in the
......@@ -69,10 +69,10 @@ INSTALLATION
base URL to the web site. Open the configuration file and edit the
$db_url line to match the database defined in the previous step:
$db_url = "mysql://username:password@localhost/databasename";
$db_url = "mysql://username:password@localhost/databasename";
If you use PostgreSQL, change "mysql" to "pgsql" in the above line.
Set $base_url to match the address to your Drupal site:
$base_url = "http://www.example.com";
......
......@@ -231,15 +231,18 @@ function comment_link($type, $node = 0, $main = 0) {
return $links;
}
function comment_form_alter($form_id, &$form) {
if (substr($form_id, -14) == '_node_settings') {
$form['workflow']['comment_'. $node->type] = array('#type' => 'radios', '#title' => t('Default comment setting'), '#default_value' => variable_get('comment_'. $node->type, COMMENT_NODE_READ_WRITE), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
}
}
/**
* Implementation of hook_nodeapi().
*
*/
function comment_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
$form['comment_'. $node->type] = array('#type' => 'radios', '#title' => t('Default comment setting'), '#default_value' => variable_get('comment_'. $node->type, COMMENT_NODE_READ_WRITE), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
return $form;
case 'fields':
return array('comment');
......
......@@ -231,15 +231,18 @@ function comment_link($type, $node = 0, $main = 0) {
return $links;
}
function comment_form_alter($form_id, &$form) {
if (substr($form_id, -14) == '_node_settings') {
$form['workflow']['comment_'. $node->type] = array('#type' => 'radios', '#title' => t('Default comment setting'), '#default_value' => variable_get('comment_'. $node->type, COMMENT_NODE_READ_WRITE), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
}
}
/**
* Implementation of hook_nodeapi().
*
*/
function comment_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
$form['comment_'. $node->type] = array('#type' => 'radios', '#title' => t('Default comment setting'), '#default_value' => variable_get('comment_'. $node->type, COMMENT_NODE_READ_WRITE), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
return $form;
case 'fields':
return array('comment');
......
......@@ -1227,7 +1227,6 @@ function node_multiple_delete_confirm_execute($form_id, $edit) {
*/
function node_types_configure($type = NULL) {
if (isset($type)) {
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
$node = new stdClass();
$node->type = $type;
$form['submission'] = array('#type' => 'fieldset', '#title' =>t('Submission form') );
......@@ -1240,10 +1239,9 @@ function node_types_configure($type = NULL) {
'#description' => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type)))
);
$form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'));
$form['workflow'] = array_merge($form['workflow'], node_invoke_nodeapi($node, 'settings'));
$form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
return system_settings_form($type . '_node_settings', $form);
return system_settings_form($type .'_node_settings', $form);
}
else {
$header = array(t('Type'), t('Operations'));
......@@ -2056,19 +2054,13 @@ function node_update_index() {
}
}
/**
* Implementation of hook_nodeapi().
*/
function node_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
$form['node_options_'. $node->type] = array(
'#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => variable_get('node_options_'. $node->type, array('status', 'promote')),
'#options' => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'),
'sticky' => t('Sticky at top of lists'), 'revision' => t('Create new revision')),
'#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.')
);
return $form;
function node_form_alter($form_id, &$form) {
if (substr($form_id, -14) == '_node_settings') {
$form['workflow']['node_options_'. $node->type] = array(
'#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => variable_get('node_options_'. $node->type, array('status', 'promote')),
'#options' => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'), 'sticky' => t('Sticky at top of lists'), 'revision' => t('Create new revision')),
'#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.'),
);
}
}
......
......@@ -1227,7 +1227,6 @@ function node_multiple_delete_confirm_execute($form_id, $edit) {
*/
function node_types_configure($type = NULL) {
if (isset($type)) {
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
$node = new stdClass();
$node->type = $type;
$form['submission'] = array('#type' => 'fieldset', '#title' =>t('Submission form') );
......@@ -1240,10 +1239,9 @@ function node_types_configure($type = NULL) {
'#description' => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type)))
);
$form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'));
$form['workflow'] = array_merge($form['workflow'], node_invoke_nodeapi($node, 'settings'));
$form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
return system_settings_form($type . '_node_settings', $form);
return system_settings_form($type .'_node_settings', $form);
}
else {
$header = array(t('Type'), t('Operations'));
......@@ -2056,19 +2054,13 @@ function node_update_index() {
}
}
/**
* Implementation of hook_nodeapi().
*/
function node_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
$form['node_options_'. $node->type] = array(
'#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => variable_get('node_options_'. $node->type, array('status', 'promote')),
'#options' => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'),
'sticky' => t('Sticky at top of lists'), 'revision' => t('Create new revision')),
'#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.')
);
return $form;
function node_form_alter($form_id, &$form) {
if (substr($form_id, -14) == '_node_settings') {
$form['workflow']['node_options_'. $node->type] = array(
'#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => variable_get('node_options_'. $node->type, array('status', 'promote')),
'#options' => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'), 'sticky' => t('Sticky at top of lists'), 'revision' => t('Create new revision')),
'#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.'),
);
}
}
......
......@@ -143,17 +143,20 @@ function upload_file_download($file) {
}
}
function upload_form_alter($form_id, &$form) {
if (substr($form_id, -14) == '_node_settings') {
$form['workflow']['upload_'. $node->type] = array(
'#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $node->type, 1),
'#options' => array(t('Disabled'), t('Enabled')),
);
}
}
/**
* Implementation of hook_nodeapi().
*/
function upload_nodeapi(&$node, $op, $arg) {
switch ($op) {
case 'settings':
$form['upload_'. $node->type] = array(
'#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $node->type, 1),
'#options' => array(t('Disabled'), t('Enabled'))
);
return $form;
case 'validate':
$node->files = upload_load($node);
// Double check existing files:
......
......@@ -143,17 +143,20 @@ function upload_file_download($file) {
}
}
function upload_form_alter($form_id, &$form) {
if (substr($form_id, -14) == '_node_settings') {
$form['workflow']['upload_'. $node->type] = array(
'#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $node->type, 1),
'#options' => array(t('Disabled'), t('Enabled')),
);
}
}
/**
* Implementation of hook_nodeapi().
*/
function upload_nodeapi(&$node, $op, $arg) {
switch ($op) {
case 'settings':
$form['upload_'. $node->type] = array(
'#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $node->type, 1),
'#options' => array(t('Disabled'), t('Enabled'))
);
return $form;
case 'validate':
$node->files = upload_load($node);
// Double check existing files:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment