Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/newsticker/README.txt,v
retrieving revision 1.2
diff -u -r1.2 README.txt
--- README.txt	16 May 2008 21:04:39 -0000	1.2
+++ README.txt	1 Dec 2008 21:02:33 -0000
@@ -1,4 +1,4 @@
-$Id: README.txt,v 1.2 2008/05/16 21:04:39 loubabe Exp $
+$Id$
 Newsticker provides the ability to add and manage newsticker items consisting of a Title, Link, and Weight.  You can choose from several transition effects and speeds and the ticker can be displayed in a block.
 
 Big thanks to Mike Alsup for the JCycle library (http://malsup.com/jquery/cycle/) and the URL validation from the link module.
@@ -6,6 +6,4 @@
 Installing Newsticker:
   Download the Newsticker release for your version.
   Untar it in the modules directory.
-  Activate the module through drupals administrative interface.
-  
-Requires a new version of JQuery, so jquery_update is required.
\ No newline at end of file
+  Activate the module through drupals administrative interface.
\ No newline at end of file
Index: newsticker.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/newsticker/newsticker.info,v
retrieving revision 1.2
diff -u -r1.2 newsticker.info
--- newsticker.info	16 May 2008 21:04:39 -0000	1.2
+++ newsticker.info	26 Nov 2008 18:16:18 -0000
@@ -1,4 +1,4 @@
-; $Id: newsticker.info,v 1.2 2008/05/16 21:04:39 loubabe Exp $
+; $Id$
 name = Newsticker
 description = Enables a basic news ticker with transition effects.
-dependencies = jquery_update
\ No newline at end of file
+core = 6.x
Index: newsticker.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/newsticker/newsticker.install,v
retrieving revision 1.2
diff -u -r1.2 newsticker.install
--- newsticker.install	3 Aug 2008 19:27:42 -0000	1.2
+++ newsticker.install	1 Dec 2008 17:06:39 -0000
@@ -1,28 +1,58 @@
 <?php
-// $Id: newsticker.install,v 1.2 2008/08/03 19:27:42 loubabe Exp $
+// $Id$
 
 /**
  * Implementation of hook_uninstall().
  */
 function newsticker_uninstall() {
-  $result = db_query('DROP TABLE {newsticker_item}');
+  drupal_uninstall_schema('newsticker');
 }
 
+/**
+ * Implementation of hook_install().
+ */
 function newsticker_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {newsticker_item} (
-                ntid int(10) unsigned NOT NULL default '0',
-                title varchar(255) NOT NULL default '',
-                link text NULL default '',
-                weight tinyint(4) NOT NULL default '0',
-                PRIMARY KEY (ntid)
-               ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
+  drupal_install_schema('newsticker');
+}
 
-      break;
+function newsticker_schema() {
+  $schema['newsticker_item'] = array(
+    'description' => t('Enables a basic news ticker with transition effects.'),
+    'fields' => array(
+      'ntid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'description' => t('News ticker ID.')
+      ),
+      'title' => array(
+        'type' => 'varchar',
+        'length' => 256,
+        'not null' => TRUE,
+        'default' => '',
+        'description' => t('Title')
+      ),
+      'link' => array(
+        'type' => 'varchar',
+        'length' => 512,
+        'not null' => TRUE,
+        'default' => '',
+        'description' => t('Link')
+      ),
+      'weight' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => t('Weight')
+      ),
+    ),
+    'indexes' => array('ntid' => array('ntid')),
+    'primary key' => array('ntid'),
+  );
+
+  return $schema;
+}
 
-    case 'pgsql':
-      break;
-   }
+function newsticker_update_1() {
+  variable_del('newsticker_effect');
 }
\ No newline at end of file
Index: newsticker.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/newsticker/newsticker.module,v
retrieving revision 1.5
diff -u -r1.5 newsticker.module
--- newsticker.module	13 Aug 2008 21:02:03 -0000	1.5
+++ newsticker.module	1 Dec 2008 17:16:10 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: newsticker.module,v 1.5 2008/08/13 21:02:03 loubabe Exp $
+// $Id$
 
 define('LINK_EXTERNAL', 'external');
 define('LINK_INTERNAL', 'internal');
@@ -14,77 +14,87 @@
   return array('create newsticker item', 'edit newsticker item', 'edit own newsticker item', 'administer newsticker');
 }
 
-function newsticker_menu($may_cache){
+function newsticker_menu() {
   $items = array();
+  $items['admin/build/newsticker'] = array(
+    'title' => 'Newsticker',
+    'page callback' => 'newsticker_items_list',
+    'access callback' => 'newsticker_list_access',
+  );
+  $items['admin/build/newsticker/list'] = array(
+    'title' => 'List',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -10
+  );
+  $items['admin/build/newsticker/add'] = array(
+    'title' => 'Add Newsticker Item',
+    'page callback' => 'newsticker_item_edit',
+    'access arguments' => array('create newsticker item'),
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/build/newsticker/settings'] = array(
+    'title' => 'Newsticker Settings',
+    'description' => 'Adjust settings for the Newsticker',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('newsticker_settings'),
+    'access arguments' => array('administer newsticker'),
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['newsticker/%/edit'] = array(
+    'title' => 'Edit',
+    'page callback' => 'newsticker_item_edit',
+    'page arguments' => array(1),
+    'access callback' => 'newsticker_edit_access',
+    'type' => MENU_CALLBACK);
+  $items['newsticker/%/delete'] = array(
+    'title' => 'Delete',
+    'page callback' => 'newsticker_item_delete',
+    'page arguments' => array(1),
+    'access callback' => 'newsticker_edit_access',
+    'type' => MENU_CALLBACK);
 
-  if($may_cache){
-    $items[] = array(
-      'path' => 'admin/build/newsticker',
-      'title' => t('Newsticker'),
-      'callback' => 'newsticker_items_list',
-      'access' => user_access('edit newsticker item') || user_access('edit own newsticker item') || user_access('create newsticker item') ,
-    );
-    $items[] = array('path' => 'admin/build/newsticker/list', 'title' => t('List'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);    
-    $items[] = array(
-      'path' => 'admin/build/newsticker/add',
-      'title' => t('Add Newsticker Item'),
-      'callback' => 'newsticker_item_edit',
-      'access' => user_access('create newsticker item'),
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'admin/build/newsticker/settings',
-      'title' => t('Newsticker Settings'),
-      'description' => t('Adjust settings for the Newsticker.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('newsticker_settings'),
-      'access' => user_access('administer newsticker'),
-      'type' => MENU_LOCAL_TASK,
-    );    
-  }
-  else{
-    $items[] = array(
-      'path' => 'newsticker/'. arg(1) .'/edit', 
-      'title' => t('Edit'),
-      'callback' => 'newsticker_item_edit',
-      'callback arguments' => array(arg(1)),
-      'access' => user_access('edit newsticker item') || user_access('edit own newsticker item'),
-      'type' => MENU_CALLBACK);
-    $items[] = array(
-      'path' => 'newsticker/'. arg(1) .'/delete', 
-      'title' => t('Delete'),
-      'callback' => 'newsticker_item_delete',
-      'callback arguments' => array(arg(1)),
-      'access' => user_access('edit newsticker item') || user_access('edit own newsticker item'),
-      'type' => MENU_CALLBACK);    
-  }
-
-  return $items;  
+  return $items;
+}
+
+
+function newsticker_list_access() {
+  return user_access('edit newsticker item') || user_access('edit own newsticker item') || user_access('create newsticker item');
+}
+
+function newsticker_edit_access() {
+  return user_access('edit newsticker item') || user_access('edit own newsticker item');
 }
 
+function _newsticker_access () {
 
-function newsticker_settings(){
-  $options = array('fade' => t('fade'), 'shuffle' => t('shuffle'), 'zoom' => t('zoom'), 'slideX' => t('slideX'), 'slideY' => t('slideY'), 'scrollUp' => t('scrollUp'), 'scrollDown' => t('scrollDown'), 'scrollLeft' => t('scrollLeft'), 'scrollRight' => t('scrollRight'));
-  $form['newsticker_effect'] = array(
-    '#type' => 'select',
-    '#options' => $options,
-    '#title' => t('Transition Effect'),
-    '#default_value' => variable_get('newsticker_effect', 'fade'),
+}
+
+function newsticker_settings() {
+  $form['newsticker_timeout'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Set the time between transitions'),
+    '#default_value' => variable_get('newsticker_timeout', 4000),
+    '#description' => t('Milliseconds between slide transitions.'),
   );
   $form['newsticker_speed'] = array(
     '#type' => 'textfield',
     '#title' => t('Set the speed of the rotator'),
-    '#default_value' => variable_get('newsticker_speed', 4000),
-    '#description' => t('Milliseconds between slide transitions (0 to disable auto advance).'),
-  );  
+    '#default_value' => variable_get('newsticker_speed', 1000),
+    '#description' => t('Duration of the transition in miliseconds. Lower values will make the text move faster.'),
+  );
   $form['newsticker_pause'] = array(
     '#type' => 'checkbox',
     '#title' => t('Pause on hover'),
     '#default_value' => variable_get('newsticker_pause', 1),
     '#description' => t('True to pause when hovering over Newsticker.'),
-  ); 
-  return system_settings_form($form);  
+  );
+  $form['newsticker_continous'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Continous'),
+    '#default_value' => variable_get('newsticker_continous', 0),
+    '#description' => t('True to start next transition immediately after current one completes.'),
+  );
+  return system_settings_form($form);
 }
 
 
@@ -92,10 +102,10 @@
   return drupal_get_form('newsticker_item_form', $ntid);
 }
 
-function newsticker_item_form($ntid = NULL){
+function newsticker_item_form($ntid = NULL) {
   $form = array();
   $item = $ntid ? db_fetch_array(db_query('SELECT * FROM {newsticker_item} WHERE ntid = %d', $ntid)) : NULL;
-  
+
   $form['title'] = array(
     '#type'          => 'textfield',
     '#title'         => t('Title'),
@@ -107,83 +117,82 @@
     '#title'         => t('Link'),
     '#required'      => FALSE,
     '#default_value' => $item['link'],
-  );    
+  );
   $form['weight'] = array(
     '#title' => t('Weight'),
-    '#type' => 'weight', 
+    '#type' => 'weight',
     '#default_value' => $item['weight'],
-  );  
-  
-  if ($item) { 
+  );
+
+  if ($item) {
     $form['ntid'] = array(
-      '#type'            => 'hidden', 
+      '#type'            => 'hidden',
       '#default_value'   => $item['ntid'],
-    ); 
+    );
   }
-  
+
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Submit Item'),
   );
 
-  
+
   return $form;
 }
 
-function newsticker_item_form_validate($form_id, $form_values){
-  if(trim($form_values['link']) != '' && !newsticker_validate_url($form_values['link']))
+function newsticker_item_form_validate($form, &$form_state) {
+  if (trim($form_state['values']['link']) != '' && !newsticker_validate_url($form_state['values']['link']))
     form_set_error('link', t('Please ensure you entered a valid link.'));
 }
 
-function newsticker_item_form_submit($form_id, $form_values){
-  $ntid = $form_values['ntid'] ? $form_values['ntid'] : NULL;
-  $link = newsticker_cleanup_url($form_values['link']);
-  if(!$ntid){
-    $result = db_query("INSERT INTO {newsticker_item} (ntid, title, link, weight) VALUES (%d, '%s', '%s', %d)", db_next_id('{newsticker_item}_ntid'), $form_values['title'], $link, $form_values['weight']);
+function newsticker_item_form_submit($form, &$form_state) {
+  $ntid = $form_state['values']['ntid'] ? $form_state['values']['ntid'] : NULL;
+  $link = newsticker_cleanup_url($form_state['values']['link']);
+  if (!$ntid) {
+    $result = db_query("INSERT INTO {newsticker_item} (ntid, title, link, weight) VALUES (%d, '%s', '%s', %d)", '', $form_state['values']['title'], $link, $form_state['values']['weight']);
     $msg = 'Newsticker item created.';
   }
-  else{
-    $result = db_query("UPDATE {newsticker_item} set title = '%s', link = '%s', weight = %d WHERE ntid = %d", $form_values['title'], $link, $form_values['weight'], $ntid);
+  else {
+    $result = db_query("UPDATE {newsticker_item} set title = '%s', link = '%s', weight = %d WHERE ntid = %d", $form_state['values']['title'], $link, $form_state['values']['weight'], $ntid);
     $msg = 'Newsticker item updated.';
   }
-  
-  if($result){
+
+  if ($result) {
     drupal_set_message($msg);
     drupal_goto('admin/build/newsticker');
   }
 }
 
 
-function newsticker_items_list(){
+function newsticker_items_list() {
   $result = db_query('SELECT ntid, weight, title, link FROM {newsticker_item} ORDER BY weight');
-  if($result){
+  if ($result) {
     $headers = array(
       array('data' => t('Weight')),
       array('data' => t('Title')),
       array('data' => t('Link')),
       array('data' => t('Operations')),
     );
-    
+
     $rows = array();
-    while($item = db_fetch_array($result)){
-      $rows[] = array($item['weight'], $item['title'], l($item['link'], $item['link']), 
-        l('edit', 'newsticker/'.$item['ntid'].'/edit') . ' | ' . l('delete', 'newsticker/'.$item['ntid'].'/delete'));
+    while ($item = db_fetch_array($result)) {
+      $rows[] = array($item['weight'], $item['title'], l($item['link'], $item['link']),
+        l('edit', 'newsticker/'. $item['ntid'] .'/edit') .' | '. l('delete', 'newsticker/'. $item['ntid'] .'/delete'));
     }
-    
+
     $output = theme('table', $headers, $rows, array('id' => 'newsticker_item_list'));
-   }
-  
+  }
   return $output;
 }
 
-function newsticker_item_delete($ntid){
+function newsticker_item_delete($ntid) {
   $result = db_query('DELETE FROM {newsticker_item} WHERE ntid = %d', $ntid);
   drupal_set_message('Newsticker item deleted.');
   drupal_goto('admin/build/newsticker');
 }
 
 function newsticker_block($op = 'list', $delta = 0, $edit = array()) {
-  switch($op){
+  switch ($op) {
     case 'list':
       $blocks[0] = array(
         'info' => t('Newsticker Items'),
@@ -199,23 +208,46 @@
   }
 }
 
-function newsticker_get_rotator(){
+function newsticker_get_rotator() {
   $result = db_query('SELECT title, link FROM {newsticker_item} ORDER BY weight');
 
-  if($result){
-    drupal_add_js(drupal_get_path('module', 'newsticker') . '/jcycle.js');
-    drupal_add_js("$(function() { $('div#newsticker').cycle({fx: '". variable_get('newsticker_effect', 'fade') ."', timeout: ". variable_get('newsticker_speed', 4000) .", pause: ". variable_get('newsticker_pause', 1) ."}); });", 'inline');
-    
+  if ($result) {
+    $pause = '';
+    if (variable_get('newsticker_pause', 1)) {
+      $pause = "
+        $('#newsticker').hover(function(){
+            $(this).stop().trigger('stop');
+        },function(){
+            $(this).stop().trigger('start');
+        });
+      ";
+    }
+
+    drupal_add_js(drupal_get_path('module', 'newsticker') .'/jquery.scrollTo.js');
+    drupal_add_js(drupal_get_path('module', 'newsticker') .'/jquery.serialScroll.js');
+    drupal_add_js("jQuery(function( $ ) {
+      $('#newsticker').serialScroll({
+          items: 'li',
+          start: 0,
+          force: true,
+          step: 1,
+          axis:'x',
+          cycle: ". variable_get('newsticker_continous', 1) .",
+          interval: ". variable_get('newsticker_timeout', 1000) .",
+          duration: ". variable_get('newsticker_speed', 1000) ."
+      });
+    ". $pause ."});", 'inline');
+
     $output = '';
     while ($item = db_fetch_array($result)) {
-      if(trim($item['link']) != '' )
-        $content = l($item['title'], $item['link']);
+      if (trim($item['link']) != '' )
+        $content = '<a href="'. $item['link'] .'">'. $item['title'] .'</a>';
       else
         $content = $item['title'];
-        
-      $output .= '<div class="newsticker-item">' . $content . '</div>';
+
+      $output .= '<li class="newsticker-item">'. $content .'</li>';
     }
-    return '<div id="newsticker">' . $output . '</div>';
+    return '<div id="newsticker"><ul>'. $output .'</ul></div>';
   }
 }
 
@@ -229,49 +261,49 @@
 function newsticker_cleanup_url($url, $protocol = "http") {
   $url = trim($url);
   $type = newsticker_validate_url($url);
-    
+
   if ($type == LINK_EXTERNAL) {
     // Check if there is no protocol specified
-    $protocol_match = preg_match("/^([a-z0-9][a-z0-9\.\-_]*:\/\/)/i",$url);
+    $protocol_match = preg_match("/^([a-z0-9][a-z0-9\.\-_]*:\/\/)/i", $url);
     if (empty($protocol_match)) {
       // But should there be? Add an automatic http:// if it starts with a domain name
-      $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)('. LINK_DOMAINS .'|[a-z]{2}))/i',$url);
+      $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)('. LINK_DOMAINS .'|[a-z]{2}))/i', $url);
       if (!empty($domain_match)) {
-        $url = $protocol."://".$url;
+        $url = $protocol ."://". $url;
       }
     }
   }
-  
+
   return $url;
 }
 
 function newsticker_validate_url($text) {
-  
+
   $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'));
-  
-  $protocol = '((' . implode("|", $allowed_protocols) . '):\/\/)';
+
+  $protocol = '(('. implode("|", $allowed_protocols) .'):\/\/)';
   $authentication = '([a-z0-9]+(:[a-z0-9]+)?@)';
   $domain = '(([a-z0-9]([a-z0-9\-_\[\]]*\.)+)('. LINK_DOMAINS .'|[a-z]{2}))';
-  $ipv4 = '([0-9]{1,3}(\.[0-9]{1,3}){3})'; 
-  $ipv6 = '([0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7})'; 
+  $ipv4 = '([0-9]{1,3}(\.[0-9]{1,3}){3})';
+  $ipv6 = '([0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7})';
   $port = '(:([0-9]{1,5}))';
-  
+
   // Pattern specific to eternal links
-  $external_pattern = '/^' . $protocol . '?'. $authentication . '?' . '(' . $domain . '|' . $ipv4 . '|' . $ipv6 . ' |localhost)' . $port . '?';
-  
+  $external_pattern = '/^'. $protocol .'?'. $authentication .'?'.'('. $domain .'|'. $ipv4 .'|'. $ipv6 .' |localhost)'. $port .'?';
+
   // Pattern specific to internal links
   $internal_pattern = "/^([a-z0-9_\-+\[\]]+)";
-  
+
   $directories = "(\/[a-z0-9_\-\.~+%=&,$'():;*@\[\]]*)*";
   $query = "(\/?[?a-z0-9+_\-\.\/%=&,$'():;*@\[\]]*)";
   $anchor = "(#[a-z0-9_\-\.~+%=&,$'():;*@\[\]]*)";
-  
+
   // the rest of the path for a standard URL
-  $end = $directories . '?' . $query . '?' .  $anchor . '?' . '$/i';
-  
+  $end = $directories .'?'. $query .'?'.  $anchor .'?'.'$/i';
+
   $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\'\[\]]+';
-  $email_pattern = '/^mailto:' . $user . '@' . '(' . $domain . '|' . $ipv4 .'|'. $ipv6 . '|localhost)' . $query . '$/';
-  
+  $email_pattern = '/^mailto:'. $user .'@'.'('. $domain .'|'. $ipv4 .'|'. $ipv6 .'|localhost)'. $query .'$/';
+
   if (preg_match($external_pattern . $end, $text)) {
     return LINK_EXTERNAL;
   }

