Commit 7db0e379 authored by John C Fiala's avatar John C Fiala
Browse files

Branched the code to 6.x-2.x properly.

parent 41bfcdc2
<?php
// $Id$
/**
* @file
* Install file for the link module.
*/
/**
* Implementation of hook_install().
*/
function link_install() {
drupal_load('module', 'content');
content_notify('install', 'link');
}
......@@ -12,6 +18,7 @@ function link_install() {
* Implementation of hook_uninstall().
*/
function link_uninstall() {
drupal_load('module', 'content');
content_notify('uninstall', 'link');
}
......@@ -19,6 +26,7 @@ function link_uninstall() {
* Implementation of hook_enable().
*/
function link_enable() {
drupal_load('module', 'content');
content_notify('enable', 'link');
}
......@@ -26,41 +34,65 @@ function link_enable() {
* Implementation of hook_disable().
*/
function link_disable() {
drupal_load('module', 'content');
content_notify('disable', 'link');
}
/**
* Removed link.module created tables, move data to content.module tables
*
* Even though most everyone will not be using this particular update, several
* folks have complained that their upgrades of link.module do not work because
* of this function being missing when schema expects it. - JCF
* And on further review, I'm removing the body, since some of those calls
* no longer exist in Drupal 6. Remember to upgrade from 4.7 to 5 first, and
* *then* from 5 to 6. kthx! -JCF
*/
function link_update_1() {
$ret = array();
// GNDN
return $ret;
}
include_once(drupal_get_path('module', 'content') .'/content.module');
include_once(drupal_get_path('module', 'content') .'/content_admin.inc');
$fields = content_fields();
/**
* Ensure that content.module is updated before link module.
*/
function link_update_6000() {
if ($abort = content_check_update('link')) {
return $abort;
}
return array();
}
foreach ($fields as $field) {
switch ($field['type']) {
case 'link':
$columns = array(
'url' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''"),
'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''"),
'attributes' => array('type' => 'mediumtext', 'not null' => FALSE),
);
content_alter_db_field(array(), array(), $field, $columns);
$db_info = content_database_info($field);
if ($field['multiple']) {
$ret[] = update_sql('INSERT INTO {'. $db_info['table'] .'} (vid, delta, nid, '. $field['field_name'] .'_url, '. $field['field_name'] .'_title, '. $field['field_name'] ."_attributes) SELECT vid, delta, nid, field_url, field_title, attributes FROM {node_field_link_data} WHERE field_name = '". $field['field_name'] ."'");
}
else {
$ret[] = update_sql('UPDATE {'. $db_info['table'] .'} c, {node_field_link_data} l SET c.'. $field['field_name'] .'_url = l.field_url, c.'. $field['field_name'] .'_title = l.field_title, c.'. $field['field_name'] ."_attributes = l.attributes WHERE l.field_name = '". $field['field_name'] ."' AND c.vid = l.vid AND c.nid = l.nid");
}
/**
* Change the database schema to allow NULL values.
*/
function link_update_6001() {
$ret = array();
// Build a list of fields that need updating.
$update_fields = array();
foreach (content_types_install() as $type_name => $fields) {
foreach ($fields as $field) {
if ($field['type'] == 'link') {
// We only process a given field once.
$update_fields[$field['field_name']] = $field;
}
}
}
$ret[] = update_sql('DROP TABLE {node_field_link_data}');
db_query('DELETE FROM {cache}');
// Update each field's storage to match the current definition.
foreach ($update_fields as $field) {
$db_info = content_database_info($field);
foreach ($db_info['columns'] as $column) {
db_change_field($ret, $db_info['table'], $column['column'], $column['column'], $column);
$ret[] = update_sql("UPDATE {". $db_info['table'] ."} SET ". $column['column'] ." = NULL WHERE ". $column['column'] ." = '' OR ". $column['column'] ." = 'N;'");
}
}
// Let CCK re-associate link fields with Link module and activate the fields.
content_associate_fields('link');
return $ret;
}
This diff is collapsed.
<?php
// $Id$
/**
* @file
* Basic CRUD simpletests for the link module, based off of content.crud.test in CCK.
*/
// Need to include content.crud.test so we can inherit from it's ContentCrudTestCase.
require_once(drupal_get_path('module', 'content') .'/tests/content.crud.test');
class LinkContentCrudTest extends ContentCrudTestCase {
function getInfo() {
return array(
'name' => t('Link CRUD - Basic API tests'),
'description' => t('Tests the field CRUD (create, read, update, delete) API. <strong>Requires <a href="@schema_link">Schema module</a>.</strong>', array('@schema_link' => 'http://www.drupal.org/project/schema')),
'group' => t('Link'),
);
}
function setUp() {
parent::setUp('link', 'views');
$this->loginWithPermissions();
}
/**
* All we're doing here is creating a content type, creating a simple link field
* on that content type, and making sure said field exists in the database.
*/
function testLinkCreateFieldAPI() {
$this->acquireContentTypes(1);
$field = $this->createField(array('type' => 'link', 'widget_type' => 'link'), 0);
$this->assertEqual(1, 1, print_r($this->content_types, TRUE));
$this->assertEqual(1, 1, print_r($field, TRUE));
$table_schema = drupal_get_schema();
$this->assertEqual(1, 1, print_r(array_keys($table_schema), TRUE));
// Check the schema - the values should be in the per-type table.
$this->assertSchemaMatchesTables(array(
'per_type' => array(
$this->content_types[0]->type => array($field['field_name'] => array('url', 'title', 'attributes')),
),
));
}
}
# $Id$
#
# French translation of Drupal (general)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# link.module,v 1.24.2.29 2008/09/22 04:20:33 quicksketch
# link.info,v 1.2 2008/03/31 06:50:42 quicksketch
# link_views_handler_argument_target.inc,v 1.1.2.1 2008/09/06 21:45:25 quicksketch
# views/link.views.inc: n/a
# link_views_handler_filter_protocol.inc,v 1.1.2.1 2008/09/06 21:45:25 quicksketch
#
msgid ""
msgstr ""
"Project-Id-Version: French translation for drupal link module\n"
"POT-Creation-Date: 2009-03-26 18:34+0100\n"
"PO-Revision-Date: 2009-03-26 19:03+0100\n"
"Project-Id-Version: link drupal module : french translation\n"
"POT-Creation-Date: 2007-12-08 13:14+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Sylvain Moreau <sylvain.moreau@ows.fr>\n"
"Language-Team: Sylvain Moreau, OWS <sylvain.moreau@ows.fr>\n"
"Language-Team: Sylvain Moreau <sylvain.moreau@ows.fr>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n>1);\n"
"X-Poedit-Language: French\n"
"X-Poedit-Country: FRANCE\n"
#: link.module:21;564
#: link.info:0
msgid "Link"
msgstr "Lien"
#: link.module:22
msgid "Store a title, href, and attributes in the database to assemble a link."
msgstr "Stocker un titre, href et des attributs dans la base de données pour les assembler dans un lien."
#: link.module:39
msgid "Optional URL"
msgstr "URL optionnelle"
#: link.module:42
msgid "If checked, the URL field is optional and submitting a title alone will be acceptable. If the URL is ommitted, the title will be displayed as plain text."
msgstr "Si coché, le champ URL est facultatif, et soumettre seulement un titre sera acceptable. Si l'URL est omise, le titre sera affiché comme un texte simple."
#: link.module:46
#: link.module:51
msgid "Optional Title"
msgstr "Titre Optionnel"
#: link.module:47
#: link.module:52
msgid "Required Title"
msgstr "Titre Obligatoire"
#: link.module:48
#: link.module:53
msgid "Static Title: "
msgstr "Titre Statique : "
#: link.module:49
#: link.module:54
msgid "No Title"
msgstr "Aucun Titre"
#: link.module:54
#: link.module:59;176
msgid "Link Title"
msgstr "Titre du Lien"
#: link.module:57
msgid "If the link title is optional or required, a field will be displayed to the end user. If the link title is static, the link will always use the same title. If <a href=\"http://drupal.org/project/token\">token module</a> is installed, the static title value may use any other node field as its value. Static and token-based titles may include most inline XHTML tags such as <em>strong</em>, <em>em</em>, <em>img</em>, <em>span</em>, etc."
msgstr "Si le titre du lien est facultatif ou obligatoire, un champ sera affiché à l'utilisateur final. Si le titre du lien est statique, le lien utilisera toujours le même titre. Si le <a href=\"http://drupal.org/project/token\">module token</a> est installé, le titre statique peut utiliser n'importe quel autre champ du noeud pour sa valeur. Les titres statiques et basés sur des jetons (tokens) peuvent contenir la plupart des balises XHTML en ligne, telles que <em>strong</em>, <em>em</em>, <em>img</em>, <em>span</em>, etc."
#: link.module:62
msgid "If the link title is optional or required, a field will be displayed to the end user. If the link title is static, the link will always use the same title. If <a href=\"http://drupal.org/project/token\">token module</a> is installed, the static title value may use any other node field as its value."
msgstr "Si le titre du lien est optionnel ou obligatoire, un champ sera affiché à l'utilisateur final. Si le titre du lien est statique, le lien utilisera toujours le même titre. Si <a href=\"http://drupal.org/project/token\">le module token</a> est installé, la valeur du titre statique peut utiliser n'importe quel autre champ du noeud en tant que valeur."
#: link.module:72
#: link.module:77;268
#, fuzzy
msgid "Placeholder tokens"
msgstr "Ebauches de jetons"
#: link.module:73
#: link.module:78
#, fuzzy
msgid "The following placeholder tokens can be used in both paths and titles. When used in a path or title, they will be replaced with the appropriate values."
msgstr "Les ébauches de jetons suivantes peuvent être utilisées à la fois dans les chemins et dans les titres. Lorsqu'elles sont utilisées dans un chemin ou un titre, elles seront remplacées par les valeurs appropriées."
#: link.module:81
msgid "Allow user-entered tokens"
msgstr "Autoriser les jetons (tokens) saisis par l'utilisateur"
#: link.module:86
msgid "Allow tokens"
msgstr "Autoriser les jetons (tokens)"
#: link.module:83
#: link.module:88
msgid "Checking will allow users to enter tokens in URLs and Titles on the node edit form. This does not affect the field settings on this page."
msgstr "Le fait de cocher cette case permettra aux utilisateurs de saisir des jetons (tokens) dans les URL et les Titres dans le formulaire d'édition du noeud. Ceci n'affecte pas les configurations de champ sur cette page."
msgstr "Le fait de cocher cette case permettra aux utilisateurs de saisir des jetons dans les URL et les Titres dans le formulaire d'édition du noeud. Ceci n'affecte pas les configurations de champ sur cette page."
#: link.module:92
#: link.module:97
msgid "URL Display Cutoff"
msgstr "Coupure de l'Affichage de l'URL"
#: link.module:94
#: link.module:99
msgid "If the user does not include a title for this link, the URL will be used as the title. When should the link title be trimmed and finished with an elipsis (&hellip;)? Leave blank for no limit."
msgstr "Si l'utilisateur n'inclue pas de titre pour ce lien, l'URL sera utilisée en tant que titre. A quel endroit le lien devra-t-il être coupé et terminé par une ellipse (&hellip;) ? Laissez vide pour aucune limite."
#: link.module:100
#: link.module:105
msgid "Default (no target attribute)"
msgstr "Par Défaut (aucun attribut de cible)"
#: link.module:101
#: link.module:106
msgid "Open link in window root"
msgstr "Ouvrir le lien dans la fenêtre courante"
#: link.module:102
#: link.module:107
msgid "Open link in new window"
msgstr "Ouvrir le lien dans une nouvelle fenêtre"
#: link.module:103
#: link.module:108
msgid "Allow the user to choose"
msgstr "Autoriser l'utilisateur à choisir"
#: link.module:110
#: link.module:115;180
msgid "Link Target"
msgstr "Cible du Lien"
#: link.module:116
#: link.module:121
msgid "Rel Attribute"
msgstr "Attribut Rel"
#: link.module:117
#: link.module:122
msgid "When output, this link will have this rel attribute. The most common usage is <a href=\"http://en.wikipedia.org/wiki/Nofollow\">rel=&quot;nofollow&quot;</a> which prevents some search engines from spidering entered links."
msgstr "Quand il sera affiché, ce lien aura cet attribut rel. L'usage le plus commun est <a href=\"http://fr.wikipedia.org/wiki/Nofollow\">rel=&quot;nofollow&quot;</a> qui empêche certains moteurs de recherche d'aspirer les liens suivis."
#: link.module:125
#: link.module:127
msgid "Additional CSS Class"
msgstr "Classe CSS additionnelle"
#: link.module:126
msgid "When output, this link will have have this class attribute. Multiple classes should be separated by spaces."
msgstr "Lors de son rendu, ce lien aura cet attribut de classe. Les classes multiples doivent être séparées par des espaces."
#: link.module:128
msgid "When output, this link will have have this class attribute. Multiple classes should be seperated by spaces."
msgstr "A l'affichage, ce lien possédera cet attribut de classe. Les classes multiples doivent être séparées par des espaces."
#: link.module:133
#: link.module:135
msgid "A default title must be provided if the title is a static value"
msgstr "Un titre pas défaut doit être fourni si le titre est une valeur statique"
#: link.module:195
msgid "At least one title or URL must be entered."
msgstr "Vous devez saisir au moins un titre ou une URL."
#: link.module:152;404
msgid "URL"
msgstr "URL"
#: link.module:157;416
msgid "Title"
msgstr "Titre"
#: link.module:162
msgid "Protocol"
msgstr "Protocole"
#: link.module:172
msgid "Link URL"
msgstr "Url du Lien"
#: link.module:269
#, fuzzy
msgid "The following placeholder tokens can be used in both titles and URLs. When used in a URL or title, they will be replaced with the appropriate values."
msgstr "Les ébauches de jetons suivantes peuvent être utilisées à la fois dans les titres et dans les URL. Lorsqu'elles sont utilisées dans une URL ou un titre, elles seront remplacées par les valeurs appropriées."
#: link.module:317
msgid "More Links"
msgstr "Plus de Liens"
#: link.module:343
msgid "Not a valid URL."
msgstr "Cette URL n'est pas valide."
#: link.module:273
#: link.module:347
msgid "Titles are required for all links."
msgstr "Les titres sont obligatoires pour tous les liens."
#: link.module:278
msgid "You cannot enter a title without a link url."
msgstr "Vous ne pouvez pas saisir un titre dans une url de lien."
#: link.module:352
msgid "You cannot enter a title without a link."
msgstr "Vous ne pouvez pas saisir de titre sans un lien."
#: link.module:470
msgid "URL"
msgstr "URL"
#: link.module:479
#: views/link_views_handler_argument_target.inc:26
msgid "Title"
msgstr "Titre"
#: link.module:487
#: link.module:424
msgid "Open URL in a New Window"
msgstr "Ouvril l'URL dans une Nouvelle Fenêtre"
#: link.module:500
msgid "Title, as link (default)"
msgstr "Titre, en tant que lien (par défaut)"
#: link.module:505
msgid "URL, as link"
msgstr "URL, en tant que lien"
#: link.module:532
msgid "Default, as link with title"
msgstr "Par défaut, comme lien avec titre"
#: link.module:510
msgid "URL, as plain text"
msgstr "URL, texte simple"
#: link.module:536
msgid "Plain, as the text URL"
msgstr "Plat, comme l'URL texte"
#: link.module:515
#: link.module:540
msgid "Short, as link with title \"Link\""
msgstr "Court, comme lien avec le titre \"Lien\""
#: link.module:520
#: link.module:544
msgid "Label, as link with label as title"
msgstr "Etiquette, comme lien avec l'étiquette comme titre"
#: link.module:525
msgid "Separate title and URL"
msgstr "Titre et URL séparés"
#: link.module:593
msgid "Link URL"
msgstr "Url du Lien"
#: link.module:594
msgid "Link title"
msgstr "Titre du lien"
#: link.module:595
msgid "Formatted html link"
msgstr "Lien html formaté"
#: link.module:602
#: link.info:0
msgid "Link"
msgstr "Lien"
#: link.module:0
msgid "link"
......@@ -205,75 +173,3 @@ msgstr "Définit les types de champs \"lien simple\"."
msgid "CCK"
msgstr "CCK"
#: views/link.views.inc:36
msgid "@label URL"
msgstr "URL de @label"
#: views/link.views.inc:42;75;92
msgid "Content"
msgstr "Contenu"
#: views/link.views.inc:43;56
msgid "@label title"
msgstr "Titre de @label"
#: views/link.views.inc:76;80
msgid "@label protocol"
msgstr "Protocole de @label"
#: views/link.views.inc:93;97
msgid "@label target"
msgstr "Cible de @label"
#: views/link_views_handler_argument_target.inc:28
msgid "The title to use when this argument is present; it will override the title of the view and titles from previous arguments. You can use percent substitution here to replace with argument titles. Use \"%1\" for the first argument, \"%2\" for the second, etc."
msgstr "Le titre à utiliser lorsque cet argument est présent; il écrasera le titre de la vue et les titres provenant des arguments précédents. Vous pouvez utiliser ici la substitution avec le caractère pourcentagen pour remplacer avec les titres des arguments. Utilisez \"%1\" pour le premier argument, \"%2\" pour le second, etc."
#: views/link_views_handler_argument_target.inc:41
msgid "Action to take if argument is not present"
msgstr "Action à prendre si l'argument n'est pas présent"
#: views/link_views_handler_argument_target.inc:53
msgid "Wildcard"
msgstr "Joker"
#: views/link_views_handler_argument_target.inc:56
msgid "If this value is received as an argument, the argument will be ignored; i.e, \"all values\""
msgstr "Si cette valeur est reçue en tant qu'argument, l'argument sera ignoré; c'est-à-dire \"toutes les valeurs\""
#: views/link_views_handler_argument_target.inc:62
msgid "Wildcard title"
msgstr "Titre du joker"
#: views/link_views_handler_argument_target.inc:65
msgid "The title to use for the wildcard in substitutions elsewhere."
msgstr "Le titre à utiliser pour le joker dans les substitutions partout ailleurs."
#: views/link_views_handler_argument_target.inc:88
msgid "Validator"
msgstr "Validateur"
#: views/link_views_handler_argument_target.inc:92
msgid "<Basic validation>"
msgstr "<Validation basique>"
#: views/link_views_handler_argument_target.inc:128
msgid "Action to take if argument does not validate"
msgstr "Action à prendre si l'argument n'est pas valide"
#: views/link_views_handler_filter_protocol.inc:24
msgid "Is one of"
msgstr "Est l'un de"
#: views/link_views_handler_filter_protocol.inc:25
msgid "="
msgstr "="
#: views/link_views_handler_filter_protocol.inc:58
msgid "Protocol"
msgstr "Protocole"
#: views/link_views_handler_filter_protocol.inc:63
msgid "The protocols displayed here are those globally available. You may add more protocols by modifying the <em>filter_allowed_protocols</em> variable in your installation."
msgstr "Les protocoles affichés ici sont ceux disponibles de manière globale. Vous pouvez ajouter plus de protocoles en modifiant la variable <em>filter_allowed_protocols</em> de votre installation."
<?php
// $Id$
/**
* @file
* Contains functions handling views integration.
*/
/**
* Implementation of hook_views_handlers().
*/
function link_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'link') .'/views',
),
'handlers' => array(
'link_views_handler_argument_target' => array(
'parent' => 'views_handler_argument',
),
'link_views_handler_filter_protocol' => array(
'parent' => 'views_handler_filter_string',
),
),
);
}
/**
* Return CCK Views data for the link_field_settings($op == 'views data').
*/
function link_views_content_field_data($field) {
// Build the automatic views data provided for us by CCK.
// This creates all the information necessary for the "url" field.
$data = content_views_field_views_data($field);
$db_info = content_database_info($field);
$table_alias = content_views_tablename($field);
$field_types = _content_field_types();
// Tweak the automatic views data for the link "url" field.
// Set the filter title to "@label URL"
$data[$table_alias][$field['field_name'] .'_url']['filter']['title'] = t('@label URL', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']);
// Remove the argument handling for URLs.
unset($data[$table_alias][$field['field_name'] .'_url']['argument']);
// Build out additional views data for the link "title" field.
$data[$table_alias][$field['field_name'] .'_title'] = array(
'group' => t('Content'),
'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
'help' => $data[$table_alias][$field['field_name'] .'_url']['help'],
'argument' => array(
'field' => $db_info['columns']['title']['column'],
'tablename' => $db_info['table'],
'handler' => 'content_handler_argument_string',
'click sortable' => TRUE,
'name field' => '', // TODO, mimic content.views.inc :)
'content_field_name' => $field['field_name'],
'allow_empty' => TRUE,
),
'filter' => array(
'field' => $db_info['columns']['title']['column'],
'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))),
'tablename' => $db_info['table'],
'handler' => 'content_handler_filter_string',
'additional fields' => array(),
'content_field_name' => $field['field_name'],
'allow_empty' => TRUE,
),
'sort' => array(
'field' => $db_info['columns']['title']['column'],
'tablename' => $db_info['table'],
'handler' => 'content_handler_sort',
'content_field_name' => $field['field_name'],
'allow_empty' => TRUE,
),
);
// Build out additional Views filter for the link "protocol" pseudo field.
// TODO: Add a protocol argument.
$data[$table_alias][$field['field_name'] .'_protocol'] = array(
'group' => t('Content'),
'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
'help' => $data[$table_alias][$field['field_name'] .'_url']['help'],
'filter' => array(
'field' => $db_info['columns']['url']['column'],
'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))),
'tablename' => $db_info['table'],
'handler' => 'link_views_handler_filter_protocol',
'additional fields' => array(),
'content_field_name' => $field['field_name'],
'allow_empty' => TRUE,
),
);
// Build out additional Views argument for the link "target" pseudo field.
// TODO: Add a target filter.
$data[$table_alias][$field['field_name'] .'_target'] = array(
'group' => t('Content'),
'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
'help' => $data[$table_alias][$field['field_name'] .'_url']['help'],
'argument' => array(
'field' => $db_info['columns']['attributes']['column'],
'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
'tablename' => $db_info['table'],
'handler' => 'link_views_handler_argument_target',
'additional fields' => array(),
'content_field_name' => $field['field_name'],
'allow_empty' => TRUE,
),
);
return $data;
}
<?php
// $Id$
/**
* @file
* Argument handler to filter results by target.