| 1 |
<?php |
<?php |
| 2 |
// $Id: weight.admin.inc,v 1.1.2.1 2009/04/25 15:03:23 nancyw Exp $ |
// $Id: weight.admin.inc,v 1.1.2.2 2009/04/25 16:08:45 nancyw Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* This module uses the sticky column of the node table |
* This module uses the sticky column of the node table |
| 12 |
$types = node_get_types('names'); |
$types = node_get_types('names'); |
| 13 |
|
|
| 14 |
$form['weight_range'] = array( |
$form['weight_range'] = array( |
| 15 |
'#type' => 'select', |
// '#type' => 'select', |
| 16 |
|
'#type' => 'radios', |
| 17 |
'#title' => t('Node Weight Range'), |
'#title' => t('Node Weight Range'), |
| 18 |
'#default_value' => variable_get('weight_range', 20), |
'#default_value' => variable_get('weight_range', 20), |
| 19 |
'#options' => array(5 => 5, 10 => 10, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 60 => 60, 70 => 70, 80 => 80, 90 => 90), |
'#options' => array(5 => 5, 10 => 10, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 60 => 60, 70 => 70, 80 => 80, 90 => 90), |
| 21 |
); |
); |
| 22 |
|
|
| 23 |
$form['weight_use_menu'] = array( |
$form['weight_use_menu'] = array( |
| 24 |
'#type' => 'checkbox', |
'#type' => 'radios', |
| 25 |
|
'#options' => array(t('No'), t('Yes')), |
| 26 |
'#title' => t('Use Menu Weight'), |
'#title' => t('Use Menu Weight'), |
| 27 |
'#default_value' => variable_get('weight_use_menu', FALSE), |
'#default_value' => variable_get('weight_use_menu', FALSE), |
| 28 |
'#description' => '<p>'. t('If the node has not been weighted, should we use the menu item weight?') .'</p>', |
'#description' => '<p>'. t('If the node has not been weighted, should we use the menu item weight if there is one?') .'</p>', |
| 29 |
); |
); |
| 30 |
|
|
| 31 |
$form['weight_position'] = array( |
$form['node'] = array( |
| 32 |
|
'#type' => 'fieldset', |
| 33 |
|
'#title' => t('Node weight selector settings'), |
| 34 |
|
'#description' => '<p>'. t('These settings are for the Weight section of the node form.') .'</p>', |
| 35 |
|
'#collapsible' => TRUE, |
| 36 |
|
'#collapsed' => FALSE, |
| 37 |
|
); |
| 38 |
|
|
| 39 |
|
$form['node']['weight_position'] = array( |
| 40 |
'#type' => 'weight', |
'#type' => 'weight', |
| 41 |
'#delta' => 10, |
'#delta' => 10, |
| 42 |
'#title' => t('Weight selector position weight'), |
'#title' => t('Weight selector position weight'), |
| 44 |
'#description' => '<p>'. t('This controls where the selection for node weight goes on the node edit form. If the position is 10 and the user has "administer nodes" permission, it will be added into the "Workflow options."') .'</p>', |
'#description' => '<p>'. t('This controls where the selection for node weight goes on the node edit form. If the position is 10 and the user has "administer nodes" permission, it will be added into the "Workflow options."') .'</p>', |
| 45 |
); |
); |
| 46 |
|
|
| 47 |
|
$form['node']['weight_label'] = array( |
| 48 |
|
'#type' => 'textfield', |
| 49 |
|
'#maxlength' => 64, |
| 50 |
|
'#size' => 64, |
| 51 |
|
'#title' => t('Weight field set label'), |
| 52 |
|
'#default_value' => variable_get('weight_label', t('Node Weight')), |
| 53 |
|
'#description' => '<p>'. t('This determines the legend that is used on the field set. (Maximum length is 64 characters.)') .'</p>', |
| 54 |
|
); |
| 55 |
|
|
| 56 |
$form['weight_node_types'] = array( |
$form['weight_node_types'] = array( |
| 57 |
'#type' => 'checkboxes', |
'#type' => 'checkboxes', |
| 58 |
'#title' => t('Display On'), |
'#title' => t('Display On'), |
| 87 |
variable_set('weight_range', $form_state['values']['weight_range']); |
variable_set('weight_range', $form_state['values']['weight_range']); |
| 88 |
variable_set('weight_position', $form_state['values']['weight_position']); |
variable_set('weight_position', $form_state['values']['weight_position']); |
| 89 |
variable_set('weight_default', $form_state['values']['weight_default']); |
variable_set('weight_default', $form_state['values']['weight_default']); |
| 90 |
|
variable_set('weight_use_menu', $form_state['values']['weight_use_menu']); |
| 91 |
|
variable_set('weight_label', $form_state['values']['weight_label']); |
| 92 |
|
|
| 93 |
// Check for changes in the list. |
// Check for changes in the list. |
| 94 |
$before = array_filter(variable_get('weight_node_types', array())); |
$before = array_filter(variable_get('weight_node_types', array())); |