Mercurial > defr > drupal > scald > dnd
comparison dnd.module @ 20:89fe0aca43d4
Refactored the entire interval system, and started on form behavior.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Sun, 08 Mar 2009 20:29:57 -0500 |
parents | d83073a08b25 |
children | 69db20fdbac2 |
comparison
equal
deleted
inserted
replaced
19:d83073a08b25 | 20:89fe0aca43d4 |
---|---|
74 * configuration options | 74 * configuration options |
75 * callback should be smart about attachment and detachment | 75 * callback should be smart about attachment and detachment |
76 */ | 76 */ |
77 function dnd_process_textarea($element, $form_state) { | 77 function dnd_process_textarea($element, $form_state) { |
78 if ($element['#dnd-enabled']) { | 78 if ($element['#dnd-enabled']) { |
79 | |
80 // BeautyTips | |
79 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/excanvas_0002/excanvas-compressed.js'); | 81 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/excanvas_0002/excanvas-compressed.js'); |
82 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/jquery.hoverIntent.minified.js'); | |
83 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/jquery.bt.js'); | |
84 | |
85 // Dependencies | |
80 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.url.packed.js'); | 86 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.url.packed.js'); |
81 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.fieldselection.js'); | 87 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.fieldselection.js'); |
82 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/jquery.bt.js'); | 88 drupal_add_js('misc/jquery.form.js'); |
89 | |
90 // Drag and drop | |
83 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.draganddrop.js'); | 91 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.draganddrop.js'); |
84 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js'); | 92 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js'); |
85 | 93 |
86 $settings = array(); | 94 $settings = array(); |
87 | 95 |
133 $json = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $request->data), TRUE); | 141 $json = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $request->data), TRUE); |
134 | 142 |
135 // Generate an array of editor representations to add | 143 // Generate an array of editor representations to add |
136 if (is_array($json['editor_representations'])) { | 144 if (is_array($json['editor_representations'])) { |
137 foreach ($json['editor_representations'] as $editor_id=>$editor_item) { | 145 foreach ($json['editor_representations'] as $editor_id=>$editor_item) { |
138 $editor_representations[$editor_id] = filter_xss_admin($editor_item); | 146 $editor_representations[$editor_id] = $editor_item; |
139 } | 147 } |
140 } | 148 } |
141 | 149 |
142 // Generate an array of library previews to add | 150 // Generate an array of library previews to add |
143 if (is_array($json['library_previews'])) { | 151 if (is_array($json['library_previews'])) { |
144 foreach ($json['library_previews'] as $preview_id=>$preview_item) { | 152 foreach ($json['library_previews'] as $preview_id=>$preview_item) { |
145 $library_previews[$preview_id] = filter_xss_admin($preview_item); | 153 $library_previews[$preview_id] = $preview_item; |
146 } | 154 } |
147 } | 155 } |
148 | 156 |
149 // Store editor representations in Drupal setting | 157 // Store editor representations in Drupal setting |
150 drupal_add_js(array( | 158 drupal_add_js(array( |
151 'dndEditorRepresentations' => $editor_representations, | 159 'dndEditorRepresentations' => $editor_representations, |
152 'dndLibraryPreviews' => $library_previews, | 160 'dndLibraryPreviews' => $library_previews, |
153 ), 'setting'); | 161 ), 'setting'); |
154 | 162 |
155 $variables['library_id'] = $settings['library_id']; | 163 $variables['library_id'] = $settings['library_id']; |
156 $variables['header'] = filter_xss_admin($json['header']); | 164 $variables['header'] = $json['header']; |
157 $variables['library'] = filter_xss_admin($json['library']); | 165 $variables['library'] = $json['library']; |
158 $variables['footer'] = filter_xss_admin($json['footer']); | 166 $variables['footer'] = $json['footer']; |
159 } | 167 } |