Commit f1ecd1bd authored by yched's avatar yched

pre-release cleanup : remove trailing spaces

parent d9233485
......@@ -13,11 +13,11 @@ Files added:
- 79887 default field theming : do not display label on empty fields.
- 103585 userreference: force transposed node_field['uid'] to array when empty.
- Fix body sort in field overview, add field type and module as hidden fields to
- Fix body sort in field overview, add field type and module as hidden fields to
content_admin_field form to make programmatic form submission easier.
- 88135 Fix Views handling of multiple fields to allow option to group multiple fields together.
- 89172 Improved handling for optionwidgets, adding ability to create options as an array
in php or as a list of values. Also fixes View handling, making sure the right value is
- 89172 Improved handling for optionwidgets, adding ability to create options as an array
in php or as a list of values. Also fixes View handling, making sure the right value is
swapped in for the option in Views tables and lists.
- 99672 Improved UI for setting weights and groups on field overview page.
- Added content.css.
......
table.content-field-overview, table.content-field-overview fieldset table {
width:100%;
}
}
table.content-field-overview td {
width:14%;
}
}
.content-field-overview .content-field-overview-disabled {
filter:alpha(opacity=50);
-moz-opacity: .50;
opacity: .50;
}
filter:alpha(opacity=50);
-moz-opacity: .50;
opacity: .50;
}
.content-field-overview-empty {
text-align:center;
}
}
......@@ -228,7 +228,7 @@ function content_update_7() {
*/
function content_update_8() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
......
......@@ -256,7 +256,7 @@ function content_load($node) {
function content_form(&$node, &$param) {
$form = array();
$type = content_types($node->type);
// Set form parameters so we can accept file uploads.
$form['#attributes'] = array("enctype" => "multipart/form-data");
......@@ -366,7 +366,7 @@ function content_nodeapi(&$node, $op, $teaser, $page) {
*/
function content_field($op, &$node, $field, &$node_field, $teaser, $page) {
$db_info = content_database_info($field);
switch ($op) {
case 'load':
$column_names = array();
......
......@@ -175,13 +175,13 @@ function _content_admin_type_edit_submit($form_id, $form_values) {
}
if ($form_values['original_type_name'] > '') {
// Duplicate the field structure from the old content type.
$info = _content_type_info();
$fields = array_keys($info['content types'][$form_values['original_type_name']]['fields']);
foreach ($fields as $field) {
$field_values = array('field_name' => $field, 'type_name' => $form_values['type_name']);
// using this function will both create new field instances
// using this function will both create new field instances
// and move existing fields to separate shared table, if not already shared
_content_admin_field_add_existing_submit('_content_admin_field_add_existing', $field_values);
}
......@@ -221,7 +221,7 @@ function _content_admin_type_delete_submit($form_id, $form_values) {
/**
* Menu callback; presents a listing of fields for a content type.
*
*
* Form includes form widgets to set weight and group for each item
* and displays other form elements and their weights to make it
* easier to place CCK fields in the form and see where they will appear.
......@@ -235,7 +235,7 @@ function content_admin_field_overview_form($type_name) {
$type = content_types($type_name);
$field_types = _content_field_types();
// Create a dummy node and form and call hook_form_alter()
// to produce an array of fields and weights added to the node by all modules.
$dummy_node = new StdClass();
......@@ -246,7 +246,7 @@ function content_admin_field_overview_form($type_name) {
$function = $module .'_form_alter';
$function($dummy_form_id, $dummy_form);
}
// Move group fields into a 'fields' subgroup to make them easier to identify.
// Remove fields that are used in groups from the form, the group will handle them.
if (module_exist('fieldgroup')) {
......@@ -261,26 +261,26 @@ function content_admin_field_overview_form($type_name) {
}
}
}
if (!$type['fields']) {
drupal_set_message(t('There are no fields configured for this content type.'));
}
if (!$type['fields'] && !$form['#groups']) {
return $form;
}
// Iterate through the dummy form and add top-level fields and weights to a table.
// Construct the table values in an array '#table' that FAPI will ignore, keyed on the item's weight.
// Create separate form elements for each weight and group value and put a placeholder for each in #table.
foreach ($dummy_form as $key => $value) {
// Limiting weight to < 10 will keep workflow and submit elements from being added to the overview table.
// They're outside the weight range allowed for CCK fields, so won't interfere with field placement.
if (is_array($value) && (isset($value['#weight']) || $key == 'body_filter') && $value['#weight'] <= 10) {
// if this item is a group, insert group info into table, then add all the group fields below it
if (substr($key, 0, 6) == 'group_' && isset($form['#groups'])) {
$row = $group_form = array();
......@@ -330,7 +330,7 @@ function content_admin_field_overview_form($type_name) {
$row['configure'] = l(t('configure'), 'admin/node/types/'. $type['type_name'] .'/fields/'. $key);
$row['remove'] = l(t('remove'), 'admin/node/types/'. $type['type_name'] .'/fields/'. $key .'/remove');
$form['#table'][$field['widget']['weight']][] = array($key => $row);
$form['field-weights'][$key] = array('#type' => 'weight', '#default_value' => $field['widget']['weight']);
if (isset($form['#groups'])) {
$form['field-groups'][$key] = array('#type' => 'select', '#options' => $form['#group_labels'], '#default_value' => fieldgroup_get_group($type['type_name'], $key));
......@@ -352,15 +352,15 @@ function content_admin_field_overview_form($type_name) {
$row['remove'] = '';
$form['#table'][$value['#weight']][] = array($key => $row);
$form['disabled']['#value'][] = $key;
$form['field-weights'][$key] = array('#type' => 'weight', '#default_value' => $value['#weight'], '#attributes' => array('disabled' => 'disabled'));
}
}
}
// sort the table by weight
ksort($form['#table']);
// add submit buttons and hidden fields
$form['submit'] = array('#type' => 'submit', '#value' => t('Update'));
$form['field-weights']['#tree'] = TRUE;
......@@ -371,7 +371,7 @@ function content_admin_field_overview_form($type_name) {
$form['disabled']['#value'] = serialize($form['disabled']['#value']);
$form['type_name']['#type'] = 'hidden';
$form['type_name']['#value'] = $type['type_name'];
return $form;
}
......@@ -380,13 +380,13 @@ function content_admin_field_overview_form($type_name) {
* Theme the field overview table by iterating through the form and rendering form elements in table cells
*/
function theme_content_admin_field_overview_form($form) {
if (!$form['#table']) {
return;
}
$disabled = unserialize($form['disabled']['#value']);
if (module_exist('fieldgroup')) {
$header = array(t('Label'), t('Name'), t('Type'), t('Weight'), t('Group'), array('data' => t('Operations'), 'colspan' => 2));
$colspan = 7;
......@@ -427,12 +427,12 @@ function theme_content_admin_field_overview_form($form) {
$row[] = array('data' => $cell, 'class' => $class);
}
}
elseif (isset($form['#groups'])) {
// if this form contains groups info and this is a group 'fields' col, finish the previous row
// then theme the 'fields' col with a fieldset containing a table and the group fields
$grows = array();
if (!empty($cell)) {
foreach ($cell as $gweight => $grow) {
foreach ($grow as $gdelta => $gitem) {
......@@ -458,7 +458,7 @@ function theme_content_admin_field_overview_form($form) {
else {
$grows[] = array(array('data' => t('No fields have been added to this group.'), 'colspan' => $colspan, 'class' => 'content-field-overview-empty'));
}
// add the group row in its own table above the group fields table, then reset $row().
$fieldset = array(
'#title' => t('!label (!name)', array('!label' => $form['#group_labels'][$fname], '!name' => $fname)),
......@@ -468,8 +468,8 @@ function theme_content_admin_field_overview_form($form) {
);
$row = array();
$row[] = array(
'data' => theme('fieldset', $fieldset),
'colspan' => $colspan,
'data' => theme('fieldset', $fieldset),
'colspan' => $colspan,
'class' => 'active',
);
$grows = array();
......@@ -486,7 +486,7 @@ function theme_content_admin_field_overview_form($form) {
}
function content_admin_field_overview_form_submit($form_id, $form_values) {
$msg = FALSE;
foreach ((array) $form_values['field-groups'] as $key => $value) {
if ($key && !in_array($key, unserialize($form_values['disabled']))) {
......@@ -504,7 +504,7 @@ function content_admin_field_overview_form_submit($form_id, $form_values) {
if ($key && !in_array($key, unserialize($form_values['disabled']))) {
db_query("UPDATE {node_group} SET weight = %d WHERE type_name = '%s' AND group_name = '%s'",
$value, $form_values['type_name'], $key);
$msg = TRUE;
$msg = TRUE;
}
}
if ($msg) {
......@@ -513,7 +513,7 @@ function content_admin_field_overview_form_submit($form_id, $form_values) {
$msg = FALSE;
foreach ((array) $form_values['field-weights'] as $key => $value) {
if ($key && !in_array($key, unserialize($form_values['disabled']))) {
db_query("UPDATE {node_field_instance} SET weight = %d WHERE type_name = '%s' AND field_name = '%s'",
db_query("UPDATE {node_field_instance} SET weight = %d WHERE type_name = '%s' AND field_name = '%s'",
$value, $form_values['type_name'], $key);
$msg = TRUE;
}
......@@ -795,7 +795,7 @@ function _content_admin_field($type_name, $field_name) {
if (is_array($additions)) {
$form['widget'] = array_merge($form['widget'], $additions);
}
$form['widget']['description'] = array(
'#type' => 'textarea',
'#title' => t('Help text'),
......@@ -846,9 +846,9 @@ function _content_admin_field($type_name, $field_name) {
'#type' => 'value',
'#value' => $field_type['module'],
);
$output .= drupal_get_form('_content_admin_field', $form);
return $output;
}
......@@ -862,10 +862,10 @@ function _content_admin_field_validate($form_id, $form_values) {
$field_type = $field_types[$field['type']];
$widget_types = _content_widget_types();
$widget_type = $widget_types[$field['widget']['type']];
module_invoke($widget_type['module'], 'widget_settings', 'validate', array_merge($field, $form_values));
module_invoke($field_type['module'], 'field_settings', 'validate', array_merge($field, $form_values));
}
/**
......
......@@ -11,7 +11,7 @@
*
* @param $properties
* An array of properties to load the content type with. Valid keys:
* - '' -
* - '' -
* @return
* The ID of the newly-created content type.
*/
......@@ -24,7 +24,7 @@ function content_type_create($properties) {
*
* @param $properties
* An array of properties to use in selecting a content type. Valid keys:
* - '' -
* - '' -
* @return
* The content type array.
*/
......@@ -37,7 +37,7 @@ function content_type_read($properties) {
*
* @param $properties
* An array of properties to set in the content type. Valid keys:
* - '' -
* - '' -
* @return
* The number of content types updated.
*/
......@@ -60,7 +60,7 @@ function content_type_delete($properties) {
while ($node = db_fetch_object($result)) {
node_delete($node->nid);
}
$result = db_query("SELECT field_name FROM {node_field_instance} WHERE type_name = '%s'", $properties['type_name']);
$field_names = array();
while ($type = db_fetch_array($result)) {
......@@ -90,7 +90,7 @@ function content_type_delete($properties) {
*
* @param $properties
* An array of properties to load the field with. Valid keys:
* - '' -
* - '' -
* @return
* The ID of the newly-created field.
*/
......@@ -103,7 +103,7 @@ function content_field_create($properties) {
*
* @param $properties
* An array of properties to use in selecting a field. Valid keys:
* - '' -
* - '' -
* @return
* The field array.
*/
......@@ -116,7 +116,7 @@ function content_field_read($properties) {
*
* @param $properties
* An array of properties to set in the field. Valid keys:
* - '' -
* - '' -
* @return
* The number of fields updated.
*/
......@@ -151,7 +151,7 @@ function content_field_delete($properties) {
*
* @param $properties
* An array of properties to load the field instance with. Valid keys:
* - '' -
* - '' -
* @return
* The ID of the newly-created field instance.
*/
......@@ -178,7 +178,7 @@ function content_field_instance_read($properties) {
*
* @param $properties
* An array of properties to set in the field instance. Valid keys:
* - '' -
* - '' -
* @return
* The number of field instance updated.
*/
......@@ -198,7 +198,7 @@ function content_field_instance_update($properties) {
*/
function content_field_instance_delete($properties) {
$number_deleted = db_query("DELETE FROM {node_field_instance} WHERE type_name = '%s' AND field_name = '%s'", $properties['type_name'], $properties['field_name']);
$type = content_types($properties['type_name']);
$field = $type['fields'][$properties['field_name']];
$field_types = _content_field_types();
......@@ -230,7 +230,7 @@ function content_field_instance_delete($properties) {
}
content_clear_type_cache();
return $number_deleted;
}
......
......@@ -19,7 +19,7 @@ function content_views_tables() {
foreach (content_fields() as $field) {
$db_info = content_database_info($field);
$module = $field_types[$field['type']]['module'];
$formatters = array();
if (is_array($field_types[$field['type']]['formatters'])) {
foreach ($field_types[$field['type']]['formatters'] as $name => $info) {
......@@ -257,7 +257,7 @@ function content_views_argument_handler($op, &$query, $argtype, $arg = '') {
* @param unknown_type $update_fields
*/
function _content_views_rebuild_views($update_fields) {
$tables = _views_get_tables();
$result = db_query("SELECT name, query FROM {view_view} ORDER BY name");
while ($row = db_fetch_array($result)) {
......
......@@ -266,14 +266,14 @@ function hook_field_formatter($field, $item, $formatter, $node) {
else {
$text = check_plain($item['value']);
}
switch ($formatter) {
case 'plain':
return strip_tags($text);
case 'trimmed':
return node_teaser($text, $field['text_processing'] ? $item['format'] : NULL);
default:
return $text;
}
......
......@@ -151,7 +151,7 @@ function number_field($op, &$node, $field, &$items, $teaser, $page) {
* Implementation of hook_field_formatter_info().
*/
function number_field_formatter_info() {
return array(
'default' => array(
'label' => 'Default',
......@@ -254,7 +254,7 @@ function number_allowed_values($field) {
if ($allowed_values[$field['field_name']]) {
return $allowed_values[$field['field_name']];
}
$allowed_values[$field['field_name']] = array();
if ($field['allowed_values_php']) {
ob_start();
......@@ -265,7 +265,7 @@ function number_allowed_values($field) {
ob_end_clean();
}
if (!$allowed_values[$field['field_name']]) {
$list = explode("\n", $field['allowed_values']);
$list = array_map('trim', $list);
$list = array_filter($list, 'strlen');
......
......@@ -12,9 +12,9 @@ function optionwidgets_install() {
*/
function optionwidgets_update_1() {
$ret = array();
// find distinct values already stored in the database
$result = db_query("SELECT * FROM {node_field_instance} fi LEFT JOIN {node_field} f ON fi.field_name=f.field_name WHERE widget_type IN ('options_select', 'options_buttons')");
while ($field_instance = db_fetch_array($result)) {
......@@ -24,7 +24,7 @@ function optionwidgets_update_1() {
$values[$field_instance['field_name']][$value[$info['columns']['value']['column']]] = $value[$info['columns']['value']['column']];
}
}
// find all field instances that use the optionwidgets widget
$result = db_query("SELECT DISTINCT f.field_name, f.type, global_settings FROM {node_field} f LEFT JOIN {node_field_instance} fi ON fi.field_name=f.field_name WHERE widget_type IN ('options_select', 'options_buttons') AND type IN ('text', 'number_integer', 'number_decimal')");
......@@ -32,7 +32,7 @@ function optionwidgets_update_1() {
$updated = FALSE;
$used_keys = $used_deltas = $keys = $deltas = $delta_values = $key_values = $allowed_values = array();
// get the current allowed values settings
$global_settings = array();
......@@ -80,7 +80,7 @@ function optionwidgets_update_1() {
drupal_set_message(t('<div>The allowed values list for %field was not changed from </div><pre>%start</pre>', array('%field' => $field->field_name, '%start' => $start_values)));
}
}
db_query('DELETE FROM {cache}');
return $ret;
......
......@@ -20,7 +20,7 @@ function optionwidgets_help($section) {
* Implementation of hook_widget_info().
*/
function optionwidgets_widget_info() {
$option_types = array('text', 'number_integer', 'number_decimal');
return array(
'options_select' => array(
......@@ -55,7 +55,7 @@ function optionwidgets_widget($op, &$node, $field, &$node_field) {
$options = _optionwidgets_options($field);
$node_field_transposed = content_transpose_array_rows_cols($node_field);
$values = (isset($node_field_transposed['value']) && is_array($node_field_transposed['value'])) ? $node_field_transposed['value'] : array();
$keys = array();
foreach ($values as $value) {
$key = array_search($value, array_keys($options));
......@@ -73,11 +73,11 @@ function optionwidgets_widget($op, &$node, $field, &$node_field) {
case 'form':
$options = _optionwidgets_options($field);
$form = array();
$form[$field['field_name']] = array('#tree' => TRUE);
switch ($field['widget']['type']) {
case 'options_select':
if (!$field['required']) $options = array('' => theme('optionwidgets_none', $field['widget']['type'], $field['field_name'], $node->type)) + $options;
......@@ -129,7 +129,7 @@ function optionwidgets_widget($op, &$node, $field, &$node_field) {
}
break;
}
return $form;
case 'process form values':
......@@ -141,16 +141,16 @@ function optionwidgets_widget($op, &$node, $field, &$node_field) {
else {
$keys = array($node_field['key']);
}
$values = array();
foreach ($keys as $key) {
if (isset($options[$key])) {
$values[] = $key;
}
}
$node_field = content_transpose_array_rows_cols(array('value' => $values));
// Remove the widget's data representation so it isn't saved.
unset($node_field['keys']);
unset($node_field['key']);
......@@ -159,7 +159,7 @@ function optionwidgets_widget($op, &$node, $field, &$node_field) {
}
function _optionwidgets_options($field) {
$types = _content_field_types();
$field_allowed_values = $types[$field['type']]['module'] .'_allowed_values';
if (function_exists($field_allowed_values)) {
......
......@@ -3,7 +3,7 @@
class ContentCrudTest extends DrupalTestCase {
var $_cleanup_roles = array();
var $_cleanup_users = array();
/**
* Implementation of get_info() for information
*/
......@@ -14,26 +14,26 @@ class ContentCrudTest extends DrupalTestCase {
function setUp() {
$this->drupalModuleEnable('content');
}
function testContenTypeCreation() {
/* Prepare settings */
#$this->drupalVariableSet('node_options_page', array('status', 'promote'));
/* Prepare a user to do the stuff */
#$web_user = $this->drupalCreateUserRolePerm(array('administer content types'));
#$this->drupalLoginUser($web_user);
// $edit = array();
// $edit['title'] = '!SimpleTest test node! ' . $this->randomName(10);
// $edit['body'] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
// $this->drupalPostRequest('node/add/page', $edit, 'Submit');
//
//
// // see: http://drupal.org/node/37754 why this currently fails
// $this->assertWantedText(t('Your %post was created.', array ('%post' => 'page')), 'Page created');
//
//
// $node = node_load(array('title' => $edit['title']));
// $this->assertNotNull($node, 'Node found in database. %s');
//
//
// node_delete($node->nid);
$properties = array();
......
......@@ -170,11 +170,11 @@ function text_field_formatter($field, $item, $formatter, $node) {
if (!isset($item['value'])) {
return '';
}
if ($allowed_values = text_allowed_values($field)) {
return $allowed_values[$item['value']];
}
if ($field['text_processing']) {
$text = check_markup($item['value'], $item['format'], is_null($node) || isset($node->in_preview));
}
......
<div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
<?php if ($picture) {
print $picture;
}?>
<?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php }; ?>
<span class="submitted"><?php print $submitted?></span>
<span class="taxonomy"><?php print $terms?></span>
<div class="content">
Here's the body:
<?php print $field_body[0]['view']; ?>
<div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
<?php if ($picture) {
print $picture;
}?>
<?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php }; ?>
<span class="submitted"><?php print $submitted?></span>
<span class="taxonomy"><?php print $terms?></span>
<div class="content">
Here's the body:
<?php print $field_body[0]['view']; ?>
And some footnotes:
<ul>
<?php
foreach ($field_footnotes as $item) {
print '<li>'. $item['view'] .'</li>';
}
?>
</ul>
</div>
<?php if ($links) { ?><div class="links">&raquo; <?php print $links?></div><?php }; ?>
And some footnotes:
<ul>
<?php
foreach ($field_footnotes as $item) {
print '<li>'. $item['view'] .'</li>';
}
?>
</ul>
</div>
<?php if ($links) { ?><div class="links">&raquo; <?php print $links?></div><?php }; ?>
</div>
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