Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.331
diff -u -p -r1.331 menu.inc
--- includes/menu.inc 30 Jul 2009 10:16:48 -0000 1.331
+++ includes/menu.inc 5 Aug 2009 00:35:57 -0000
@@ -1122,7 +1122,7 @@ function menu_tree_check_access(&$tree,
$nids = array_keys($node_links);
$select = db_select('node');
$select->addField('node', 'nid');
- $select->condition('status', 1);
+ $select->condition('status', NODE_STATUS_PUBLISHED);
$select->condition('nid', $nids, 'IN');
$select->addTag('node_access');
$nids = $select->execute()->fetchCol();
Index: includes/pager.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/pager.inc,v
retrieving revision 1.68
diff -u -p -r1.68 pager.inc
--- includes/pager.inc 28 Jul 2009 19:18:05 -0000 1.68
+++ includes/pager.inc 5 Aug 2009 00:35:57 -0000
@@ -162,9 +162,9 @@ class PagerDefault extends SelectQueryEx
* certain page. However, it has to learn the total number of records returned
* by the query to compute the number of pages (the number of records / records
* per page). This is done by inserting "COUNT(*)" in the original query. For
- * example, the query "SELECT nid, type FROM node WHERE status = '1' ORDER BY
+ * example, the query "SELECT nid, type FROM node WHERE status = :status ORDER BY
* sticky DESC, created DESC" would be rewritten to read "SELECT COUNT(*) FROM
- * node WHERE status = '1' ORDER BY sticky DESC, created DESC". Rewriting the
+ * node WHERE status = :status ORDER BY sticky DESC, created DESC". Rewriting the
* query is accomplished using a regular expression.
*
* Unfortunately, the rewrite rule does not always work as intended for queries
Index: modules/aggregator/aggregator.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v
retrieving revision 1.28
diff -u -p -r1.28 aggregator.test
--- modules/aggregator/aggregator.test 30 Jul 2009 19:24:20 -0000 1.28
+++ modules/aggregator/aggregator.test 5 Aug 2009 00:35:58 -0000
@@ -76,7 +76,7 @@ class AggregatorTestCase extends DrupalW
*/
function getDefaultFeedItemCount() {
// Our tests are based off of rss.xml, so let's find out how many elements should be related.
- $feed_count = db_query_range('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = 1', 0, variable_get('feed_default_items', 10))->fetchField();
+ $feed_count = db_query_range('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = :status', array(':status' => NODE_STATUS_PUBLISHED), 0, variable_get('feed_default_items', 10))->fetchField();
return $feed_count > 10 ? 10 : $feed_count;
}
@@ -253,7 +253,7 @@ EOF;
$edit = array();
$edit['title'] = $this->randomName();
$edit['body[0][value]'] = $this->randomName();
- $this->drupalPost('node/add/article', $edit, t('Save'));
+ $this->drupalPost('node/add/article', $edit, t('Publish'));
}
}
}
Index: modules/blog/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v
retrieving revision 1.328
diff -u -p -r1.328 blog.module
--- modules/blog/blog.module 20 Jul 2009 18:51:32 -0000 1.328
+++ modules/blog/blog.module 5 Aug 2009 00:35:59 -0000
@@ -160,7 +160,7 @@ function _blog_post_exists($account) {
->fields('n', array('nid'))
->condition('type', 'blog')
->condition('uid', $account->uid)
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->range(0, 1)
->addTag('node_access')
->execute()
@@ -187,7 +187,7 @@ function blog_block_view($delta = '') {
$result = db_select('node', 'n')
->fields('n', array('nid', 'title', 'created'))
->condition('type', 'blog')
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->orderBy('created', 'DESC')
->range(0, 10)
->addTag('node_access')
Index: modules/blog/blog.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v
retrieving revision 1.21
diff -u -p -r1.21 blog.pages.inc
--- modules/blog/blog.pages.inc 29 Jul 2009 06:39:33 -0000 1.21
+++ modules/blog/blog.pages.inc 5 Aug 2009 00:35:59 -0000
@@ -34,7 +34,7 @@ function blog_page_user($account) {
->fields('n', array('nid', 'sticky', 'created'))
->condition('type', 'blog')
->condition('uid', $account->uid)
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->orderBy('sticky', 'DESC')
->orderBy('created', 'DESC')
->limit(variable_get('default_nodes_main', 10))
@@ -83,7 +83,7 @@ function blog_page_last() {
$nids = $query
->fields('n', array('nid', 'sticky', 'created'))
->condition('type', 'blog')
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->orderBy('sticky', 'DESC')
->orderBy('created', 'DESC')
->limit(variable_get('default_nodes_main', 10))
@@ -116,7 +116,7 @@ function blog_feed_user($account) {
->fields('n', array('nid', 'created'))
->condition('type', 'blog')
->condition('uid', $account->uid)
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->orderBy('created', 'DESC')
->range(0, variable_get('feed_default_items', 10))
->addTag('node_access')
@@ -136,7 +136,7 @@ function blog_feed_last() {
$nids = db_select('node', 'n')
->fields('n', array('nid', 'created'))
->condition('type', 'blog')
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->orderBy('created', 'DESC')
->range(0, variable_get('feed_default_items', 10))
->addTag('node_access')
Index: modules/blog/blog.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.test,v
retrieving revision 1.17
diff -u -p -r1.17 blog.test
--- modules/blog/blog.test 3 Aug 2009 03:04:33 -0000 1.17
+++ modules/blog/blog.test 5 Aug 2009 00:35:59 -0000
@@ -153,7 +153,7 @@ class BlogTestCase extends DrupalWebTest
$edit = array();
$edit['title'] = 'node/' . $node->nid;
$edit['body[0][value]'] = $this->randomName(256);
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit['title'])), t('Blog node was edited'));
// Delete blog node.
Index: modules/blogapi/blogapi.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v
retrieving revision 1.158
diff -u -p -r1.158 blogapi.module
--- modules/blogapi/blogapi.module 5 Jul 2009 18:00:07 -0000 1.158
+++ modules/blogapi/blogapi.module 5 Aug 2009 00:36:00 -0000
@@ -337,7 +337,7 @@ function blogapi_status_error_check($nod
// changing or for a new node the status is not the content type's default,
// then return an error.
if (!user_access('administer nodes') && (($node->status != $original_status) || (empty($node->nid) && $node->status != in_array('status', $node_type_default)))) {
- if ($node->status) {
+ if ($node->status == NODE_STATUS_PUBLISHED) {
return blogapi_error(t('You do not have permission to publish this type of post. Please save it as a draft instead.'));
}
else {
@@ -648,7 +648,7 @@ function blogapi_mt_publish_post($postid
}
// Nothing needs to be done if already published.
- if ($node->status) {
+ if ($node->status == NODE_STATUS_PUBLISHED) {
return;
}
@@ -656,7 +656,7 @@ function blogapi_mt_publish_post($postid
return blogapi_error(t('You do not have permission to update this post.'));
}
- $node->status = 1;
+ $node->status = NODE_STATUS_PUBLISHED;
node_save($node);
return TRUE;
Index: modules/book/book.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.module,v
retrieving revision 1.501
diff -u -p -r1.501 book.module
--- modules/book/book.module 30 Jul 2009 19:24:20 -0000 1.501
+++ modules/book/book.module 5 Aug 2009 00:36:01 -0000
@@ -69,7 +69,7 @@ function book_node_view_link($node, $bui
if (isset($node->book['depth'])) {
if ($build_mode == 'full') {
$child_type = variable_get('book_child_type', 'book');
- if ((user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && $node->book['depth'] < MENU_MAX_DEPTH) {
+ if ((user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && ($node->status == NODE_STATUS_PUBLISHED) && $node->book['depth'] < MENU_MAX_DEPTH) {
$links['book_add_child'] = array(
'title' => t('Add child page'),
'href' => 'node/add/' . str_replace('_', '-', $child_type),
Index: modules/book/book.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.test,v
retrieving revision 1.13
diff -u -p -r1.13 book.test
--- modules/book/book.test 20 Jul 2009 18:51:32 -0000 1.13
+++ modules/book/book.test 5 Aug 2009 00:36:02 -0000
@@ -65,7 +65,7 @@ class BookTestCase extends DrupalWebTest
$other_book = $this->createBookNode('new');
$node = $this->createBookNode($book->nid);
$edit = array('book[bid]' => $other_book->nid);
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->drupalLogout();
$this->drupalLogin($web_user);
@@ -180,10 +180,10 @@ class BookTestCase extends DrupalWebTest
$this->drupalPost('node/add/book', $edit, t('Change book (update list of parents)'));
$edit['book[plid]'] = $parent;
- $this->drupalPost(NULL, $edit, t('Save'));
+ $this->drupalPost(NULL, $edit, t('Publish'));
}
else {
- $this->drupalPost('node/add/book', $edit, t('Save'));
+ $this->drupalPost('node/add/book', $edit, t('Publish'));
}
// Check to make sure the book node was created.
Index: modules/dblog/dblog.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.test,v
retrieving revision 1.24
diff -u -p -r1.24 dblog.test
--- modules/dblog/dblog.test 31 Jul 2009 19:01:01 -0000 1.24
+++ modules/dblog/dblog.test 5 Aug 2009 00:36:02 -0000
@@ -262,14 +262,16 @@ class DBLogTestCase extends DrupalWebTes
// Create node using form to generate add content event (which is not triggered by drupalCreateNode).
$edit = $this->getContent($type);
$title = $edit['title'];
- $this->drupalPost('node/add/' . $type, $edit, t('Save'));
+ $node_type_settings = variable_get('node_options_' . $type, array('status', 'published'));
+ $node_type_status = in_array('status', $node_type_settings) ? NODE_STATUS_PUBLISHED : NODE_STATUS_UNPUBLISHED;
+ $this->drupalPost('node/add/' . $type, $edit, $node_type_status == NODE_STATUS_PUBLISHED ? t('Publish') : t('Submit for approval'));
$this->assertResponse(200);
// Retrieve node object.
$node = $this->drupalGetNodeByTitle($title);
$this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
// Edit node.
$edit = $this->getContentUpdate($type);
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->assertResponse(200);
// Delete node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.28
diff -u -p -r1.28 filter.test
--- modules/filter/filter.test 27 Jul 2009 20:15:35 -0000 1.28
+++ modules/filter/filter.test 5 Aug 2009 00:36:03 -0000
@@ -112,7 +112,7 @@ class FilterAdminTestCase extends Drupal
$edit['title'] = $this->randomName();
$edit['body[0][value]'] = $body . '' . $extra_text . '';
$edit['body[0][value_format]'] = $filtered;
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
$this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Filtered node created.'));
$node = $this->drupalGetNodeByTitle($edit['title']);
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.507
diff -u -p -r1.507 forum.module
--- modules/forum/forum.module 28 Jul 2009 10:41:20 -0000 1.507
+++ modules/forum/forum.module 5 Aug 2009 00:36:04 -0000
@@ -531,7 +531,7 @@ function forum_block_view($delta = '') {
$query
->fields('n', array('nid', 'title'))
->fields('ncs', array('comment_count', 'last_comment_timestamp'))
- ->condition('n.status', 1)
+ ->condition('n.status', NODE_STATUS_PUBLISHED)
->condition('td.vid', variable_get('forum_nav_vocabulary', 0))
->addTag('node_access');
switch ($delta) {
@@ -615,7 +615,7 @@ function forum_get_forums($tid = 0) {
$query->addExpression('SUM(ncs.comment_count)', 'comment_count');
$counts = $query
->fields('r', array('tid'))
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->groupBy('tid')
->addTag('node_access')
->execute()
@@ -645,7 +645,7 @@ function forum_get_forums($tid = 0) {
$topic = $query
->fields('ncs', array('last_comment_timestamp', 'last_comment_uid'))
- ->condition('n.status', 1)
+ ->condition('n.status', NODE_STATUS_PUBLISHED)
->orderBy('last_comment_timestamp', 'DESC')
->range(0, 1)
->addTag('node_access')
@@ -676,7 +676,7 @@ function _forum_topics_unread($term, $ui
$query->join('history', 'h', 'n.nid = h.nid AND h.uid = :uid', array(':uid' => $uid));
$query->addExpression('COUNT(n.nid)', 'count');
return $query
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->condition('n.created', NODE_NEW_LIMIT, '>')
->isNull('h.nid')
->addTag('node_access')
@@ -718,7 +718,7 @@ function forum_get_topics($tid, $sortby,
->fields('r', array('tid'))
->fields('u', array('name', 'uid'))
->fields('ncs', array('last_comment_timestamp', 'last_comment_uid'))
- ->condition('n.status', 1)
+ ->condition('n.status', NODE_STATUS_PUBLISHED)
->orderBy('n.sticky', 'DESC')
->orderByHeader($forum_topic_list_header)
->orderBy('n.created', 'DESC')
@@ -733,6 +733,7 @@ function forum_get_topics($tid, $sortby,
$query->setCountQuery($count_query);
$result = $query->execute();
+
$topics = array();
foreach ($result as $topic) {
if ($user->uid) {
@@ -1029,7 +1030,7 @@ function template_preprocess_forum_topic
$result = $query
->fields('n', array('nid', 'title', 'sticky'))
->fields('ncs', array('comment_count', 'last_comment_timestamp'))
- ->condition('n.status', 1)
+ ->condition('n.status', NODE_STATUS_PUBLISHED)
->addTag('node_access')
->orderBy('n.sticky', 'DESC')
->orderBy($order['field'], strtoupper($order['sort']))
Index: modules/forum/forum.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.test,v
retrieving revision 1.27
diff -u -p -r1.27 forum.test
--- modules/forum/forum.test 3 Aug 2009 03:04:33 -0000 1.27
+++ modules/forum/forum.test 5 Aug 2009 00:36:05 -0000
@@ -243,8 +243,7 @@ class ForumTestCase extends DrupalWebTes
// Instead, the post variables seem to pick up the first non-blank value in the select list.
// Create forum topic.
-// $this->drupalPost('node/add/forum/' . $forum['tid'], $edit, t('Save'));
- $this->drupalPost('node/add/forum/', $edit, t('Save'));
+ $this->drupalPost('node/add/forum/', $edit, t('Publish'));
$type = t('Forum topic');
if ($container) {
$this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), t('Forum topic was not created'));
@@ -324,7 +323,7 @@ class ForumTestCase extends DrupalWebTes
$edit['body[0][value]'] = $this->randomName(256);
$edit['taxonomy[1]'] = $this->root_forum['tid']; // Assumes the topic is initially associated with $forum.
$edit['shadow'] = TRUE;
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title'])), t('Forum node was edited'));
// Verify topic was moved to a different forum.
Index: modules/locale/locale.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v
retrieving revision 1.34
diff -u -p -r1.34 locale.test
--- modules/locale/locale.test 3 Aug 2009 22:18:59 -0000 1.34
+++ modules/locale/locale.test 5 Aug 2009 00:36:06 -0000
@@ -1401,7 +1401,7 @@ class LocaleContentFunctionalTest extend
$edit = array(
'language' => 'en',
);
- $this->drupalPost($path, $edit, t('Save'));
+ $this->drupalPost($path, $edit, t('Publish changes'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node_title)), t('Page updated.'));
$this->drupalLogout();
Index: modules/node/node.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v
retrieving revision 1.60
diff -u -p -r1.60 node.admin.inc
--- modules/node/node.admin.inc 30 Jul 2009 19:24:21 -0000 1.60
+++ modules/node/node.admin.inc 5 Aug 2009 00:36:07 -0000
@@ -73,8 +73,9 @@ function node_filters() {
$filters['status'] = array(
'title' => t('status'),
'options' => array(
- 'status-1' => t('published'),
- 'status-0' => t('not published'),
+ 'status-' . NODE_STATUS_PUBLISHED => t('published'),
+ 'status-' . NODE_STATUS_DRAFT => t('draft'),
+ 'status-' . NODE_STATUS_UNPUBLISHED => t('unpublished'),
'promote-1' => t('promoted'),
'promote-0' => t('not promoted'),
'sticky-1' => t('sticky'),
@@ -447,6 +448,7 @@ function node_admin_nodes() {
$languages = language_list();
$destination = drupal_get_destination();
+ $node_status_options = _node_status_options();
$nodes = array();
foreach ($result as $node) {
$nodes[$node->nid] = '';
@@ -454,7 +456,7 @@ function node_admin_nodes() {
$form['title'][$node->nid] = array('#markup' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', node_mark($node->nid, $node->changed)));
$form['name'][$node->nid] = array('#markup' => check_plain(node_type_get_name($node)));
$form['username'][$node->nid] = array('#markup' => theme('username', $node));
- $form['status'][$node->nid] = array('#markup' => ($node->status ? t('published') : t('not published')));
+ $form['status'][$node->nid] = array('#markup' => $node_status_options[$node->status]);
$form['changed'][$node->nid] = array('#markup' => format_date($node->changed, 'small'));
if ($multilanguage) {
$form['language'][$node->nid] = array('#markup' => empty($node->language) ? t('Language neutral') : t($languages[$node->language]->name));
Index: modules/node/node.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.js,v
retrieving revision 1.4
diff -u -p -r1.4 node.js
--- modules/node/node.js 27 Apr 2009 20:19:37 -0000 1.4
+++ modules/node/node.js 5 Aug 2009 00:36:07 -0000
@@ -24,10 +24,7 @@ Drupal.behaviors.nodeFieldsetSummaries =
vals.push(Drupal.checkPlain($.trim($(this).text())));
});
- if (!$('#edit-status', context).is(':checked')) {
- vals.unshift(Drupal.t('Not published'));
- }
- return vals.join(', ');
+ return vals.length ? vals.join(', ') : Drupal.t('None');
});
}
};
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1091
diff -u -p -r1.1091 node.module
--- modules/node/node.module 4 Aug 2009 06:44:48 -0000 1.1091
+++ modules/node/node.module 5 Aug 2009 00:36:10 -0000
@@ -16,6 +16,21 @@
define('NODE_NEW_LIMIT', REQUEST_TIME - 30 * 24 * 60 * 60);
/**
+ * Node is in the draft state.
+ */
+define('NODE_STATUS_DRAFT', -1);
+
+/**
+ * Node is not published.
+ */
+define('NODE_STATUS_UNPUBLISHED', 0);
+
+/**
+ * Node is published.
+ */
+define('NODE_STATUS_PUBLISHED', 1);
+
+/**
* Implement hook_help().
*/
function node_help($path, $arg) {
@@ -1361,8 +1376,8 @@ function node_search($op = 'search', $ke
return;
case 'status':
- $total = db_query('SELECT COUNT(*) FROM {node} WHERE status = 1')->fetchField();
- $remaining = db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = 1 AND d.sid IS NULL OR d.reindex <> 0")->fetchField();
+ $total = db_query('SELECT COUNT(*) FROM {node} WHERE status = :status', array(':status' => NODE_STATUS_PUBLISHED))->fetchField();
+ $remaining = db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = :status AND d.sid IS NULL OR d.reindex <> 0", array(':status' => NODE_STATUS_PUBLISHED))->fetchField();
return array('remaining' => $remaining, 'total' => $total);
case 'admin':
@@ -1393,6 +1408,7 @@ function node_search($op = 'search', $ke
// Build matching conditions
list($join1, $where1) = _db_rewrite_sql();
$arguments1 = array();
+ // TODO: Convert to NODE_STATUS_PUBLISHED
$conditions1 = 'n.status = 1';
if ($type = search_query_extract($keys, 'type')) {
@@ -1890,7 +1906,7 @@ function node_feed($nids = FALSE, $chann
$nids = db_select('node', 'n')
->fields('n', array('nid', 'created'))
->condition('n.promote', 1)
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->orderBy('n.created', 'DESC')
->range(0, variable_get('feed_default_items', 10))
->addTag('node_access')
@@ -1981,7 +1997,7 @@ function node_page_default() {
$select = db_select('node', 'n')
->fields('n', array('nid'))
->condition('promote', 1)
- ->condition('status', 1)
+ ->condition('status', NODE_STATUS_PUBLISHED)
->orderBy('sticky', 'DESC')
->orderBy('created', 'DESC')
->extend('PagerDefault')
@@ -2296,7 +2312,7 @@ function node_access($op, $node, $accoun
$query->addExpression('COUNT(*)');
$query->condition('grant_' . $op, 1, '>=');
$nids = db_or()->condition('nid', $node->nid);
- if ($node->status) {
+ if ($node->status == NODE_STATUS_PUBLISHED) {
$nids->condition('nid', 0);
}
$query->condition($nids);
@@ -2878,6 +2894,16 @@ function node_action_info() {
'comment' => array('delete', 'insert', 'update'),
),
),
+ 'node_draft_action' => array(
+ 'type' => 'node',
+ 'description' => t('Make post a draft'),
+ 'configurable' => FALSE,
+ 'behavior' => array('changes_node_property'),
+ 'hooks' => array(
+ 'node' => array('presave'),
+ 'comment' => array('delete', 'insert', 'update'),
+ ),
+ ),
'node_make_sticky_action' => array(
'type' => 'node',
'description' => t('Make post sticky'),
@@ -2950,24 +2976,33 @@ function node_action_info() {
/**
* Implement a Drupal action.
- * Sets the status of a node to 1, meaning published.
+ * Sets the status of a node to published.
*/
function node_publish_action($node, $context = array()) {
- $node->status = 1;
+ $node->status = NODE_STATUS_PUBLISHED;
watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title));
}
/**
* Implement a Drupal action.
- * Sets the status of a node to 0, meaning unpublished.
+ * Sets the status of a node to unpublished.
*/
function node_unpublish_action($node, $context = array()) {
- $node->status = 0;
+ $node->status = NODE_STATUS_UNPUBLISHED;
watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title));
}
/**
* Implement a Drupal action.
+ * Sets the status of a node to draft.
+ */
+function node_draft_action($node, $context = array()) {
+ $node->status = NODE_STATUS_DRAFT;
+ watchdog('action', 'Set @type %title to draft.', array('@type' => node_get_types('name', $node), '%title' => $node->title));
+}
+
+/**
+ * Implement a Drupal action.
* Sets the sticky-at-top-of-list property of a node to 1.
*/
function node_make_sticky_action($node, $context = array()) {
@@ -3098,7 +3133,7 @@ function node_unpublish_by_keyword_actio
function node_unpublish_by_keyword_action($node, $context) {
foreach ($context['keywords'] as $keyword) {
if (strpos(drupal_render(node_build(clone $node)), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) {
- $node->status = 0;
+ $node->status = NODE_STATUS_UNPUBLISHED;
watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title));
break;
}
@@ -3169,3 +3204,10 @@ function node_requirements($phase) {
);
return $requirements;
}
+
+/**
+ * Get a list of node status options.
+ */
+function _node_status_options() {
+ return array(NODE_STATUS_UNPUBLISHED => t('Unpublished'), NODE_STATUS_DRAFT => t('Draft'), NODE_STATUS_PUBLISHED => t('Published'));
+}
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.73
diff -u -p -r1.73 node.pages.inc
--- modules/node/node.pages.inc 4 Aug 2009 06:44:48 -0000 1.73
+++ modules/node/node.pages.inc 5 Aug 2009 00:36:11 -0000
@@ -232,9 +232,8 @@ function node_form(&$form_state, $node)
'#weight' => 95,
);
$form['options']['status'] = array(
- '#type' => 'checkbox',
- '#title' => t('Published'),
- '#default_value' => $node->status,
+ '#type' => 'value',
+ '#value' => $node->status,
);
$form['options']['promote'] = array(
'#type' => 'checkbox',
@@ -255,16 +254,103 @@ function node_form(&$form_state, $node)
);
}
+ $default_options = variable_get('node_options_' . $node->type, array('status', 'published'));
+ $default_status = in_array('status', $default_options) ? NODE_STATUS_PUBLISHED : NODE_STATUS_UNPUBLISHED;
+ $new = empty($node->nid);
+ $published = !$new && $node->status == NODE_STATUS_PUBLISHED;
+ $draft = $node->status == NODE_STATUS_DRAFT;
+ $unpublished = !$new && $node->status == NODE_STATUS_UNPUBLISHED;
+ $admin = user_access('administer nodes');
+
// Add the buttons.
$form['buttons'] = array();
$form['buttons']['#weight'] = 100;
- $form['buttons']['submit'] = array(
- '#type' => 'submit',
- '#access' => variable_get('node_preview_' . $node->type, 1) != DRUPAL_REQUIRED || (!form_get_errors() && isset($form_state['node_preview'])),
- '#value' => t('Save'),
- '#weight' => 5,
- '#submit' => array('node_form_submit'),
- );
+ if (variable_get('node_preview_' . $node->type, 1) != DRUPAL_REQUIRED || (!form_get_errors() && isset($form_state['node_preview']))) {
+ // Add direct save buttons if node preview was not mandatory or if we're in
+ // preview and have seen no errors.
+
+ // Always show the "Save draft" button.
+ $form['buttons']['submit_draft'] = array(
+ '#type' => 'submit',
+ '#value' => t('Save draft'),
+ '#weight' => 3,
+ '#submit' => array('node_form_draft_submit'),
+ );
+
+ if ($admin && !$published && ($unpublished || $default_status == NODE_STATUS_UNPUBLISHED)) {
+ // Show the "Publish" button if the node isn't currently published and we
+ // have access to publish nodes. If a node type defaults to the published
+ // status, the node can be published by clicking on the "Save" button.
+ $form['buttons']['submit_publish'] = array(
+ '#type' => 'submit',
+ '#value' => t('Publish'),
+ '#weight' => 4,
+ '#access' => array('administer nodes'),
+ '#submit' => array('node_form_publish_submit'),
+ );
+ }
+
+ if ($admin && !$unpublished && ($published || ($draft && $default_status == NODE_STATUS_PUBLISHED && $node->uid != $user->uid))) {
+ // Show the "Publish" button if the node is not currently unpublished and
+ // the user has access to unpublish nodes. If a node type defaults to the
+ // unpublished status, the node can be unpublished by clicking the "Save"
+ // button. Do not show the "Unpublish" button for a new node created by a
+ // user with the "administer nodes" permission even when the node type is
+ // published by default. Administrators cannot unpublish their own drafts
+ // if nodes of this type default to being published.
+ $form['buttons']['submit_unpublish'] = array(
+ '#type' => 'submit',
+ '#value' => $draft ? t('Save without publishing') : t('Unpublish'),
+ '#weight' => 4,
+ '#access' => array('administer nodes'),
+ '#submit' => array('node_form_unpublish_submit'),
+ );
+ }
+
+ // Always show the save button, but change the title in certain situations.
+ if ($new || $draft) {
+ // The node is either new or a draft.
+ if ($default_status == NODE_STATUS_PUBLISHED) {
+ // If the node is new or a draft, if the default status is "Published",
+ // the user will always have access to publish the node.
+ $label = t('Publish');
+ }
+ else {
+ // If a node is new or a draft and the default status is "Unpublished",
+ // users without the "administer nodes" permission should see a "Submit
+ // for approval" button, but users administrators should see the button
+ // named "Save without publishing" to emphasize the contrast between it
+ // and the "Publish" button.
+ if ($admin) {
+ $label = t('Save without publishing');
+ }
+ else {
+ $label = t('Submit for approval');
+ }
+ }
+ }
+ else {
+ // The node is either published or unpublished.
+ if ($published) {
+ if ($admin) {
+ $label = t('Save');
+ }
+ else {
+ $label = t('Publish changes');
+ }
+ }
+ else {
+ $label = t('Save');
+ }
+ }
+ $form['buttons']['submit_save'] = array(
+ '#type' => 'submit',
+ '#value' => $label,
+ '#weight' => 5,
+ '#submit' => array('node_form_submit'),
+ );
+ }
+
$form['buttons']['preview'] = array(
'#access' => variable_get('node_preview_' . $node->type, 1) != DRUPAL_DISABLED,
'#type' => 'submit',
@@ -290,6 +376,30 @@ function node_form(&$form_state, $node)
}
/**
+ * Button submit function: handle the "Save draft" button on the node form.
+ */
+function node_form_draft_submit($form, &$form_state) {
+ $form_state['values']['status'] = NODE_STATUS_DRAFT;
+ node_form_submit($form, $form_state, TRUE);
+}
+
+/**
+ * Button submit function: handle the "Publish" button on the node form.
+ */
+function node_form_publish_submit($form, &$form_state) {
+ $form_state['values']['status'] = NODE_STATUS_PUBLISHED;
+ node_form_submit($form, $form_state, TRUE);
+}
+
+/**
+ * Button submit functioN: handle the "Unpublish" button on the node form.
+ */
+function node_form_unpublish_submit($form, &$form_state) {
+ $form_state['values']['status'] = NODE_STATUS_UNPUBLISHED;
+ node_form_submit($form, $form_state, TRUE);
+}
+
+/**
* Button submit function: handle the 'Delete' button on the node form.
*/
function node_form_delete_submit($form, &$form_state) {
@@ -395,8 +505,13 @@ function theme_node_preview($node) {
return $output;
}
-function node_form_submit($form, &$form_state) {
+function node_form_submit($form, &$form_state, $set_status = FALSE) {
global $user;
+ if (!$set_status && $form_state['values']['status'] == NODE_STATUS_DRAFT) {
+ $default_options = variable_get('node_options_' . $form_state['values']['type'], array('status', 'published'));
+ $default_status = in_array('status', $default_options) ? NODE_STATUS_PUBLISHED : NODE_STATUS_UNPUBLISHED;
+ $form_state['values']['status'] = $default_status;
+ }
$node = node_form_submit_build_node($form, $form_state);
$insert = empty($node->nid);
Index: modules/node/node.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.test,v
retrieving revision 1.38
diff -u -p -r1.38 node.test
--- modules/node/node.test 28 Jul 2009 19:18:06 -0000 1.38
+++ modules/node/node.test 5 Aug 2009 00:36:12 -0000
@@ -191,7 +191,7 @@ class PageEditTestCase extends DrupalWeb
$edit = array();
$edit['title'] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit['title']);
@@ -213,7 +213,7 @@ class PageEditTestCase extends DrupalWeb
$edit['title'] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
// Stay on the current page, without reloading.
- $this->drupalPost(NULL, $edit, t('Save'));
+ $this->drupalPost(NULL, $edit, t('Publish changes'));
// Check that the title and body fields are displayed with the updated values.
$this->assertText($edit['title'], t('Title displayed.'));
@@ -312,7 +312,7 @@ class PageCreationTestCase extends Drupa
$edit = array();
$edit['title'] = $this->randomName(8);
$edit['body[0][value]'] = $this->randomName(16);
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
// Check that the page has been created.
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit['title'])), t('Page created.'));
@@ -501,7 +501,7 @@ class NodePostSettingsTestCase extends D
$edit = array();
$edit['title'] = $this->randomName(8);
$edit['body[0][value]'] = $this->randomName(16);
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit['title']);
@@ -522,7 +522,7 @@ class NodePostSettingsTestCase extends D
$edit = array();
$edit['title'] = $this->randomName(8);
$edit['body[0][value]'] = $this->randomName(16);
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit['title']);
Index: modules/path/path.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.test,v
retrieving revision 1.16
diff -u -p -r1.16 path.test
--- modules/path/path.test 14 Jul 2009 10:22:17 -0000 1.16
+++ modules/path/path.test 5 Aug 2009 00:36:12 -0000
@@ -113,7 +113,7 @@ class PathTestCase extends DrupalWebTest
// Create alias.
$edit = array();
$edit['path'] = $this->randomName(8);
- $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Publish changes'));
// Confirm that the alias works.
$this->drupalGet($edit['path']);
@@ -122,7 +122,7 @@ class PathTestCase extends DrupalWebTest
// Change alias.
$previous = $edit['path'];
$edit['path'] = $this->randomName(8);
- $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Publish changes'));
// Confirm that the alias works.
$this->drupalGet($edit['path']);
@@ -138,13 +138,13 @@ class PathTestCase extends DrupalWebTest
// Set alias to second test node.
// Leave $edit['path'] the same.
- $this->drupalPost('node/' . $node2->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node2->nid . '/edit', $edit, t('Publish changes'));
// Confirm that the alias didn't make a duplicate.
$this->assertText(t('The path is already in use.'), 'Attempt to moved alias was rejected.');
// Delete alias.
- $this->drupalPost('node/' . $node1->nid . '/edit', array('path' => ''), t('Save'));
+ $this->drupalPost('node/' . $node1->nid . '/edit', array('path' => ''), t('Publish changes'));
// Confirm that the alias no longer works.
$this->drupalGet($edit['path']);
@@ -201,7 +201,7 @@ class PathLanguageTestCase extends Drupa
$edit = array();
$edit['language'] = 'en';
$edit['path'] = $this->randomName();
- $this->drupalPost('node/' . $english_node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $english_node->nid . '/edit', $edit, t('Publish changes'));
// Confirm that the alias works.
$this->drupalGet($edit['path']);
@@ -214,7 +214,7 @@ class PathLanguageTestCase extends Drupa
$edit['title'] = $this->randomName();
$edit['body[0][value]'] = $this->randomName();
$edit['path'] = $this->randomName();
- $this->drupalPost(NULL, $edit, t('Save'));
+ $this->drupalPost(NULL, $edit, t('Publish'));
// Clear the path lookup cache.
drupal_lookup_path('wipe');
Index: modules/php/php.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.test,v
retrieving revision 1.14
diff -u -p -r1.14 php.test
--- modules/php/php.test 13 Jul 2009 21:51:11 -0000 1.14
+++ modules/php/php.test 5 Aug 2009 00:36:12 -0000
@@ -61,7 +61,7 @@ class PHPFilterTestCase extends PHPTestC
// Change filter to PHP filter and see that PHP code is evaluated.
$edit = array();
$edit['body[0][value_format]'] = 3;
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.'));
// Make sure that the PHP code shows up as text.
Index: modules/poll/poll.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.test,v
retrieving revision 1.21
diff -u -p -r1.21 poll.test
--- modules/poll/poll.test 20 Jul 2009 18:51:33 -0000 1.21
+++ modules/poll/poll.test 5 Aug 2009 00:36:13 -0000
@@ -44,7 +44,7 @@ class PollTestCase extends DrupalWebTest
list($edit, $index) = $this->_pollGenerateEdit($title, $choices, $index);
}
- $this->drupalPost(NULL, $edit, t('Save'));
+ $this->drupalPost(NULL, $edit, t('Publish'));
$node = $this->drupalGetNodeByTitle($title);
$this->assertText(t('@type @title has been created.', array('@type' => node_type_get_name('poll'), '@title' => $title)), 'Poll has been created.');
$this->assertTrue($node->nid, t('Poll has been found in the database.'));
@@ -79,7 +79,7 @@ class PollTestCase extends DrupalWebTest
function pollUpdate($nid, $title, $edit) {
// Edit the poll node.
- $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $nid . '/edit', $edit, t('Publish changes'));
$this->assertText(t('@type @title has been updated.', array('@type' => node_type_get_name('poll'), '@title' => $title)), 'Poll has been updated.');
}
}
Index: modules/search/search.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.api.php,v
retrieving revision 1.11
diff -u -p -r1.11 search.api.php
--- modules/search/search.api.php 22 Jun 2009 09:10:06 -0000 1.11
+++ modules/search/search.api.php 5 Aug 2009 00:36:13 -0000
@@ -80,8 +80,8 @@ function hook_search($op = 'search', $ke
return;
case 'status':
- $total = db_result(db_query('SELECT COUNT(*) FROM {node} WHERE status = 1'));
- $remaining = db_result(db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = 1 AND d.sid IS NULL OR d.reindex <> 0"));
+ $total = db_result(db_query('SELECT COUNT(*) FROM {node} WHERE status = :status', array(':status' => NODE_STATUS_PUBLISHED)));
+ $remaining = db_result(db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = :status AND d.sid IS NULL OR d.reindex <> 0", array(':status' => NODE_STATUS_PUBLISHED)));
return array('remaining' => $remaining, 'total' => $total);
case 'admin':
@@ -112,6 +112,7 @@ function hook_search($op = 'search', $ke
// Build matching conditions
list($join1, $where1) = _db_rewrite_sql();
$arguments1 = array();
+ // TODO: Convert to using NODE_STATUS_PUBLISHED.
$conditions1 = 'n.status = 1';
if ($type = search_query_extract($keys, 'type')) {
@@ -246,7 +247,7 @@ function hook_search_preprocess($text) {
function hook_update_index() {
$limit = (int)variable_get('search_cron_limit', 100);
- $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit);
+ $result = db_query_range('SELECT n.nid, c.last_comment_timestamp FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = :status AND n.moderate = 0 AND (n.created > :created OR n.changed > :changed OR c.last_comment_timestamp > :last_comment) ORDER BY GREATEST(n.created, n.changed, c.last_comment_timestamp) ASC', array(':status' => NODE_STATUS_PUBLISHED, ':last' => $last), 0, $limit);
foreach ($result as $node) {
$node = node_load($node->nid);
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.61
diff -u -p -r1.61 system.test
--- modules/system/system.test 31 Jul 2009 11:20:43 -0000 1.61
+++ modules/system/system.test 5 Aug 2009 00:36:20 -0000
@@ -695,7 +695,7 @@ class PageTitleFiltering extends DrupalW
'body[0][value]' => '!SimpleTest! test body' . $this->randomName(200),
);
// Create the node with HTML in the title.
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertNotNull($node, 'Node created and found in database');
Index: modules/taxonomy/taxonomy.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v
retrieving revision 1.43
diff -u -p -r1.43 taxonomy.test
--- modules/taxonomy/taxonomy.test 4 Aug 2009 06:50:07 -0000 1.43
+++ modules/taxonomy/taxonomy.test 5 Aug 2009 00:36:21 -0000
@@ -455,7 +455,7 @@ class TaxonomyTermTestCase extends Taxon
$edit['title'] = $this->randomName();
$edit['body[0][value]'] = $this->randomName();
$edit['taxonomy[' . $this->vocabulary->vid . ']'] = $term1->tid;
- $this->drupalPost('node/add/article', $edit, t('Save'));
+ $this->drupalPost('node/add/article', $edit, t('Publish'));
// Check that the term is displayed when the node is viewed.
$node = $this->drupalGetNodeByTitle($edit['title']);
@@ -464,7 +464,7 @@ class TaxonomyTermTestCase extends Taxon
// Edit the node with a different term.
$edit['taxonomy[' . $this->vocabulary->vid . ']'] = $term2->tid;
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->drupalGet('node/' . $node->nid);
$this->assertText($term2->name, t('Term is displayed when viewing the node.'));
@@ -496,7 +496,7 @@ class TaxonomyTermTestCase extends Taxon
// free-tagging field created by the default profile.
$edit['taxonomy[tags][' . $this->vocabulary->vid . ']'] = implode(', ', $terms);
$edit['body[0][value]'] = $this->randomName();
- $this->drupalPost('node/add/article', $edit, t('Save'));
+ $this->drupalPost('node/add/article', $edit, t('Publish'));
$this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit['title'])), t('The node was created successfully'));
foreach ($terms as $term) {
$this->assertText($term, t('The term was saved and appears on the node page'));
Index: modules/translation/translation.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.pages.inc,v
retrieving revision 1.8
diff -u -p -r1.8 translation.pages.inc
--- modules/translation/translation.pages.inc 29 Jul 2009 06:39:35 -0000 1.8
+++ modules/translation/translation.pages.inc 5 Aug 2009 00:36:21 -0000
@@ -26,6 +26,7 @@ function translation_node_overview($node
$header = array(t('Language'), t('Title'), t('Status'), t('Operations'));
+ $node_status_options = _node_status_options();
foreach (language_list() as $language) {
$options = array();
$language_name = $language->name;
@@ -37,7 +38,7 @@ function translation_node_overview($node
if (node_access('update', $translation_node)) {
$options[] = l(t('edit'), "node/$translation_node->nid/edit");
}
- $status = $translation_node->status ? t('Published') : t('Not published');
+ $status = $node_status_options[$translation_node->status];
$status .= $translation_node->translate ? ' - ' . t('outdated') . '' : '';
if ($translation_node->nid == $tnid) {
$language_name = t('@language_name (source)', array('@language_name' => $language_name));
Index: modules/translation/translation.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v
retrieving revision 1.14
diff -u -p -r1.14 translation.test
--- modules/translation/translation.test 20 Jul 2009 18:51:34 -0000 1.14
+++ modules/translation/translation.test 5 Aug 2009 00:36:21 -0000
@@ -61,7 +61,7 @@ class TranslationTestCase extends Drupal
$edit = array();
$edit['title'] = $this->randomName();
$edit['body[0][value]'] = $this->randomName();
- $this->drupalPost('node/add/page', $edit, t('Save'), array('query' => array('translation' => $node->nid, 'language' => 'es')));
+ $this->drupalPost('node/add/page', $edit, t('Publish'), array('query' => array('translation' => $node->nid, 'language' => 'es')));
$duplicate = $this->drupalGetNodeByTitle($edit['title']);
$this->assertEqual($duplicate->tnid, 0, t('The node does not have a tnid.'));
@@ -69,7 +69,7 @@ class TranslationTestCase extends Drupal
$edit = array();
$edit['body[0][value]'] = $this->randomName();
$edit['translation[retranslate]'] = TRUE;
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node_title)), t('Original node updated.'));
// Check to make sure that interface shows translation as outdated
@@ -80,7 +80,7 @@ class TranslationTestCase extends Drupal
$edit = array();
$edit['body[0][value]'] = $this->randomName();
$edit['translation[status]'] = FALSE;
- $this->drupalPost('node/' . $node_translation->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node_translation->nid . '/edit', $edit, t('Publish changes'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node_translation_title)), t('Translated node updated.'));
}
@@ -130,7 +130,7 @@ class TranslationTestCase extends Drupal
$edit['title'] = $title;
$edit['body[0][value]'] = $body;
$edit['language'] = $language;
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
$this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Page created.'));
// Check to make sure the node was created.
@@ -154,7 +154,7 @@ class TranslationTestCase extends Drupal
$edit = array();
$edit['title'] = $title;
$edit['body[0][value]'] = $body;
- $this->drupalPost(NULL, $edit, t('Save'));
+ $this->drupalPost(NULL, $edit, t('Publish'));
$this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Translation created.'));
// Check to make sure that translation was successful.
Index: modules/trigger/trigger.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.test,v
retrieving revision 1.15
diff -u -p -r1.15 trigger.test
--- modules/trigger/trigger.test 28 Jul 2009 19:18:08 -0000 1.15
+++ modules/trigger/trigger.test 5 Aug 2009 00:36:21 -0000
@@ -22,7 +22,7 @@ class TriggerContentTestCase extends Dru
*/
function testActionsContent() {
global $user;
- $content_actions = array('node_publish_action', 'node_unpublish_action', 'node_make_sticky_action', 'node_make_unsticky_action', 'node_promote_action', 'node_unpromote_action');
+ $content_actions = array('node_unpublish_action', 'node_make_sticky_action', 'node_make_unsticky_action', 'node_promote_action', 'node_unpromote_action');
foreach ($content_actions as $action) {
$hash = md5($action);
@@ -39,8 +39,10 @@ class TriggerContentTestCase extends Dru
$edit = array();
$edit['title'] = '!SimpleTest test node! ' . $this->randomName(10);
$edit['body[0][value]'] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
- $edit[$info['property']] = !$info['expected'];
- $this->drupalPost('node/add/page', $edit, t('Save'));
+ if (empty($info['skip_set'])) {
+ $edit[$info['property']] = !$info['expected'];
+ }
+ $this->drupalPost('node/add/page', $edit, t('Publish'));
// Make sure the text we want appears.
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit['title'])), t('Make sure the page has actually been created'));
// Action should have been fired.
@@ -75,15 +77,13 @@ class TriggerContentTestCase extends Dru
*/
function actionInfo($action) {
$info = array(
- 'node_publish_action' => array(
- 'property' => 'status',
- 'expected' => 1,
- 'name' => t('publish post'),
- ),
+ // We can't test the "publish post" action because there is no way for an
+ // administrator to create an unpublished node.
'node_unpublish_action' => array(
'property' => 'status',
'expected' => 0,
'name' => t('unpublish post'),
+ 'skip_set' => TRUE,
),
'node_make_sticky_action' => array(
'property' => 'sticky',
Index: modules/upload/upload.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.test,v
retrieving revision 1.22
diff -u -p -r1.22 upload.test
--- modules/upload/upload.test 28 Jul 2009 19:18:08 -0000 1.22
+++ modules/upload/upload.test 5 Aug 2009 00:36:22 -0000
@@ -73,7 +73,7 @@ class UploadTestCase extends DrupalWebTe
// Rename file.
$edit = array();
$edit['files[' . $upload->fid . '][description]'] = $new_name = substr($upload->description, 1);
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File renamed successfully.');
$this->assertText($new_name, $new_name . ' found on node.');
@@ -82,7 +82,7 @@ class UploadTestCase extends DrupalWebTe
// Delete a file.
$edit = array();
$edit['files[' . $upload->fid . '][remove]'] = TRUE;
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File deleted successfully.');
$this->assertNoText($new_name, $new_name . ' not found on node.');
@@ -193,7 +193,7 @@ class UploadTestCase extends DrupalWebTe
function uploadFile($node, $filename, $assert = TRUE) {
$edit = array();
$edit['files[upload]'] = $filename; //edit-upload
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+ $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Publish changes'));
if ($assert) {
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File attached successfully.');
}
Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.51
diff -u -p -r1.51 user.test
--- modules/user/user.test 31 Jul 2009 21:14:01 -0000 1.51
+++ modules/user/user.test 5 Aug 2009 00:36:23 -0000
@@ -196,7 +196,7 @@ class UserCancelTestCase extends DrupalW
// Confirm user's content has not been altered.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), t('Node of the user has not been altered.'));
+ $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == NODE_STATUS_PUBLISHED), t('Node of the user has not been altered.'));
}
/**
@@ -237,7 +237,7 @@ class UserCancelTestCase extends DrupalW
// Confirm user's content has not been altered.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), t('Node of the user has not been altered.'));
+ $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == NODE_STATUS_PUBLISHED), t('Node of the user has not been altered.'));
}
/**
@@ -311,9 +311,9 @@ class UserCancelTestCase extends DrupalW
// Confirm user's content has been unpublished.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue($test_node->status == 0, t('Node of the user has been unpublished.'));
+ $this->assertTrue($test_node->status == NODE_STATUS_UNPUBLISHED, t('Node of the user has been unpublished.'));
$test_node = node_load($node->nid, $node->vid, TRUE);
- $this->assertTrue($test_node->status == 0, t('Node revision of the user has been unpublished.'));
+ $this->assertTrue($test_node->status == NODE_STATUS_UNPUBLISHED, t('Node revision of the user has been unpublished.'));
// Confirm user is logged out.
$this->assertNoText($account->name, t('Logged out.'));
@@ -360,11 +360,11 @@ class UserCancelTestCase extends DrupalW
// Confirm that user's content has been attributed to anonymous user.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid == 0 && $test_node->status == 1), t('Node of the user has been attributed to anonymous user.'));
+ $this->assertTrue(($test_node->uid == 0 && $test_node->status == NODE_STATUS_PUBLISHED), t('Node of the user has been attributed to anonymous user.'));
$test_node = node_load($revision_node->nid, $revision, TRUE);
- $this->assertTrue(($test_node->uid == 0 && $test_node->status == 1), t('Node revision of the user has been attributed to anonymous user.'));
+ $this->assertTrue(($test_node->uid == 0 && $test_node->status == NODE_STATUS_PUBLISHED), t('Node revision of the user has been attributed to anonymous user.'));
$test_node = node_load($revision_node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid != 0 && $test_node->status == 1), t("Current revision of the user's node was not attributed to anonymous user."));
+ $this->assertTrue(($test_node->uid != 0 && $test_node->status == NODE_STATUS_PUBLISHED), t("Current revision of the user's node was not attributed to anonymous user."));
// Confirm that user is logged out.
$this->assertNoText($account->name, t('Logged out.'));