- Patch #7336 by TDobes: in various parts of Drupal, we use the title attribute for links to provide a slightly more detailed explanation as to the purpose of a link or where it goes.
parent
254256de82
commit
c0f6fccac3
|
@ -268,6 +268,7 @@ CREATE TABLE menu (
|
|||
pid int(10) unsigned NOT NULL default '0',
|
||||
path varchar(255) NOT NULL default '',
|
||||
title varchar(255) NOT NULL default '',
|
||||
description varchar(255) NOT NULL default '',
|
||||
weight tinyint(4) NOT NULL default '0',
|
||||
type int(2) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (mid)
|
||||
|
|
|
@ -269,6 +269,7 @@ CREATE TABLE menu (
|
|||
pid integer NOT NULL default '0',
|
||||
path varchar(255) NOT NULL default '',
|
||||
title varchar(255) NOT NULL default '',
|
||||
description varchar(255) NOT NULL default '',
|
||||
weight smallint NOT NULL default '0',
|
||||
type smallint NOT NULL default '0',
|
||||
PRIMARY KEY (mid)
|
||||
|
|
|
@ -1207,9 +1207,13 @@ function update_95() {
|
|||
|
||||
function update_96() {
|
||||
$ret = array();
|
||||
|
||||
$ret[] = update_sql('ALTER TABLE {accesslog} DROP nid');
|
||||
$ret[] = update_sql('ALTER TABLE {accesslog} ADD title VARCHAR(255) DEFAULT NULL');
|
||||
$ret[] = update_sql('ALTER TABLE {accesslog} ADD path VARCHAR(255) DEFAULT NULL');
|
||||
|
||||
$ret[] = update_sql("ALTER TABLE {menu} ADD description varchar(255) DEFAULT '' NOT NULL");
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,8 +178,11 @@ define('MENU_ACCESS_DENIED', 3);
|
|||
* with the following key-value pairs defined:
|
||||
* - 'title' - The displayed title of the menu or menu item. It will already
|
||||
* have been translated by the locale system.
|
||||
* - 'description' - The description (link title attribute) of the menu item.
|
||||
* It will already have been translated by the locale system.
|
||||
* - 'path' - The Drupal path to the menu item. A link to a particular item
|
||||
* can thus be constructed with l($item['title'], $item['path']).
|
||||
* can thus be constructed with
|
||||
* l($item['title'], $item['path'], array('title' => $item['description'])).
|
||||
* - 'children' - A linear list of the menu ID's of this item's children.
|
||||
*
|
||||
* Menu ID 0 is the "root" of the menu. The children of this item are the
|
||||
|
@ -486,12 +489,12 @@ function menu_rebuild() {
|
|||
}
|
||||
}
|
||||
|
||||
$new_items[$mid] = array('mid' => $new_mid, 'pid' => $new_pid, 'path' => $item['path'], 'title' => $item['title'], 'weight' => $item['weight'], 'type' => $item['type']);
|
||||
$new_items[$mid] = array('mid' => $new_mid, 'pid' => $new_pid, 'path' => $item['path'], 'title' => $item['title'], 'description' => $item['description'], 'weight' => $item['weight'], 'type' => $item['type']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($new_items as $item) {
|
||||
db_query('INSERT INTO {menu} (mid, pid, path, title, weight, type) VALUES (%d, %d, \'%s\', \'%s\', %d, %d)', $item['mid'], $item['pid'], $item['path'], $item['title'], $item['weight'], $item['type']);
|
||||
db_query('INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (%d, %d, \'%s\', \'%s\', \'%s\', %d, %d)', $item['mid'], $item['pid'], $item['path'], $item['title'], $item['description'], $item['weight'], $item['type']);
|
||||
}
|
||||
|
||||
// Rebuild the menu to account for any changes.
|
||||
|
@ -548,7 +551,7 @@ function theme_menu_item($mid) {
|
|||
$link_mid = $menu['items'][$link_mid]['pid'];
|
||||
}
|
||||
|
||||
return l($menu['items'][$mid]['title'], $menu['items'][$link_mid]['path']);
|
||||
return l($menu['items'][$mid]['title'], $menu['items'][$link_mid]['path'], $menu['items'][$mid]['description'] ? array("title" => $menu['items'][$mid]['description']) : array());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -666,6 +669,9 @@ function _menu_build() {
|
|||
if (!array_key_exists('type', $item)) {
|
||||
$item['type'] = MENU_NORMAL_ITEM;
|
||||
}
|
||||
if (!array_key_exists('description', $item)) {
|
||||
$item['description'] = '';
|
||||
}
|
||||
if (!array_key_exists('weight', $item)) {
|
||||
$item['weight'] = 0;
|
||||
}
|
||||
|
@ -696,6 +702,7 @@ function _menu_build() {
|
|||
// If administrator has changed item position, reflect the change.
|
||||
if ($item->type & MENU_MODIFIED_BY_ADMIN) {
|
||||
$_menu['items'][$item->mid]['title'] = $item->title;
|
||||
$_menu['items'][$item->mid]['description'] = $item->description;
|
||||
$_menu['items'][$item->mid]['pid'] = $item->pid;
|
||||
$_menu['items'][$item->mid]['weight'] = $item->weight;
|
||||
$_menu['items'][$item->mid]['type'] = $item->type;
|
||||
|
@ -703,7 +710,7 @@ function _menu_build() {
|
|||
}
|
||||
// Next, add any custom items added by the administrator.
|
||||
else if ($item->type & MENU_CREATED_BY_ADMIN) {
|
||||
$_menu['items'][$item->mid] = array('pid' => $item->pid, 'path' => $item->path, 'title' => $item->title, 'access' => TRUE, 'weight' => $item->weight, 'type' => $item->type, 'callback' => '', 'callback arguments' => array());
|
||||
$_menu['items'][$item->mid] = array('pid' => $item->pid, 'path' => $item->path, 'title' => $item->title, 'description' => $item->description, 'access' => TRUE, 'weight' => $item->weight, 'type' => $item->type, 'callback' => '', 'callback arguments' => array());
|
||||
|
||||
if (!empty($item->path)) {
|
||||
$_menu['path index'][$item->path] = $item->mid;
|
||||
|
|
|
@ -224,6 +224,7 @@ function menu_edit_item($mid = 0) {
|
|||
$edit['pid'] = $item->pid;
|
||||
$edit['path'] = $item->path;
|
||||
$edit['title'] = $item->title;
|
||||
$edit['description'] = $item->description;
|
||||
$edit['weight'] = $item->weight;
|
||||
$edit['type'] = $item->type;
|
||||
}
|
||||
|
@ -253,6 +254,8 @@ function menu_edit_item_form($edit) {
|
|||
$form .= form_hidden('weight', 0);
|
||||
}
|
||||
else {
|
||||
$form .= form_textfield(t('Description'), 'description', $edit['description'], 60, 128, t('The description displayed when hovering over a menu item.'));
|
||||
|
||||
if ($edit['type'] & MENU_CREATED_BY_ADMIN) {
|
||||
$form .= form_textfield(t('Path'), 'path', $edit['path'], 60, 128);
|
||||
}
|
||||
|
@ -287,12 +290,12 @@ function menu_edit_item_form($edit) {
|
|||
*/
|
||||
function menu_edit_item_save($edit) {
|
||||
if ($edit['mid']) {
|
||||
db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', weight = %d, type = %d WHERE mid = %d", $edit['pid'], $edit['path'], $edit['title'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN, $edit['mid']);
|
||||
db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', description = '%s', weight = %d, type = %d WHERE mid = %d", $edit['pid'], $edit['path'], $edit['title'], $edit['description'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN, $edit['mid']);
|
||||
drupal_set_message(t('updated menu item "%title".', array('%title' => $edit['title'])));
|
||||
}
|
||||
else {
|
||||
$mid = db_next_id('{menu}_mid');
|
||||
db_query("INSERT INTO {menu} (mid, pid, path, title, weight, type) VALUES (%d, %d, '%s', '%s', %d, %d)", $mid, $edit['pid'], $edit['path'], $edit['title'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN);
|
||||
db_query("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (%d, %d, '%s', '%s', '%s', %d, %d)", $mid, $edit['pid'], $edit['path'], $edit['title'], $edit['description'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN);
|
||||
drupal_set_message(t('created new menu item "%title".', array('%title' => $edit['title'])));
|
||||
}
|
||||
|
||||
|
|
|
@ -224,6 +224,7 @@ function menu_edit_item($mid = 0) {
|
|||
$edit['pid'] = $item->pid;
|
||||
$edit['path'] = $item->path;
|
||||
$edit['title'] = $item->title;
|
||||
$edit['description'] = $item->description;
|
||||
$edit['weight'] = $item->weight;
|
||||
$edit['type'] = $item->type;
|
||||
}
|
||||
|
@ -253,6 +254,8 @@ function menu_edit_item_form($edit) {
|
|||
$form .= form_hidden('weight', 0);
|
||||
}
|
||||
else {
|
||||
$form .= form_textfield(t('Description'), 'description', $edit['description'], 60, 128, t('The description displayed when hovering over a menu item.'));
|
||||
|
||||
if ($edit['type'] & MENU_CREATED_BY_ADMIN) {
|
||||
$form .= form_textfield(t('Path'), 'path', $edit['path'], 60, 128);
|
||||
}
|
||||
|
@ -287,12 +290,12 @@ function menu_edit_item_form($edit) {
|
|||
*/
|
||||
function menu_edit_item_save($edit) {
|
||||
if ($edit['mid']) {
|
||||
db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', weight = %d, type = %d WHERE mid = %d", $edit['pid'], $edit['path'], $edit['title'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN, $edit['mid']);
|
||||
db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', description = '%s', weight = %d, type = %d WHERE mid = %d", $edit['pid'], $edit['path'], $edit['title'], $edit['description'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN, $edit['mid']);
|
||||
drupal_set_message(t('updated menu item "%title".', array('%title' => $edit['title'])));
|
||||
}
|
||||
else {
|
||||
$mid = db_next_id('{menu}_mid');
|
||||
db_query("INSERT INTO {menu} (mid, pid, path, title, weight, type) VALUES (%d, %d, '%s', '%s', %d, %d)", $mid, $edit['pid'], $edit['path'], $edit['title'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN);
|
||||
db_query("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (%d, %d, '%s', '%s', '%s', %d, %d)", $mid, $edit['pid'], $edit['path'], $edit['title'], $edit['description'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN);
|
||||
drupal_set_message(t('created new menu item "%title".', array('%title' => $edit['title'])));
|
||||
}
|
||||
|
||||
|
|
|
@ -775,7 +775,7 @@ function node_admin_nodes() {
|
|||
$header = array(NULL, t('title'), t('type'), t('author'), t('status'), array('data' => t('operations'), 'colspan' => 2));
|
||||
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$rows[] = array(form_checkbox(NULL, 'status]['. $node->nid, 1, 0), l($node->title, 'node/'. $node->nid) .' '. (node_is_new($node->nid, $node->changed) ? theme_mark() : ''), node_invoke($node, 'node_name'), format_name($node), ($node->status ? t('published') : t('not published')), l(t('edit %post', array('%post' => t($node->type))), 'node/'. $node->nid .'/edit'), l(t('delete %post', array('%post' => t($node->type))), 'admin/node/delete/'. $node->nid));
|
||||
$rows[] = array(form_checkbox(NULL, 'status]['. $node->nid, 1, 0), l($node->title, 'node/'. $node->nid) .' '. (node_is_new($node->nid, $node->changed) ? theme_mark() : ''), node_invoke($node, 'node_name'), format_name($node), ($node->status ? t('published') : t('not published')), l(t('edit'), 'node/'. $node->nid .'/edit'), l(t('delete'), 'admin/node/delete/'. $node->nid));
|
||||
}
|
||||
|
||||
if ($pager = theme('pager', NULL, 50, 0)) {
|
||||
|
|
|
@ -775,7 +775,7 @@ function node_admin_nodes() {
|
|||
$header = array(NULL, t('title'), t('type'), t('author'), t('status'), array('data' => t('operations'), 'colspan' => 2));
|
||||
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$rows[] = array(form_checkbox(NULL, 'status]['. $node->nid, 1, 0), l($node->title, 'node/'. $node->nid) .' '. (node_is_new($node->nid, $node->changed) ? theme_mark() : ''), node_invoke($node, 'node_name'), format_name($node), ($node->status ? t('published') : t('not published')), l(t('edit %post', array('%post' => t($node->type))), 'node/'. $node->nid .'/edit'), l(t('delete %post', array('%post' => t($node->type))), 'admin/node/delete/'. $node->nid));
|
||||
$rows[] = array(form_checkbox(NULL, 'status]['. $node->nid, 1, 0), l($node->title, 'node/'. $node->nid) .' '. (node_is_new($node->nid, $node->changed) ? theme_mark() : ''), node_invoke($node, 'node_name'), format_name($node), ($node->status ? t('published') : t('not published')), l(t('edit'), 'node/'. $node->nid .'/edit'), l(t('delete'), 'admin/node/delete/'. $node->nid));
|
||||
}
|
||||
|
||||
if ($pager = theme('pager', NULL, 50, 0)) {
|
||||
|
|
Loading…
Reference in New Issue