...
 
Commits (698)
This diff is collapsed.
DEVELOPER DOCUMENTATION
UPDATING FROM 5.x TO 6.x
TODO:
- field modules have to write an update function to update their columns
(can we provide a helper function to make this easier ?)
See http://drupal.org/node/191796 for an guide to updating field modules.
Look in the /examples/ folder of this module for example field module
code.
\ No newline at end of file
See http://drupal.org/node/191796 for a guide to updating field modules.
// $Id$
IMPORTANT : this is experimental Drupal 6 code, not ready for any kind of use.
Use 4.7 or 5 branch releases instead !
Content Construction Kit
------------------------
NOTE: Install the advanced_help module (http://drupal.org/project/advanced_help)
to access more help (writing still in progress...)
To install, place the entire CCK folder into your modules directory.
Go to Administer -> Site building -> Modules and enable the Content module and one or
more field type modules:
......@@ -19,7 +19,7 @@ content type and edit it to add some fields. Then test by creating
a new node of your new type using the Create content menu link.
The included optionswidget.module provides radio and check box selectors
for text and numeric types.
for the various field types.
The included fieldgroup.module allows you to group fields together
in fieldsets to help organize them.
......@@ -27,5 +27,21 @@ in fieldsets to help organize them.
A comprehensive guide to using CCK is available as a CCK Handbook
at http://drupal.org/node/101723.
jvandyk [at] iastate.edu
jchaffer [at] structureinteractive.com
Known incompatibilitie
----------------------
The Devel Themer module that ships with Devel is known to mess with CCK admin pages.
As a general rule, Devel Themer should only be switched on intermittently when doing
theme work on a specific page, and switched off immediately after that, for it adds
massive processing overhead.
Maintainers
-----------
The Content Construction Kit was originally developped by:
John Van Dyk
Jonathan Chaffer
Current maintainers:
Karen Stevenson
Yves Chedemois
// $Id$
================================================================
UPDATING FROM VERSION 4.7 to 6.x
......@@ -18,33 +17,70 @@ ALWAYS BACKUP YOUR DATABASE BEFORE UPGRADING!
the latest 5.x versions of all CCK modules, go to update.php and
run all possible updates.
3) Install Drupal version 6. Once it is running, upload and install
the latest 6.x versions of all CCK modules, go to update.php and
run all possible updates.
Your database should now be ready to run in CCK version 6.x
Jump to the instructions for updating from version 5.x to 6.x.
================================================================
UPDATING FROM VERSION 5.x to 6.x
================================================================
YOU MUST RUN ALL POSSIBLE UPDATES TO YOUR DATABASE IN 5.x USING
YOU MUST RUN ALL POSSIBLE UPDATES TO YOUR DATABASE IN 5.x USING
THE LATEST 5.x CODE, BEFORE UPGRADING FROM 5.x to 6.x.
ALWAYS BACKUP YOUR DATABASE BEFORE UPGRADING!
1) Before upgrading to 6.x, upload the latest 5.x versions of all
1) Before upgrading to 6.x, upload the latest 5.x versions of all
CCK modules, go to update.php and run all possible updates.
2) Install Drupal version 6. Once it is running, upload and install
the latest 6.x versions of all CCK modules, go to update.php and
run all possible updates.
2) Disable all CCK modules and remove them from the modules folder
before upgrading.
3) Install Drupal version 6. Leave all contributed modules out of
the modules folder until core modules are up and running.
Set your administration theme to a core theme like Garland until
everything has been updated to help ensure you don't encounter
theme-related problems accessing the administration area.
4) Once core is running, upload and install the latest 6.x versions
of ONLY CCK CORE FILES (the ones in the tarball on the CCK
project page). Enable them, then go to update.php and run all
possible updates. DO NOT add any other CCK modules to the
modules folder until the core CCK files are updated and working
correctly.
5) After updating CCK core modules, you may get messages saying that
some updates failed and that you need to run update.php again.
If you get messages like that, keep re-running update.php until
you get no more messages.
6) Once the core CCK modules are updated and working correctly,
add other CCK modules to the modules folder, enable them,
and run update.php. For best results, do this one module at a
time so you can tell immediately if any of them create problems
without letting those problems interfere with other updates.
Your database should now be ready to run in CCK version 6.x
================================================================
These steps are necessary because of significant changes in the
database structure between the 4.7 and 6.x versions. These changes
make it extremely difficult to create an automatic upgrade path that
The 4.7 to 5.x steps are necessary because of significant changes
in the database structure between the 4.7 and 6.x versions. These changes
make it extremely difficult to create an automatic upgrade path that
will work reliably in every possible situation.
The extra steps in the 5.x to 6.x upgrade are because all modules
in the modules folder are automatically updated in Drupal 6, even if they
are not enabled. That means that modules that rely on core CCK may try
to run their updates even if core CCK is not enabled, and contributed
CCK modules that have broken updates will have their broken updates
run even if they are not enabled.
A number of updates are dependent on other updates and won't work
until previous updates are finished or specific modules are enabled,
so you may get messages that other modules need to be enabled or that
update.php needs to be re-run, and you need to follow those instructions
until all the updates complete.
Taking extra time during the upgrade by leaving modules out of the
modules folder altogether until you are ready to enable and update them
should reduce or eliminate update problems.
\ No newline at end of file
; $Id$
name = Content
description = Allows administrators to define new content types.
package = CCK
......
This diff is collapsed.
// $Id$
/**
* Show the Save button when fields are swapped.
*
* This behavior is dependent on the tableDrag behavior, since it uses the
* objects initialized in that behavior to update the row.
*/
Drupal.behaviors.cckFieldDrag = function(context) {
var tableDrag = Drupal.tableDrag['content-field-overview']; // Get the tableDrag object.
// Add a handler for when a row is dropped,
// show Save button if the table has been changed.
tableDrag.onDrop = function() {
if (tableDrag.changed) {
$('.content-admin-field-overview-submit').fadeIn('slow');
}
}
Drupal.behaviors.cckManageFields = function(context) {
attachUpdateSelects(context);
};
function attachUpdateSelects(context) {
var widgetTypes = Drupal.settings.contentWidgetTypes;
var fields = Drupal.settings.contentFields;
// Store the default text of widget selects.
$('#content-field-overview .content-widget-type-select', context).each(function() {
this.initialValue = this.options[0].text;
});
// 'Field type' select updates its 'Widget' select.
$('#content-field-overview .content-field-type-select', context).each(function() {
this.targetSelect = $('.content-widget-type-select', $(this).parents('tr').eq(0));
$(this).change(function() {
var selectedFieldType = this.options[this.selectedIndex].value;
var options = (selectedFieldType in widgetTypes) ? widgetTypes[selectedFieldType] : [ ];
this.targetSelect.contentPopulateOptions(options);
});
// Trigger change on initial pageload to get the right widget options
// when field type comes pre-selected (on failed validation).
$(this).trigger('change');
});
// 'Existing field' select updates its 'Widget' select and 'Label' textfield.
$('#content-field-overview .content-field-select', context).each(function() {
this.targetSelect = $('.content-widget-type-select', $(this).parents('tr').eq(0));
this.targetTextfield = $('.content-label-textfield', $(this).parents('tr').eq(0));
$(this).change(function(e, updateText) {
var updateText = (typeof(updateText) == 'undefined') ? true : updateText;
var selectedField = this.options[this.selectedIndex].value;
var selectedFieldType = (selectedField in fields) ? fields[selectedField].type : null;
var selectedFieldWidget = (selectedField in fields) ? fields[selectedField].widget : null
var options = (selectedFieldType && (selectedFieldType in widgetTypes)) ? widgetTypes[selectedFieldType] : [ ];
this.targetSelect.contentPopulateOptions(options, selectedFieldWidget);
if (updateText) {
$(this.targetTextfield).attr('value', (selectedField in fields) ? fields[selectedField].label : '');
}
});
// Trigger change on initial pageload to get the right widget options
// and label when field type comes pre-selected (on failed validation).
$(this).trigger('change', false);
});
}
jQuery.fn.contentPopulateOptions = function(options, selected) {
return this.each(function() {
var disabled = false;
if (options.length == 0) {
options = [this.initialValue];
disabled = true;
}
// If possible, keep the same widget selected when changing field type.
// This is based on textual value, since the internal value might be
// different (optionwidgets_buttons vs. nodereference_buttons).
var previousSelectedText = this.options[this.selectedIndex].text;
var html = '';
jQuery.each(options, function(value, text) {
// Figure out which value should be selected. The 'selected' param
// takes precedence.
var is_selected = ((typeof(selected) !== 'undefined' && value == selected) || (typeof(selected) == 'undefined' && text == previousSelectedText));
html += '<option value="' + value + '"' + (is_selected ? ' selected="selected"' : '') +'>' + text + '</option>';
});
$(this)
.html(html)
.attr('disabled', disabled ? 'disabled' : '');
});
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<p>Using a field across several content type can be handy if a piece of data
is relevant for several content types. A typical use case is a 'Phone number'
field, used in both 'Restaurant' and 'Hotel' content types, even if hotels
and restaurants are different enough to deserve their own specific set of
fields and thus their own dedicated content types.</p>
<p>When a field has been added to more than one content type, we also say it is
"shared", and that it as "several instances".</p>
<p>At the bottom of the <strong>Manage fields</strong> page for a content type,
you'll find this:</p>
<img src="&path&add-existing-field.png">
<p>In order to add a new instance of an existing field to a content type, you
need to provide the following information:</p>
<dl>
<dt><strong>Label:</strong></dt>
<dd>
A human-readable name for the field. It will be used in input forms and
on displayed content.<br/>
All characters are allowed, including spaces, accentuated or non-european
characters.<br/>
</dd>
<dt><strong>Field:</strong></dt>
<dd>
The field to be shared.<br/>
A field cannot appear more than once in each content type. Thus, only
fields that are not already present in the current content type will be
proposed as "shareable". If none, the <strong>Add existing field</strong>
option is not available on the <strong>Manage fields</strong> page for
this content type.<br/>
Selecting a field automatically populates the <strong>Label</strong> and
<strong>Widget</strong> values with the ones used by the previous field
instance, but you can change them if needed before submitting the form.
</dd>
<dt><strong>Widget:</strong></dt>
<dd>
The form element that will be used to input data for this field on
content forms : text input, select list, etc...<br/>
Each field type has its own list of available widgets. When selecting a
field to share, the list of widgets you can select is automatically updated.
</dd>
</dl>
\ No newline at end of file
<p>At the bottom of the <strong>Manage fields</strong> page for a content type,
you'll find this:</p>
<img src="&path&add-new-field.png">
<p>In order to add a new field to a content type, you need to provide the
following information:</p>
<dl>
<dt>Label:</dt>
<dd>
A human-readable name for the field. It will be used in input forms and
on displayed content.<br/>
All characters are allowed, including spaces, accentuated or non-european
characters.
</dd>
<dt>Field name:</dt>
<dd>
A machine-readable name for the field. It is used internally to identify
the field and handle database storage. When doing custom theming, it is
this identifier that you'll use to refer to that field.<br/>
<strong>Important:</strong> The field name cannot be changed once the field has been
created.<br/>
Allowed characters: a-z (unaccentuated), 0-9 and the underscore (_).<br/>
The length of the field name cannot exceed 32 characters (including the
'field_' prefix that gets added automatically - that is, 26 free characters)<br/>
</dd>
<dt>Field type:</dt>
<dd>
The type of data to be stored in that field.<br/>
<strong>Important:</strong> The field type cannot be changed once the field has been
created.<br/>
The available field types depend on the modules you have enabled on your site. CCK comes with 6
basic field types :
<ul>
<li>Text</li>
<li>Integer</li>
<li>Float</li>
<li>Decimal</li>
<li>Node reference</li>
<li>User reference</li>
</ul>
Additional modules can be downloaded to handle other field types such as
dates, files, images... Look at the
<a href="http://www.drupal.org/project/cck" target="_blank"> CCK project page</a>
and the <a href="http://drupal.org/project/Modules/category/88" target="_blank">complete list of CCK-related modules</a>.
</dd>
<dt>Widget:</dt>
<dd>
The form element that will be used to input data for this field on
content forms : text input, select list, etc...<br/>
Each field type has its own list of available widgets. When selecting a
field type, the list of widgets you can select is automatically updated.
</dd>
</dl>
\ No newline at end of file
<p>Field groups are used to visually gather several fields that are associated
by some sort of logic, for instance several text fields that hold the different
parts of an 'Address'. On input forms and displayed content, the corresponding
fields are enclosed inside an HTML fieldset.</p>
<img style="vertical-align:top" src="&path&group-node-edit-form.png">
<img style="vertical-align:top" src="&path&group-node-display.png">
<p>At the bottom of the <strong>Manage fields</strong> page for a content type,
you'll find this:</p>
<img src="&path&add-new-group.png">
<p>In order to add a new group to a content type, you need to provide the
following information:</p>
<dl>
<dt><strong>Label:</strong></dt>
<dd>
A human-readable name for the group. It will be used in input forms and
on displayed content.<br/>
All characters are allowed, including spaces, accentuated or non-european
characters.<br/>
</dd>
<dt>Group name:</dt>
<dd>
A machine-readable name for the group. It is used internally to identify
the group. When doing custom theming, it is this identifier that you'll use
to refer to that group.<br/>
<strong>Important:</strong> The group name cannot be changed once the group has been
created.<br/>
Allowed characters: a-z (unaccentuated), 0-9 and the underscore (_).<br/>
The length of the group name cannot exceed 32 characters (including the
'group_' prefix that gets added automatically - that is, 26 free characters)<br/>
</dd>
</dl>
<p>Once a group has been created, you can define what fields it will enclose by
<a href="topic:content/rearrange">rearranging fields and groups</a>.</p>
\ No newline at end of file
<p>The form elements at the bottom of the <strong>Manage fields</strong> page
let you add fields and groups to your content types.</p>
<img src="&path&add-new.png">
<p style="font-size:smaller">(The <strong>Add existing field</strong> row is
displayed only if there are fields available in other content types.
The <strong>Add new group</strong> rows is displayed only if Fieldgroup module
is enabled.)</p>
<p>Your fields and groups will be created after you click the <strong>Save</strong>
button at the bottom of the page. In subsequent pages you will be presented
with the settings form for each field you added.</p>
<p>You will find more details on the required informations in the
following pages:</p>
\ No newline at end of file
[advanced help settings]
name = CCK
index name = "CCK (Content Construction Kit)"
[fields]
title = Fields and Widgets
weight = -10
[manage-fields]
title = 'Manage fields' tab
[add]
title = Add fields and groups
parent = manage-fields
weight = 1
[add-new-field]
title = Add a new field
parent = add
weight = 1
[add-existing-field]
title = Add an existing field : share a field across content types
parent = add
weight = 2
[add-new-group]
title = Add a new group
parent = add
weight = 3
[rearrange]
title = Rearrange fields and groups
parent = manage-fields
weight = 2
[remove]
title = Remove fields and groups
parent = manage-fields
weight = 3
[theme]
title = Theming CCK data in nodes
[theme-node-templates]
title = Node templates
parent = theme
weight = 1
[theme-field-templates]
title = Field templates
parent = theme
weight = 2
[theme-formatters]
title = Formatter theme functions
parent = theme
weight = 3
<p>The Content Construction Kit (CCK) is composed of numerous field and widget modules that can be used to add fields to any content type.</p>
\ No newline at end of file
<p>This page lets you manage the CCK fields in your content type : add fields and
groups, rearrange them, access their configuration pages, remove them from the
content type.</p>
\ No newline at end of file
<p>To change the order of fields, grab a drag-and-drop handle
<img src="&path&draggable.png"> and drag the field to a new location in the list
(grab a handle by clicking and holding the mouse while hovering over a handle
icon). Remember that your changes will not be saved until you click the
<strong>Save</strong> button at the bottom of the page.</p>
<p>The order you define will be used both on input forms (when creating or
editing a post), and on content display (teasers, content page, RSS items...)</p>
<p>You can also change the order of non-CCK 'fields' like <strong>Title</strong>
or <strong>File attachments</strong>. Depending on the 'field', this will
affect input forms and/or content display (some of those 'fields' are not
displayed in both contexts).</p>
<p>If your content type has groups (requires the Fieldgroup module), you can
move a field inside a group by dragging it below the row of the group, and
then slightly to the right before dropping it. Note that groups can also be
reordered, but can currently not be nested inside other groups.</p>
<img src="&path&drag-groups.png">
<p>When adding a field or a group, you can drag them directly to the
intended spot in the list of fields and groups that are already present in your
content type, before clicking <strong>Save</strong>:</p>
<img src="&path&drag-new.png">
\ No newline at end of file
<h3>Removing a field</h3>
<p>When you remove a field from a content type, the data it holds are
<strong>permanently</strong> erased. You will be asked to confirm this action</p>
<p>You will have to manually update your Views, pathauto settings, etc... if
needed.</p>
<p>Note : if the field is shared across several content types, removing it from
one content type does <strong>not</strong> affect the data for the other content
types.</p>
<h3>Removing a group</h3>
<p>Removing a group from a content type does <strong>not</strong> remove the fields
it contains, and therefore erases no field data.</p>
\ No newline at end of file
This diff is collapsed.
<p>Formatters are used to turn the raw data for a single field value into html.
The <strong>Display Fields</strong> tab lets you chose which formatter you want to use
for each of your fields.</p>
<p>In CCK 2.0 for Drupal 6, all formatters now go through the theme layer.
Therefore, overriding a formatter's theme is another way you can alter how your
values are displayed (whereas changing <span class="code">content-field.tpl.php</span>
lets you change the html that "wraps" the values).</p>
<p>Most formatters come as theme functions, but some might use templates instead.
Either way, you can override them using the usual Drupal 6 theme override
practices. For more informations, see the <a href="http://drupal.org/theme-guide">Theme guide for Drupal 6</a>,
and more specifically the <a href="http://drupal.org/node/173880">Overriding themable output</a> section.</p>
\ No newline at end of file
This diff is collapsed.
<p><strong>Note:</strong> these instructions assume you are familiar with the basic concepts
of Drupal 6 theming. For more informations, see the <a href="http://drupal.org/theme-guide">Theme guide for Drupal 6</a>,
and more specifically the <a href="http://drupal.org/node/173880">Overriding themable output</a>
section.</p>
<p>There are 3 levels where you can customize how the data in CCK fields
is displayed in nodes:</p>
<img src="&path&theme.png" class="content-border">
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
/**
* @file
* The subclass simply adds properties,
* for field-specific subclasses to use if they need to.
*/
class content_handler_argument extends views_handler_argument {
var $content_field;
function construct() {
parent::construct();
$this->content_field = content_fields($this->definition['content_field_name']);
$this->additional_fields = $this->definition['additional fields'];
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.