summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-11-25 10:11:59 +0000
committerDries Buytaert <dries@buytaert.net>2005-11-25 10:11:59 +0000
commitb1b1e2045f9a3bcc645293c372516e756f0dcb57 (patch)
tree0ec8a2fa3f65161af09a13a327b66a833386a43b
parent924dda1fa4f227c295f5a6e28f2c6e57d7871ecc (diff)
downloadbrdo-b1b1e2045f9a3bcc645293c372516e756f0dcb57.tar.gz
brdo-b1b1e2045f9a3bcc645293c372516e756f0dcb57.tar.bz2
- Patch #37798 by Neil: allow non-workflow form elements on the node type settings page.
-rw-r--r--INSTALL.mysql.txt6
-rw-r--r--INSTALL.pgsql.txt26
-rw-r--r--INSTALL.txt6
-rw-r--r--modules/comment.module9
-rw-r--r--modules/comment/comment.module9
-rw-r--r--modules/node.module24
-rw-r--r--modules/node/node.module24
-rw-r--r--modules/upload.module15
-rw-r--r--modules/upload/upload.module15
9 files changed, 65 insertions, 69 deletions
diff --git a/INSTALL.mysql.txt b/INSTALL.mysql.txt
index 7402f70c9..0d82937e5 100644
--- a/INSTALL.mysql.txt
+++ b/INSTALL.mysql.txt
@@ -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
diff --git a/INSTALL.pgsql.txt b/INSTALL.pgsql.txt
index a1c99b103..078f4caaa 100644
--- a/INSTALL.pgsql.txt
+++ b/INSTALL.pgsql.txt
@@ -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.
diff --git a/INSTALL.txt b/INSTALL.txt
index e4d77a42f..0cc20116b 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -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";
diff --git a/modules/comment.module b/modules/comment.module
index 36f81ac93..12a23143a 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -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');
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 36f81ac93..12a23143a 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -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');
diff --git a/modules/node.module b/modules/node.module
index aad24f85f..dac183dff 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -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.'),
+ );
}
}
diff --git a/modules/node/node.module b/modules/node/node.module
index aad24f85f..dac183dff 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -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.'),
+ );
}
}
diff --git a/modules/upload.module b/modules/upload.module
index 2ce3fe8c6..50a4c0861 100644
--- a/modules/upload.module
+++ b/modules/upload.module
@@ -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:
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 2ce3fe8c6..50a4c0861 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -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: