? files ? sites/foo.delocalizedham.com.drupal Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.81 diff -u -F^f -r1.81 updates.inc --- database/updates.inc 19 Jan 2005 16:22:52 -0000 1.81 +++ database/updates.inc 21 Jan 2005 00:08:20 -0000 @@ -94,7 +94,8 @@ "2005-01-07" => "update_115", "2005-01-14" => "update_116", "2005-01-18" => "update_117", - "2005-01-19" => "update_118" + "2005-01-19" => "update_118", + "2005-01-20" => "update_119" ); function update_32() { @@ -2114,6 +2115,37 @@ function update_118() { } } $ret[] = update_sql("ALTER TABLE {vocabulary} DROP nodes"); + return $ret; +} + +function update_119() { + $ret = array(); + + foreach (node_list() as $type) { + $node_options = array(); + if (variable_get('node_status_'. $type, 1)) { + $node_options[] = 'status'; + } + if (variable_get('node_moderate_'. $type, 0)) { + $node_options[] = 'moderate'; + } + if (variable_get('node_promote_'. $type, 1)) { + $node_options[] = 'promote'; + } + if (variable_get('node_sticky_'. $type, 0)) { + $node_options[] = 'sticky'; + } + if (variable_get('node_revision_'. $type, 0)) { + $node_options[] = 'revision'; + } + variable_set('node_options_'. $type, $node_options); + variable_del('node_status_'. $type); + variable_del('node_moderate_'. $type); + variable_del('node_promote_'. $type); + variable_del('node_sticky_'. $type); + variable_del('node_revision_'. $type); + } + return $ret; } Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.327 diff -u -F^f -r1.327 comment.module --- modules/comment.module 19 Jan 2005 01:46:25 -0000 1.327 +++ modules/comment.module 21 Jan 2005 00:08:21 -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 'update': db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE nid = %d AND cid = 0', $node->changed, $node->nid); break; @@ -261,6 +265,7 @@ function comment_nodeapi(&$node, $op, $a db_query('DELETE FROM {comments} WHERE nid = %d', $node->nid); db_query('DELETE FROM {node_comment_statistics} WHERE nid = %d', $node->nid); break; + case 'update index': $text = ''; $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = 0', $node->nid); @@ -268,6 +273,7 @@ function comment_nodeapi(&$node, $op, $a $text .= '

'. $comment->subject .'

'. check_output($comment->comment, $comment->format); } return $text; + case 'search result': $comments = db_result(db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = %d', $node->nid)); return format_plural($comments, '1 comment', '%count comments'); Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.446 diff -u -F^f -r1.446 node.module --- modules/node.module 19 Jan 2005 01:51:58 -0000 1.446 +++ modules/node.module 21 Jan 2005 00:08:21 -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.

', array('%comments' => url('admin/comment'))); case 'admin/node/search': return t('

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".

'); - case 'admin/node/configure/defaults': - return t('

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?

'); + case 'admin/node/configure/types': + if (!arg(4)) { + return t("

Configure how each content type behaves by clicking 'configure.'

"); + } + return; } if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') { @@ -664,8 +667,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')) { @@ -710,6 +713,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; @@ -809,46 +821,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)); } /** @@ -1121,11 +1119,12 @@ function node_validate($node) { // Validate for normal users: $node->uid = $user->uid ? $user->uid : 0; // Force defaults in case people modify the form: - $node->status = variable_get("node_status_$node->type", 1); - $node->promote = variable_get("node_promote_$node->type", 1); - $node->moderate = variable_get("node_moderate_$node->type", 0); - $node->sticky = variable_get("node_sticky_$node->type", 0); - $node->revision = variable_get("node_revision_$node->type", 0); + $node_options = variable_get('node_options_'. $edit->type, array('status', 'promote')); + $node->status = in_array('status', $node_options); + $node->moderate = in_array('moderate', $node_options); + $node->promote = in_array('promote', $node_options); + $node->sticky = in_array('sticky', $node_options); + $node->revision = in_array('revision', $node_options); unset($node->created); } @@ -1182,11 +1181,12 @@ function node_form($edit) { $output .= form_group(t('Authoring information'), $author); $output .= "\n"; - $options .= form_checkbox(t('Published'), 'status', 1, isset($edit->status) ? $edit->status : variable_get('node_status_'. $edit->type, 1)); - $options .= form_checkbox(t('In moderation queue'), 'moderate', 1, isset($edit->moderate) ? $edit->moderate : variable_get('node_moderate_'. $edit->type, 0)); - $options .= form_checkbox(t('Promoted to front page'), 'promote', 1, isset($edit->promote) ? $edit->promote : variable_get('node_promote_'. $edit->type, 1)); - $options .= form_checkbox(t('Sticky at top of lists'), 'sticky', 1, isset($edit->sticky) ? $edit->sticky : variable_get('node_sticky_'. $edit->type, 0)); - $options .= form_checkbox(t('Create new revision'), 'revision', 1, isset($edit->revision) ? $edit->revision : variable_get('node_revision_'. $edit->type, 0)); + $node_options = variable_get('node_options_'. $edit->type, array('status', 'promote')); + $options .= form_checkbox(t('Published'), 'status', 1, isset($edit->status) ? $edit->status : in_array('status', $node_options)); + $options .= form_checkbox(t('In moderation queue'), 'moderate', 1, isset($edit->moderate) ? $edit->moderate : in_array('moderate', $node_options)); + $options .= form_checkbox(t('Promoted to front page'), 'promote', 1, isset($edit->promote) ? $edit->promote : in_array('promote', $node_options)); + $options .= form_checkbox(t('Sticky at top of lists'), 'sticky', 1, isset($edit->sticky) ? $edit->sticky : in_array('sticky', $node_options)); + $options .= form_checkbox(t('Create new revision'), 'revision', 1, isset($edit->revision) ? $edit->revision : in_array('revision', $node_options)); $output .= '
'; $output .= form_group(t('Options'), $options); @@ -1611,12 +1611,8 @@ 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; + return form_checkboxes(t('Default options'), 'node_options_'. $node->type, variable_get('node_options_'. $node->type, array('status', 'promote')), 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')), 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/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.191 diff -u -F^f -r1.191 system.module --- modules/system.module 14 Jan 2005 15:21:38 -0000 1.191 +++ modules/system.module 21 Jan 2005 00:08:22 -0000 @@ -539,7 +539,7 @@ function system_settings_save() { } drupal_set_message(t('The configuration options have been reset to their default values.')); } - if ($op == t('Save configuration')) { + else if ($op == t('Save configuration')) { if (is_array($edit)) { foreach ($edit as $name => $value) { variable_set($name, $value); Index: modules/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload.module,v retrieving revision 1.18 diff -u -F^f -r1.18 upload.module --- modules/upload.module 31 Dec 2004 09:30:12 -0000 1.18 +++ modules/upload.module 21 Jan 2005 00:08:22 -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;