Index: transformations_ui.dragndrop.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/transformations/ui/transformations_ui.dragndrop.js,v
retrieving revision 1.3
diff -u -r1.3 transformations_ui.dragndrop.js
--- transformations_ui.dragndrop.js	23 Jun 2009 20:07:28 -0000	1.3
+++ transformations_ui.dragndrop.js	29 Jun 2009 13:17:53 -0000
@@ -8,12 +8,12 @@
 
   // This allows the user to resize the operation block area. It works like
   // Drupal's original grippie, but grippie is for textareas only.
-  $('.transformations-pipeline-canvas', context).resizable({
+  $('.transformations-pipeline-canvas', context).resizable( {
     maxWidth : $('.transformations-pipeline-canvas', context).width(),
     minWidth : $('.transformations-pipeline-canvas', context).width(),
     minHeight : $('.transformations-pipeline-canvas', context).height(),
     handles : { s : $('#transformations-grippie', context) },
-  });
+  } );
   $('#transformations-grippie', context).show();
 
   var delayedPositions = [];
@@ -28,28 +28,28 @@
       operationDiv.css('left', position['left'] + 'px');
       operationDiv.css('position', 'absolute');
     }
-    else {
+    else {  
       // For operations that don't yet have a position assigned, set them to
       // "position: absolute" with their current position, so that the
       // position-save callback stores the correct values.
       // However, we can't set them to "position: absolute" just yet because
       // that would modify the other blocks' positions as well. So let's store
       // the current positions first, and set them in one go afterwards.
-      delayedPositions = delayedPositions.concat({
+      delayedPositions = delayedPositions.concat( {
         div: operationDiv,
         top: operationDiv.position().top,
         left: operationDiv.position().left,
-      });
+      } );
     }
-  });
+  } );
   $.each(delayedPositions, function(index, item) {
     item.div.css('position', 'absolute');
     item.div.css('top', item.top + 'px');
     item.div.css('left', item.left + 'px');
-  });
+  } );
 
   // Initialize all draggable operation blocks.
-  $('.transformations-operation-block', context).draggable({
+  $('.transformations-operation-block', context).draggable( {
     stack: {
       group: '.transformations-operation-block',
       min: 1,
@@ -68,41 +68,43 @@
       // The minHeight will also be set if the lowest object was moved.
       Drupal.transformationsUiSetCanvasMinimumHeight('no-autoresize');
     },
-  });
+  } );
 
   // Initialize the draggables.
-  $('.transformations-operation-output', context).draggable({
+  $('.transformations-operation-output', context).draggable( {
     cursor: 'move',
     helper: 'clone',
     opacity: 0.5,
-  });
-  $('.transformations-operation-input', context).draggable({
+  } );
+  $('.transformations-operation-input', context).draggable( {
     cursor: 'move',
     helper: 'clone',
     opacity: 0.5,
-  });
+  } );
 
   // Initialize the droppables.
-  $('.transformations-operation-output .transformations-drop-target', context).droppable({
+  $('.transformations-operation-output .transformations-drop-target', context).droppable( {
     accept: '.transformations-operation-input',
     hoverClass: 'transformations-operation-slot-hover',
     tolerance: 'pointer',
+    accept: Drupal.transformationsUiIsDroppable,
     drop: function(event, ui) {
       Drupal.transformationsUiConnectSlots(
         $(this).parent().attr('id'), $(ui.draggable).attr('id')
       );
     },
-  });
-  $('.transformations-operation-input .transformations-drop-target', context).droppable({
+  } );
+  $('.transformations-operation-input .transformations-drop-target', context).droppable( {
     accept: '.transformations-operation-output',
     hoverClass: 'transformations-operation-slot-hover',
     tolerance: 'pointer',
+    accept: Drupal.transformationsUiIsDroppable,
     drop: function(event, ui) {
       Drupal.transformationsUiConnectSlots(
         $(ui.draggable).attr('id'), $(this).parent().attr('id')
       );
     },
-  });
+  } );
 
   Drupal.transformationsUiSetCanvasMinimumHeight('autoresize');
 };
@@ -123,10 +125,31 @@
     + '/' + target.entity + '/' + escape(target.key);
   $.get('?q=transformations/slot-connect/' + arguments + '&ajax=1', null, function(data) {
     window.location.reload();
-  });
+  } );
 }
 
 /**
+ * Check an given parameters are from the same Operation or
+ * the one is from pipe parameters and the other from the pipe output
+ */
+Drupal.transformationsUiIsDroppable = function(draggable){
+  if (draggable != null){
+    var source = Drupal.settings.transformationsUiSlots[draggable.attr('id')];
+    var target = Drupal.settings.transformationsUiSlots[$(this).parent().attr('id')];
+    if(source != null && target != null){
+      if((source.entity == target.entity) || (source.entity == '4' && target.entity == '2') 
+          || (source.entity == '2' && target.entity == '4')){
+        return false;
+      }
+      else{
+        return true;
+      }
+    }
+  }
+}
+
+
+/**
  * Look for the bottom-most operation block and set the canvas's
  * minimum height appropriately.
  */
@@ -140,7 +163,7 @@
     if (size > totalSize) {
       totalSize = size;
     }
-  });
+  } );
 
   if (resizeMode == 'autoresize') {
     $('.transformations-pipeline-canvas').css('height', totalSize + 'px');
