Index: taxonomy_ticker.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_ticker/taxonomy_ticker.module,v retrieving revision 1.17 diff -u -r1.17 taxonomy_ticker.module --- taxonomy_ticker.module 5 Nov 2006 16:55:11 -0000 1.17 +++ taxonomy_ticker.module 4 May 2007 23:04:47 -0000 @@ -1,9 +1,10 @@
'; - + // Removing the style tag from scrollPane breaks the scrolling functionality. + $block = '
'; + $type_q = ($type ? "n.type = '$type'" : 1); - $tid = variable_get("taxonomy_ticker_tid", 1); + $tid = variable_get("taxonomy_ticker_tid", 1); foreach ($tid as $key => $val) { $tid[$key] = "r.tid = '$val'"; } - if (!empty($tid)) $tids = "AND (" . join(" OR ", $tid) . ")"; - - $query = db_rewrite_sql("SELECT n.nid, n.title, n.type FROM {node} n LEFT JOIN {term_node} r ON r.nid = n.nid WHERE n.status = 1 " . $tids . " AND $type_q ORDER BY n.changed DESC"); - + if (!empty($tid)) $tids = "AND (". join(" OR ", $tid) .")"; + + $query = db_rewrite_sql("SELECT n.nid, n.title, n.type FROM {node} n LEFT JOIN {term_node} r ON r.nid = n.nid WHERE n.status = 1 ". $tids ." AND $type_q ORDER BY n.changed DESC"); + $results = db_query_range($query, 0, variable_get('taxonomy_ticker_count', 5)); - + $block .= '
'; - while ( $result = db_fetch_object($results) ) { - -/* The commented code that follows is an example of how to integrate taxonomy_ticker with - * a flexinode content-type, which could be used to show some html content instead of just - * displaying the title of the node... */ -/* + while ($result = db_fetch_object($results)) { + /** + * The commented code that follows is an example of how to integrate taxonomy_ticker with + * a flexinode content-type, which could be used to show some html content instead of just + * displaying the title of the node. + */ + /* $node = node_load(array('nid'=>$result->nid)); if ( $node->flexinode_2 != '' ) { // $block .= ""; $block .= "

$node->flexinode_2

"; } else { -*/ - if (variable_get('taxonomy_ticker_teaser', 0) == 1) { - $node = node_load(array('nid' => $result->nid)); - $teaser = '
' . $node->teaser; - } else $teaser = ''; - $block .= '

' . l($result->title, 'node/' . $result->nid) . $teaser . '

'; -/* + */ + if (variable_get('taxonomy_ticker_teaser', 0) == 1) { + $node = node_load(array('nid' => $result->nid)); + $teaser = '
'. $node->teaser; + } + else $teaser = ''; + $block .= '

'. l($result->title, 'node/'. $result->nid) . $teaser .'

'; + /* } -*/ + */ } - + $block .= '
'; - $block .= '
'; - + $block .= '
'; + return $block; } function taxonomy_ticker_block($op = 'list', $delta = 0, $edit = array()) { - switch($op) { - case 'list' : + switch ($op) { + case 'list': $blocks[0]['info'] = t('A ticker block'); return $blocks; - case 'view' : + + case 'view': $blocks["content"] = taxonomy_ticker_contents(); $blocks["subject"] = t('Ticker'); return $blocks; @@ -84,7 +90,7 @@ function taxonomy_ticker_menu($maycache) { $items = array(); - + if (!$may_cache) { $items[] = array( 'path' => 'admin/settings/taxonomy-ticker', @@ -96,24 +102,22 @@ 'type' => MENU_NORMAL_ITEM, ); } - + return $items; } function taxonomy_ticker_admin_settings() { - $form['taxonomy_ticker_tid'] = array( '#type' => 'select', '#title' => t('Terms'), '#default_value' => variable_get('taxonomy_ticker_tid', 1), '#options' => taxonomy_form_all(), - '#description' => /* $description = */ - t('Take nodes associated to the selected terms.'), - '#extra' => /* $extra = */ 0, - '#multiple' => /* $multiple = */ TRUE, - '#required' => /* $required = */ TRUE, + '#description' => t('Take nodes associated to the selected terms.'), + '#extra' => 0, + '#multiple' => TRUE, + '#required' => TRUE, ); - + $form['taxonomy_ticker_count'] = array( '#type' => 'textfield', '#title' => t('Number of items'), @@ -122,7 +126,7 @@ '#maxlength' => 3, '#description' => t('The number of items to display in the ticker.'), ); - + $form['taxonomy_ticker_direction'] = array( '#type' => 'select', '#title' => t('Direction of scroll'), @@ -130,7 +134,7 @@ '#options' => array(0 => t('Vertically'), 1 => t('Horizontally')), '#description' => t('The direction in which the items scroll in the ticker.'), ); - + $form['taxonomy_ticker_speed'] = array( '#type' => 'select', '#title' => t('Scroll Speed'), @@ -138,7 +142,7 @@ '#options' => array(1 => t('Super Fast'), 4 => t('Fast'), 8 => t('Standard'), 12 => t('Slow'), 16 => t('Super Slow')), '#description' => t('The speed in which the items scroll in the ticker.'), ); - + $form['taxonomy_ticker_teaser'] = array( '#type' => 'radios', '#title' => t('Include teaser'), @@ -146,8 +150,9 @@ '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('This option makes teasers appear under the titles (best used when scrolling vertically)'), ); - + return system_settings_form($form); } -?> + +