1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-09 16:17:14 +02:00

A little closer to drag and drop functioning as intended.

This commit is contained in:
Cameron
2013-05-09 04:22:42 -07:00
parent f9c157817a
commit 72e7040284

View File

@@ -396,6 +396,39 @@ class e_layout
if(vartrue($_GET['configure'])) //ie Inside the IFRAME. if(vartrue($_GET['configure'])) //ie Inside the IFRAME.
{ {
e107::js('url',"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js");
e107::js('url', "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery-ui.css");
e107::js('inline','
$(function()
{
$( "#sortable" ).sortable({
revert: true
});
});
');
e107::js('inline', "
win = document.getElementById('menu_iframe').contentWindow;
win.jQuery(dragelement,parent.document).draggable({
connectToSortable : $('#sortable')
});
",'jquery');
$this->curLayout = varsettrue($_GET['configure'], $pref['sitetheme_deflayout']); $this->curLayout = varsettrue($_GET['configure'], $pref['sitetheme_deflayout']);
$this->renderLayout($this->curLayout); $this->renderLayout($this->curLayout);
} }
@@ -404,17 +437,19 @@ class e_layout
// XXX HELP _ i don't work with iFrames. // XXX HELP _ i don't work with iFrames.
e107::js('inline',' e107::js('inline','
$(function() { $(function()
{
$( "#sortable" ).sortable({ $( "#sortable" ).sortable({
revert: true revert: true
}); });
$( ".draggable" ).draggable({ $( ".draggable" ).draggable({
connectToSortable: "#sortable", connectToSortable: $("#sortable"),
helper: "clone", helper: "clone",
revert: "invalid", revert: "invalid",
cursor: "move", cursor: "move",
// iframeFix: true, iframeFix: true,
start: function(ev,ui) start: function(ev,ui)
{ {
@@ -429,23 +464,12 @@ class e_layout
} }
}); });
$( "ul, li" ).disableSelection(); $( "ul, li" ).disableSelection();
// Not Working.
$("#menu_iframe").load(function(){
$("#menu_iframe").contents().find("#sortable").droppable({
accept: ".drag",
drop: function( event, ui ) {
var html = "<div class=\'droptrue\'>"+ ui.draggable.html() + "</div>";
//alert(html);
$(this).append(html);
}
});
}); });
','jquery');
});
');
$this->scanForNew(); $this->scanForNew();
@@ -472,6 +496,7 @@ class e_layout
$this->menuData = ($data); $this->menuData = ($data);
// print_a($this->menuData);
} }
@@ -540,7 +565,7 @@ class e_layout
private function renderMenu($row) private function renderMenu($row)
{ {
// return print_a($row,true); // return print_a($row,true);
$TEMPLATE = '<li class="regularMenu" id="block-1-1"> '.$row['name'].' </li>'; // TODO perhaps a simple counter for the id $TEMPLATE = '<li class="regularMenu" id="block-'.$row['name'].'"> '.$row['name'].' </li>'; // TODO perhaps a simple counter for the id
return $TEMPLATE; return $TEMPLATE;