diff dnd_test/dnd_test.module @ 14:ef7ad7b5baa4

Slightly changed matching mechanism to handle Firefox's crazy desire to make dropped src attributes relative.
author David Eads <eads@chicagotech.org>
date Fri, 27 Feb 2009 12:30:42 -0600
parents a5b2b9fa2a1a
children 7a5f74482ee3
line wrap: on
line diff
--- a/dnd_test/dnd_test.module	Fri Feb 27 11:51:28 2009 -0600
+++ b/dnd_test/dnd_test.module	Fri Feb 27 12:30:42 2009 -0600
@@ -26,10 +26,6 @@
  * This demonstrates how to attach Drag and Drop to a given textarea.
  */
 function dnd_test_form_alter(&$form, &$form_state) {
-
-  //global $_SERVER;
-  //dpm($_SERVER);
-
   if ($form['#id'] == 'node-form' && $form['type']['#value'] == 'page') {
     drupal_add_css(drupal_get_path('module', 'dnd_test') .'/dnd_test.css');
     $form['body_field']['body']['#dnd-enabled'] = TRUE;
@@ -92,7 +88,7 @@
 
 /**
  * Theme wrapper that spins out multiple library representations for a given
- ;[''''* editor representation.  This is because we want to demonstrate how to allow
+ * editor representation.  This is because we want to demonstrate how to allow
  * for multiple versions (i.e. different sizes) of a single item
  */
 function dnd_editor_items($i) {
@@ -122,12 +118,12 @@
   }
 
   //$variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-thumb.jpg');
-  $variables['image'] = '<img src="http://'. $_SERVER['SERVER_ADDR'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-thumb.jpg?dnd_id='. $i .'-M" class="drop" />';
+  $variables['image'] = '<img src="http://'. $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-thumb.jpg?dnd_id='. $i .'-M" class="drop" />';
   $variables['title'] = t('Lorem Ipsum @count', array('@count' => $i));
   $variables['date'] = 'Feb 18 2009';
   $variables['author'] = 'David Eads';
   foreach(array(t('S'), t('M'), t('L')) as $size) {
-    $sizes[] = '<img src="http://'. $_SERVER['SERVER_ADDR'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/icon/'. $size .'.png?dnd_id='. $i .'-'. $size .'" class="drop" />';
+    $sizes[] = '<img src="http://'. $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/icon/'. $size .'.png?dnd_id='. $i .'-'. $size .'" class="drop" />';
   }
   $variables['sizes'] = '<ul><li>'. implode('</li><li>', $sizes) .'</li></ul>';
 }