/[drupal]/contributions/modules/ticketyboo/ticketyboo.module
ViewVC logotype

Diff of /contributions/modules/ticketyboo/ticketyboo.module

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

revision 1.1, Tue Aug 26 15:34:14 2008 UTC revision 1.2, Thu Sep 4 17:55:12 2008 UTC
# Line 25  function ticketyboo_block($op = 'list', Line 25  function ticketyboo_block($op = 'list',
25           1 => array('info' => t('Ticker 1'), ),           1 => array('info' => t('Ticker 1'), ),
26           2 => array('info' => t('Ticker 2'), ),           2 => array('info' => t('Ticker 2'), ),
27           3 => array('info' => t('Ticker 3'), ),           3 => array('info' => t('Ticker 3'), ),
28             4 => array('info' => t('Ticker 4'), ),
29             5 => array('info' => t('Ticker 5'), ),
30        );        );
31     }     }
32     elseif ($op == 'configure') {     elseif ($op == 'configure') {
# Line 46  function ticketyboo_block($op = 'list', Line 48  function ticketyboo_block($op = 'list',
48  */  */
49  function _ticketyboo_config($delta) {  function _ticketyboo_config($delta) {
50     $form = array();     $form = array();
51       $form['text'] = array(
52          '#title' => t('Text'),
53          '#description' => t('Text, which will go in front of the ticker'),
54          '#type' => 'textarea',
55          '#default_value' => variable_get('ticketyboo_text_'.$delta, ''),
56       );
57     $form['nodes'] = array(     $form['nodes'] = array(
58        '#title' => t('Nodes'),        '#title' => t('Nodes'),
59        '#description' => t('A list of node numbers which will be used for Ticker ').$delta.'. '.t('Separate node numbers with commas.'),        '#description' => t('A list of node numbers which will be used for Ticker ').$delta.'. '.t('Separate node numbers with commas.'),
# Line 57  function _ticketyboo_config($delta) { Line 65  function _ticketyboo_config($delta) {
65        '#description' => t('How often the ticker content will change - in seconds'),        '#description' => t('How often the ticker content will change - in seconds'),
66        '#type' => 'select',        '#type' => 'select',
67        '#default_value' => variable_get('ticketyboo_seconds_'.$delta, 5),        '#default_value' => variable_get('ticketyboo_seconds_'.$delta, 5),
68        '#options' => array(5=>5, 10=>10, 20=>20, 30=>30, 60=>60, 120=>120),        '#options' => array(5=>5, 6=>6, 7=>7,8=>8, 9=>9, 10=>10, 15=>15, 20=>20, 30=>30, 40=>40, 50=>50, 60=>60, 90=>90, 120=>120),
69       );
70       $form['direction'] = array(
71          '#title' => t('Direction'),
72          '#description' => t('Direction in which the ticker will move'),
73          '#type' => 'select',
74          '#default_value' => variable_get('ticketyboo_direction_'.$delta, 'vertical'),
75          '#options' => array('vertical'=>'vertical', 'horizontal'=>'horizontal', 'diagonal'=>'diagonal'),
76     );     );
77     $form['height'] = array(     $form['height'] = array(
78        '#title' => t('Height'),        '#title' => t('Height'),
# Line 79  function _ticketyboo_config($delta) { Line 94  function _ticketyboo_config($delta) {
94  */  */
95  function _ticketyboo_config_save($delta, $edit) {  function _ticketyboo_config_save($delta, $edit) {
96     variable_set('ticketyboo_nodes_'.$delta, $edit['nodes']);     variable_set('ticketyboo_nodes_'.$delta, $edit['nodes']);
97       variable_set('ticketyboo_text_'.$delta, $edit['text']);
98     variable_set('ticketyboo_seconds_'.$delta, $edit['seconds']);     variable_set('ticketyboo_seconds_'.$delta, $edit['seconds']);
99       variable_set('ticketyboo_direction_'.$delta, $edit['direction']);
100     variable_set('ticketyboo_height_'.$delta, $edit['height']);     variable_set('ticketyboo_height_'.$delta, $edit['height']);
101     variable_set('ticketyboo_width_'.$delta, $edit['width']);     variable_set('ticketyboo_width_'.$delta, $edit['width']);
102  }  }
# Line 92  static $loaded = false; Line 109  static $loaded = false;
109    
110     $nodes = variable_get('ticketyboo_nodes_'.$delta, '');     $nodes = variable_get('ticketyboo_nodes_'.$delta, '');
111     $height = variable_get('ticketyboo_height_'.$delta, '100px');     $height = variable_get('ticketyboo_height_'.$delta, '100px');
112     $ret = '<div id="ticketyboo_'.$delta.'" class="ticketyboo_wrapper" style="height: '.$height.'; width: '.variable_get('ticketyboo_width_'.$delta, '200px').';" onMouseover="ticketypause['.$delta.'] = true" onMouseout="ticketypause['.$delta.'] = false">';     $ret = '';
113       $ret .= variable_get('ticketyboo_text_'.$delta, '');
114       $ret .= '<div id="ticketyboo_'.$delta.'" class="ticketyboo_wrapper" style="height: '.$height.'; width: '.variable_get('ticketyboo_width_'.$delta, '200px').';" onMouseover="ticketypause['.$delta.'] = true" onMouseout="ticketypause['.$delta.'] = false">';
115     $nodes = explode(',', $nodes);     $nodes = explode(',', $nodes);
116     $i = 0;     $i = 0;
117     foreach ($nodes as $nid) {     foreach ($nodes as $nid) {
118        $i++;        $i++;
119        $node = node_load(trim($nid));        $node = node_load(trim($nid));
120        $ret .= '<div id="ticketyboo_'.$delta.'_'.$i.'" class="ticketyboo_teaser">';        $ret .= '<div id="ticketyboo_'.$delta.'_'.$i.'" class="ticketyboo_teaser" style="height: '.$height.'; width: '.variable_get('ticketyboo_width_'.$delta, '200px').';">';
121        $ret .= $node->teaser;        $ret .= $node->teaser;
122        $ret .= '</div>';        $ret .= '</div>';
123     }     }
124     $ret .= '</div>';     $ret .= '</div>';
125    
126     drupal_add_js('ticketyboo_init('.$delta.', '.variable_get('ticketyboo_seconds_'.$delta, 10).', '.count($nodes).')', 'inline', 'footer', true);     drupal_add_js('ticketyboo_init('.$delta.', '.variable_get('ticketyboo_seconds_'.$delta, 10).', '.count($nodes).', "'.variable_get('ticketyboo_direction_'.$delta, 'vertical').'")', 'inline', 'footer', true);
127     if (!$loaded) {     if (!$loaded) {
128        drupal_add_js(drupal_get_path('module', 'ticketyboo').'/ticketyboo.js', 'module');        drupal_add_js(drupal_get_path('module', 'ticketyboo').'/ticketyboo.js', 'module');
129        drupal_add_css(drupal_get_path('module', 'ticketyboo').'/ticketyboo.css', 'module');        drupal_add_css(drupal_get_path('module', 'ticketyboo').'/ticketyboo.css', 'module');

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2