Drag and Drop
1. How to create drag and drop items in common:
1.1 create a dragdrop object:
require_once(EGW_INCLUDE_ROOT . '/phpgwapi/inc/class.dragdrop.inc.php');
$dragdrop = new dragdrop();
1.2 mark items which should be draggable (the items you can move around afterwards)
|name||The unique html id of the <div> or <img> element. The name can be called in your actionScripts with "dd.obj.name"|
|values||An optional associative array with keys and values for the object if needed. The values can be called in your actionScripts with "dd.obj.my_<valueKeyName>"|
e.g. for a script which resists in calendar/js/myscript.js and the function which is called when the ite is drop is mydrop(), the name
an optional string which defines the focus of the draggable object. Possible values are e.g. "top center 2" or "bottom left 10". Default is "center center 0".
You can access your objects "name" and "values" in the ActionScripts as following:
current "draggable" object name: dd.obj.name;
current "draggable" object value: dd.obj.my_<valueKeyName>;
current "droppable" object name: var dropTarget = dd.obj.getEltBelow(); dropTarget.name;
current "droppable" object value: var dropTarget = dd.obj.getEltBelow(); dropTarget.my_<valueKeyName>;
1.3 mark items on which we can drop other items, these are the "droppables"
(Parameters as described above)
information what can be done with the DHTML objects, visit Walter Zorns Homepage.