Mercurial > defr > drupal > scald > dnd
comparison dnd.module @ 31:767ebf925654
Added forcecontainer tinymce plugin, lots and lots and lots of refactorizing.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Thu, 19 Mar 2009 15:58:36 -0500 |
parents | 2d49adbd8992 |
children | 6947c6579d40 |
comparison
equal
deleted
inserted
replaced
30:2d49adbd8992 | 31:767ebf925654 |
---|---|
28 /** | 28 /** |
29 * Implementation of hook_theme(). | 29 * Implementation of hook_theme(). |
30 */ | 30 */ |
31 function dnd_theme() { | 31 function dnd_theme() { |
32 return array( | 32 return array( |
33 'dnd_library' => array('arguments' => array('library' => NULL, 'library_id' => NULL), 'template' => 'dnd-library'), | 33 'dnd_library_wrapper' => array('arguments' => array('settings' => NULL, 'element' => NULL)), |
34 ); | 34 ); |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 /** | 38 /** |
107 | 107 |
108 drupal_add_js(array( | 108 drupal_add_js(array( |
109 'dndEnabledLibraries' => array($element['#id'] => $settings), | 109 'dndEnabledLibraries' => array($element['#id'] => $settings), |
110 ), 'setting'); | 110 ), 'setting'); |
111 | 111 |
112 // Store editor representations in Drupal setting | 112 // Generate |
113 drupal_add_js(array( | |
114 'dndEditorRepresentations' => $library['editor_representations'], | |
115 'dndLibraryPreviews' => $library['library_previews'], | |
116 ), 'setting'); | |
117 | |
118 // Note that we brute force the wrapper | |
119 $element['#suffix'] = '<div class="dnd-library-wrapper" id="'. $settings['library_id'] .'"></div>'. $element['#suffix']; | 113 $element['#suffix'] = '<div class="dnd-library-wrapper" id="'. $settings['library_id'] .'"></div>'. $element['#suffix']; |
120 | 114 |
121 } | 115 } |
122 return $element; | 116 return $element; |
123 } | 117 } |
124 | |
125 function template_preprocess_dnd_library($library) {} | |
126 | 118 |
127 /** | 119 /** |
128 * Implementation of hook_wywiwyg_plugin(). | 120 * Implementation of hook_wywiwyg_plugin(). |
129 */ | 121 */ |
130 function dnd_wysiwyg_plugin($editor, $version=0) { | 122 function dnd_wysiwyg_plugin($editor, $version=0) { |
131 $plugins = array(); | 123 $plugins = array(); |
132 switch ($editor) { | 124 switch ($editor) { |
133 case 'tinymce': | 125 case 'tinymce': |
134 if ($version > 3) { | 126 if ($version > 3) { |
135 $plugins['atomic'] = array( | 127 $plugins['forcecontainer'] = array( |
136 'type' => 'external', | 128 'title' => t('Force Container Plugin'), |
137 'title' => t('Atomic selection plugin'), | 129 'description' => t('A custom plugin to forces a selection up to the outer container of a given element.'), |
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.'), | 130 'extensions' => array('forcecontainer' => t('Force Container')), |
139 'extensions' => array('atomic' => t('Atomic Selection')), | 131 'path' => drupal_get_path('module', 'dnd') .'/js/tinymce/forcecontainer/editor_plugin_src.js', |
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, | 132 'load' => TRUE, |
143 ); | 133 'options' => array( |
144 $plugins['noneditable'] = array( | 134 'forcecontainer_class' => 'dnd-drop-wrapper', |
145 'path' => drupal_get_path('module', 'wysiwyg') .'/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js', | 135 'forcecontainer_trigger_dnd' => TRUE, |
146 'extensions' => array('noneditable' => t('Noneditable')), | 136 ), |
147 'load' => TRUE, | |
148 ); | 137 ); |
149 } | 138 } |
150 break; | 139 break; |
151 } | 140 } |
152 return $plugins; | 141 return $plugins; |
153 } | 142 } |
143 | |
144 | |
145 /** | |
146 * Theme the markup that will surround a library loaded via JSON. | |
147 */ | |
148 function theme_dnd_library_wrapper($settings, $element = NULL) { | |
149 return '<div id="'. $settings['library_id'] .'" class="dnd-library-wrapper"></div>'; | |
150 } | |
151 |