New: Drag and drop on home page is now done by jquery
This commit is contained in:
parent
629f782f17
commit
becb9099a6
@ -55,7 +55,7 @@ function printBoxesArea($user,$areacode)
|
|||||||
print '<td width="50%" valign="top" style="padding-right: 4px;">'."\n";
|
print '<td width="50%" valign="top" style="padding-right: 4px;">'."\n";
|
||||||
|
|
||||||
print "\n<!-- Box left container -->\n";
|
print "\n<!-- Box left container -->\n";
|
||||||
print '<div id="left">'."\n";
|
print '<div id="left" class="connectedSortable">'."\n";
|
||||||
|
|
||||||
$ii=0;
|
$ii=0;
|
||||||
foreach ($boxarray as $key => $box)
|
foreach ($boxarray as $key => $box)
|
||||||
@ -90,7 +90,7 @@ function printBoxesArea($user,$areacode)
|
|||||||
print '<td width="50%" valign="top" style="padding-right: 2px;">';
|
print '<td width="50%" valign="top" style="padding-right: 2px;">';
|
||||||
|
|
||||||
print "\n<!-- Box right container -->\n";
|
print "\n<!-- Box right container -->\n";
|
||||||
print '<div id="right">'."\n";
|
print '<div id="right" class="connectedSortable">'."\n";
|
||||||
|
|
||||||
$ii=0;
|
$ii=0;
|
||||||
foreach ($boxarray as $key => $box)
|
foreach ($boxarray as $key => $box)
|
||||||
@ -130,38 +130,29 @@ function printBoxesArea($user,$areacode)
|
|||||||
{
|
{
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<script type="text/javascript" language="javascript">';
|
print '<script type="text/javascript" language="javascript">';
|
||||||
print 'function updateOrder(){';
|
print 'jQuery(function() {
|
||||||
print 'var left_list = cleanSerialize(Sortable.serialize(\'left\'));';
|
jQuery("#left, #right").sortable({
|
||||||
print 'var right_list = cleanSerialize(Sortable.serialize(\'right\'));';
|
/* placeholder: \'ui-state-highlight\', */
|
||||||
print 'var boxorder = \'A:\' + left_list + \'-B:\' + right_list;';
|
handle: \'.boxhandle\',
|
||||||
//alert( \'boxorder=\' + boxorder );
|
revert: \'invalid\',
|
||||||
print 'var userid = \''.$user->id.'\';';
|
items: \'.box\',
|
||||||
print 'var url = "ajaxbox.php";';
|
containment: \'.fiche\',
|
||||||
print 'o_options = new Object();';
|
connectWith: \'.connectedSortable\',
|
||||||
print 'o_options = {asynchronous:true,method: \'get\',parameters: \'boxorder=\' + boxorder + \'&userid=\' + userid};';
|
stop: function(event, ui) {
|
||||||
print 'var myAjax = new Ajax.Request(url, o_options);';
|
updateOrder();
|
||||||
print '}';
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
';
|
||||||
print "\n";
|
print "\n";
|
||||||
|
print 'function updateOrder(){'."\n";
|
||||||
print '// <![CDATA['."\n";
|
print 'var left_list = cleanSerialize(jQuery("#left").sortable( "serialize" ));'."\n";
|
||||||
|
print 'var right_list = cleanSerialize(jQuery("#right").sortable( "serialize" ));'."\n";
|
||||||
print 'Sortable.create(\'left\', {'."\n";
|
print 'var boxorder = \'A:\' + left_list + \'-B:\' + right_list;'."\n";
|
||||||
print ' tag:\'div\', '."\n";
|
//print 'alert( \'boxorder=\' + boxorder );';
|
||||||
print ' containment:["left","right"], '."\n";
|
print 'var userid = \''.$user->id.'\';'."\n";
|
||||||
print ' constraint:false, '."\n";
|
print 'jQuery.get(\'ajaxbox.php?boxorder=\'+boxorder+\'&userid=\'+'.$user->id.');'."\n";
|
||||||
print " handle: 'boxhandle',"."\n";
|
print '}'."\n";
|
||||||
print ' onUpdate:updateOrder';
|
|
||||||
print " });\n";
|
|
||||||
|
|
||||||
print 'Sortable.create(\'right\', {'."\n";
|
|
||||||
print ' tag:\'div\', '."\n";
|
|
||||||
print ' containment:["right","left"], '."\n";
|
|
||||||
print ' constraint:false, '."\n";
|
|
||||||
print " handle: 'boxhandle',"."\n";
|
|
||||||
print ' onUpdate:updateOrder';
|
|
||||||
print " });\n";
|
|
||||||
|
|
||||||
print '// ]]>'."\n";
|
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -640,7 +640,8 @@ function ac_return(field, val){
|
|||||||
|
|
||||||
|
|
||||||
/*=================================================================
|
/*=================================================================
|
||||||
Purpose: Clean values of a "Sortable.serialize". Used by drag and drop.
|
Purpose: Clean values of a "Sortable.serialize".
|
||||||
|
Used by drag and drop. Works for Scriptaculous and jQuery.
|
||||||
Input: expr
|
Input: expr
|
||||||
Author: Regis Houssin
|
Author: Regis Houssin
|
||||||
Licence: GPL
|
Licence: GPL
|
||||||
@ -654,51 +655,6 @@ function cleanSerialize(expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*=================================================================
|
|
||||||
Purpose: Show a confim popup (Use PWC)
|
|
||||||
Input: title,linkurlyes,linkurlno,message,ok,cancel,objectID
|
|
||||||
Author: Regis Houssin, Laurent Destailleur
|
|
||||||
Licence: GPL
|
|
||||||
==================================================================*/
|
|
||||||
/* @deprecated Replaced by jquery code
|
|
||||||
function dialogConfirm(title,linkurlyes,linkurlno,message,ok,cancel,objectID) {
|
|
||||||
Dialog.confirm(message, {
|
|
||||||
width:560,
|
|
||||||
okLabel: ok,
|
|
||||||
cancelLabel: cancel,
|
|
||||||
buttonClass: "buttonajax",
|
|
||||||
id: objectID,
|
|
||||||
destroyOnClose: true,
|
|
||||||
ok:function(win) {window.location.href=linkurlyes; return true;},
|
|
||||||
cancel:function(win) { if (linkurlno!='') { window.location.href=linkurlno; return true; } }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*=================================================================
|
|
||||||
Purpose: Affiche une fenetre (Use PWC)
|
|
||||||
Input: message
|
|
||||||
Author: Regis Houssin
|
|
||||||
Licence: GPL
|
|
||||||
==================================================================*/
|
|
||||||
/* @deprecated Replaced by jquery code
|
|
||||||
function dialogWindow(message,windowTitle) {
|
|
||||||
var win = new Window({className: "dialog",
|
|
||||||
width:600,
|
|
||||||
height:400,
|
|
||||||
zIndex: 100,
|
|
||||||
resizable: false,
|
|
||||||
title: windowTitle,
|
|
||||||
showEffect:Effect.BlindDown,
|
|
||||||
hideEffect: Effect.SwitchOff,
|
|
||||||
draggable:true
|
|
||||||
})
|
|
||||||
win.getContent().update(message);
|
|
||||||
win.showCenter();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*=================================================================
|
/*=================================================================
|
||||||
Purpose: Display a temporary message in input text fields (For showing help message on input field).
|
Purpose: Display a temporary message in input text fields (For showing help message on input field).
|
||||||
Input: fieldId
|
Input: fieldId
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user