--- gmaplocation.module	2009-02-15 03:26:34.000000000 -0600
+++ gmaplocation.module	2009-06-21 11:35:28.000000000 -0500
@@ -22,14 +22,30 @@ function gmaplocation_menu() {
     'page callback' => 'drupal_get_form',
     'page arguments' => array('gmaplocation_admin_settings'),
     'access callback' => 'user_access',
-    'access arguments' => array('admin gmaplocation'),
+    'access arguments' => array('edit gmaplocation'),
     'type' => MENU_NORMAL_ITEM,
-  );    
+  ); 
   $items['gmaplocation'] = array('title' => 'Our Location',
     'access callback' => TRUE,
     'page callback' => 'gmaplocation_page',
     'type' => MENU_SUGGESTED_ITEM,
-    );
+  );
+
+  $items['gmaplocation/view'] = array(
+    'title' => 'View',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -10
+  );
+    
+  $items['gmaplocation/edit'] = array(
+    'title' => 'Edit',
+    'description' => 'Configure Google Maps location.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('gmaplocation_admin_settings'),
+    'access callback' => 'user_access',
+    'access arguments' => array('edit gmaplocation'),
+    'type' => MENU_LOCAL_TASK,
+  );
   return $items;
 }
 
@@ -38,21 +54,45 @@ function gmaplocation_menu() {
  */
 function gmaplocation_admin_settings() {
   drupal_add_js(drupal_get_path('module', 'gmaplocation') .'/gmaplocation_admin.js');
-                    
+
+  $form['info'] = array(
+   '#type' => 'fieldset',
+   '#title' => t('Information'), '#collapsible' => TRUE,
+   '#collapsed' => FALSE,
+    );
+  
+  $form['info']['gmaplocation_title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title'),
+    '#default_value' => variable_get('gmaplocation_title', 'Our Location'),
+    '#description' => t('The title of the page.'),
+    );
+
+  $form['info']['gmaplocation_additional']['gmaplocation_body'] = array('#type' => 'textarea',
+    '#required' => TRUE,
+    '#title' => t('Location information for visitors'),
+    '#default_value' => variable_get('gmaplocation_body', ''),
+    '#description' => t('You may give your visitors more information about where you located 
+                         such as specific driving directions.'),
+    );
+  
+  $form['info']['gmaplocation_additional']['format'] = filter_form();
+                        
   $form["location"] = array('#type' => 'fieldset',
-    '#title' => t('Your location'), '#collapsible' => TRUE,
-    '#collapsed' => FALSE);
+    '#title' => t('Your Location'), '#collapsible' => TRUE,
+    '#collapsed' => FALSE
+    );
   $form["location"]["gmaplocation_info"] = array('#type' => 'textarea',
-    '#title' => t('Description'),
+    '#title' => t('Marker Information'),
     '#default_value' => variable_get('gmaplocation_info', ''),
     '#description' => t('The description that would be shown when user click on marker. If this field is empty, address would be used.'),
     );
-    // clear gmaplocation_lat and gmaplocation_lng on change
+  // clear gmaplocation_lat and gmaplocation_lng on change
   $form["location"]["gmaplocation_address"] = array('#type' => 'textfield',
     '#required' => TRUE,
     '#title' => t('Address of your location'),
     '#default_value' => variable_get('gmaplocation_address', ''),
-    '#description' => NULL
+    '#description' => t('To help Google resolve your address, enter your address separated by commas: # Street, City, State, Zip'),
     );
   $form["location"]["gmaplocation_type"] = array('#type' => 'select',
     '#title' => t('Map type'),
@@ -61,14 +101,6 @@ function gmaplocation_admin_settings() {
     '#options' => array('G_NORMAL_MAP' => 'the default view', 'G_SATELLITE_MAP' => 'showing Google Earth satellite images', 'G_HYBRID_MAP' => 'showing a mixture of normal and satellite views'),
     );
     
-  $form["keys"]["gmaplocation_key"] = array('#type' => 'textfield',
-    '#title' => t('API key'),
-    '#required' => TRUE,
-    '#description' => t('Google Maps key for your domain.') . " " .  
-                      t('Obtain key on !url', array('!url' => l('http://code.google.com/apis/maps/signup.html', 'http://code.google.com/apis/maps/signup.html')))
-                      );
-    
-    
   $zoom_levels = array("0" => t("0 - minimum zoom level, whole world"));
   for ($i = 1; $i<17; $i++) $zoom_levels["$i"] = "$i";
   $zoom_levels["17"] = t("17 - maximum zoom level");
@@ -78,6 +110,19 @@ function gmaplocation_admin_settings() {
     '#description' => NULL,
     '#options' => $zoom_levels,
     );
+  $form["location"]["gmaplocation_width"] = array('#type' => 'textfield',
+    '#title' => t('Map Width'),
+    '#default_value' => variable_get('gmaplocation_width', '300'),
+    '#description' => NULL,
+    '#size' => 10,
+    );
+  $form["location"]["gmaplocation_height"] = array('#type' => 'textfield',
+    '#title' => t('Map Height'),
+    '#default_value' => variable_get('gmaplocation_height', '500'),
+    '#description' => NULL,
+    '#size' => 10,
+    );
+
   $form["location"]["latlng"] = array('#type' => 'fieldset',
     '#title' => t('Geographical coordinate'), 
     '#collapsible' => TRUE,
@@ -98,11 +143,11 @@ function gmaplocation_admin_settings() {
   $form["keys"]["gmaplocation_key"] = array('#type' => 'textfield',
     '#title' => t('API key'),
     '#default_value' => variable_get('gmaplocation_key', ''),
+    '#required' => TRUE,
     '#description' => t('Google Maps key for your domain.') . " " .  
                       t('Obtain key on !url', array('!url' => l('http://code.google.com/apis/maps/signup.html', 'http://code.google.com/apis/maps/signup.html')))
                       );
-	$form['#validate'][] = 'gmaplocation_admin_settings_submit';
-                      
+	$form['#validate'][] = 'gmaplocation_admin_settings_validate';
   return system_settings_form($form);
 }
 
@@ -132,6 +177,11 @@ function gmaplocation_perm() {
  * Menu callback; generate an page with Google Maps.
  */
 function gmaplocation_page() {
+  $gmaplocation_title = t(variable_get('gmaplocation_title', 'Our Location'));
+  $gmaplocation_body = t(variable_get('gmaplocation_body', 'Our Location'));
+  $gmaplocation_width = variable_get('gmaplocation_width', '500px');
+  $gmaplocation_height = variable_get('gmaplocation_height', '300px');
+  
   $path = drupal_get_path('module', 'gmaplocation');
   $gmap_key = variable_get("gmaplocation_key", NULL);
   drupal_set_html_head('<script src="http://maps.google.com/maps?file=api&amp;hl=en&amp;v=2&amp;key=' . $gmap_key . '" type="text/javascript"></script>');
@@ -145,11 +195,18 @@ function gmaplocation_page() {
       'type' => variable_get("gmaplocation_type", 'G_NORMAL_MAP'),
       'admin' => user_access('admin gmaplocation'),
     );
+
   if (!$gmaplocation_settings['info']) $gmaplocation_settings['info'] = $gmaplocation_settings['address'];
   drupal_add_js(array('gmaplocation' => $gmaplocation_settings), 'setting');
-  drupal_set_title(t("Location"));
-  $output = theme("gmaplocation_map");
+
+  $output = "<div id=\"gmaplocation_body\">" . $gmaplocation_body . "</div>";
+  $output .= "<div id=\"gmaplocation_map\" 
+                   style=\"width: " . $gmaplocation_width . "px;height: " . $gmaplocation_height . "px;\">";
+                   
+//  $output .= theme("gmaplocation_map");
+  $output .= "</div>";
   if (user_access('admin gmaplocation')) $output .= drupal_get_form("gmaplocation_in_place_edit_form");
+  drupal_set_title($gmaplocation_title);
   return $output;
 }
 
@@ -259,7 +316,7 @@ function gmaplocation_static_image_url($
 
 function gmaplocation_block_image() {
   $block = array();
-  $block['subject'] = t("Our location");
+  $block['subject'] = t(variable_get('gmaplocation_title', 'Our Location'));
   $block['content'] = theme("gmaplocation_block_image_link");
 	return($block);  
 }
