Index: weblinks.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/weblinks/weblinks.module,v
retrieving revision 1.46
diff -u -r1.46 weblinks.module
--- weblinks.module	13 Jul 2008 22:58:00 -0000	1.46
+++ weblinks.module	14 Jul 2008 16:38:47 -0000
@@ -1046,9 +1055,9 @@
 /**
  * Prepare block content.
  */
-function _weblinks_get_query($tid = 0, $sort = 'title') {
+function _weblinks_get_query($tid = 0, $sort = 'title', $limit = 0) {
   // Get the max number of posts to display
-  $limitnum = variable_get('weblinks_maxdisp_'. $tid, 10);
+  $limitnum = $limit ? $limit : variable_get('weblinks_maxdisp_'. $tid, 10);
 
   $query = 'SELECT nr.body, nr.format, n.*, bw.url ';
   $query .= 'FROM {node} n ';
@@ -1083,8 +1092,8 @@
 /**
  * Prepare block content.
  */
-function _weblinks_block_content($tid = 0, $sort) {
-  $result = _weblinks_get_query($tid, $sort);
+function _weblinks_block_content($tid = 0, $sort, $limit) {
+  $result = _weblinks_get_query($tid, $sort, $limit);
   $urlnode = variable_get('weblinks_block_urlnode', 'url');
   $options = $items = array();
   if (variable_get('weblinks_external', true)) {
@@ -1107,46 +1116,51 @@
 /**
  * Implementation of hook_block().
  */
-function weblinks_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $tree = module_invoke('taxonomy', 'get_tree', _weblinks_get_vocid());
-dsm($tree);
-dsm($taxonomy_get_tree(_weblinks_get_vocid()));
-    if ($tree) {
-      foreach ($tree as $linkcat) {
-        $block['weblink-'. $linkcat->tid]['info'] = 'Web Link: '. $linkcat->name;
-      }
-    }
-    $block['weblink-recent']['info'] = 'Recent Web Links';
-    return $block;
-  }
-  else if ($op == 'view') {
-    list($type, $tid) = explode('-', $delta);
-    if ($type == 'weblink') {
-      if ($linkcat = module_invoke('taxonomy', 'get_term', $tid)) {
-        $block['subject'] = check_plain($linkcat->name);
-        $block['content'] = _weblinks_block_content($tid, variable_get('weblinks_block_sort', 'title'));
+function weblinks_block($op = 'list', $delta = 0, $edit = array()) {
+  $block = $form = array();
+  switch ($op) {
+    case 'list':
+      $tree = module_invoke('taxonomy', 'get_tree', _weblinks_get_vocid());
+      if ($tree) {
+        foreach ($tree as $linkcat) {
+          $block['weblink-'. $linkcat->tid]['info'] = 'Web Link: '. $linkcat->name;
+        }
       }
-      else if ($tid == 'recent') {
-        $block['subject'] = t('Recent Web Links');
-        $block['content'] = _weblinks_block_content(0, 'recent_block');
+      $block['weblink-recent']['info'] = 'Recent Web Links';
+      return $block;
+
+    case 'view':
+      list($type, $tid) = explode('-', $delta);
+      $limit = variable_get('weblinks_maxdisp_block_'. $tid, 10);
+      if ($type == 'weblink') {
+        if ($linkcat = module_invoke('taxonomy', 'get_term', $tid)) {
+          $block['subject'] = check_plain($linkcat->name);
+          $block['content'] = _weblinks_block_content($tid, variable_get('weblinks_block_sort', 'title'), $limit);
+        }
+        else if ($tid == 'recent') {
+          $block['subject'] = t('Recent Web Links');
+          $block['content'] = _weblinks_block_content(0, 'recent_block', $limit);
+        }
       }
-    }
-    return $block;
-  }
-  elseif ($op == 'configure') {
-    $form = array();
-    switch ($delta) {
-      case 'weblink-recent':
-        $form['weblinks_maxdisp_block_recent'] = array(
+      return $block;
+
+    case 'configure':
+      list($type, $tid) = explode('-', $delta);
+      $form = array(
+        'weblinks_maxdisp_block' => array(
           '#type' => 'textfield',
           '#title' => t('Maximum Recent Web Links'),
-          '#default_value' => variable_get('weblinks_maxdisp_block_recent', 10),
+          '#size' => 3,
+          '#default_value' => variable_get('weblinks_maxdisp_block_'. $tid, 10),
           '#description' => t('The number of links to show.'),
-          );
-        break;
-    }
-    return $block;
+          ),
+        );
+      return $form;
+
+    case 'save':
+      list($type, $tid) = explode('-', $delta);
+      variable_set('weblinks_maxdisp_block_'. $tid, $edit['weblinks_maxdisp_block']);
+      break;
   }
 }
 
Index: weblinks.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/weblinks/weblinks.admin.inc,v
retrieving revision 1.10
diff -u -r1.10 weblinks.admin.inc
--- weblinks.admin.inc	12 Jul 2008 21:01:24 -0000	1.10
+++ weblinks.admin.inc	14 Jul 2008 16:38:23 -0000
@@ -211,15 +211,16 @@
       '#description' => t('Leave blank if you would not like to limit the number of links displayed'),
     );
 
-    // Set the maximum number of links to display in the block for each category
-    $form['categories'][$row->tid]['weblinks_maxdisp_block_'. $row->tid] = array(
-      '#type' => 'textfield',
-      '#title' => t('Maximum block entries to display'),
-      '#default_value' => variable_get('weblinks_maxdisp_block_'. $row->tid, NULL),
-      '#size' => 2,
-      '#required' => FALSE,
-      '#description' => t('Leave blank if you would not like to limit the number of links displayed'),
-    );
+//  Moved to block settings.
+//    // Set the maximum number of links to display in the block for each category
+//    $form['categories'][$row->tid]['weblinks_maxdisp_block_'. $row->tid] = array(
+//      '#type' => 'textfield',
+//      '#title' => t('Maximum block entries to display'),
+//      '#default_value' => variable_get('weblinks_maxdisp_block_'. $row->tid, NULL),
+//      '#size' => 2,
+//      '#required' => FALSE,
+//      '#description' => t('Leave blank if you would not like to limit the number of links displayed'),
+//    );
   }
   return system_settings_form($form);
 }
