? .DS_Store ? favorite_nodes_coder.patch Index: favorite_nodes.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/favorite_nodes/favorite_nodes.install,v retrieving revision 1.4 diff -u -p -r1.4 favorite_nodes.install --- favorite_nodes.install 18 Jun 2008 14:44:15 -0000 1.4 +++ favorite_nodes.install 8 Sep 2008 20:13:14 -0000 @@ -1,5 +1,10 @@ array( - 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'fields' => array( + 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), 'last' => array('type' => 'int'), - ), - 'primary key' => array('nid' ,'uid') + ), + 'primary key' => array('nid', 'uid') ); return $schema; - -} +} \ No newline at end of file Index: favorite_nodes.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/favorite_nodes/favorite_nodes.module,v retrieving revision 1.8.2.2 diff -u -p -r1.8.2.2 favorite_nodes.module --- favorite_nodes.module 8 Sep 2008 03:56:48 -0000 1.8.2.2 +++ favorite_nodes.module 8 Sep 2008 20:13:15 -0000 @@ -98,14 +98,15 @@ function favorite_nodes_menu() { */ function favorite_nodes_theme() { return array( -'favorite_nodes_view_table' => array( -'arguments' => array('list' => array(), 'uid' => NULL, 'type' => NULL), - ), -'favorite_nodes_view_teasers' => array( -'arguments' => array('list' => array(), 'uid' => NULL, 'type' => NULL), - ) + 'favorite_nodes_view_table' => array( + 'arguments' => array('list' => array(), 'uid' => NULL, 'type' => NULL), + ), + 'favorite_nodes_view_teasers' => array( + 'arguments' => array('list' => array(), 'uid' => NULL, 'type' => NULL), + ) ); } + /** * Implementation of hook_xmlrpc(). */ @@ -115,8 +116,8 @@ function favorite_nodes_xmlrpc() { $items[] = array( 'favorite_nodes.add', 'favorite_nodes_add', - array('boolean', 'int'), - t('Add a favorite node to the current user\'s list.') + array('boolean', 'int'), + t('Add a favorite node to the current user\'s list.') ); } @@ -133,14 +134,14 @@ function _node_types_natcasesort() { /** * Implementation of hook_user(). */ -function favorite_nodes_user($op, &$edit, &$user, $category = null) { +function favorite_nodes_user($op, &$edit, &$user, $category = NULL) { switch ($op) { case 'view': $user->content['faveliste'] = array( - '#type' => 'user_profile_category', - '#title' => t('My favorites'), - '#value' => theme('item_list', $items), + '#type' => 'user_profile_category', + '#title' => t('My favorites'), + '#value' => theme('item_list', $items), ); $fav_list = array(); foreach (_node_types_natcasesort() as $type) { @@ -152,11 +153,11 @@ function favorite_nodes_user($op, &$edit foreach ($favorites as $favorite) { $items[] = l($favorite->title, "node/$favorite->nid"); } - $user->content['faveliste'][$type->name] = array( - '#type' => 'user_profile_item', - '#title' => l($type->name, "favorite_nodes/view/$user->uid/$type->type"), - '#value' => theme('item_list', $items), - ); + $user->content['faveliste'][$type->name] = array( + '#type' => 'user_profile_item', + '#title' => l($type->name, "favorite_nodes/view/$user->uid/$type->type"), + '#value' => theme('item_list', $items), + ); } } } @@ -171,7 +172,7 @@ function favorite_nodes_user($op, &$edit /** * Implementation of hook_nodeapi(). */ -function favorite_nodes_nodeapi(&$node, $op, $teaser = null, $page = null) { +function favorite_nodes_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { switch ($op) { case 'delete': // Delete all favorite entries of the node being deleted. @@ -226,8 +227,8 @@ function favorite_nodes_block($op = 'lis $form['titles'] = array( '#type' => 'fieldset', '#title' => t('Titles'), - '#collapsible' => true, - '#collapsed' => false, + '#collapsible' => TRUE, + '#collapsed' => FALSE, ); $form['titles']['title'] = array( '#type' => 'textfield', @@ -246,8 +247,8 @@ function favorite_nodes_block($op = 'lis $form['titles']['subtitles'] = array( '#type' => 'fieldset', '#title' => t('Type subtitles'), - '#collapsible' => true, - '#collapsed' => true, + '#collapsible' => TRUE, + '#collapsed' => TRUE, ); foreach ($node_types as $type) { if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) { @@ -278,12 +279,12 @@ function favorite_nodes_block($op = 'lis } /** - * Implementation of hook_links(). + * Implementation of hook_link(). */ -function favorite_nodes_link($type, $node = null, $teaser = false) { +function favorite_nodes_link($type, $node = NULL, $teaser = FALSE) { global $user; $links = array(); - + if ($type == 'node') { if (variable_get(FAVORITE_NODES_NODE_TYPE . $node->type, 0)) { if (user_access(FAVORITE_NODES_PERM_ADD)) { @@ -322,10 +323,9 @@ function favorite_nodes_settings() { $form[$set] = array( '#type' => 'fieldset', '#title' => t('Favorites Page Settings'), - '#collapsible' => true, - '#collapsed' => false, + '#collapsible' => TRUE, + '#collapsed' => FALSE, ); - $form[$set][FAVORITE_NODES_PAGE_LIMIT] = array( '#type' => 'textfield', '#title' => t('Favorite Nodes Page Limit'), @@ -344,11 +344,10 @@ function favorite_nodes_settings() { '#options' => array( 'table' => 'Table', 'teasers' => 'Teasers', - ), + ), '#default_value' => variable_get(FAVORITE_NODES_PAGE_TYPE, 'table'), '#description' => t('How should favorites be displayed on the favorite nodes page?'), ); - $form[$set][FAVORITE_NODES_MENUS] = array( '#type' => 'checkbox', '#title' => t('Navigation menu items'), @@ -356,7 +355,6 @@ function favorite_nodes_settings() { '#default_value' => variable_get(FAVORITE_NODES_MENUS, 0), '#description' => t('Whether to show a menu item in the navigation block for each node type?'), ); - $form[$set][FAVORITE_NODES_TEASER] = array( '#type' => 'checkbox', '#title' => t('Show in teaser'), @@ -369,8 +367,8 @@ function favorite_nodes_settings() { $form[$set] = array( '#type' => 'fieldset', '#title' => t('Enable favorites for these node types'), - '#collapsible' => true, - '#collapsed' => false, + '#collapsible' => TRUE, + '#collapsed' => FALSE, ); foreach (_node_types_natcasesort() as $type) { $form[$set][FAVORITE_NODES_NODE_TYPE . $type->type] = array( @@ -380,9 +378,8 @@ function favorite_nodes_settings() { '#default_value' => variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0), ); } - // $form['#submit'][] = 'example_admin_settings_submit'; + return system_settings_form($form); - } /** @@ -397,10 +394,10 @@ function favorite_nodes_add($nid) { db_query("DELETE FROM {favorite_nodes} WHERE nid = %d AND uid = %d", $nid, $user->uid); db_query("INSERT INTO {favorite_nodes} (nid, uid, last) VALUES (%d, %d, %d)", $nid, $user->uid, time()); - return true; + return TRUE; } else { - return false; + return FALSE; } } @@ -416,7 +413,7 @@ function favorite_nodes_delete($nid) { * Select all the favorite nodes a user has. * TODO why don't return all node if tpye are nul. So we can display all favorite node on path favorite_nodes/view/"uid" */ -function favorite_nodes_get($uid, $type = null, $limit = null) { +function favorite_nodes_get($uid, $type = NULL, $limit = NULL) { if (is_null($limit)) { $limit = variable_get(FAVORITE_NODES_PAGE_LIMIT, 10); } @@ -424,7 +421,7 @@ function favorite_nodes_get($uid, $type if ($type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) { $sql = "SELECT n.nid, n.title, f.uid, f.last FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC"; - $result = pager_query($sql, $limit, 0, null, $type, $uid); + $result = pager_query($sql, $limit, 0, NULL, $type, $uid); if ($result) { while ($data = db_fetch_object($result)) { $row[$data->nid] = $data; @@ -473,7 +470,6 @@ function favorite_nodes_delete_page() { * Page to display a user's favorite list. */ function favorite_nodes_view_page() { - $uid = arg(2); $type = arg(3); $output = theme('favorite_nodes_view_'. variable_get(FAVORITE_NODES_PAGE_TYPE, 'table'), favorite_nodes_get($uid, $type), $uid, $type); @@ -514,7 +510,7 @@ function _favorite_nodes_check($nid) { /** * TODO: This is not being used.. do we need it? */ -function theme_favorite_nodes_view_teasers($list = array(), $uid = null, $type = null) { +function theme_favorite_nodes_view_teasers($list = array(), $uid = NULL, $type = NULL) { $type_desc = variable_get(FAVORITE_NODES_BLOCK . $type, $type); $user = user_load(array('uid' => $uid)); @@ -527,7 +523,7 @@ function theme_favorite_nodes_view_tease $output .= '