Index: modules/links/links_related.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/links/links_related.module,v
retrieving revision 1.2
diff -u -r1.2 links_related.module
--- modules/links/links_related.module	16 Jun 2005 04:10:42 -0000	1.2
+++ modules/links/links_related.module	13 Nov 2005 00:19:54 -0000
@@ -105,24 +105,63 @@
  * Implementation of hook_settings()
  */
 function links_related_settings() {
-  $output = '';
-  if (module_exist('links')) {
-    $output .= '<p>' . t('The &quot;links&quot; module is installed and enabled on this site, as required.');
-  } else {
+  $form = array();
+  if (!module_exist('links')) {
     drupal_set_message(t('The &quot;links&quot; module is disabled or not installed. Node links will not function until this is corrected. Check the availability of that module, and enable if needed, in the %modules.',array('%modules'=>l(t('modules administration page'),'admin/modules'))),'error');
   }
 
-  $group = form_select(t('Displayed links (teaser mode)'), 'links_related_display_teaser', variable_get('links_related_display_teaser','1'), array(0=>t('None'), 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, -1=>t('All')), t('This setting controls how many links are displayed near the node title (in most themes) for the teaser or listing format.'));
-  $group .= form_select(t('Displayed links (full-page mode)'), 'links_related_display_full', variable_get('links_related_display_full','0'), array(0=>t('None'), 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, -1=>t('All')), t('This setting controls how many links are displayed near the node title (in most themes) in full-page displays. Since the links also display in a list at the end of the article, you may wish to set this to &quot;None&quot;.'));
-  $group .= form_select(t('Display trim length'), 'links_related_display_length', variable_get('links_related_display_length','0'), array(0=>t('Unlimited'), 20=>20, 30=>30, 40=>40), t('Trims the displayed text (but not the actual URL) for links displayed near the article title. Does not affect display of links as end-notes within the article body.'));
-  $group .= form_checkbox(t('Show end-notes list'), 'links_related_enable_list', 1, variable_get('links_related_enable_list','1'), t('If enabled, a detailed and complete list of the article links will be appended to the end of the content, when in full-page display mode.'));
-  $group .= form_checkbox(t('Show links tab'), 'links_related_enable_tab', 1, variable_get('links_related_enable_tab','0'), t('If enabled, a tab will be added to node displays to display the list of links on their own separate page.'));
-
-  $output .= form_group(t('Link display settings'), $group, t("Other settings for how the links behave and how they are displayed are available in the %linksettingspage.", array('%linksettingspage'=>l(t('links module settings page'),'admin/settings/links'))));
-
-  $output .= '<p>' . t("To choose what content types have link URLs available, use the %workflowpage to set the 'has related links url' attribute for the desired node types. Note that you may need to revisit this setting if you add modules that define new node types, because the default is OFF for each content type.", array('%workflowpage'=>l(t('default content workflow page'),'admin/node/configure/types')));
-  $output .= '<p>';
-  return $output;
+  $form['link_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Link display settings'),
+    '#description' => t("Other settings for how the links behave and how they are displayed are available in the %linksettingspage.", array('%linksettingspage'=>l(t('links module settings page'),'admin/settings/links'))),
+  );
+
+  $form['link_settings']['links_related_display_teaser'] = array(
+    '#type' => 'select',
+    '#title' => t('Displayed links (teaser mode)'),
+    '#default_value' => variable_get('links_related_display_teaser','1'),
+    '#options' => array(0=>t('None'), 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, -1=>t('All')),
+    '#description' => t('This setting controls how many links are displayed near the node title (in most themes) for the teaser or listing format.'),
+  );
+
+  $form['link_settings']['links_related_display_full'] = array(
+    '#type' => 'select',
+    '#title' => t('Displayed links (full-page mode)'),
+    '#default_value' => variable_get('links_related_display_full','1'),
+    '#options' => array(0=>t('None'), 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, -1=>t('All')),
+    '#description' => t('This setting controls how many links are displayed near the node title (in most themes) in full-page displays.'),
+  );
+
+  $form['link_settings']['links_related_display_length'] = array(
+    '#type' => 'select',
+    '#title' => t('Display trim length'),
+    '#default_value' => variable_get('links_related_display_length','0'),
+    '#options' => array(0=>t('Unlimited'), 20=>20, 30=>30, 40=>40),
+    '#description' => t('Trims the displayed text (but not the actual URL) for links displayed near the article title. Does not affect display of links as end-notes within the article body.'),
+  );
+
+  $form['link_settings']['links_related_enable_list'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show end-notes list'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('links_related_enable_list','1'),
+    '#description' => t('If enabled, a detailed and complete list of the article links will be appended to the end of the content, when in full-page display mode.'),
+  );
+  
+  $form['link_settings']['links_related_enable_tab'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show links tab'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('links_related_enable_tab','0'),
+    '#description' => t('If enabled, a tab will be added to node displays to display the list of links on their own separate page.'),
+  );
+
+  $form['types'] = array(
+    '#type' => 'markup',
+    '#value' =>'<p>' . t("To choose what content types have link URLs available, use the %workflowpage to set the 'has related links url' attribute for the desired node types. Note that you may need to revisit this setting if you add modules that define new node types, because the default is OFF for each content type." . "</p>", array('%workflowpage'=>l(t('default content workflow page'),'admin/node/configure/types'))),
+  );
+  
+  return $form;
 }
 
 /**
@@ -134,29 +173,52 @@
     // page for all node types (URL=admin/node/configure/defaults).
     case 'settings':
       $settings = array();
-      $settings[t('has related links url')] = form_checkbox(t('Allow related links URLs'),'links_related_types_'.$node->type, 1,
-        variable_get('links_related_types_'.$node->type, FALSE));
+      $settings['links_related_types_'.$node->type] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Allow related link URLs'),
+        '#return_value' => 1,
+        '#default_value' => variable_get('links_related_types_'.$node->type, 0),
+      );
       return $settings;
       break;
 
     // This allows the users to enter the links_related into appropriate
     // node types' edit screens.
-    case 'form post':
+    case 'form':
       if (variable_get('links_related_types_'. $node->type, FALSE)) {
         _links_related_sort_links($node);
         $links =& $node->links_links;
-        $group = '<table class="links_related_table">';
+
+        $form = array();
+        $form['links_links'] = array(
+          '#type' => 'fieldset',
+          '#tree' => TRUE,
+          '#title' => t('Related Links (optional)'),
+          '#description' => t('Links are stored as part of the %page. Monitoring and dead link detection are centrally managed from there. <strong>To remove a link from this article, just blank out its URL field or check the Delete box.</strong> If you blank out the title but leave the URL, then the system will suggest a title for you. The Weight allows you to determine the order in which links are displayed; lower numbers float to the top.',array('%page'=>l(t('links management feature'),'admin/links'))),
+          '#collapsible' => TRUE,
+          '#collapsed' => TRUE,
+        );
+
+        $form['links_links']['open_table'] = array(
+          '#type' => 'markup',
+          '#value' => '<table class="links_related_table"><tr><th class="links_related_table_url">URL</th><th class="links_related_table_title">Title</th><th class="links_related_table_weight">Weight</th><th class="links_related_table_delete">Delete</th></tr>',
+        );
+        
         // Existing links first
         for ($i=0; $i<count($links); $i++) {
-          $group .= _links_related_form_line($node, $i, $links[$i]);
+          $form['links_links'] = array_merge($form['links_links'], _links_related_form_line($node, $i, $links[$i]));
         }
-        // Then a blank one
-        $group .= _links_related_form_line($node, count($links), NULL);
-        $group .= '</table>';
-        return form_group(t('Related Links (optional)'), $group, t('Links are stored as part of the %page. Monitoring and dead link detection are centrally managed from there. <strong>To remove a link from this article, just blank out its URL field or check the Delete box.</strong> If you blank out the title but leave the URL, then the system will suggest a title for you. The Weight allows you to determine the order in which links are displayed; lower numbers float to the top.',array('%page'=>l(t('links management feature'),'admin/links'))));
+        $form['links_links'] = array_merge($form['links_links'], _links_related_form_line($node, count($links), NULL));
+
+        $form['links_links']['close_table'] = array(
+          '#type' => 'markup',
+          '#value' => '</table>',
+        );
+        return $form;
       }
       break;
 
+    /*
     // Validate the links fields. They are not required, but if present then
     // they need to make sense.
     case 'validate':
@@ -171,7 +233,7 @@
 // TODO -- right return value?
       return array('links_links'=>$links);
       break;
-
+*/
     // Load the values of the special table from the database as needed
     case 'load':
       if (variable_get('links_related_types_'. $node->type, FALSE)) {
@@ -311,20 +373,52 @@
  * Outputs one line of the data entry form for links
  */
 function _links_related_form_line(&$node, $i, $link=NULL) {
-	if (! is_array($link)) {
-		$link = array();
-	}
-        $html = '<tr>';
-	$html .= '<td class="links_related_table_left">';
-        $html .= form_textfield(t('Link %i URL',array('%i'=>$i+1)),'links_links]['.$i.'][url]', $link['url'], 128, 8000, ($i==0 ? t('URL of an external web page related to this article') : ''), '', FALSE);
-        $html .= form_textfield(t('Link %i title',array('%i'=>$i+1)),'links_links]['.$i.'][link_title]', $link['link_title'], 100, 100, ($i==0 ? t('Title for external URL (optional, defaults to showing the raw URL)') : ''), '', FALSE);
-        $html .= '</td>';
-	$html .= '<td class="links_related_table_right">';
-	$html .= form_weight(t('Weight'), 'links_links]['.$i.'][weight]', $link['weight'], 5);
-	$html .= form_checkbox(t('Delete'), 'links_links]['.$i.'][delete]', 1, $link['delete']);
-	$html .= '</td>';
-	$html .= '</tr>';
-	return $html;
+  if (! is_array($link)) {
+    $link = array();
+  }
+
+  $entry['links_links'][$i]['open_row'] = array(
+    '#type' => 'markup',
+    '#value' => '<tr><td class="links_related_table_url">',
+  );
+  $entry['links_links'][$i]['url'] = array(
+    '#type' => 'textfield',
+    '#default_value' => $link['url'],
+  );
+
+  $entry['links_links'][$i]['col2'] = array(
+    '#type' => 'markup',
+    '#value' => '</td><td class="links_related_table_title">',
+  );
+  $entry['links_links'][$i]['link_title'] = array(
+    '#type' => 'textfield',
+    '#default_value' => $link['link_title'],
+  ); 
+ 
+  $entry['links_links'][$i]['col3'] = array(
+    '#type' => 'markup',
+    '#value' => '</td><td class="links_related_table_weight">',
+  );
+  $entry['links_links'][$i]['weight'] = array(
+    '#type' => 'weight',
+    '#default_value' => $link['weight'],
+  );
+
+  $entry['links_links'][$i]['col4'] = array(
+    '#type' => 'markup',
+    '#value' => '</td><td class="links_related_table_delete">',
+  );
+  $entry['links_links'][$i]['delete'] = array(
+    '#type' => 'checkbox',
+    '#return_value' => 1,
+    '#default_value' => $link['delete'],
+  ); 
+
+  $entry['links_links'][$i]['close_row'] = array(
+    '#type' => 'markup',
+    '#value' => '</td></tr>',
+  );
+  return $entry;
 }
 
 /**
@@ -507,4 +601,4 @@
   $html .= '</table>';
   return form_group(t('Embedded Links'), $html, '<p>' . t('These are the links found inside the page content. You can choose to replace the direct URLs with managed links from the site\'s links catalog (adding new links if necessary), or to replace existing catalog links with the actual direct URLs. Titles added or changed here do not override titles for the same link if it appears on other pages.'));
 }
-?>
+
Index: modules/links/links_weblink.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/links/links_weblink.module,v
retrieving revision 1.1
diff -u -r1.1 links_weblink.module
--- modules/links/links_weblink.module	10 Jun 2005 04:29:09 -0000	1.1
+++ modules/links/links_weblink.module	13 Nov 2005 00:19:54 -0000
@@ -63,14 +63,26 @@
 }
 
 function links_weblink_nodeapi(&$node, $op, $teaser=NULL, $page=NULL) {
-  if ($node->type == 'weblink' && $op == 'form post') {
-    $output = '';
-    if (function_exists('taxonomy_node_form')) {
-      $output .= implode('', taxonomy_node_form('weblink', $node));
-    }
-    $output .= form_textarea(t("Body"), "body", $node->body, 60, 20, t("Textual description of the weblink") . ($error['body'] ? $error['body'] : ''));
-    $output .= filter_form('format', $node->format);
-    return $output;
+  if ($node->type == 'weblink' && $op == 'form') {
+    $form = array();
+    
+    $form['title'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Title'),
+      '#required' => TRUE,
+      '#default_value' => $node->title,
+      '#description' => t("Textual description of the weblink"),
+    );
+    
+    $form['body'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Body'),
+      '#default_value' => $node->body,
+      '#required' => TRUE,
+    );
+    
+    $form = array_merge($form, filter_form($node->format));
+    return $form;
   }
 }
 
@@ -200,3 +212,4 @@
   }
 }
 ?>
+   
\ No newline at end of file
Index: modules/links/links.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/links/links.module,v
retrieving revision 1.2
diff -u -r1.2 links.module
--- modules/links/links.module	16 Jun 2005 03:22:37 -0000	1.2
+++ modules/links/links.module	13 Nov 2005 00:19:54 -0000
@@ -32,23 +32,52 @@
 }
 
 function links_settings() {
+  $form = array();
+  
+  $form['description'] = array(
+    '#type' => 'markup',
+    '#value' => '<p>' . t('These settings control the behavior of the link-management services and provide defaults for modules which use those services. Some modules may offer module-specific settings that override these for that module only.'),
+  );
+  
+  $form['display_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Display settings'),
+  );
+  
+  $form['display_settings']['links_link_display'] = array(
+    '#type' => 'radios',
+    '#title' => t("Visit link display mode"),
+    '#options' => array(t("display as title"), t("display as url"), t("only display the 'visit external link' text")),
+    '#default_value' => variable_get("links_link_display", 0),
+    '#description' => t("Users are able to visit links via the node links list. This setting toggles how the visit link is displayed, either containing the node title or the node target URL or just the words 'visit external link'"),
+  );
+  
+    $form['link_targets'] = array( '#type' => 'fieldset', '#title' => t('Link
+                                  targets'), );
+
+      $form['link_targets']['links_target_default'] = array(     '#type' =>
+        'radios', '#title' => t("Open links in new window"), '#options' =>
+  array(t("Never"),t("All links"),t("External links only")), '#default_value' =>
+  variable_get("links_target_default", 0), '#description' => t("Controls opening
+                     of new browser windows for links."), );
+
+   $form['link_targets']['links_target_user'] = array(     '#type' => 'radios',
+     '#title' => t("User setting for target"), '#options' => array(t("deny"),
+      t("allow")), '#default_value' => variable_get("links_target_user", 0),
+  '#description' => t("Allow users to specify their own preference via the user
+                               settings page."), );
+  
+  $form['security_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Security settings'),
+  );
+  
+  $form['security_settings']['security_link'] = array(
+    '#type' => 'markup',
+    '#value' => t("You can set the permissions of who is allowed to view the count of how many people have followed each link in the %link.", array('%link'=>l(t('access control page'),'admin/access'))),
+  );
 
-  $output = '<p>' . t('These settings control the behavior of the link-management services and provide defaults for modules which use those services. Some modules may offer module-specific settings that override these for that module only.');
-
-  $group = form_radios(t("Visit link display mode"), "links_link_display", variable_get("links_link_display", 0), array(t("display as title"), t("display as url"), t("only display the 'visit external link' text")), t("Users are able to visit links via the node links list. This setting toggles how the visit link is displayed, either containing the node title or the node target URL or just the words 'visit external link'"));
-
-  $output .= form_group(t('Display settings'), $group);
-
-  $group = form_radios(t('Open links in new window'), "links_target_default", variable_get("links_target_default", 0), array(t("Never"),t("All links"),t("External links only")), t("Controls opening of new browser windows for links."));
-
-  $group .= form_radios(t('User setting for target'), "links_target_user", variable_get("links_target_user", 0), array(t("deny"), t("allow")), t("Allow users to specify their own preference via the user settings page."));
-
-  $output .= form_group(t('Link targets'), $group);
-
-  $group = t("You can set the permissions of who is allowed to view the count of how many people have followed each link in the %link.", array('%link'=>l(t('access control page'),'admin/access'))); 
-  $output .= form_group(t('Security settings'), $group);
-
-  return $output;
+  return $form;
 }
 
 function links_user($op, &$edit, &$user, $category='') {
@@ -60,12 +89,23 @@
       break; 
     case 'form':
       if ($category == 'links' && variable_get('links_target_user',0)) {
-        return array(array('title'=>t('Link settings'), 'data'=>form_select(t("Open links in new window"), "links_target_new", $user->links_target_new, array(t("Never"), t("All links"), t("External links only")), t("Create a new window when you click on a link."))));
+      	$form = array();
+  
+      	$form['links_target_new'] = array(
+          '#type' => 'radios',
+          '#title' => t("User setting for target"),
+          '#options' => array(t("Never"), t("All links"), t("External links only")),
+          '#default_value' => $user->links_target_new,
+          '#description' => t("Create a new window when you click on a link."),
+        );
+
+        return $form;
       }
       break;
     case 'validate':
       return array('links_target_new'=>$edit['links_target_new']);
     case 'view':
+    /*
       if (variable_get('links_target_user',0)) {
         $target_new = $user->links_target_new;
         switch ($target_new) {
@@ -82,6 +122,7 @@
         return array(t('Links')=>$text);
       }
       break;
+      */
   }
 }
 
@@ -298,4 +339,4 @@
 function _links_search_form($url='', $keys=NULL) {
   return '<p>Search stub for links';
 }
-?>
+
