diff options
Diffstat (limited to 'modules/taxonomy')
-rw-r--r-- | modules/taxonomy/taxonomy.admin.inc | 4 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index b6734906e..cb58d93c7 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -180,7 +180,7 @@ function taxonomy_overview_terms($vocabulary) { if ($vocabulary->tags) { // We are not calling taxonomy_get_tree because that might fail with a big // number of tags in the freetagging vocabulary. - $results = pager_query(db_rewrite_sql('SELECT t.*, h.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'), $page_increment, 0, NULL, $vid); + $results = pager_query(db_rewrite_sql('SELECT t.*, h.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'), $page_increment, 0, NULL, $vocabulary->vid); while ($term = db_fetch_object($results)) { $rows[] = array( l($term->name, "taxonomy/term/$term->tid"), @@ -207,7 +207,7 @@ function taxonomy_overview_terms($vocabulary) { $GLOBALS['pager_total'][] = intval($total_entries / $page_increment) + 1; // FIXME } - $output .= theme('table', $header, $rows, array('id' => 'taxonomy')); + $output = theme('table', $header, $rows, array('id' => 'taxonomy')); if ($vocabulary->tags || $total_entries >= $page_increment) { $output .= theme('pager', NULL, $page_increment); } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 3fc560c22..fe8547bee 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -165,8 +165,12 @@ function taxonomy_menu() { function taxonomy_save_vocabulary(&$edit) { $edit['nodes'] = empty($edit['nodes']) ? array() : $edit['nodes']; + if (!isset($edit['module'])) { + $edit['module'] = 'taxonomy'; + } + if (!empty($edit['vid']) && !empty($edit['name'])) { - db_query("UPDATE {vocabulary} SET name = '%s', description = '%s', help = '%s', multiple = %d, required = %d, hierarchy = %d, relations = %d, tags = %d, weight = %d, module = '%s' WHERE vid = %d", $edit['name'], $edit['description'], $edit['help'], $edit['multiple'], $edit['required'], $edit['hierarchy'], $edit['relations'], $edit['tags'], $edit['weight'], isset($edit['module']) ? $edit['module'] : 'taxonomy', $edit['vid']); + drupal_write_record('vocabulary', $edit, 'vid'); db_query("DELETE FROM {vocabulary_node_types} WHERE vid = %d", $edit['vid']); foreach ($edit['nodes'] as $type => $selected) { db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type); @@ -178,8 +182,7 @@ function taxonomy_save_vocabulary(&$edit) { $status = taxonomy_del_vocabulary($edit['vid']); } else { - db_query("INSERT INTO {vocabulary} (name, description, help, multiple, required, hierarchy, relations, tags, weight, module) VALUES ('%s', '%s', '%s', %d, %d, %d, %d, %d, %d, '%s')", $edit['name'], isset($edit['description']) ? $edit['description'] : NULL, isset($edit['help']) ? $edit['help'] : NULL, $edit['multiple'], $edit['required'], $edit['hierarchy'], $edit['relations'], isset($edit['tags']) ? $edit['tags'] : NULL, $edit['weight'], isset($edit['module']) ? $edit['module'] : 'taxonomy'); - $edit['vid'] = db_last_insert_id('vocabulary', 'vid'); + drupal_write_record('vocabulary', $edit); foreach ($edit['nodes'] as $type => $selected) { db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type); } @@ -231,7 +234,7 @@ function taxonomy_save_term(&$form_values) { ); if (!empty($form_values['tid']) && $form_values['name']) { - db_query("UPDATE {term_data} SET name = '%s', description = '%s', weight = %d WHERE tid = %d", $form_values['name'], $form_values['description'], $form_values['weight'], $form_values['tid']); + drupal_write_record('term_data', $form_values, 'tid'); $hook = 'update'; $status = SAVED_UPDATED; } @@ -239,8 +242,7 @@ function taxonomy_save_term(&$form_values) { return taxonomy_del_term($form_values['tid']); } else { - db_query("INSERT INTO {term_data} (name, description, vid, weight) VALUES ('%s', '%s', %d, %d)", $form_values['name'], $form_values['description'], $form_values['vid'], $form_values['weight']); - $form_values['tid'] = db_last_insert_id('term_data', 'tid'); + drupal_write_record('term_data', $form_values); $hook = 'insert'; $status = SAVED_NEW; } |