Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.429 diff -u -F^f -r1.429 node.module --- modules/node.module 7 Dec 2004 16:55:38 -0000 1.429 +++ modules/node.module 10 Dec 2004 02:31:36 -0000 @@ -48,8 +48,11 @@ function node_help($section) { return t('
Below is a list of all of the posts on your site. Other forms of content are listed elsewhere (e.g. comments).
Clicking a title views the post, while clicking an author\'s name edits their user information.
Other post-related tasks are available from the menu.
Enter a simple pattern to search for a post. This can include the wildcard character *.
For example, a search for "br*" might return "bread bakers", "our daily bread" and "brenda".
This page lets you set the defaults used during creation of nodes for all the different node types.
comment: Read/write setting for comments.
publish: Is this post publicly viewable, has it been published?
promote: Is this post to be promoted to the front page?
moderate: Does this post need approval before it can be viewed?
sticky: Is this post always visible at the top of lists?
revision: Will this post go into the revision system allowing multiple versions to be saved?
Configure how each content type behaves by clicking 'configure.'
"); + } + return; } if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') { @@ -665,8 +668,8 @@ function node_menu($may_cache) { 'type' => MENU_LOCAL_TASK); $items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); - $items[] = array('path' => 'admin/node/configure/defaults', 'title' => t('default workflow'), - 'callback' => 'node_default_settings', + $items[] = array('path' => 'admin/node/configure/types', 'title' => t('content types'), + 'callback' => 'node_types', 'access' => user_access('administer nodes'), 'type' => MENU_LOCAL_TASK); if (module_exist('search')) { @@ -711,6 +714,15 @@ function node_menu($may_cache) { } } } + else if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'configure' && arg(3) == 'types' && is_string(arg(4))) { + $node = new StdClass(); + $node->type = arg(4); + $items[] = array('path' => 'admin/node/configure/types/'. arg(4), + 'title' => t("'%name' content type", array('%name' => node_invoke($node, 'node_name'))), + 'callback' => 'node_types_configure', + 'access' => user_access('administer nodes'), + 'type' => MENU_CALLBACK); + } } return $items; @@ -810,46 +822,32 @@ function node_admin_nodes() { return form($output); } -/** - * Menu callback; presents the interface for setting node defaults. - */ -function node_default_settings() { - $op = $_POST['op']; - $edit = $_POST['edit']; - - if ($op == t('Save configuration')) { - // Save the configuration options: - foreach ($edit as $name => $value) { - variable_set($name, $value); - } - drupal_set_message(t('The content settings have been saved.')); - } +function node_types() { + $header = array('type', 'operations'); - if ($op == t('Reset to defaults')) { - // Reset the configuration options to their default value: - foreach ($edit as $name => $value) { - variable_del($name); - } - drupal_set_message(t('The content settings have been reset to their default values.')); - } - - $header = array_merge(array(t('type')), array_keys(node_invoke_nodeapi($node, 'settings'))); + $rows = array(); foreach (node_list() as $type) { $node = new StdClass(); $node->type = $type; - $cols = array(); - foreach (node_invoke_nodeapi($node, 'settings') as $setting) { - $cols[] = array('data' => $setting, 'align' => 'center', 'width' => 55); - } - $rows[] = array_merge(array(node_invoke($node, 'node_name')), $cols); + $rows[] = array(node_invoke($node, 'node_name'), l(t('configure'), 'admin/node/configure/types/'. $type)); } - $output .= theme('table', $header, $rows); + print theme('page', theme('table', $header, $rows)); +} + +function node_types_configure() { + // Go to the listing page when we submit this form, system_settings_save() calls drupal_goto(). + if ($_POST['op']) { + $_GET['q'] = 'admin/node/configure/types'; + } + system_settings_save(); - $output .= form_submit(t('Save configuration')); - $output .= form_submit(t('Reset to defaults')); + $node = new StdClass(); + $node->type = arg(4); - print theme('page', form($output)); + $output .= implode('', node_invoke_nodeapi($node, 'settings')); + + print theme('page', system_settings_form($output)); } /** @@ -1594,12 +1592,13 @@ function node_update_index() { function node_nodeapi(&$node, $op, $arg = 0) { switch ($op) { case 'settings': - $output[t('publish')] = form_checkbox('', "node_status_$node->type", 1, variable_get("node_status_$node->type", 1)); - $output[t('promote')] = form_checkbox('', "node_promote_$node->type", 1, variable_get("node_promote_$node->type", 1)); - $output[t('moderate')] = form_checkbox('', "node_moderate_$node->type", 1, variable_get("node_moderate_$node->type", 0)); - $output[t('sticky')] = form_checkbox('', "node_sticky_$node->type", 1, variable_get("node_sticky_$node->type", 0)); - $output[t('revision')] = form_checkbox('', "node_revision_$node->type", 1, variable_get("node_revision_$node->type", 0)); - return $output; + $output = form_checkbox(t('Published'), 'node_status_'. $node->type, 1, variable_get('node_status_'. $node->type, 1)); + $output .= form_checkbox(t('In moderation queue'), 'node_moderate_'.$node->type, 1, variable_get('node_moderate_'. $node->type, 0)); + $output .= form_checkbox(t('Promoted to front page'), 'node_promote_'. $node->type, 1, variable_get('node_promote_'. $node->type, 1)); + $output .= form_checkbox(t('Sticky at top of lists'), 'node_sticky_'. $node->type, 1, variable_get('node_sticky_'. $node->type, 0)); + $output .= form_checkbox(t('Create new revision'), 'node_revision_'. $node->type, 1, variable_get('node_revision_'. $node->type, 0)); + return form_item(t('Default options'), $output, t('Users with the administer nodes permission will be able to override these options.')); + case 'fields': return array('nid', 'uid', 'type', 'title', 'teaser', 'body', 'revisions', 'status', 'promote', 'moderate', 'sticky', 'created', 'changed', 'format'); } Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.313 diff -u -F^f -r1.313 comment.module --- modules/comment.module 7 Dec 2004 16:55:38 -0000 1.313 +++ modules/comment.module 10 Dec 2004 02:31:37 -0000 @@ -232,10 +232,11 @@ function comment_link($type, $node = 0, function comment_nodeapi(&$node, $op, $arg = 0) { switch ($op) { case 'settings': - $output[t('comment')] = form_select('', "comment_$node->type", variable_get("comment_$node->type", 2), array(t('Disabled'), t('Read only'), t('Read/Write'))); - return $output; + return form_radios(t('Default comment setting'), 'comment_'. $node->type, variable_get('comment_'. $node->type, 2), array(t('Disabled'), t('Read only'), t('Read/Write')), t('Users with the administer comments permission will be able to override this setting.')); + case 'fields': return array('comment'); + case 'form admin': if (user_access('administer comments')) { $selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2); @@ -243,6 +244,7 @@ function comment_nodeapi(&$node, $op, $a return form_group(t('User comments'), $output); } break; + case 'load': return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, last_comment_name, comment_count, cid as last_comment_cid FROM {node_comment_statistics} WHERE nid = %d", $node->nid)); case 'validate': @@ -251,9 +253,11 @@ function comment_nodeapi(&$node, $op, $a $node->comment = variable_get("comment_$node->type", 2); } break; + case 'insert': db_query('INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d,0,%d,NULL,%d,0)', $node->nid, $node->created, $node->uid); break; + case 'delete': db_query('DELETE FROM {comments} WHERE nid = %d', $node->nid); db_query('DELETE FROM {node_comment_statistics} WHERE nid = %d', $node->nid); Index: modules/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload.module,v retrieving revision 1.15 diff -u -F^f -r1.15 upload.module --- modules/upload.module 23 Nov 2004 22:20:41 -0000 1.15 +++ modules/upload.module 10 Dec 2004 02:31:37 -0000 @@ -105,13 +105,14 @@ function upload_file_download($file) { function upload_nodeapi(&$node, $op, $arg) { switch ($op) { case 'settings': - $output[t('attachments')] = form_checkbox(NULL, "upload_$node->type", 1, variable_get("upload_$node->type", 1)); - break; + return form_radios(t('Attachments'), 'upload_'. $node->type, variable_get('upload_'. $node->type, 1), array(t('Disabled'), t('Enabled'))); + case 'form param': if (variable_get("upload_$node->type", 1) && user_access('upload files')) { $output['options'] = array('enctype' => 'multipart/form-data'); } break; + case 'validate': $node->files = upload_load($node); @@ -197,16 +198,19 @@ function upload_nodeapi(&$node, $op, $ar } } break; + case 'form post': if (variable_get("upload_$node->type", 1) == 1 && user_access('upload files')) { $output = upload_form($node); } break; + case 'load': if (variable_get("upload_$node->type", 1) == 1) { $output['files'] = upload_load($node); } break; + case 'view': if ($node->files && user_access('view uploaded files')) { $header = array(t('Attachment'), t('Size')); @@ -248,12 +252,14 @@ function upload_nodeapi(&$node, $op, $ar } } break; + case 'insert': case 'update': if (user_access('upload files')) { upload_save($node); } break; + case 'delete': upload_delete($node); break;