Index: nodecarousel.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nodecarousel/nodecarousel.install,v retrieving revision 1.4.2.4 diff -u -p -r1.4.2.4 nodecarousel.install --- nodecarousel.install 19 Apr 2008 23:10:04 -0000 1.4.2.4 +++ nodecarousel.install 28 Apr 2008 23:05:37 -0000 @@ -70,7 +70,8 @@ function nodecarousel_install() { sort_ascending NOT NULL smallint default '0', js_scroll_function text default NULL, view_vid int(10) NOT NULL default '0', - autoload smallint NOT NULL default '1' + autoload smallint NOT NULL default '1', + js_index_trigger text default NULL PRIMARY KEY (ncid), "); db_query("CREATE INDEX {nodecarousel}_name_idx ON {nodecarousel} (name)"); @@ -106,3 +107,16 @@ function nodecarousel_update_5001() { } return $items; } +function nodecarousel_update_5002() { + $items = array(); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $items[] = update_sql("ALTER TABLE {nodecarousel} ADD js_index_trigger longtext default NULL"); + break; + case 'pgsql': + $items[] = update_sql("ALTER TABLE {nodecarousel} ADD js_index_trigger longtext default NULL"); + break; + } + return $items; +} Index: nodecarousel.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nodecarousel/nodecarousel.module,v retrieving revision 1.4.2.5 diff -u -p -r1.4.2.5 nodecarousel.module --- nodecarousel.module 19 Apr 2008 23:10:04 -0000 1.4.2.5 +++ nodecarousel.module 28 Apr 2008 23:05:37 -0000 @@ -15,6 +15,7 @@ DEFINE("NC_SOURCE_VIEW", 4); DEFINE("NC_INDEX_TITLE", 'ttl'); DEFINE("NC_INDEX_NUMBER", 'num'); DEFINE("NC_INDEX_THEME", 'thm'); +DEFINE("NC_TRIGGER_FUNCTION", 'click'); /** * Implementation of hook_perm() @@ -701,6 +702,15 @@ function nodecarousel_edit_form($node_ca '#maxlength' => 100, ); + $form['other']['js_index_trigger'] = array( + '#type' => 'textfield', + '#title' => t('Javascript Index Event Trigger'), + '#default_value' => $node_carousel->js_index_trigger, + '#description' => t('Set the Javascript event you want to trigger the index to change nodes. Common values will be the default "click" or "mouseover".'), + '#size' => 20, + '#maxlength' => 50, + ); + $form['other']['autoload'] = array( '#type' => 'checkbox', '#title' => t('Automatically Load Node Carousel on Page Load'), @@ -850,6 +860,10 @@ function nodecarousel_edit_form_validate if (!_nodecarousel_validate_length($form_values['js_scroll_function'], $form['other']['js_scroll_function']['#maxlength'])) { form_set_error('js_scroll_function', t('The Javascript Event Handler cannot be more than %d characters long.', $form['other']['js_scroll_function']['#maxlength'])); } + + if (!_nodecarousel_validate_length($form_values['js_index_trigger'], $form['other']['js_index_trigger']['#maxlength'])) { + form_set_error('js_index_trigger', t('The Javascript Index Trigger cannot be more than %d characters long.', $form['other']['js_index_trigger']['#maxlength'])); + } } /** @@ -1014,17 +1028,17 @@ function nodecarousel_edit_form_submit($ $query = "INSERT INTO {nodecarousel} (ncid, name, title, description, access, dynamic, horizontal, wrap, autoscroll, index_control, number_fetch, number_scroll, number_visible, start_position, animation_speed, prev_text, next_text, first_text, last_text, node_source, node_types, taxonomy_tids, nodequeue_qid, - sort, sort_ascending, js_scroll_function, view_vid, autoload) + sort, sort_ascending, js_scroll_function, js_index_trigger, view_vid, autoload) VALUES (%d, '%s', '%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', %d, - '%s', %d, '%s', %d, %d)"; + '%s', %d, '%s', '%s', %d, %d)"; //drupal_set_message('queue: '. print_r($form_values['nodequeue_qid'], true)); $result = db_query($query, $form_values['ncid'], $form_values['name'], $form_values['title'], $form_values['description'], serialize($access), $form_values['dynamic'], $form_values['horizontal'], $form_values['wrap'], $form_values['autoscroll'], $form_values['index_control'], $form_values['number_fetch'], $form_values['number_scroll'], $form_values['number_visible'], $form_values['start_position'], $form_values['animation_speed'], $form_values['prev_text'], $form_values['next_text'], $form_values['first_text'], $form_values['last_text'], $form_values['node_source'], serialize($node_types), serialize(array_keys($form_values['taxonomy_tids'])), $form_values['nodequeue_qid'], - $form_values['sort'], $form_values['sort_ascending'], $form_values['js_scroll_function'], $form_values['view_vid'], $form_values['autoload'] ); + $form_values['sort'], $form_values['sort_ascending'], $form_values['js_scroll_function'], $form_values['js_index_trigger'], $form_values['view_vid'], $form_values['autoload'] ); return 'admin/build/nodecarousel'; } @@ -1509,11 +1523,11 @@ function initialize_%d(carousel, state) outermostDiv.children(".jcarousel-next").after("
" + last + "
"); } - jQuery('div#nc_first_%d').click(function(e) { + jQuery('div#nc_first_%d').%s(function(e) { carousel.scroll(1, true); }); - jQuery('div#nc_last_%d').click(function(e) { + jQuery('div#nc_last_%d').%s(function(e) { carousel.scroll($("#nc_" + carouselName + " li").length, true); }); INIT; @@ -1537,13 +1551,15 @@ INIT; } outermostDiv.children(".index_control_list").append("
  • " + displayText + "
  • "); }); - outermostDiv.children(".index_control_list").children(".index_control_item").click(function(e) { + outermostDiv.children(".index_control_list").children(".index_control_item").%s(function(e) { carousel.scroll(parseInt($(this).attr('li_index')), true); }); INDEX; - - $js_index_script = sprintf($js_index_script, $nc->name, $nc->index_control, NC_INDEX_TITLE, $nc->index_control, NC_INDEX_THEME); + if ($nc->js_index_trigger == "") { + $nc->js_index_trigger = NC_TRIGGER_FUNCTION; + } + $js_index_script = sprintf($js_index_script, $nc->name, $nc->index_control, NC_INDEX_TITLE, $nc->index_control, NC_INDEX_THEME, $nc->js_index_trigger); } @@ -1555,7 +1571,7 @@ INDEX; ENDINIT; - return sprintf($js_initialize, $nc->ncid, $nc->name, $nc->first_text, $nc->last_text, $nc->ncid, $nc->ncid, $nc->ncid, $nc->ncid) + return sprintf($js_initialize, $nc->ncid, $nc->name, $nc->first_text, $nc->last_text, $nc->ncid, $nc->ncid, $nc->ncid, NC_TRIGGER_FUNCTION, $nc->ncid, $nc->js_index_trigger) . $js_index_script . $js_end_initialize; } @@ -1616,7 +1632,7 @@ function theme_nodecarousel_node($node, /** * This function looks for the first image tag in a string, and returns that tag. - * + * * @param string $view * A string containing, possibly, an image tag. * @return string @@ -1681,4 +1697,4 @@ function jcarousel_add($skin = 'tango') $added = TRUE; } } -*/ \ No newline at end of file + */ \ No newline at end of file