Mercurial > defr > drupal > scald > dnd
comparison dnd.module @ 30:2d49adbd8992
Start of applying a last layer of polish: starting the process of cleaning up the library code.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Tue, 17 Mar 2009 21:29:00 -0500 |
parents | 37ca57016cbe |
children | 767ebf925654 |
comparison
equal
deleted
inserted
replaced
29:37ca57016cbe | 30:2d49adbd8992 |
---|---|
87 } | 87 } |
88 else if (is_array($element['#dnd-settings'])) { | 88 else if (is_array($element['#dnd-settings'])) { |
89 $settings = $element['#dnd-settings']; | 89 $settings = $element['#dnd-settings']; |
90 } | 90 } |
91 | 91 |
92 // Set some important defaults | 92 $settings = array('library_id' => $element['#id'] . DND_ID_SUFFIX) + $settings; |
93 if (function_exists($settings['callback']) && ($library = $settings['callback']($element))) { | |
94 $settings = array('library_id' => $element['#id'] . DND_ID_SUFFIX) + $settings; | |
95 unset($settings['callback']); | |
96 | 93 |
97 // BeautyTips | 94 // BeautyTips |
98 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/excanvas_0002/excanvas-compressed.js'); | 95 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/excanvas_0002/excanvas-compressed.js'); |
99 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/jquery.hoverIntent.minified.js'); | 96 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/jquery.hoverIntent.minified.js'); |
100 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/jquery.bt.js'); | 97 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/jquery.bt.js'); |
101 | 98 |
102 // Dependencies | 99 // Dependencies |
103 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.url.packed.js'); | 100 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.url.packed.js'); |
104 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.fieldselection.js'); | 101 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.fieldselection.js'); |
105 drupal_add_js('misc/jquery.form.js'); | 102 drupal_add_js('misc/jquery.form.js'); |
106 | 103 |
107 // Drag and drop | 104 // Drag and drop |
108 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.draganddrop.js'); | 105 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.draganddrop.js'); |
109 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js'); | 106 drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js'); |
110 | 107 |
111 drupal_add_js(array( | 108 drupal_add_js(array( |
112 'dndEnabledLibraries' => array($element['#id'] => $settings), | 109 'dndEnabledLibraries' => array($element['#id'] => $settings), |
113 ), 'setting'); | 110 ), 'setting'); |
114 | 111 |
115 // Store editor representations in Drupal setting | 112 // Store editor representations in Drupal setting |
116 drupal_add_js(array( | 113 drupal_add_js(array( |
117 'dndEditorRepresentations' => $library['editor_representations'], | 114 'dndEditorRepresentations' => $library['editor_representations'], |
118 'dndLibraryPreviews' => $library['library_previews'], | 115 'dndLibraryPreviews' => $library['library_previews'], |
119 ), 'setting'); | 116 ), 'setting'); |
120 | 117 |
121 $element['#suffix'] = theme('dnd_library', $library['library'], $settings['library_id']) . $element['#suffix']; | 118 // Note that we brute force the wrapper |
122 } | 119 $element['#suffix'] = '<div class="dnd-library-wrapper" id="'. $settings['library_id'] .'"></div>'. $element['#suffix']; |
123 | 120 |
124 } | 121 } |
125 return $element; | 122 return $element; |
126 } | 123 } |
127 | 124 |
128 function template_preprocess_dnd_library($library) {} | 125 function template_preprocess_dnd_library($library) {} |
129 | 126 |
130 /** | 127 /** |
131 * Implementation of hook_wywiwyg_plugin(). | 128 * Implementation of hook_wywiwyg_plugin(). |
132 */ | 129 */ |
133 function dnd_wysiwyg_plugin($editor) { | 130 function dnd_wysiwyg_plugin($editor, $version=0) { |
131 $plugins = array(); | |
134 switch ($editor) { | 132 switch ($editor) { |
135 case 'tinymce': | 133 case 'tinymce': |
136 dpm($editor); | 134 if ($version > 3) { |
135 $plugins['atomic'] = array( | |
136 'type' => 'external', | |
137 'title' => t('Atomic selection plugin'), | |
138 'description' => t('This plugin forces a selection up to the outer container of a given element. It is available via the third party repository maintained by MoxieCode on SourceForge.'), | |
139 'extensions' => array('atomic' => t('Atomic Selection')), | |
140 'path' => drupal_get_path('module', 'dnd') .'/js/tinymce/atomic/editor_plugin.js', | |
141 'url' => 'http://sourceforge.net/tracker/index.php?func=detail&aid=2519211&group_id=103281&atid=738747', | |
142 'load' => TRUE, | |
143 ); | |
144 $plugins['noneditable'] = array( | |
145 'path' => drupal_get_path('module', 'wysiwyg') .'/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js', | |
146 'extensions' => array('noneditable' => t('Noneditable')), | |
147 'load' => TRUE, | |
148 ); | |
149 } | |
137 break; | 150 break; |
138 } | 151 } |
152 return $plugins; | |
139 } | 153 } |