diff dnd_test/dnd_test.module @ 12:a5b2b9fa2a1a

Cross browser compatibility changes -- winnowing the scope of possible configurations.
author David Eads <eads@chicagotech.org>
date Fri, 27 Feb 2009 11:50:59 -0600
parents 5d2ae5b8eae2
children ef7ad7b5baa4
line wrap: on
line diff
--- a/dnd_test/dnd_test.module	Fri Feb 27 00:49:22 2009 -0600
+++ b/dnd_test/dnd_test.module	Fri Feb 27 11:50:59 2009 -0600
@@ -26,6 +26,10 @@
  * 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;
@@ -94,7 +98,7 @@
 function dnd_editor_items($i) {
   $item = array();
   foreach(array(t('S'), t('M'), t('L')) as $size) {
-    $item['item-'. $i .'-'. $size] = theme('dnd_editor_item', $i, $size);
+    $item[$i .'-'. $size] = theme('dnd_editor_item', $i, $size);
   }
   return $item;
 }
@@ -103,6 +107,8 @@
  * Completely contrived edit item theme function
  */
 function template_preprocess_dnd_library_item(&$variables) {
+  global $_SERVER;
+
   $i = $variables['i'];
 
   if ($i % 3 == 0) {
@@ -115,16 +121,13 @@
     $img = 1;
   }
 
-  $variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-thumb.jpg');
+  //$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['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) {
-    $attributes = array(
-      'class' => 'drop size-'. $size, 
-      'id' => 'item-'. $i .'-'. $size,
-    );
-    $sizes[] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/icon/'. $size .'.png', $size, $size, $attributes);
+    $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" />';
   }
   $variables['sizes'] = '<ul><li>'. implode('</li><li>', $sizes) .'</li></ul>';
 }