changeset 26:45c6c48c2a88

Moved dnd_test module.
author David Eads <eads@chicagotech.org>
date Wed, 11 Mar 2009 22:52:20 -0500
parents e71df38143d1
children 9a92410be362
files dnd_test/dnd-editor-item.tpl.php dnd_test/dnd-library-header.tpl.php dnd_test/dnd-library-item.tpl.php dnd_test/dnd-library-preview.tpl.php dnd_test/dnd_test.css dnd_test/dnd_test.info dnd_test/dnd_test.module dnd_test/img-backup/page-1-large.jpg dnd_test/img-backup/page-1-small.jpg dnd_test/img-backup/page-2-large.jpg dnd_test/img-backup/page-2-small.jpg dnd_test/img/icon/L.png dnd_test/img/icon/M.png dnd_test/img/icon/S.png dnd_test/img/item-1-L.jpg dnd_test/img/item-1-M.jpg dnd_test/img/item-1-S.jpg dnd_test/img/item-1-thumb.jpg dnd_test/img/item-2-L.jpg dnd_test/img/item-2-M.jpg dnd_test/img/item-2-S.jpg dnd_test/img/item-2-thumb.jpg dnd_test/img/item-3-L.jpg dnd_test/img/item-3-M.jpg dnd_test/img/item-3-S.jpg dnd_test/img/item-3-thumb.jpg modules/dnd_test/dnd-editor-item.tpl.php modules/dnd_test/dnd-library-header.tpl.php modules/dnd_test/dnd-library-item.tpl.php modules/dnd_test/dnd-library-preview.tpl.php modules/dnd_test/dnd_test.css modules/dnd_test/dnd_test.info modules/dnd_test/dnd_test.module modules/dnd_test/img-backup/page-1-large.jpg modules/dnd_test/img-backup/page-1-small.jpg modules/dnd_test/img-backup/page-2-large.jpg modules/dnd_test/img-backup/page-2-small.jpg modules/dnd_test/img/icon/L.png modules/dnd_test/img/icon/M.png modules/dnd_test/img/icon/S.png modules/dnd_test/img/item-1-L.jpg modules/dnd_test/img/item-1-M.jpg modules/dnd_test/img/item-1-S.jpg modules/dnd_test/img/item-1-thumb.jpg modules/dnd_test/img/item-2-L.jpg modules/dnd_test/img/item-2-M.jpg modules/dnd_test/img/item-2-S.jpg modules/dnd_test/img/item-2-thumb.jpg modules/dnd_test/img/item-3-L.jpg modules/dnd_test/img/item-3-M.jpg modules/dnd_test/img/item-3-S.jpg modules/dnd_test/img/item-3-thumb.jpg
diffstat 52 files changed, 381 insertions(+), 381 deletions(-) [+]
line wrap: on
line diff
--- a/dnd_test/dnd-editor-item.tpl.php	Wed Mar 11 14:07:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-<?php print $image; ?>
--- a/dnd_test/dnd-library-header.tpl.php	Wed Mar 11 14:07:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<h3><?php print t('Test library: Page @page', array('@page' => $page)); ?></h3>
-
-<div class="view-filters">
-  <form method="get" action="/" id="test-form">
-    <div><label for="test-form-page">Page:</label> <input type="text" id="test-form-page" name="test-form-page" /></div>
-    <div><input type="submit" id="test-form-submit" value="Switch page" /></div>
-  </form>
-</div>
-
--- a/dnd_test/dnd-library-item.tpl.php	Wed Mar 11 14:07:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<div class="editor-item" id="<?php print $id; ?>">
-  <div class="image">
-    <?php print $image; ?>
-  </div>
-
-  <div class="meta">
-    <div class="title"><?php print $title; ?></div>
-    <div class="author"><?php print $author; ?></div>
-    <div class="date"><?php print $date; ?></div>
-  </div>
-
-  <div class="sizes">
-    <?php print $sizes; ?>
-  </div>
-</div>
--- a/dnd_test/dnd-library-preview.tpl.php	Wed Mar 11 14:07:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<div class="dnd-editor-preview" id="<?php print $id; ?>">
-  <h2 class="title">
-    <?php print $title; ?>
-  </h2>
-
-  <div class="media-meta">
-    <div class="description">
-      <?php print $description; ?>
-    </div>
-    <div class="attribution">
-      <span class="author"><?php print $author; ?></span> | 
-      <span class="date"><?php print $date; ?></span>
-    </div>
-  </div>
-
-  <div class="media-preview">
-    <?php print $image; ?>
-  </div>
-
-</div>
--- a/dnd_test/dnd_test.css	Wed Mar 11 14:07:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/* This is bad stuff! */
-.body-field-wrapper {
-  float: left;
-  width: 100%;
-}
-.dnd-library-wrapper {
-  float: left;
-  width: 250px;
-  margin-right: 10px;
-  margin-top: 1em;
-}
-.dnd-library-wrapper .header {
-  padding: 1px 4px;
-}
-.dnd-library-wrapper .header h3 {
-  font-size: 12px;
-  font-weight: bold;
-}
-.dnd-library-wrapper .footer {
-  float: left;
-  width: 100%;
-  border-top: 1px solid #aaa;
-  background-color: #ccc;
-}
-.dnd-library-wrapper .pager {
-  font-weight: bold;
-  padding: 0 5px;
-}
-#edit-body-wrapper {
-  float: left;
-  width: 600px;
-}
-.dnd-library-wrapper .library {
-  border: 1px solid #aaa;
-  float: left;
-}
-.dnd-library-wrapper .editor-item {
-  float: left;
-  width: 250px;
-  border-bottom: 2px solid #fff;
-  background-color: #ddd;
-}
-.dnd-library-wrapper .editor-item > div {
-  padding: 3px;
-}
-.dnd-library-wrapper div.image {
-  float: left;
-  width: 32px;
-  padding-left: 4px;
-  line-height: 1;
-}
-.dnd-library-wrapper div.meta {
-  float: left;
-  width: 149px;
-  line-height: 1.2;
-}
-.dnd-library-wrapper .title {
-  font-weight: bold;
-  font-size: 12px;
-}
-.dnd-library-wrapper .date, .dnd-library-wrapper .author {
-  font-size: 10px;
-  float: left;
-  margin-top: .5em;
-}
-.dnd-library-wrapper .author {
-  margin-right: 1em;
-}
-.dnd-library-wrapper .editor-item .sizes {
-  float: left;
-  width: 50px;
-  margin-top: 14px;
-  line-height: 1;
-}
-.dnd-library-wrapper .editor-item .sizes ul {
-  list-style-type: none;
-  margin: 0;
-}
-.dnd-library-wrapper .editor-item .sizes ul li {
-  background: none;
-  list-style-type: none;
-  display: inline;
-  padding: 0;
-  margin: 0 0 0 2px;
-}
-.dnd-library-wrapper .editor-item .sizes a {
-  float: left;
-  display: block;
-  font-size: 9px;
-  line-height: 9px;
-  margin-bottom: 2px;
-  width: 19px;
-  text-align: center;
-}
-.dnd-library-wrapper .editor-item .sizes a:link,
-.dnd-library-wrapper .editor-item .sizes a:visited,
-.dnd-library-wrapper .editor-item .sizes a:active {
-  border: 1px solid #888;
-  color: #fff;
-  cursor: move;
-  text-align: center;
-}
-.dnd-library-wrapper .editor-item .sizes a:hover,
-.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:link,
-.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:visited,
-.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:active {
-  border: 1px solid #555;
-  color: #fff;
-  text-decoration: none;
-}
-.dnd-library-wrapper .editor-item .sizes a:hover span,
-.dnd-library-wrapper .editor-item .sizes a.dnd-inserted span {
-  background-color: #555;
-}
-
-.dnd-library-wrapper .editor-item .sizes a span {
-  display: block;
-  background-color: #888;
-}
-.dnd-library-wrapper .editor-item .sizes a.size-S span {
-  margin: 3px;
-  padding: 2px 0;
-}
-.dnd-library-wrapper .editor-item .sizes a.size-M span {
-  margin: 2px;
-  padding: 3px 0;
-}
-.dnd-library-wrapper .editor-item .sizes a.size-L span {
-  margin: 1px;
-  padding: 4px 0;
-}
-.dnd-library-wrapper .editor-item.dnd-child-inserted {
-  background-color: #ccc;
-}
-.dnd-editor-preview h2.title {
-  font-size: 1em;
-  font-weight: bold;
-  margin-bottom: 0.5em;
-}
-.dnd-editor-preview .media-preview { 
-  float: left;
-  width: 125px;
-}
-
-.dnd-editor-preview .media-meta {
-  float: left;
-  width: 225px;
-  margin-right: 20px;
-}
-
-.dnd-editor-preview .attribution {
-  font-size: .875em;
-  margin-bottom: .5em;
-}
--- a/dnd_test/dnd_test.info	Wed Mar 11 14:07:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-; $Id$
-name = DnD Library Tests
-package = User interface
-description = Defines some menu callbacks and form alterations which test the drag and drop plugin.
-dependencies[] = dnd
-core = 6.x
-
--- a/dnd_test/dnd_test.module	Wed Mar 11 14:07:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-<?php
-
-/**
- * Implementation of hook_menu().
- */
-function dnd_test_menu() {
-  $items = array();
-  $items['dnd-test/library'] = array(
-    'title' => 'Drag and drop test library',
-    'page callback' => 'dnd_test_library',
-    'access arguments' => array('access dnd test library'),
-  );
-  return $items;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function dnd_test_perm() {
-  return array('access dnd test library');
-}
-
-/**
- * Implementation of hook_form_alter().
- *
- * This demonstrates how to attach Drag and Drop to a given textarea.
- */
-function dnd_test_form_alter(&$form, &$form_state) {
-  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;
-    $form['body_field']['body']['#dnd-settings'] = array(
-      'drop_selector' => '#edit-body-dnd-library .drop',
-      'url' => 'dnd-test/library',
-    );
-    $form['body_field']['body']['#rows'] = 28;
-  }
-}
-
-/**
- * Implementation of hook_theme().
- */
-function dnd_test_theme() {
-  return array(
-    'dnd_editor_item'  => array(
-      'arguments' => array('i' => NULL, 'size' => NULL),
-      'template'  => 'dnd-editor-item',
-    ),
-    'dnd_library_item' => array(
-      'arguments' => array('i' => NULL), 
-      'template'  => 'dnd-library-item',
-    ),
-    'dnd_library_preview' => array(
-      'arguments' => array('i' => NULL),
-      'template'  => 'dnd-library-preview',
-    ),
-    'dnd_library_header' => array(
-      'arguments' => array('page' => NULL),
-      'template'  => 'dnd-library-header',
-    ),
-  );
-}
-
-/**
- * Page callback that returns some JSON
- */
-function dnd_test_library() {
-  $page = ($_GET['page']) ? $_GET['page'] : 1;
-  $test_library = dnd_test_generate_library($page);
-  return drupal_json(array(
-    'header'  => theme('dnd_library_header', $page),
-    'library' => $test_library['library'],
-    'editor_representations' => $test_library['editor_representations'],
-    'library_previews' => $test_library['library_previews'],
-    'footer'  => '<div class="pager">'. l(t('1'), 'dnd-test/library') . ' '. l(t('2'), 'dnd-test/library', array('query' => array('page' => 2))) .'</div>',
-  ));
-}
-
-/**
- * Create contrived output
- */
-function dnd_test_generate_library($page = 1, $limit = 8) {
-  $start = ($page * $limit) - ($limit); 
-  $end   = $page * $limit;
-
-  $library = '';
-  $editor_representations = array();
-  $library_previews = array();
-  for ($i=$start + 1; $i < $end + 1; $i++) {
-    $library .= theme('dnd_library_item', $i);
-    $editor_representations += dnd_editor_items($i);
-    $library_previews['dnd-test-'. $i] = theme('dnd_library_preview', $i);
-  }
-  return array(
-    'library' => $library,
-    'editor_representations' => $editor_representations,
-    'library_previews' => $library_previews,
-  );
-}
-
-/**
- * Theme wrapper that spins out multiple library representations for a given
- * 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) {
-  $item = array();
-  foreach(array(t('S'), t('M'), t('L')) as $size) {
-    $item[$i .'-'. $size] = array(
-      'body' => theme('dnd_editor_item', $i, $size),
-      'title' => 'Item '. $i .'-S',
-    );
-  }
-  return $item;
-}
-
-/**
- * Completely contrived library preview theme function
- */
-function template_preprocess_dnd_library_preview(&$variables) {
-  template_preprocess_dnd_library_item($variables);
-
-  $variables['id'] = 'dnd-preview-'. $variables['i'];
-  $variables['image'] = '<img src="http://'. $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/item-'. $variables['img_num'] .'-S.jpg" class="drop" width="125" height="94" />';
-
-  $variables['description'] = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
-}
-
-
-/**
- * Completely contrived edit item theme function
- */
-function template_preprocess_dnd_library_item(&$variables) {
-  global $_SERVER;
-
-  $i = $variables['i'];
-
-  if ($i % 3 == 0) {
-    $img = 3;
-  }
-  else if ($i % 2 == 0) {
-    $img = 2;
-  }
-  else {
-    $img = 1;
-  }
-
-  $variables['img_num'] = $img;
-  $variables['id'] = 'dnd-test-'. $i;
-  $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['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>';
-}
-
-function template_preprocess_dnd_editor_item(&$variables) {
-  list($i, $size) = array($variables['i'], $variables['size']);
-
-  if ($i % 3 == 0) {
-    $img = 3;
-  }
-  else if ($i % 2 == 0) {
-    $img = 2;
-  }
-  else {
-    $img = 1;
-  }
-  $variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-'. $size .'.jpg', '', '', array('class' => 'dnd-dropped', 'id' => 'dnd-id-'. $i));
-}
-
-function template_preprocess_dnd_library_header(&$variables) {}
Binary file dnd_test/img-backup/page-1-large.jpg has changed
Binary file dnd_test/img-backup/page-1-small.jpg has changed
Binary file dnd_test/img-backup/page-2-large.jpg has changed
Binary file dnd_test/img-backup/page-2-small.jpg has changed
Binary file dnd_test/img/icon/L.png has changed
Binary file dnd_test/img/icon/M.png has changed
Binary file dnd_test/img/icon/S.png has changed
Binary file dnd_test/img/item-1-L.jpg has changed
Binary file dnd_test/img/item-1-M.jpg has changed
Binary file dnd_test/img/item-1-S.jpg has changed
Binary file dnd_test/img/item-1-thumb.jpg has changed
Binary file dnd_test/img/item-2-L.jpg has changed
Binary file dnd_test/img/item-2-M.jpg has changed
Binary file dnd_test/img/item-2-S.jpg has changed
Binary file dnd_test/img/item-2-thumb.jpg has changed
Binary file dnd_test/img/item-3-L.jpg has changed
Binary file dnd_test/img/item-3-M.jpg has changed
Binary file dnd_test/img/item-3-S.jpg has changed
Binary file dnd_test/img/item-3-thumb.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dnd_test/dnd-editor-item.tpl.php	Wed Mar 11 22:52:20 2009 -0500
@@ -0,0 +1,1 @@
+<?php print $image; ?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dnd_test/dnd-library-header.tpl.php	Wed Mar 11 22:52:20 2009 -0500
@@ -0,0 +1,9 @@
+<h3><?php print t('Test library: Page @page', array('@page' => $page)); ?></h3>
+
+<div class="view-filters">
+  <form method="get" action="/" id="test-form">
+    <div><label for="test-form-page">Page:</label> <input type="text" id="test-form-page" name="test-form-page" /></div>
+    <div><input type="submit" id="test-form-submit" value="Switch page" /></div>
+  </form>
+</div>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dnd_test/dnd-library-item.tpl.php	Wed Mar 11 22:52:20 2009 -0500
@@ -0,0 +1,15 @@
+<div class="editor-item" id="<?php print $id; ?>">
+  <div class="image">
+    <?php print $image; ?>
+  </div>
+
+  <div class="meta">
+    <div class="title"><?php print $title; ?></div>
+    <div class="author"><?php print $author; ?></div>
+    <div class="date"><?php print $date; ?></div>
+  </div>
+
+  <div class="sizes">
+    <?php print $sizes; ?>
+  </div>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dnd_test/dnd-library-preview.tpl.php	Wed Mar 11 22:52:20 2009 -0500
@@ -0,0 +1,20 @@
+<div class="dnd-editor-preview" id="<?php print $id; ?>">
+  <h2 class="title">
+    <?php print $title; ?>
+  </h2>
+
+  <div class="media-meta">
+    <div class="description">
+      <?php print $description; ?>
+    </div>
+    <div class="attribution">
+      <span class="author"><?php print $author; ?></span> | 
+      <span class="date"><?php print $date; ?></span>
+    </div>
+  </div>
+
+  <div class="media-preview">
+    <?php print $image; ?>
+  </div>
+
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dnd_test/dnd_test.css	Wed Mar 11 22:52:20 2009 -0500
@@ -0,0 +1,154 @@
+/* This is bad stuff! */
+.body-field-wrapper {
+  float: left;
+  width: 100%;
+}
+.dnd-library-wrapper {
+  float: left;
+  width: 250px;
+  margin-right: 10px;
+  margin-top: 1em;
+}
+.dnd-library-wrapper .header {
+  padding: 1px 4px;
+}
+.dnd-library-wrapper .header h3 {
+  font-size: 12px;
+  font-weight: bold;
+}
+.dnd-library-wrapper .footer {
+  float: left;
+  width: 100%;
+  border-top: 1px solid #aaa;
+  background-color: #ccc;
+}
+.dnd-library-wrapper .pager {
+  font-weight: bold;
+  padding: 0 5px;
+}
+#edit-body-wrapper {
+  float: left;
+  width: 600px;
+}
+.dnd-library-wrapper .library {
+  border: 1px solid #aaa;
+  float: left;
+}
+.dnd-library-wrapper .editor-item {
+  float: left;
+  width: 250px;
+  border-bottom: 2px solid #fff;
+  background-color: #ddd;
+}
+.dnd-library-wrapper .editor-item > div {
+  padding: 3px;
+}
+.dnd-library-wrapper div.image {
+  float: left;
+  width: 32px;
+  padding-left: 4px;
+  line-height: 1;
+}
+.dnd-library-wrapper div.meta {
+  float: left;
+  width: 149px;
+  line-height: 1.2;
+}
+.dnd-library-wrapper .title {
+  font-weight: bold;
+  font-size: 12px;
+}
+.dnd-library-wrapper .date, .dnd-library-wrapper .author {
+  font-size: 10px;
+  float: left;
+  margin-top: .5em;
+}
+.dnd-library-wrapper .author {
+  margin-right: 1em;
+}
+.dnd-library-wrapper .editor-item .sizes {
+  float: left;
+  width: 50px;
+  margin-top: 14px;
+  line-height: 1;
+}
+.dnd-library-wrapper .editor-item .sizes ul {
+  list-style-type: none;
+  margin: 0;
+}
+.dnd-library-wrapper .editor-item .sizes ul li {
+  background: none;
+  list-style-type: none;
+  display: inline;
+  padding: 0;
+  margin: 0 0 0 2px;
+}
+.dnd-library-wrapper .editor-item .sizes a {
+  float: left;
+  display: block;
+  font-size: 9px;
+  line-height: 9px;
+  margin-bottom: 2px;
+  width: 19px;
+  text-align: center;
+}
+.dnd-library-wrapper .editor-item .sizes a:link,
+.dnd-library-wrapper .editor-item .sizes a:visited,
+.dnd-library-wrapper .editor-item .sizes a:active {
+  border: 1px solid #888;
+  color: #fff;
+  cursor: move;
+  text-align: center;
+}
+.dnd-library-wrapper .editor-item .sizes a:hover,
+.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:link,
+.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:visited,
+.dnd-library-wrapper .editor-item .sizes a.dnd-inserted:active {
+  border: 1px solid #555;
+  color: #fff;
+  text-decoration: none;
+}
+.dnd-library-wrapper .editor-item .sizes a:hover span,
+.dnd-library-wrapper .editor-item .sizes a.dnd-inserted span {
+  background-color: #555;
+}
+
+.dnd-library-wrapper .editor-item .sizes a span {
+  display: block;
+  background-color: #888;
+}
+.dnd-library-wrapper .editor-item .sizes a.size-S span {
+  margin: 3px;
+  padding: 2px 0;
+}
+.dnd-library-wrapper .editor-item .sizes a.size-M span {
+  margin: 2px;
+  padding: 3px 0;
+}
+.dnd-library-wrapper .editor-item .sizes a.size-L span {
+  margin: 1px;
+  padding: 4px 0;
+}
+.dnd-library-wrapper .editor-item.dnd-child-inserted {
+  background-color: #ccc;
+}
+.dnd-editor-preview h2.title {
+  font-size: 1em;
+  font-weight: bold;
+  margin-bottom: 0.5em;
+}
+.dnd-editor-preview .media-preview { 
+  float: left;
+  width: 125px;
+}
+
+.dnd-editor-preview .media-meta {
+  float: left;
+  width: 225px;
+  margin-right: 20px;
+}
+
+.dnd-editor-preview .attribution {
+  font-size: .875em;
+  margin-bottom: .5em;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dnd_test/dnd_test.info	Wed Mar 11 22:52:20 2009 -0500
@@ -0,0 +1,7 @@
+; $Id$
+name = DnD Library Tests
+package = User interface
+description = Defines some menu callbacks and form alterations which test the drag and drop plugin.
+dependencies[] = dnd
+core = 6.x
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dnd_test/dnd_test.module	Wed Mar 11 22:52:20 2009 -0500
@@ -0,0 +1,175 @@
+<?php
+
+/**
+ * Implementation of hook_menu().
+ */
+function dnd_test_menu() {
+  $items = array();
+  $items['dnd-test/library'] = array(
+    'title' => 'Drag and drop test library',
+    'page callback' => 'dnd_test_library',
+    'access arguments' => array('access dnd test library'),
+  );
+  return $items;
+}
+
+/**
+ * Implementation of hook_perm().
+ */
+function dnd_test_perm() {
+  return array('access dnd test library');
+}
+
+/**
+ * Implementation of hook_form_alter().
+ *
+ * This demonstrates how to attach Drag and Drop to a given textarea.
+ */
+function dnd_test_form_alter(&$form, &$form_state) {
+  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;
+    $form['body_field']['body']['#dnd-settings'] = array(
+      'drop_selector' => '#edit-body-dnd-library .drop',
+      'url' => 'dnd-test/library',
+    );
+    $form['body_field']['body']['#rows'] = 28;
+  }
+}
+
+/**
+ * Implementation of hook_theme().
+ */
+function dnd_test_theme() {
+  return array(
+    'dnd_editor_item'  => array(
+      'arguments' => array('i' => NULL, 'size' => NULL),
+      'template'  => 'dnd-editor-item',
+    ),
+    'dnd_library_item' => array(
+      'arguments' => array('i' => NULL), 
+      'template'  => 'dnd-library-item',
+    ),
+    'dnd_library_preview' => array(
+      'arguments' => array('i' => NULL),
+      'template'  => 'dnd-library-preview',
+    ),
+    'dnd_library_header' => array(
+      'arguments' => array('page' => NULL),
+      'template'  => 'dnd-library-header',
+    ),
+  );
+}
+
+/**
+ * Page callback that returns some JSON
+ */
+function dnd_test_library() {
+  $page = ($_GET['page']) ? $_GET['page'] : 1;
+  $test_library = dnd_test_generate_library($page);
+  return drupal_json(array(
+    'header'  => theme('dnd_library_header', $page),
+    'library' => $test_library['library'],
+    'editor_representations' => $test_library['editor_representations'],
+    'library_previews' => $test_library['library_previews'],
+    'footer'  => '<div class="pager">'. l(t('1'), 'dnd-test/library') . ' '. l(t('2'), 'dnd-test/library', array('query' => array('page' => 2))) .'</div>',
+  ));
+}
+
+/**
+ * Create contrived output
+ */
+function dnd_test_generate_library($page = 1, $limit = 8) {
+  $start = ($page * $limit) - ($limit); 
+  $end   = $page * $limit;
+
+  $library = '';
+  $editor_representations = array();
+  $library_previews = array();
+  for ($i=$start + 1; $i < $end + 1; $i++) {
+    $library .= theme('dnd_library_item', $i);
+    $editor_representations += dnd_editor_items($i);
+    $library_previews['dnd-test-'. $i] = theme('dnd_library_preview', $i);
+  }
+  return array(
+    'library' => $library,
+    'editor_representations' => $editor_representations,
+    'library_previews' => $library_previews,
+  );
+}
+
+/**
+ * Theme wrapper that spins out multiple library representations for a given
+ * 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) {
+  $item = array();
+  foreach(array(t('S'), t('M'), t('L')) as $size) {
+    $item[$i .'-'. $size] = array(
+      'body' => theme('dnd_editor_item', $i, $size),
+      'title' => 'Item '. $i .'-S',
+    );
+  }
+  return $item;
+}
+
+/**
+ * Completely contrived library preview theme function
+ */
+function template_preprocess_dnd_library_preview(&$variables) {
+  template_preprocess_dnd_library_item($variables);
+
+  $variables['id'] = 'dnd-preview-'. $variables['i'];
+  $variables['image'] = '<img src="http://'. $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/item-'. $variables['img_num'] .'-S.jpg" class="drop" width="125" height="94" />';
+
+  $variables['description'] = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
+}
+
+
+/**
+ * Completely contrived edit item theme function
+ */
+function template_preprocess_dnd_library_item(&$variables) {
+  global $_SERVER;
+
+  $i = $variables['i'];
+
+  if ($i % 3 == 0) {
+    $img = 3;
+  }
+  else if ($i % 2 == 0) {
+    $img = 2;
+  }
+  else {
+    $img = 1;
+  }
+
+  $variables['img_num'] = $img;
+  $variables['id'] = 'dnd-test-'. $i;
+  $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['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>';
+}
+
+function template_preprocess_dnd_editor_item(&$variables) {
+  list($i, $size) = array($variables['i'], $variables['size']);
+
+  if ($i % 3 == 0) {
+    $img = 3;
+  }
+  else if ($i % 2 == 0) {
+    $img = 2;
+  }
+  else {
+    $img = 1;
+  }
+  $variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-'. $size .'.jpg', '', '', array('class' => 'dnd-dropped', 'id' => 'dnd-id-'. $i));
+}
+
+function template_preprocess_dnd_library_header(&$variables) {}
Binary file modules/dnd_test/img-backup/page-1-large.jpg has changed
Binary file modules/dnd_test/img-backup/page-1-small.jpg has changed
Binary file modules/dnd_test/img-backup/page-2-large.jpg has changed
Binary file modules/dnd_test/img-backup/page-2-small.jpg has changed
Binary file modules/dnd_test/img/icon/L.png has changed
Binary file modules/dnd_test/img/icon/M.png has changed
Binary file modules/dnd_test/img/icon/S.png has changed
Binary file modules/dnd_test/img/item-1-L.jpg has changed
Binary file modules/dnd_test/img/item-1-M.jpg has changed
Binary file modules/dnd_test/img/item-1-S.jpg has changed
Binary file modules/dnd_test/img/item-1-thumb.jpg has changed
Binary file modules/dnd_test/img/item-2-L.jpg has changed
Binary file modules/dnd_test/img/item-2-M.jpg has changed
Binary file modules/dnd_test/img/item-2-S.jpg has changed
Binary file modules/dnd_test/img/item-2-thumb.jpg has changed
Binary file modules/dnd_test/img/item-3-L.jpg has changed
Binary file modules/dnd_test/img/item-3-M.jpg has changed
Binary file modules/dnd_test/img/item-3-S.jpg has changed
Binary file modules/dnd_test/img/item-3-thumb.jpg has changed