Mercurial > defr > drupal > scald > dnd
comparison dnd_test/dnd_test.module @ 24:4f58fa0a9a6d
Cleaned up some library behavior, changed editor representation cache to track a title and a body for representations, to allow a little more dynamic composition.
| author | David Eads <eads@chicagotech.org> |
|---|---|
| date | Wed, 11 Mar 2009 01:47:57 -0500 |
| parents | a72403cfa9a8 |
| children |
comparison
equal
deleted
inserted
replaced
| 23:a72403cfa9a8 | 24:4f58fa0a9a6d |
|---|---|
| 60 ), | 60 ), |
| 61 ); | 61 ); |
| 62 } | 62 } |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Page call back that returns some JSON | 65 * Page callback that returns some JSON |
| 66 */ | 66 */ |
| 67 function dnd_test_library() { | 67 function dnd_test_library() { |
| 68 $page = ($_GET['page']) ? $_GET['page'] : 1; | 68 $page = ($_GET['page']) ? $_GET['page'] : 1; |
| 69 $test_library = dnd_test_generate_library($page); | 69 $test_library = dnd_test_generate_library($page); |
| 70 return drupal_json(array( | 70 return drupal_json(array( |
| 77 } | 77 } |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * Create contrived output | 80 * Create contrived output |
| 81 */ | 81 */ |
| 82 function dnd_test_generate_library($page = 1, $limit = 12) { | 82 function dnd_test_generate_library($page = 1, $limit = 8) { |
| 83 $start = ($page * $limit) - ($limit); | 83 $start = ($page * $limit) - ($limit); |
| 84 $end = $page * $limit; | 84 $end = $page * $limit; |
| 85 | 85 |
| 86 $library = ''; | 86 $library = ''; |
| 87 $editor_representations = array(); | 87 $editor_representations = array(); |
| 104 * for multiple versions (i.e. different sizes) of a single item | 104 * for multiple versions (i.e. different sizes) of a single item |
| 105 */ | 105 */ |
| 106 function dnd_editor_items($i) { | 106 function dnd_editor_items($i) { |
| 107 $item = array(); | 107 $item = array(); |
| 108 foreach(array(t('S'), t('M'), t('L')) as $size) { | 108 foreach(array(t('S'), t('M'), t('L')) as $size) { |
| 109 $item[$i .'-'. $size] = theme('dnd_editor_item', $i, $size); | 109 $item[$i .'-'. $size] = array( |
| 110 'body' => theme('dnd_editor_item', $i, $size), | |
| 111 'title' => 'Item '. $i .'-S', | |
| 112 ); | |
| 110 } | 113 } |
| 111 return $item; | 114 return $item; |
| 112 } | 115 } |
| 113 | 116 |
| 114 /** | 117 /** |
