Fix for Patch file from Eclipse—seems to be improved

  1. Index: todo.txt
  2. ===================================================================
  3. RCS file: todo.txt
  4. diff -N todo.txt
  5. Index: gmaplocation.info
  6. ===================================================================
  7. RCS file: /cvs/drupal/contributions/modules/gmaplocation/gmaplocation.info,v
  8. retrieving revision 1.1
  9. diff -u -r1.1 gmaplocation.info
  10. --- gmaplocation.info   18 Jun 2008 14:19:44 -0000      1.1
  11. +++ gmaplocation.info   13 Feb 2009 13:30:53 -0000
  12. @@ -1,5 +1,6 @@
  13. -; $Id: gmaplocation.info,v 1.1 2008/06/18 14:19:44 bmihelac Exp $
  14. +; $Id$
  15.  name = Google Maps location
  16.  description = Display one geographic location via Google Maps
  17.  package = Location
  18. -version = "$Name:  $"
  19. \ No newline at end of file
  20. +core = 6.x
  21. +version = 6.x-1.x-dev
  22. \ No newline at end of file
  23. Index: gmaplocation.module
  24. ===================================================================
  25. RCS file: /cvs/drupal/contributions/modules/gmaplocation/gmaplocation.module,v
  26. retrieving revision 1.1
  27. diff -u -r1.1 gmaplocation.module
  28. --- gmaplocation.module 18 Jun 2008 14:19:44 -0000      1.1
  29. +++ gmaplocation.module 13 Feb 2009 13:30:54 -0000
  30. @@ -3,35 +3,33 @@
  31.  /**
  32.   * Implementation of hook_help
  33.   */  
  34. -function gmaplocation_help($section) {
  35. -  switch ($section) {
  36. -    case 'admin/help#pathauto':
  37. -      $output = t("<p>The gmaplocation module displays marker of your geographic location with Google Maps.</p>");
  38. -      return $output;
  39. +function gmaplocation_help($path, $arg) {
  40. +   switch ($path) {
  41. +      case 'admin/help#gmaplocation':
  42. +        $output = t("<p>The gmaplocation module displays marker of your geographic location with Google Maps.</p>");
  43. +        return $output;
  44.    }
  45.  }
  46.  
  47.  /**
  48.   * Implementation of hook_menu().
  49.   */
  50. -function gmaplocation_menu($may_cache) {
  51. +function gmaplocation_menu() {
  52.    $items = array();
  53. -  if ($may_cache) {
  54. -    $items[] = array(
  55. -      'path' => 'admin/settings/gmaplocation',
  56. -      'title' => t('Google Maps location'),
  57. -      'description' => t('Configure Google Maps location.'),
  58. -      'callback' => 'drupal_get_form',
  59. -      'callback arguments' => array('gmaplocation_admin_settings'),
  60. -      'access' => user_access('admin gmaplocation'),
  61. -      'type' => MENU_NORMAL_ITEM,
  62. -    );    
  63. -    $items[] = array('path' => 'gmaplocation', 'title' => t('Our Location'),
  64. -      'access' => TRUE,
  65. -      'callback' => 'gmaplocation_page',
  66. -      'type' => MENU_SUGGESTED_ITEM,
  67. -      );
  68. -  }
  69. +  $items['admin/settings/gmaplocation'] = array(
  70. +    'title' => 'Google Maps location',
  71. +    'description' => 'Configure Google Maps location.',
  72. +    'page callback' => 'drupal_get_form',
  73. +    'page arguments' => array('gmaplocation_admin_settings'),
  74. +    'access callback' => 'user_access',
  75. +    'access arguments' => array('admin gmaplocation'),
  76. +    'type' => MENU_NORMAL_ITEM,
  77. +  );    
  78. +  $items['gmaplocation'] = array('title' => 'Our Location',
  79. +    'access callback' => TRUE,
  80. +    'page callback' => 'gmaplocation_page',
  81. +    'type' => MENU_SUGGESTED_ITEM,
  82. +    );
  83.    return $items;
  84.  }
  85.  
  86. @@ -103,14 +101,14 @@
  87.      '#description' => t('Google Maps key for your domain.') . " " .  
  88.                        t('Obtain key on !url', array('!url' => l('http://code.google.com/apis/maps/signup.html', 'http://code.google.com/apis/maps/signup.html')))
  89.                        );
  90. -       $form['#submit'] = array('system_settings_form_submit' => array(), 'gmaplocation_admin_settings_submit' => array());
  91. +       $form['#validate'][] = 'gmaplocation_admin_settings_submit';
  92.                        
  93.    return system_settings_form($form);
  94.  }
  95.  
  96. -function gmaplocation_admin_settings_submit($form, $form_values) {
  97. -  if ($form_values['gmaplocation_address']) {
  98. -    $latlng = gmaplocation_geocode_for_address_recursive($form_values['gmaplocation_address']);
  99. +function gmaplocation_admin_settings_validate($form, &$form_state) {
  100. +  if ($form_state['values']['gmaplocation_address']) {
  101. +    $latlng = gmaplocation_geocode_for_address_recursive($form_state['values']['gmaplocation_address']);
  102.      if ($latlng != FALSE) {
  103.        list($lat, $lng) = $latlng;
  104.      } else {
  105. @@ -118,8 +116,8 @@
  106.        $lat = 46.051426;
  107.        $lng = 14.505965;
  108.      }
  109. -    variable_set('gmaplocation_lat', $lat);
  110. -    variable_set('gmaplocation_lng', $lng);
  111. +    $form_state['values']['gmaplocation_lat'] = $lat;
  112. +    $form_state['values']['gmaplocation_lng'] = $lng;
  113.    }
  114.  }
  115.  
  116. @@ -191,7 +189,7 @@
  117.  }
  118.  
  119.  function gmaplocation_in_place_edit_form() {
  120. -  $form['#base'] = 'system_settings_form';
  121. +  $form['#submit'][] = 'system_settings_form_submit';
  122.    $form['description'] = array(
  123.      '#prefix' => '<p>',
  124.      '#value' => t('Click and drag marker to fine tune position of your location.'),
  125. @@ -272,7 +270,7 @@
  126.   * @ingroup themeable
  127.   */
  128.  function theme_gmaplocation_block_image_link() {
  129. -  return(l('<img src="' . gmaplocation_static_image_url(160, 120) . '" />', 'gmaplocation', array(), NULL, NULL, FALSE, TRUE));
  130. +  return(l('<img src="' . gmaplocation_static_image_url(160, 120) . '" />', 'gmaplocation', array('html' => TRUE)));
  131.  }
  132.  
  133.  /**
  134. @@ -284,3 +282,13 @@
  135.    return ('<div id="gmaplocation_map" style="width: 640px; height: 480px"></div>');
  136.  }
  137.  
  138. +/**
  139. + * Implementation of hook_theme().
  140. + */
  141. +function gmaplocation_theme() {
  142. +  return array(
  143. +    'gmaplocation_block_image_link' => array(),
  144. +    'gmaplocation_map' => array(),
  145. +  );
  146. +}
  147. +
  148. \ No newline at end of file

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.