/[drupal]/contributions/modules/localizer/patches/taxonomy.patch
ViewVC logotype

Contents of /contributions/modules/localizer/patches/taxonomy.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1.2.1 - (show annotations) (download) (as text)
Mon Dec 18 08:52:46 2006 UTC (2 years, 11 months ago) by robertogerola
Branch: DRUPAL-4-7--2
CVS Tags: DRUPAL-4-7--2-1
Changes since 1.1: +134 -0 lines
File MIME type: text/x-patch
Initial commit
1 --- modules/taxonomy.module.orig 2006-10-17 21:01:51.000000000 +0200
2 +++ modules/taxonomy.module 2006-12-18 09:42:38.000000000 +0100
3 @@ -153,6 +153,7 @@ function taxonomy_overview_terms($vid) {
4
5 $header = array(t('Name'), t('Operations'));
6 $vocabulary = taxonomy_get_vocabulary($vid);
7 + taxonomy_translate('vocabulary', $vocabulary);
8
9 drupal_set_title(check_plain($vocabulary->name));
10 $start_from = $_GET['page'] ? $_GET['page'] : 0;
11 @@ -162,6 +163,7 @@ function taxonomy_overview_terms($vid) {
12
13 $tree = taxonomy_get_tree($vocabulary->vid);
14 foreach ($tree as $term) {
15 + taxonomy_translate('term', $term);
16 $total_entries++; // we're counting all-totals, not displayed
17 if (($start_from && ($start_from * $page_increment) >= $total_entries) || ($displayed_count == $page_increment)) { continue; }
18 $rows[] = array(_taxonomy_depth($term->depth) . ' ' . l($term->name, "taxonomy/term/$term->tid"), l(t('edit'), "admin/taxonomy/edit/term/$term->tid", array(), $destination));
19 @@ -536,6 +538,7 @@ function taxonomy_term_confirm_delete_su
20 */
21 function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') {
22 $vocabulary = taxonomy_get_vocabulary($vid);
23 + taxonomy_translate('vocabulary', $vocabulary);
24 $help = ($help) ? $help : $vocabulary->help;
25 if ($vocabulary->required) {
26 $blank = 0;
27 @@ -584,6 +587,7 @@ function taxonomy_get_vocabularies($type
28 $vocabularies = array();
29 $node_types = array();
30 while ($voc = db_fetch_object($result)) {
31 + taxonomy_translate('vocabulary', $voc);
32 $node_types[$voc->vid][] = $voc->type;
33 unset($voc->type);
34 $voc->nodes = $node_types[$voc->vid];
35 @@ -673,6 +677,7 @@ function taxonomy_node_get_terms_by_voca
36 $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight', 't', 'tid'), $vid, $nid);
37 $terms = array();
38 while ($term = db_fetch_object($result)) {
39 + taxonomy_translate('term', $term);
40 $terms[$term->$key] = $term;
41 }
42 return $terms;
43 @@ -688,6 +693,7 @@ function taxonomy_node_get_terms($nid, $
44 $result = db_query(db_rewrite_sql('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), $nid);
45 $terms[$nid] = array();
46 while ($term = db_fetch_object($result)) {
47 + taxonomy_translate('term', $term);
48 $terms[$nid][$term->$key] = $term;
49 }
50 }
51 @@ -800,6 +806,7 @@ function taxonomy_get_related($tid, $key
52 $result = db_query('SELECT t.*, tid1, tid2 FROM {term_relation}, {term_data} t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = %d OR tid2 = %d) AND t.tid != %d ORDER BY weight, name', $tid, $tid, $tid);
53 $related = array();
54 while ($term = db_fetch_object($result)) {
55 + taxonomy_translate('term', $term);
56 $related[$term->$key] = $term;
57 }
58 return $related;
59 @@ -817,6 +824,7 @@ function taxonomy_get_parents($tid, $key
60 $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.parent = t.tid WHERE h.tid = %d ORDER BY weight, name', 't', 'tid'), $tid);
61 $parents = array();
62 while ($parent = db_fetch_object($result)) {
63 + taxonomy_translate('term', $parent);
64 $parents[$parent->$key] = $parent;
65 }
66 return $parents;
67 @@ -854,6 +862,7 @@ function taxonomy_get_children($tid, $vi
68 }
69 $children = array();
70 while ($term = db_fetch_object($result)) {
71 + taxonomy_translate('term', $term);
72 $children[$term->$key] = $term;
73 }
74 return $children;
75 @@ -891,6 +900,7 @@ function taxonomy_get_tree($vid, $parent
76
77 $result = db_query(db_rewrite_sql('SELECT t.tid, t.*, parent FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $vid);
78 while ($term = db_fetch_object($result)) {
79 + taxonomy_translate('term', $term);
80 $children[$vid][$term->parent][] = $term->tid;
81 $parents[$vid][$term->tid][] = $term->parent;
82 $terms[$vid][$term->tid] = $term;
83 @@ -955,6 +965,7 @@ function taxonomy_term_count_nodes($tid,
84 $result = db_query(db_rewrite_sql("SELECT t.tid, COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 AND n.type = '%s' GROUP BY t.tid"), $type);
85 }
86 while ($term = db_fetch_object($result)) {
87 + taxonomy_translate('term', $term);
88 $count[$type][$term->tid] = $term->c;
89 }
90 }
91 @@ -996,6 +1007,7 @@ function taxonomy_get_term_by_name($name
92 $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER('%s') LIKE LOWER(t.name)", 't', 'tid'), trim($name));
93 $result = array();
94 while ($term = db_fetch_object($db_result)) {
95 + taxonomy_translate('term', $term);
96 $result[] = $term;
97 }
98
99 @@ -1027,7 +1039,9 @@ function taxonomy_get_vocabulary($vid) {
100 */
101 function taxonomy_get_term($tid) {
102 // simple cache using a static var?
103 - return db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
104 + $term = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
105 + taxonomy_translate('term', $term);
106 + return $term;
107 }
108
109 function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) {
110 @@ -1210,6 +1224,7 @@ function taxonomy_term_page($str_tids =
111 $tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to.
112 $names = array();
113 while ($term = db_fetch_object($result)) {
114 + taxonomy_translate('term', $term);
115 $tids[] = $term->tid;
116 $names[] = $term->name;
117 }
118 @@ -1352,6 +1367,7 @@ function taxonomy_autocomplete($vid, $st
119
120 $matches = array();
121 while ($tag = db_fetch_object($result)) {
122 + taxonomy_translate('term', $tag);
123 $n = $tag->name;
124 // Commas and quotes in terms are special cases, so encode 'em.
125 if (preg_match('/,/', $tag->name) || preg_match('/"/', $tag->name)) {
126 @@ -1363,3 +1379,8 @@ function taxonomy_autocomplete($vid, $st
127 exit();
128 }
129 }
130 +
131 +function taxonomy_translate($object_type, &$object) {
132 + module_invoke_all('taxonomy', 'translate', $object_type, $object);
133 +}
134 +

  ViewVC Help
Powered by ViewVC 1.1.2