diff --git a/e107_admin/menus.php b/e107_admin/menus.php index 9e37839e3..57540c928 100644 --- a/e107_admin/menus.php +++ b/e107_admin/menus.php @@ -349,9 +349,24 @@ if($_SERVER['E_DEV_MENU'] == 'true')
@@ -364,7 +379,12 @@ if($_SERVER['E_DEV_MENU'] == 'true') $text .= ""; @@ -374,7 +394,7 @@ if($_SERVER['E_DEV_MENU'] == 'true')
"; - return array('caption'=>'Menu Items','text'=>$text); + return array('caption'=>'Menu Items','text'=>$text); } //} @@ -434,7 +454,7 @@ class e_layout $(function() { - $( ".sortable" ).sortable({ + $(".sortable").sortable({ revert: true, cursor: "move", @@ -454,10 +474,42 @@ class e_layout }).done(function( msg ) { - alert(" Updated in DB "+ msg ); + alert("POSTED: "+ msg ); }); } }); + + + + + // $( ".draggable", window.top.document).click(function() + // { + // alert("hi there"); + // }); + + // http://jsfiddle.net/DT764/2/ + + + $( ".draggable", window.top.document).draggable({ + connectToSortable: ".sortable", + helper: "clone", + appendTo: ".sortable", // "#area-1", + revert: true, + + cursor: "move", + iframeFix: true, + containment: false, + stop: function(e, ui) { //TODO Rename layout and area in the hidden fields to that of the where the menu was dropped. + // Figure out positioning magic to determine if e.ui.position is in the iframe + var what = $(this).parent().attr("id"); + + alert(what); + } + + }); + + // $( "ul, li", window.top.document ).disableSelection(); + }); '); @@ -489,7 +541,7 @@ class e_layout // $("#sortable") //$("iframe").contents().find(".sortable") - /* + /* e107::js('inline',' $(function() { @@ -497,43 +549,35 @@ class e_layout revert: true }); - $( ".draggable" ).draggable({ - connectToSortable: $(".sortable"), - helper: "clone", - revert: "invalid", - cursor: "move", - iframeFix: true - - - }); - - $( "ul, li" ).disableSelection(); - - - - $("#menu_frame").load(function(){ - $("#menu_frame").contents().find("#sortable").droppable({ - accept: ".drag", - drop: function( event, ui ) { - var html = "
"+ ui.draggable.html() + "
"; - //alert(html); - $(this).append(html); - } - }); - - }); - + + $("iframe").load(function(){ + var frameid = $("#iframe-default").contents().find(".sortable").attr("id") + + $( ".draggable" ).draggable({ + connectToSortable: "#" + frameid, + helper: "clone", + revert: "invalid", + cursor: "move", + iframeFix: true + + + }); + + }); + + // $( "ul, li" ).disableSelection(); + }); - - ','jquery'); + */ + - */ + $this->scanForNew(); @@ -620,7 +664,7 @@ class e_layout foreach($this->menuData[THEME_LAYOUT][$area] as $val) { - $text .= $this->renderMenu($val,$area,$count); + $text .= $this->renderMenu($val, THEME_LAYOUT, $area,$count); $count++; } @@ -639,10 +683,10 @@ class e_layout - private function renderMenu($row, $area, $count) + private function renderMenu($row, $layout, $area, $count) { // return print_a($row,true); - $TEMPLATE = '
  • '.$this->renderMenuOptions($row, $area,$count).'
  • + $TEMPLATE = '
  • '.$this->renderMenuOptions($row, $layout, $area,$count).'
  • '; // TODO perhaps a simple counter for the id return $TEMPLATE; @@ -652,23 +696,30 @@ class e_layout - - private function renderMenuOptions($row,$area,$c) + /** + * @param $row (array of data from $pref['menu_layouts'] + * @param $layout . eg. 'default' or 'home' + * @param number $area as in {MENU=x} + * @param incrementor number. + */ + public function renderMenuOptions($row, $layout, $area, $c) { $frm = e107::getForm(); - $text = $row['name']; + $text = str_replace("_menu","",$row['name']); + + //TODO Delete, Config etc. //$data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=>$row['menu_class'],'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']); // $area = 'area_'.$area; - $text .= $frm->hidden('data['.THEME_LAYOUT.']['.$area.']['.$c.'][name]',$row['name'] ); - $text .= $frm->hidden('data['.THEME_LAYOUT.']['.$area.']['.$c.'][class]',$row['class'] ); - $text .= $frm->hidden('data['.THEME_LAYOUT.']['.$area.']['.$c.'][path]',$row['path'] ); - $text .= $frm->hidden('data['.THEME_LAYOUT.']['.$area.']['.$c.'][pages]',$row['pages'] ); - $text .= $frm->hidden('data['.THEME_LAYOUT.']['.$area.']['.$c.'][parms]',$row['parms'] ); + $text .= $frm->hidden('data['.$layout.']['.$area.']['.$c.'][name]',$row['name'] ); + $text .= $frm->hidden('data['.$layout.']['.$area.']['.$c.'][class]',$row['class'] ); + $text .= $frm->hidden('data['.$layout.']['.$area.']['.$c.'][path]',$row['path'] ); + $text .= $frm->hidden('data['.$layout.']['.$area.']['.$c.'][pages]',$row['pages'] ); + $text .= $frm->hidden('data['.$layout.']['.$area.']['.$c.'][parms]',$row['parms'] ); return $text; diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 3706c1650..b766428b2 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -71,6 +71,11 @@ class e_menu $menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE.$menu_layout_field)); // $menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST); $menu_data = e107::getArrayStorage()->ReadArray($menu_data); + + + + + $eMenuArea = array(); // $eMenuList = array(); // $eMenuActive = array(); // DEPRECATED @@ -93,6 +98,11 @@ class e_menu { $eMenuArea = $menu_data['menu_area']; } + + // print_a($eMenuArea); + // $eMenuArea = $this->getData(THEME_LAYOUT); + + $total = array(); foreach($eMenuArea as $area => $val) { @@ -110,9 +120,71 @@ class e_menu } } } + + + + + e107::getRender()->eMenuTotal = $total; } + + + + + + + /** + * V2 Menu Re-Write - retrieve Menu data from $pref['menu_layouts'] + */ + protected function getData($layout) + { + $pref = e107::getPref('menu_layouts'); + + foreach($pref[$layout] as $area=>$v); + { + $c = 0; + + foreach($v as $val) + { + $class = intval($val['class']); + + if(!check_class($class)) + { + continue; + } + + $ret[$area][] = array( + + 'menu_name' => $val['name'], + 'menu_location' => $area, + 'menu_class' => $class, + 'menu_order' => $c, + 'menu_pages' => $val['pages'], + 'menu_path' => $val['path'], + 'menu_layout' => '', + 'menu_parms' => $val['parms'] + + ); + + $c++; + } + + + } + + return $ret; + + } + + + + + + + + + /** * Check visibility of a menu against URL *