Index: nodequeue.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nodequeue/nodequeue.install,v retrieving revision 1.23 diff -u -p -r1.23 nodequeue.install --- nodequeue.install 7 Oct 2010 02:50:35 -0000 1.23 +++ nodequeue.install 31 Jan 2011 17:29:00 -0000 @@ -13,8 +13,8 @@ function nodequeue_schema() { 'fields' => array( 'qid' => array( 'description' => 'The primary identifier for a queue.', - 'type' => 'serial', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE ), 'title' => array( @@ -92,9 +92,8 @@ function nodequeue_schema() { 'fields' => array( 'qid' => array( 'description' => 'Primary key for {nodequeue_queue}', - 'type' => 'int', - 'size' => 'big', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE ), 'rid' => array( @@ -115,9 +114,8 @@ function nodequeue_schema() { 'fields' => array( 'qid' => array( 'description' => 'Primary key for {nodequeue_queue}', - 'type' => 'int', - 'size' => 'big', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE ), 'type' => array( @@ -142,14 +140,14 @@ function nodequeue_schema() { 'fields' => array( 'sqid' => array( 'description' => 'Subqueue identifier', - 'type' => 'serial', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE, ), 'qid' => array( 'description' => 'Queue identifier.', - 'type' => 'int', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE, ), 'reference' => array( @@ -180,14 +178,14 @@ function nodequeue_schema() { 'fields' => array( 'qid' => array( 'description' => 'Queue id', - 'type' => 'int', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE, ), 'sqid' => array( 'description' => 'Subqueue this node is in', - 'type' => 'int', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE, ), 'nid' => array( @@ -290,8 +288,8 @@ function nodequeue_update_5201() { 'fields' => array( 'sqid' => array( 'description' => t('Subqueue identifier'), - 'type' => 'serial', - 'unsigned' => TRUE, + 'type' => 'varchar', + 'length' => 255, 'not null' => TRUE, ), 'qid' => array( @@ -446,6 +444,11 @@ function nodequeue_update_6005() { $ret[] = update_sql("UPDATE {system} set name = 'nodequeue_view_per_queue' where name = 'nodequeue_automatic_views_generation'"); return $ret; } + +function nodequeue_update_7001() { +} + + /** * Implements hook_requirements(). * Index: nodequeue.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nodequeue/nodequeue.module,v retrieving revision 1.116 diff -u -p -r1.116 nodequeue.module --- nodequeue.module 5 Jan 2011 06:13:22 -0000 1.116 +++ nodequeue.module 31 Jan 2011 17:29:01 -0000 @@ -193,12 +193,18 @@ function nodequeue_node_delete($node) { } /** - * Implements hook_node_view(). + * Implements hook_nodeapi(). */ +function nodequeue_nodeapi_OLD(&$node, $op, $teaser = NULL, $page = NULL) { } -function nodequeue_node_view(&$node, $view_mode) { +/** + * Implements hook_link(). + */ +function nodequeue_link($type, $node = NULL, $teaser = FALSE) { $links = array(); - if (variable_get('nodequeue_links', FALSE) && + + if ($type == 'node' && + variable_get('nodequeue_links', FALSE) && user_access('manipulate queues')) { $queues = nodequeue_load_queues_by_type($node->type, 'links'); $subqueues = nodequeue_get_subqueues_by_node($queues, $node); @@ -248,12 +254,7 @@ function nodequeue_node_view(&$node, $vi drupal_add_js(drupal_get_path('module', 'nodequeue') . '/nodequeue.js'); drupal_add_css(drupal_get_path('module', 'nodequeue') . '/nodequeue.css'); } - if (!empty($links)) { - $node->content['links']['nodequeue'] = array( - '#links' => $links, - '#theme' => 'links__node__nodequeue', - ); - } + return $links; } /** @@ -612,11 +613,11 @@ function nodequeue_view_queues() { if ($queue->subqueues == 1) { $qids[] = $queue->qid; } - $sort_secondary[] = drupal_strtolower($queue->title); + $sort_secondary[] = $queue->title; switch ($table_sort['sql']) { case 'title': default: - $sort_primary[] = drupal_strtolower($queue->title); + $sort_primary[] = $queue->title; $sort_direction = $sort_direction_regular; break; case 'size': @@ -737,6 +738,18 @@ function nodequeue_edit_queue_form($form '#description' => t('Enter the name of the queue'), ); + $form['name'] = array( + '#type' => 'textfield', + '#title' => t('Name'), + '#default_value' => isset($queue->qid) ? $queue->qid : '', + '#disabled' => isset($queue->qid) ? TRUE : FALSE, + '#size' => 50, + '#maxlength' => 64, + '#description' => t('Enter the machine name of the queue'), + ); + + // This is a value; as the default nodequeue implementation has just one + // This is a value; as the default nodequeue implementation has just one // queue per nodequeue, this field is totally redundant. Plugins can // override this. @@ -1392,10 +1405,7 @@ function nodequeue_clear_confirm_submit( /** * Page callback for autocomplete. */ -function nodequeue_autocomplete() { - $args = func_get_args(); - $sqid = array_shift($args); - $string = implode('/', $args); +function nodequeue_autocomplete($sqid = NULL, $string = NULL) { $matches = _nodequeue_autocomplete($sqid, $string); drupal_json_output(drupal_map_assoc($matches)); } @@ -1403,7 +1413,7 @@ function nodequeue_autocomplete() { function _nodequeue_autocomplete($sqid, $string) { $output = array(); - if (!is_numeric($sqid) || !$string) { + if (!$sqid || empty($sqid) || !$string) { return $output; } @@ -1778,8 +1788,7 @@ function subqueue_load($sqid) { if (!$sqid) { return NULL; } - $queues = nodequeue_load_subqueues(array($sqid)); - return !empty($queues) ? array_shift($queues) : array(); + return array_shift(nodequeue_load_subqueues(array($sqid))); } /** @@ -1926,7 +1935,7 @@ function nodequeue_save(&$queue) { 'link' => $queue->link, 'link_remove' => $queue->link_remove, 'owner' => $queue->owner, - 'show_in_links' => ($queue->show_in_links) ? 1 : 0, + 'show_in_links' => $queue->show_in_links, 'show_in_tab' => $queue->show_in_tab, 'show_in_ui' => $queue->show_in_ui, 'i18n' => $queue->i18n, @@ -1935,7 +1944,9 @@ function nodequeue_save(&$queue) { ); if (!isset($queue->qid)) { - $queue->qid = db_insert('nodequeue_queue') + $queue->qid = isset($queue->name) ? $queue->name : uniqid(); + $nodequeue_queue_fields['qid'] = $queue->qid; + db_insert('nodequeue_queue') ->fields($nodequeue_queue_fields) ->execute(); @@ -2030,13 +2041,11 @@ function nodequeue_delete($qid) { /** * Add a new subqueue to a queue. * - * @param $queue - * The queue object that is the parent of this subqueue. - * @param $title - * The title of the subqueue. + * @param $qid + * The queue id. This should not be the full queue object. * @param $reference * A reference that uniquely identifies this subqueue. If NULL it will - * be assigned the sqid. + * be assigned to the sqid. */ function nodequeue_add_subqueue(&$queue, $title, $reference = NULL) { if (empty($reference)) { @@ -2051,9 +2060,10 @@ function nodequeue_add_subqueue(&$queue, $subqueue->qid = $queue->qid; $subqueue->title = $title; - - $subqueue->sqid = db_insert('nodequeue_subqueue') + $subqueue->sqid = isset($subqueue->name) ? $subqueue->name : uniqid(); + db_insert('nodequeue_subqueue') ->fields(array( + 'sqid' =>$subqueue->sqid, 'qid' => $queue->qid, 'reference' => $insert_reference, 'title' => $title, @@ -2449,7 +2459,7 @@ function nodequeue_subqueue_size_text($m } else { if ($long) { - $message = theme('nodequeue_subqueue_count_text', $count); + $message = theme('nodequeue_subqueue_count_text', array('count' => $count)); } else { $message = $count; @@ -3058,6 +3068,7 @@ function theme_nodequeue_subqueue_full_t * * @ingroup themeable */ -function theme_nodequeue_subqueue_count_text($count) { - return t('@count in queue', array('@count' => $count)); +function theme_nodequeue_subqueue_count_text($vars) { + return t('@count in queue', array('@count' => $vars['count'])); } +