diff 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
line wrap: on
line diff
--- a/dnd.module	Tue Mar 17 10:59:50 2009 -0500
+++ b/dnd.module	Tue Mar 17 21:29:00 2009 -0500
@@ -89,37 +89,34 @@
       $settings = $element['#dnd-settings'];
     }
 
-    // Set some important defaults
-    if (function_exists($settings['callback']) && ($library = $settings['callback']($element))) {
-      $settings = array('library_id' => $element['#id'] . DND_ID_SUFFIX) + $settings;
-      unset($settings['callback']);
+    $settings = array('library_id' => $element['#id'] . DND_ID_SUFFIX) + $settings;
 
-      // BeautyTips
-      drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/excanvas_0002/excanvas-compressed.js');
-      drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/jquery.hoverIntent.minified.js');
-      drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/jquery.bt.js');
+    // BeautyTips
+    drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/excanvas_0002/excanvas-compressed.js');
+    drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/other_libs/jquery.hoverIntent.minified.js');
+    drupal_add_js(drupal_get_path('module', 'dnd') .'/js/bt/jquery.bt.js');
 
-      // Dependencies
-      drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.url.packed.js');
-      drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.fieldselection.js');
-      drupal_add_js('misc/jquery.form.js');
+    // Dependencies
+    drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.url.packed.js');
+    drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.fieldselection.js');
+    drupal_add_js('misc/jquery.form.js');
 
-      // Drag and drop
-      drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.draganddrop.js');
-      drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js');
+    // Drag and drop
+    drupal_add_js(drupal_get_path('module', 'dnd') .'/js/jquery.draganddrop.js');
+    drupal_add_js(drupal_get_path('module', 'dnd') .'/js/dnd-library.js');
 
-      drupal_add_js(array(
-        'dndEnabledLibraries' => array($element['#id'] => $settings),
-      ), 'setting');
+    drupal_add_js(array(
+      'dndEnabledLibraries' => array($element['#id'] => $settings),
+    ), 'setting');
 
-      // Store editor representations in Drupal setting
-      drupal_add_js(array(
-        'dndEditorRepresentations' => $library['editor_representations'], 
-        'dndLibraryPreviews' => $library['library_previews'], 
-      ), 'setting');
-      
-      $element['#suffix'] = theme('dnd_library', $library['library'], $settings['library_id']) . $element['#suffix'];
-    }
+    // Store editor representations in Drupal setting
+    drupal_add_js(array(
+      'dndEditorRepresentations' => $library['editor_representations'], 
+      'dndLibraryPreviews' => $library['library_previews'], 
+    ), 'setting');
+
+    // Note that we brute force the wrapper
+    $element['#suffix'] = '<div class="dnd-library-wrapper" id="'. $settings['library_id'] .'"></div>'. $element['#suffix'];
 
   }
   return $element;
@@ -130,10 +127,27 @@
 /**
  * Implementation of hook_wywiwyg_plugin().
  */
-function dnd_wysiwyg_plugin($editor) {
+function dnd_wysiwyg_plugin($editor, $version=0) {
+  $plugins = array();
   switch ($editor) {
     case 'tinymce':
-      dpm($editor);
+      if ($version > 3) {
+        $plugins['atomic'] = array(
+          'type' => 'external',
+          'title' => t('Atomic selection plugin'),
+          '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.'),
+          'extensions' => array('atomic' => t('Atomic Selection')),
+          'path' => drupal_get_path('module', 'dnd') .'/js/tinymce/atomic/editor_plugin.js', 
+          'url' => 'http://sourceforge.net/tracker/index.php?func=detail&aid=2519211&group_id=103281&atid=738747',
+          'load' => TRUE,
+        );
+        $plugins['noneditable'] = array(
+          'path' => drupal_get_path('module', 'wysiwyg') .'/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js',
+          'extensions' => array('noneditable' => t('Noneditable')),
+          'load' => TRUE,
+        );
+      }
       break;
   }
+  return $plugins;
 }