Mercurial > defr > drupal > scald > dnd
comparison dnd_test/dnd_test.module @ 10:5d2ae5b8eae2
Trying out pure image solution.
| author | David Eads <eads@chicagotech.org> |
|---|---|
| date | Fri, 27 Feb 2009 00:37:24 -0600 |
| parents | 4626f7e31aa0 |
| children | a5b2b9fa2a1a |
comparison
equal
deleted
inserted
replaced
| 9:4626f7e31aa0 | 10:5d2ae5b8eae2 |
|---|---|
| 17 * Implementation of hook_perm(). | 17 * Implementation of hook_perm(). |
| 18 */ | 18 */ |
| 19 function dnd_test_perm() { | 19 function dnd_test_perm() { |
| 20 return array('access dnd test library'); | 20 return array('access dnd test library'); |
| 21 } | 21 } |
| 22 | |
| 23 | 22 |
| 24 /** | 23 /** |
| 25 * Implementation of hook_form_alter(). | 24 * Implementation of hook_form_alter(). |
| 26 * | 25 * |
| 27 * This demonstrates how to attach Drag and Drop to a given textarea. | 26 * This demonstrates how to attach Drag and Drop to a given textarea. |
| 69 } | 68 } |
| 70 | 69 |
| 71 /** | 70 /** |
| 72 * Create contrived output | 71 * Create contrived output |
| 73 */ | 72 */ |
| 74 function dnd_test_generate_library($page = 1, $limit = 5) { | 73 function dnd_test_generate_library($page = 1, $limit = 12) { |
| 75 $start = ($page * $limit) - ($limit); | 74 $start = ($page * $limit) - ($limit); |
| 76 $end = $page * $limit; | 75 $end = $page * $limit; |
| 77 | 76 |
| 78 $library = ''; | 77 $library = ''; |
| 79 $editor_representations = array(); | 78 $editor_representations = array(); |
| 87 ); | 86 ); |
| 88 } | 87 } |
| 89 | 88 |
| 90 /** | 89 /** |
| 91 * Theme wrapper that spins out multiple library representations for a given | 90 * Theme wrapper that spins out multiple library representations for a given |
| 92 * editor representation. This is because we want to demonstrate how to allow | 91 ;[''''* editor representation. This is because we want to demonstrate how to allow |
| 93 * for multiple versions (i.e. different sizes) of a single item | 92 * for multiple versions (i.e. different sizes) of a single item |
| 94 */ | 93 */ |
| 95 function dnd_editor_items($i) { | 94 function dnd_editor_items($i) { |
| 96 $item = array(); | 95 $item = array(); |
| 97 foreach(array(t('S'), t('M'), t('L')) as $size) { | 96 foreach(array(t('S'), t('M'), t('L')) as $size) { |
| 119 $variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-thumb.jpg'); | 118 $variables['image'] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/item-'. $img .'-thumb.jpg'); |
| 120 $variables['title'] = t('Lorem Ipsum @count', array('@count' => $i)); | 119 $variables['title'] = t('Lorem Ipsum @count', array('@count' => $i)); |
| 121 $variables['date'] = 'Feb 18 2009'; | 120 $variables['date'] = 'Feb 18 2009'; |
| 122 $variables['author'] = 'David Eads'; | 121 $variables['author'] = 'David Eads'; |
| 123 foreach(array(t('S'), t('M'), t('L')) as $size) { | 122 foreach(array(t('S'), t('M'), t('L')) as $size) { |
| 124 $sizes[] = l('<span>'. $size .'</span>', '', array( | 123 $attributes = array( |
| 125 'html' => TRUE, | 124 'class' => 'drop size-'. $size, |
| 126 'attributes' => array( | 125 'id' => 'item-'. $i .'-'. $size, |
| 127 'class' => 'drop size-'. $size, | 126 ); |
| 128 'id' => 'item-'. $i .'-'. $size, | 127 $sizes[] = theme('image', drupal_get_path('module', 'dnd_test') .'/img/icon/'. $size .'.png', $size, $size, $attributes); |
| 129 ), | |
| 130 'query' => array('dnd_id' => 'item-'. $i .'-'. $size), | |
| 131 )); | |
| 132 } | 128 } |
| 133 $variables['sizes'] = '<ul><li>'. implode('</li><li>', $sizes) .'</li></ul>'; | 129 $variables['sizes'] = '<ul><li>'. implode('</li><li>', $sizes) .'</li></ul>'; |
| 134 } | 130 } |
| 135 | 131 |
| 136 | 132 |
