Index: taxonomy_context.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_context/taxonomy_context.info,v retrieving revision 1.2 diff -u -r1.2 taxonomy_context.info --- taxonomy_context.info 18 Jun 2007 22:54:02 -0000 1.2 +++ taxonomy_context.info 27 Feb 2008 23:16:36 -0000 @@ -1,3 +1,4 @@ ; $Id: taxonomy_context.info,v 1.2 2007/06/18 22:54:02 dww Exp $ name = Taxonomy context description = Adds description and child term information to taxonomy term pages, provides vocabulary pages, and generates a context-sensitive menu block for each vocabulary. +core = 6.x \ No newline at end of file Index: taxonomy_context.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_context/taxonomy_context.install,v retrieving revision 1.4 diff -u -r1.4 taxonomy_context.install --- taxonomy_context.install 18 Jan 2008 21:43:22 -0000 1.4 +++ taxonomy_context.install 27 Feb 2008 23:16:36 -0000Texting testing Markdown and TAOXNOMY Texting testing Markdown and TAOXNOMY @@ -5,40 +5,8 @@ * Implementation of hook_install(). */ function taxonomy_context_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {taxonomy_context_vocabulary} ( - vid int(10) unsigned NOT NULL default '0', - format int(4) NOT NULL default '0', - PRIMARY KEY (vid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - db_query("CREATE TABLE {taxonomy_context_term} ( - tid int(10) unsigned NOT NULL default '0', - format int(4) NOT NULL default '0', - PRIMARY KEY (tid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - break; - case 'pgsql': - db_query("CREATE TABLE {taxonomy_context_vocabulary} ( - vid integer NOT NULL default '0', - format int NOT NULL default '0', - PRIMARY KEY (vid) - )"); - db_query("CREATE TABLE {taxonomy_context_term} ( - tid integer NOT NULL default '0', - format int NOT NULL default '0', - PRIMARY KEY (tid) - )"); - break; - } -} - -/** - * Assign needed tables to pre-existing sites. - */ -function taxonomy_context_update_1() { - taxonomy_context_install(); + // create tables + drupal_install_schema('taxonomy_context'); } /** @@ -47,14 +15,36 @@ * Removes module's database tables and variables. */ function taxonomy_context_uninstall() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - case 'pgsql': - // delete module settings from database - db_query("DROP TABLE IF EXISTS {taxonomy_context_vocabulary}"); - db_query("DROP TABLE IF EXISTS {taxonomy_context_term}"); - db_query("DELETE FROM {variable} WHERE name LIKE 'taxonomy_context_%'"); - break; - } + drupal_uninstall_schema('taxonomy_context'); + db_query("DELETE FROM {variable} WHERE name LIKE 'taxonomy_context_%'"); +} + +/** + * Implementation of hook_schema(). + */ +function taxonomy_context_schema() { + $schema['taxonomy_context_vocabulary'] = array( + 'fields' => array( + 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + ), + 'primary key' => array('vid'), + ); + + $schema['taxonomy_context_term'] = array( + 'fields' => array( + 'tid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + ), + 'primary key' => array('tid'), + ); + + return $schema; +} + +/** + * Assign needed tables to pre-existing sites. + */ +function taxonomy_context_update_1() { + taxonomy_context_install(); } \ No newline at end of file Index: taxonomy_context.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_context/taxonomy_context.module,v retrieving revision 1.82 diff -u -r1.82 taxonomy_context.module --- taxonomy_context.module 18 Jan 2008 21:47:15 -0000 1.82 +++ taxonomy_context.module 27 Feb 2008 23:16:37 -0000 @@ -31,43 +31,46 @@ */ define('TAXONOMY_CONTENT_BLOCK_DISPLAY_EXPANDED', 1); +/** Implementation of hook_init() + * + */ +function taxonomy_context_init() { + static $taxonomy_context_css_inserted = FALSE; + if (variable_get('taxonomy_context_use_style', 1) && !$taxonomy_context_css_inserted) { + drupal_add_css(drupal_get_path('module', 'taxonomy_context') . '/taxonomy_context.css'); + $taxonomy_context_css_inserted = TRUE; + } +} + /** * Implementation of hook_menu() */ -function taxonomy_context_menu($may_cache) { +function taxonomy_context_menu() { $items = array(); - if ($may_cache) { - $items[] = array( - 'path' => 'admin/settings/taxonomy_context', - 'title' => t('Taxonomy Context'), - 'description' => t('Set display options.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('taxonomy_context_admin_settings'), - 'access' => user_access('administer site configuration'), - ); - $items[] = array( - 'path' => 'taxonomy/vocabulary', - 'title' => t('Categories'), - 'callback' => 'taxonomy_context_vocabulary_page', - 'access' => user_access('access content'), - 'type' => MENU_SUGGESTED_ITEM, - ); - $items[] = array( - 'path' => 'activemenu/tc', - 'title' => t('activemenu tc'), - 'access' => user_access('access content'), - 'type' => MENU_CALLBACK, - 'callback' => 'taxonomy_context_js', - ); - } - else { - static $taxonomy_context_css_inserted = FALSE; - if (variable_get('taxonomy_context_use_style', 1) && !$taxonomy_context_css_inserted) { - drupal_add_css(drupal_get_path('module', 'taxonomy_context') . '/taxonomy_context.css'); - $taxonomy_context_css_inserted = TRUE; - } - } + $items['admin/settings/taxonomy_context'] = array( + 'title' => 'Taxonomy Context', + 'description' => 'Set display options.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('taxonomy_context_admin_settings'), + 'access callback' => 'user_access', + 'access arguments' => array('administer site configuration'), + ); + $items['taxonomy/vocabulary'] = array( + 'title' => 'Categories', + 'page callback' => 'taxonomy_context_vocabulary_page', + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + 'type' => MENU_SUGGESTED_ITEM, + ); + $items['activemenu/tc'] = array( + 'title' => 'activemenu tc', + 'page callback' => 'taxonomy_context_js', + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + ); + return $items; } @@ -133,7 +136,7 @@ return; } - $vocabulary = taxonomy_get_vocabulary($delta); + $vocabulary = taxonomy_vocabulary_load($delta); $block['subject'] = check_plain($vocabulary->name); $block['content'] = taxonomy_context_menu_tree($delta, NULL, TRUE) . "\n"; @@ -144,7 +147,7 @@ /** * Implementation of hook_help(). */ -function taxonomy_context_help($section) { +function taxonomy_context_help($path, $arg) { // If we're on a 2nd or subsequent page, don't show taxonomy info. if (arg(0) == 'taxonomy' && empty($_GET['from'])) { $context = taxonomy_context_get_context(); @@ -162,7 +165,7 @@ return $output; } - switch ($section) { + switch ($path) { case 'admin/help#taxonomy_context': $output .= t('

This module can be used to output title and description of the current taxonomy term plus child nodes of that term.

'); break; @@ -198,7 +201,7 @@ /** * Implementation of hook_form_alter(). */ -function taxonomy_context_form_alter($form_id, &$form) { +function taxonomy_context_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'node_type_form' && isset($form['identity']['type'])) { $options = array(t('Disabled'), t('Enabled')); $form['taxonomy_context'] = array('#type' => 'fieldset', '#title' => t('Taxonomy context'), '#weight' => 0); @@ -254,7 +257,7 @@ ); $vocabularies = taxonomy_get_vocabularies($node->type); foreach ($vocabularies as $vocabulary) { - if ($vocabulary->terms = taxonomy_node_get_terms_by_vocabulary($node->nid, $vocabulary->vid)) { + if ($vocabulary->terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid)) { $node->content['taxonomy_context_taxonomy']['#value'] .= theme('taxonomy_context_vocabulary_list', $vocabulary); } } @@ -329,7 +332,7 @@ if (! isset($breadcrumb[$cache_index])) { $breadcrumb[$cache_index][] = l(t('Home'), ''); - $vocabulary = taxonomy_get_vocabulary($context->vid); + $vocabulary = taxonomy_vocabulary_load($context->vid); $breadcrumb[$cache_index][] = l($vocabulary->name, 'taxonomy/vocabulary/' . $context->vid); $parents = taxonomy_get_parents_all($context->tid); if ($parents) { @@ -359,7 +362,7 @@ } else { $vocabularies = array(); - $vocabularies[] = taxonomy_get_vocabulary($vid); + $vocabularies[] = taxonomy_vocabulary_load($vid); } foreach ($vocabularies as $vocabulary) { taxonomy_context_load('vocabulary', $vocabulary); @@ -625,6 +628,26 @@ } /** + * Implementation of hook_theme(). + */ +function taxonomy_context_theme() { + return array( + 'taxonomy_context_subterms' => array( + 'arguments' => array('terms'), + ), + 'taxonomy_context_term' => array( + 'arguments' => array('term'), + ), + 'taxonomy_context_vocabulary' => array( + 'arguments' => array('vocabulary'), + ), + 'taxonomy_context_vocabulary_list' => array( + 'arguments' => array('vocabulary'), + ), + ); +} + +/** * Theme a term output. */ function theme_taxonomy_context_term($term) {