Commit 172a35fa authored by Gábor Hojtsy's avatar Gábor Hojtsy

#184968 spin off coding style fixes to let the substance of the patch get reviewed

parent 1f299b52
...@@ -1077,9 +1077,14 @@ function node_search($op = 'search', $keys = NULL) { ...@@ -1077,9 +1077,14 @@ function node_search($op = 'search', $keys = NULL) {
case 'admin': case 'admin':
$form = array(); $form = array();
// Output form for defining rank factor weights. // Output form for defining rank factor weights.
$form['content_ranking'] = array('#type' => 'fieldset', '#title' => t('Content ranking')); $form['content_ranking'] = array(
'#type' => 'fieldset',
'#title' => t('Content ranking'),
);
$form['content_ranking']['#theme'] = 'node_search_admin'; $form['content_ranking']['#theme'] = 'node_search_admin';
$form['content_ranking']['info'] = array('#value' => '<em>'. t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') .'</em>'); $form['content_ranking']['info'] = array(
'#value' => '<em>'. t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') .'</em>'
);
$ranking = array('node_rank_relevance' => t('Keyword relevance'), $ranking = array('node_rank_relevance' => t('Keyword relevance'),
'node_rank_recent' => t('Recently posted')); 'node_rank_recent' => t('Recently posted'));
...@@ -1093,7 +1098,12 @@ function node_search($op = 'search', $keys = NULL) { ...@@ -1093,7 +1098,12 @@ function node_search($op = 'search', $keys = NULL) {
// Note: reversed to reflect that higher number = higher ranking. // Note: reversed to reflect that higher number = higher ranking.
$options = drupal_map_assoc(range(0, 10)); $options = drupal_map_assoc(range(0, 10));
foreach ($ranking as $var => $title) { foreach ($ranking as $var => $title) {
$form['content_ranking']['factors'][$var] = array('#title' => $title, '#type' => 'select', '#options' => $options, '#default_value' => variable_get($var, 5)); $form['content_ranking']['factors'][$var] = array(
'#title' => $title,
'#type' => 'select',
'#options' => $options,
'#default_value' => variable_get($var, 5),
);
} }
return $form; return $form;
...@@ -2592,7 +2602,7 @@ function node_mass_update($nodes, $updates) { ...@@ -2592,7 +2602,7 @@ function node_mass_update($nodes, $updates) {
batch_set($batch); batch_set($batch);
} }
else { else {
foreach($nodes as $nid) { foreach ($nodes as $nid) {
_node_mass_update_helper($nid, $updates); _node_mass_update_helper($nid, $updates);
} }
drupal_set_message(t('The update has been performed.')); drupal_set_message(t('The update has been performed.'));
......
...@@ -115,11 +115,17 @@ function node_form(&$form_state, $node) { ...@@ -115,11 +115,17 @@ function node_form(&$form_state, $node) {
* These elements are just values so they are not even sent to the client. * These elements are just values so they are not even sent to the client.
*/ */
foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) { foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {
$form[$key] = array('#type' => 'value', '#value' => isset($node->$key) ? $node->$key : NULL); $form[$key] = array(
'#type' => 'value',
'#value' => isset($node->$key) ? $node->$key : NULL,
);
} }
// Changed must be sent to the client, for later overwrite error checking. // Changed must be sent to the client, for later overwrite error checking.
$form['changed'] = array('#type' => 'hidden', '#default_value' => isset($node->changed) ? $node->changed : NULL); $form['changed'] = array(
'#type' => 'hidden',
'#default_value' => isset($node->changed) ? $node->changed : NULL,
);
// Get the node-specific bits. // Get the node-specific bits.
if ($extra = node_invoke($node, 'form', $form_state)) { if ($extra = node_invoke($node, 'form', $form_state)) {
$form = array_merge_recursive($form, $extra); $form = array_merge_recursive($form, $extra);
...@@ -164,8 +170,21 @@ function node_form(&$form_state, $node) { ...@@ -164,8 +170,21 @@ function node_form(&$form_state, $node) {
'#collapsed' => TRUE, '#collapsed' => TRUE,
'#weight' => 20, '#weight' => 20,
); );
$form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous'))))); $form['author']['name'] = array(
$form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O')))); '#type' => 'textfield',
'#title' => t('Authored by'),
'#maxlength' => 60,
'#autocomplete_path' => 'user/autocomplete',
'#default_value' => $node->name ? $node->name : '',
'#weight' => -1,
'#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),
);
$form['author']['date'] = array(
'#type' => 'textfield',
'#title' => t('Authored on'),
'#maxlength' => 25,
'#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),
);
if (isset($node->date)) { if (isset($node->date)) {
$form['author']['date']['#default_value'] = $node->date; $form['author']['date']['#default_value'] = $node->date;
...@@ -180,13 +199,28 @@ function node_form(&$form_state, $node) { ...@@ -180,13 +199,28 @@ function node_form(&$form_state, $node) {
'#collapsed' => TRUE, '#collapsed' => TRUE,
'#weight' => 25, '#weight' => 25,
); );
$form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status); $form['options']['status'] = array(
$form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote); '#type' => 'checkbox',
$form['options']['sticky'] = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->sticky); '#title' => t('Published'),
'#default_value' => $node->status,
);
$form['options']['promote'] = array(
'#type' => 'checkbox',
'#title' => t('Promoted to front page'),
'#default_value' => $node->promote,
);
$form['options']['sticky'] = array(
'#type' => 'checkbox',
'#title' => t('Sticky at top of lists'),
'#default_value' => $node->sticky,
);
// These values are used when the user has no administrator access. // These values are used when the user has no administrator access.
foreach (array('uid', 'created') as $key) { foreach (array('uid', 'created') as $key) {
$form[$key] = array('#type' => 'value', '#value' => $node->$key); $form[$key] = array(
'#type' => 'value',
'#value' => $node->$key,
);
} }
// Add the buttons. // Add the buttons.
...@@ -232,7 +266,8 @@ function node_body_field(&$node, $label, $word_count) { ...@@ -232,7 +266,8 @@ function node_body_field(&$node, $label, $word_count) {
'#rows' => 10, '#rows' => 10,
'#teaser' => 'edit-body', '#teaser' => 'edit-body',
'#teaser_checkbox' => 'edit-teaser-include', '#teaser_checkbox' => 'edit-teaser-include',
'#disabled' => TRUE); '#disabled' => TRUE,
);
$form['teaser_include'] = array( $form['teaser_include'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
...@@ -247,7 +282,8 @@ function node_body_field(&$node, $label, $word_count) { ...@@ -247,7 +282,8 @@ function node_body_field(&$node, $label, $word_count) {
'#title' => check_plain($label), '#title' => check_plain($label),
'#default_value' => $include ? $node->body : ($node->teaser . $node->body), '#default_value' => $include ? $node->body : ($node->teaser . $node->body),
'#rows' => 20, '#rows' => 20,
'#required' => ($word_count > 0)); '#required' => ($word_count > 0),
);
$form['format'] = filter_form($node->format); $form['format'] = filter_form($node->format);
...@@ -428,13 +464,18 @@ function node_form_submit_build_node($form, &$form_state) { ...@@ -428,13 +464,18 @@ function node_form_submit_build_node($form, &$form_state) {
* Menu callback -- ask for confirmation of node deletion * Menu callback -- ask for confirmation of node deletion
*/ */
function node_delete_confirm(&$form_state, $node) { function node_delete_confirm(&$form_state, $node) {
$form['nid'] = array('#type' => 'value', '#value' => $node->nid); $form['nid'] = array(
'#type' => 'value',
'#value' => $node->nid,
);
return confirm_form($form, return confirm_form($form,
t('Are you sure you want to delete %title?', array('%title' => $node->title)), t('Are you sure you want to delete %title?', array('%title' => $node->title)),
isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid, isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid,
t('This action cannot be undone.'), t('This action cannot be undone.'),
t('Delete'), t('Cancel')); t('Delete'),
t('Cancel')
);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment