Index: navigate/navigate.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/navigate/navigate.js,v
retrieving revision 1.6
diff -u -p -r1.6 navigate.js
--- navigate/navigate.js	6 Nov 2008 01:46:43 -0000	1.6
+++ navigate/navigate.js	7 Nov 2008 21:43:58 -0000
@@ -10,41 +10,41 @@ $(document).ready(function(){
  * This is run on document load ready and when any widget is added. Widget class is passed via 'item'
  */
 function navigate_load_bind_widgets(item) {
-  
+
   // Set item if it's not set
   item = navigate_item_default(item);
-  
+
   // Bind events to on/off buttons
   navigate_bind_toggle_buttons(item);
-  
+
   // Bind events to callback buttons
   navigate_bind_callback_buttons(item);
-  
+
   // Bind events to text inputs
   navigate_bind_text_inputs(item);
-  
+
   // Bind events to close button
   navigate_bind_widget_close();
-  
+
   // Bind events to textarea
   navigate_bind_textareas();
-  
+
    // Bind event to widget settings button
   $(item + ' .navigate-widget-settings-button').click(function() {
     $(this).parent().find('.navigate-widget-settings-outer').slideToggle('slow', function() { navigate_cache_save();});
   });
-  
+
   // Add select all on text inputs
   $(item + " .navigate-select-all").focus(function () {
     $(this).select();
   });
-  
+
   // Bind doubleclick for title change
   navigate_bind_title_change(item);
-  
+
   // Add tooltips
   navigate_add_tooltips();
-  
+
 }
 
 
@@ -116,16 +116,16 @@ function navigate_bind_widget_close() {
  * Binds events and various errata after page is loaded
  */
 function navigate_load() {
-  
+
   // Bind click events to buttons and inputs to all widgets
   navigate_load_bind_widgets();
-  
+
   // Bind click event to widget list (if visible)
   navigate_bind_add_widget_list();
-  
+
   // Run pngFix for IE6
   $('.navigate').pngFix();
-  
+
    // Make widgets sortable using their title as the handle
   $(".navigate-all-widgets").sortable({
       cursor: "move",
@@ -169,10 +169,10 @@ function navigate_load() {
       }
     });
   });
-  
+
   // Add tooltips
   navigate_add_tooltips()
-  
+
   // Bind event to text input to save the value of the input.
   // Since the .val() and .attr() functions don't change the actual html of an input,
   // we have to add a hidden input with the value of the text field, and then replace the text field with the value
@@ -184,7 +184,7 @@ function navigate_load() {
       $(this).val($("input[rel='" + rel + "']").val());
     }
   });
-  
+
   // Clear user cache when button is clicked
   $('.navigate-clear-cache').click(function() {
     $.ajax({
@@ -198,16 +198,29 @@ function navigate_load() {
         }
       });
   });
-  
+
 
   // Run pngFix on switch button
   $('#navigate-switch-outer').pngFix();
- 
+
   // Add select all on text inputs with select all specified
   $(".navigate-select-all").focus(function () {
     $(this).select();
   });
-  
+
+  // Set our navigate_on variable
+  navigate_on == Drupal.settings.navigateOn;
+
+  // Set initial styling.
+  if (navigate_on == 0) {
+    $("body").css("padding-left", "0px");
+    $(".navigate").css("margin-left", "-550px");
+    $("#navigate-switch").css("margin-left", "-230px").css("margin-top", "-30px");
+    $(".navigate-loading").css("margin-left", "-550px");
+  } else {
+    $("body").css("padding-left", "210px");
+  }
+
     // Bind events to switch button
   $("#navigate-switch").click(function () {
     // Close
@@ -229,15 +242,15 @@ function navigate_load() {
       $("#navigate-switch").animate({ marginLeft: "-195px", marginTop: "0px"}, "slow");
       $(".navigate-loading").animate({ marginLeft: "-30px"}, "slow");
     }
-    
+
   });
-  
-  
-  // Bind click event to acklowledgement link 
+
+
+  // Bind click event to acklowledgement link
   $(".navigate-acknowledgement-switch").click(function () {
     $('.navigate-acknowledgement').slideToggle('slow');
   });
-  
+
   // Bind doubleclick event to title
   $('.navigate-title').dblclick(function() {
     $('.navigate-shorten').slideToggle('fast', function() {
@@ -252,12 +265,12 @@ function navigate_load() {
  */
 function navigate_bind_toggle_buttons(item) {
   item = navigate_item_default(item);
-  
+
   $(item + ' .navigate-button-outer').each(function() {
     var wid = navigate_widget_id(this);
     var widget = this;
     $(this).children().click(function() {
-      
+
       // Grab all variables from hidden inputs
       var on = $(widget).find('.on').val();
       var off = $(widget).find('.off').val();
@@ -265,7 +278,7 @@ function navigate_bind_toggle_buttons(it
       var required = $(widget).find('.required').val();
       var callback = $(widget).find('.callback').val();
       var val;
-      
+
       // If it's a group
       if ($(widget).find('.group').length > 0) {
         var group = $(widget).find('.group').val();
@@ -285,7 +298,7 @@ function navigate_bind_toggle_buttons(it
         });
         val = on;
         $(this).addClass('navigate-button-on');
-      
+
       // If not a group
       } else {
         // If it's just a callback
@@ -334,13 +347,13 @@ function navigate_bind_text_inputs(item)
   item = navigate_item_default(item);
   var search_timeout = undefined;
   $(item + ' .navigate-text-input-outer').each(function() {
-    
+
     var wid = navigate_widget_id(this);
     var widget = this;
     var callback = $(widget).children('.callback').val();
     var name = $(widget).children('.name').val();
     var text_input = this;
-    
+
     $(this).find('input').bind('keyup', function(e) {
       var input_name = $(text_input).children('div').children('input').attr('name');
       var id = $(text_input).children('div').children('input').attr('id');
@@ -354,7 +367,7 @@ function navigate_bind_text_inputs(item)
             $(this).val('');
             $('.' + holder_id).remove();
             var new_input = '<div  class="' + holder_id + '"><input rel="' + id + '" type="hidden" name="' + input_name + '" value="' + val + '" /></div>';
-            $(text_input).parent().append(new_input);          
+            $(text_input).parent().append(new_input);
             //navigate_variable_set(name, '', wid);
           }
         }
@@ -363,14 +376,14 @@ function navigate_bind_text_inputs(item)
                 clearTimeout(search_timeout);
         }
         var $this = this;
-        
+
         // Set timeout to save input text when typing is paused
         search_timeout = setTimeout(function() {
           search_timeout = undefined;
           var val = $(text_input).children('div').children('input').val();
           $('.' + holder_id).remove();
           var new_input = '<div  class="' + holder_id + '"><input rel="' + id + '" type="hidden" name="' + input_name + '" value="' + val + '" /></div>';
-          $(text_input).parent().append(new_input);          
+          $(text_input).parent().append(new_input);
           navigate_variable_set(name, val, wid);
           navigate_cache_save();
         }, 500);
@@ -426,7 +439,7 @@ function navigate_add_tooltips() {
  * Set a variable
  */
 function navigate_variable_set(name, val, wid) {
-  
+
   // Save the variable in a database
   navigate_queue_add();
    $.ajax({
@@ -465,10 +478,10 @@ function navigate_queue_subtract() {
  * Save html to cache
  */
 function navigate_cache_save() {
-  
+
   // Refresh tooltips, added here for convenience so widgets don't have to call it on laoding
   navigate_add_tooltips();
-  
+
   navigate_queue_add();
   $.ajax({
       url: $("#navigate_process_url").val(),
Index: navigate/navigate.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/navigate/navigate.module,v
retrieving revision 1.7
diff -u -p -r1.7 navigate.module
--- navigate/navigate.module	6 Nov 2008 01:46:43 -0000	1.7
+++ navigate/navigate.module	7 Nov 2008 21:43:58 -0000
@@ -31,14 +31,14 @@ function navigate_menu() {
     'callback' => 'navigate_process',
     'access' => user_access('navigate view'),
     'type' => MENU_CALLBACK,
-  ); 
+  );
   $items[]= array(
     'path' => 'navigate/clear',
     'callback' => 'navigate_clear_user_cache_and_back',
     'access' => user_access('navigate view'),
     'type' => MENU_CALLBACK,
-  ); 
-  
+  );
+
   return $items;
 }
 
@@ -54,6 +54,15 @@ function navigate_init() {
     drupal_add_js(drupal_get_path('module', 'navigate') .'/jquery_plugins/jquery.tooltip.js', 'module', 'footer');
     drupal_add_js(drupal_get_path('module', 'navigate') .'/jquery_plugins/jquery-ui.js', 'module', 'footer');
     drupal_add_js(drupal_get_path('module', 'navigate') .'/jquery_plugins/jquery.pngFix.js', 'module', 'footer');
+
+    $on = navigate_variable_get('on');
+
+    // Default to on
+    if ($on == '') {
+      $on = 0;
+    }
+
+    drupal_add_js(array('navigateOn' => $on), 'setting');
   }
 }
 
@@ -62,7 +71,7 @@ function navigate_init() {
  * Render help page
  */
 function navigate_help_page() {
-  
+
 
 }
 
@@ -130,7 +139,7 @@ function navigate_admin_settings() {
     '#type' => 'textarea',
     '#rows' => '7',
     '#default_value' => variable_get('navigate_help_text', navigate_HELP_TEXT),
-  );  
+  );
   return $settings;
 }
 
@@ -139,36 +148,18 @@ function navigate_admin_settings() {
  * Implementation of hook_footer()
  */
 function navigate_footer() {
-  
+
   if (user_access('navigate view')) {
     // Build navigate
     $output = navigate_build();
-    $on = navigate_variable_get('on');
-    
-    // Default to on
-    if ($on == '') {
-      $on = 0;
-    }
-    
-    // If off, set navigate outside of the current view
-    if ($on == 0) {
-      $style = 'body { padding-left:0px;} .navigate { margin-left:-550px;} #navigate-switch { margin-left:-230px; margin-top:-30px;} .navigate-loading { margin-left:-550px;}';
-      
-    // If on, add some padding to the body
-    }
-    else {
-      $style = 'body { padding-left:210px;}';
-    }
-    
+
     // Theme navigate
     $output = theme('navigate_outer', $output, $hidden);
     $output .= '
       <input type="hidden" id="navigate_process_url" value="'. url('navigate/process') .'" />
-      <input type="hidden" id="navigate_q" value="'. $_GET['q'] .'" />
-      <style>'. $style .'</style>
-      <script>var navigate_on = '. $on .';</script>';
+      <input type="hidden" id="navigate_q" value="'. $_GET['q'] .'" />';
   }
-  
+
   navigate_acknowledgetment(&$output);
   return $output;
 }
@@ -181,7 +172,7 @@ function navigate_acknowledgetment(&$out
   return $output;
 
    /*
-    
+
   $last = variable_get('navigate_last', '0');
   //if (time() - $last > 60*60*24*14) {
     if (variable_get('navigate_ackowledgement', '') == '') {
@@ -249,7 +240,7 @@ function navigate_process() {
     case 'widget_delete':
       navigate_widget_delete();
       break;
-    
+
     default:
       if (module_exists($_POST['module'])) {
         $function = $_POST['module'] .'_navigate_widget_process';
@@ -271,7 +262,7 @@ function navigate_clear_user_cache() {
  * Clears the cache table
  */
 function navigate_clear_cache() {
-  db_query("TRUNCATE TABLE {navigate_cache}");  
+  db_query("TRUNCATE TABLE {navigate_cache}");
 }
 
 
@@ -317,7 +308,7 @@ function navigate_widget_sort() {
 function navigate_widget_add($output=TRUE, $type='', $module='') {
   global $user;
   $wid = db_next_id('{navigate_widgets}_wid');
-  
+
   if ($type == '') {
     $type = $_POST['type'];
   }
@@ -330,7 +321,7 @@ function navigate_widget_add($output=TRU
   // Get next weight
   $weight = db_result(db_query_range("SELECT weight FROM {navigate_widgets} WHERE uid = '%d' ORDER BY weight DESC", $user->uid, 0, 1));
   $weight++;
-  
+
   db_query("INSERT INTO {navigate_widgets} SET wid = '%d', uid = '%d', type = '%s', module='%s', weight='%d'", $wid, $user->uid, $type, $module, $weight);
   if ($output) {
     $row = db_fetch_array(db_query("SELECT * FROM {navigate_widgets} WHERE wid = '%d'", $wid));
@@ -424,7 +415,7 @@ function navigate_variable_get($name, $w
  */
 function navigate_build() {
   global $user;
-  
+
   // Return from cache if cache is not disabled
   if (NAVIGATE_DISABLE_CACHE != 1) {
     $result = db_query("SELECT * FROM {navigate_cache} WHERE uid = '%d'", $user->uid);
@@ -432,19 +423,19 @@ function navigate_build() {
       return trim($row['content']);
     }
   }
-  
+
   // Build default widget set, if there are no widgets
   $count = db_result(db_query("SELECT COUNT(wid) FROM {navigate_widgets} WHERE uid = '%d'", $user->uid));
   if ($count < 1) {
     navigate_add_default_widgets();
   }
-  
+
   // Build widgets
   $result = db_query("SELECT * FROM {navigate_widgets} WHERE uid = '%d' ORDER BY weight ASC", $user->uid);
   while ($row = db_fetch_array($result)) {
     $output .= navigate_output_widget($row);
   }
-  
+
   // Clear cache button
    $settings = array(
     'help' => 'Click this to clear the cache',
@@ -453,14 +444,14 @@ function navigate_build() {
   );
   $help = navigate_help_helper($settings);
   $content['cache_button'] = '<div class="navigate-clear-cache'. $help['class'] .'"'. $help['rel'] .'></div>'. $help['output'];
-  
+
   $output = theme('navigate_all_widgets', $output);
   //$output .= navigate_help_helper(NULL, TRUE);
   $content['navigate'] = $output;
-  
+
   $output = theme('navigate', $content);
   navigate_cache_save($output);
-  
+
   return $output;
 }
 
@@ -531,7 +522,7 @@ function navigate_add_widget_link($conte
  * Theme the navigate bar
  */
 function theme_navigate($content) {
-  
+
   //$title_help =navigate_help_helper(array('help' => t('Double-click this title to hide parts of widgets you might not need all the time.'), 'class' => 'navigate-title'));
   $help = navigate_help_helper('<p><strong>'. t('Add / Remove Widgets') .'</strong></p><p>'. t('Click this to display a list of widgets to add. When clicked, this will also add close buttons to visible widgets.') .'</p>');
   $output = '
@@ -630,7 +621,7 @@ function navigate_button($button_setting
     }
   }
   $settings = navigate_widget_settings_get($button_settings['wid']);
-  
+
   // If the setting hasn't set before, set it to the default
   if (is_null($settings[$button_settings['name']]) && $button_settings['default'] != '') {
     $settings = array(
@@ -641,7 +632,7 @@ function navigate_button($button_setting
     navigate_variable_set($settings);
     $settings = navigate_widget_settings_get($button_settings['wid'], TRUE);
   }
-  
+
   if ($settings[$button_settings['name']] == $button_settings['on']) {
     $on_class = ' navigate-button-on ';
   }
