diff --git a/e107_admin/auth.php b/e107_admin/auth.php index 400a8232b..db9ca41ec 100644 --- a/e107_admin/auth.php +++ b/e107_admin/auth.php @@ -84,7 +84,7 @@ else $admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", LAN_ROLL_LOG_11, "U: ".$tp->toDB($_POST['authname']), FALSE, LOG_TO_ROLLING); echo "\n"; // header("location: ../index.php"); - e107::getRedirect()->redirect('../index.php'); + e107::getRedirect()->redirect('admin.php?failed'); exit; } else @@ -126,7 +126,7 @@ else } $e_sub_cat = 'logout'; - + if (!defset('NO_HEADER')) require_once (e_ADMIN."header.php"); @@ -156,7 +156,9 @@ class auth $incChap = (vartrue($pref['password_CHAP'], 0)) ? " onsubmit='hashLoginPassword(this)'" : ""; - $text = "
+ $class = (e_QUERY == 'failed') ? "class='e-shake'" : ""; + + $text = "
@@ -196,7 +198,8 @@ class auth "; - e107::getRender()->tablerender(ADLAN_92, $text); + // echo $text; + e107::getRender()->tablerender(ADLAN_92, $text); } diff --git a/e107_admin/menus.php b/e107_admin/menus.php index 56d16f47a..6e172d2b3 100644 --- a/e107_admin/menus.php +++ b/e107_admin/menus.php @@ -31,6 +31,49 @@ if (!getperms("2")) e107::coreLan('menus', true); e107::coreLan('admin', true); +if(strpos(e_QUERY, 'configure') !== FALSE ) +{ + + e107::js('core', 'colorbox/jquery.colorbox-min.js', 'jquery', 2); + e107::css('core', 'colorbox/colorbox.css', 'jquery'); + + e107::js('core', 'core/jquery.elastic.source.js', 'jquery', 2); + + e107::js('core', 'plupload/plupload.full.js', 'jquery', 2); + e107::css('core', 'plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', 'jquery'); + e107::js('core', 'plupload/jquery.plupload.queue/jquery.plupload.queue.js', 'jquery', 2); + + e107::css('core', 'chosen/chosen.css', 'jquery'); + e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2); + + e107::css('core', 'password/style.css', 'jquery'); + e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2); + // + e107::js("core", "plupload/customUpload.js","jquery",3); + + e107::js("core", "core/mediaManager.js","jquery",3); + + + e107::css('core', 'core/admin.css', 'jquery'); + e107::js('core', 'core/admin.jquery.js', 'jquery', 4); + + + e107::css('inline'," .column { width: 170px; float: left; padding-bottom: 100px; } + .portlet { margin: 0 1em 1em 0; } + .portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; cursor:move } + .portlet-header .ui-icon { float: right; } + .portlet-content { padding: 10px; } + .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; } + .ui-sortable-placeholder * { visibility: hidden; } + ",'jquery'); + + +} + + + + + $e_sub_cat = 'menus'; require_once(e_HANDLER."file_class.php"); @@ -41,7 +84,7 @@ require_once(e_HANDLER."menumanager_class.php"); $rs = new form; $frm = new e_form(); - $men = new e_menuManager(); // use 1 for dragdrop. + $men = new e_menuManager(0); // use 1 for dragdrop. if(e_AJAX_REQUEST) @@ -96,6 +139,8 @@ require_once("footer.php"); function headerjs() { + return; + global $sql,$pref,$men; if(!$men->dragDrop) diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index c64553bf5..95739b5d3 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -557,7 +557,7 @@ class e_menuManager { foreach($this->menuActivateIds as $sel_mens) { //Get info from menu being activated - if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_id = ".$sel_mens." ")) + if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_id = ".intval($sel_mens)." ")) { $row=$sql->db_Fetch(); //If menu is not already activated in that area, add the record. @@ -725,16 +725,21 @@ class e_menuManager { function menuDeactivate() { // Get current menu name global $sql,$admin_log; + + //echo "FOUND= ".$this->menuId; if($sql->db_Select('menus', 'menu_name', 'menu_id='.$this->menuId, 'default')) { - + $row = $sql->db_Fetch(); //Check to see if there is already a menu with location = 0 (to maintain BC) if($sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = 0 AND menu_layout ='".$this->dbLayout."' LIMIT 1")) { //menu_location=0 already exists, we can just delete this record - $sql->db_Delete('menus', 'menu_id='.$this->menuId); + if(!$sql->db_Delete('menus', 'menu_id='.$this->menuId)) + { + $message = "Deletion Failed"; + } } else { @@ -748,6 +753,10 @@ class e_menuManager { $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location={$location} AND menu_order > {$position} AND menu_layout = '".$this->dbLayout."' "); $admin_log->log_event('MENU_04',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } + else + { + $message = "NO CHANGES MADE"; + } echo $message; } @@ -802,13 +811,13 @@ class e_menuManager { if(!$this->dragDrop) { - $text .= "
"; + $text .= "
"; $text .= "
\n"; } else { - $text .= "
\n"; + $text .= "
\n"; } $color = ""; @@ -839,12 +848,10 @@ class e_menuManager { } else { - $text .= "
dbLayout."' style='border:1px outset black;text-align:left;color:black'> - -
".$row['menu_name']." {$pdeta}
-
"; - $text .= $this->menuRenderMenu($row, $menu_count); - $text .= "
\n"; + // Menu Choices box. + $text .= "
"; + $text .= $this->menuRenderMenu($row, $menu_count,true); + $text .= "
\n"; } } $text .= (!$this->dragDrop) ? "
" : ""; @@ -864,9 +871,9 @@ class e_menuManager { $text .= "toJS(MENLAN_41)."')\" />

\n"; // Use Menu Presets $text .= ""; } - $text .= ""; + $text .= ""; } - + $text .= ""; $text .= ""; $text .= ""; @@ -892,15 +899,12 @@ class e_menuManager { function menuSelectLayout() { global $rs, $pref; + +// onchange=\"urljump(this.options[selectedIndex].value);\" $text .= "
"; - // color:white;background-color:black;width:98%;display:block;padding:15px;text-align:center $text .= "
".MENLAN_30." "; - // $text .= "\n"; // window.frames['menu_iframe'].location=this.options[selectedIndex].value ??? - - $text .= "\n"; // window.frames['menu_iframe'].location=this.options[selectedIndex].value ??? $search = array("_","legacyDefault","legacyCustom"); @@ -913,9 +917,11 @@ class e_menuManager { $layoutName = str_replace($search,$replace,$key); $layoutName .=($key==$pref['sitetheme_deflayout']) ? " (".MENLAN_31.")" : ""; $selected = ($this->curLayout == $key || ($key==$pref['sitetheme_deflayout'] && $this->curLayout=='')) ? "selected='selected'" : FALSE; + + // $url = e_SELF."?lay=".$key; - $url = e_SELF."?lay="; - $url .= $key; + $url = e_SELF."?configure=".$key; + $text .= ""; } @@ -1032,54 +1038,83 @@ class e_menuManager { $matches = array(); if(preg_match_all("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", $str, $matches)) { + $menuText = ""; foreach($matches[1] as $menu) { $menu = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $str); if(isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false) { - echo $sc_style['MENU']['pre']; + $menuText .= $sc_style['MENU']['pre']; } - echo " -
- -
- -
" . MENLAN_14 . " " . $menu . "

"; - $text = " "; + + + // --------------- + $menuText .= "\n\n"; + $menuText .= " +
"; + + + + + $menuText .= "
+ " . MENLAN_14 . " " . $menu . " +
+ \n\n"; + + + $sql9 = new db(); + // $sql9 = e107::getDb('sql9'); if($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' AND menu_layout = '" . $this->dbLayout . "' ")) { unset($text); - echo $rs->form_open("post", e_SELF . "?configure=" . $this->curLayout, "frm_menu_" . intval($menu)); + $menuText .= $rs->form_open("post", e_SELF . "?configure=" . $this->curLayout, "frm_menu_" . intval($menu)); $MODE = 1; $sql9->db_Select("menus", "*", "menu_location='$menu' AND menu_layout='" . $this->dbLayout . "' ORDER BY menu_order"); $menu_count = $sql9->db_Rows(); + + $menuText .= "\n
\n\n"; while($row = $sql9->db_Fetch(MYSQL_ASSOC)) { - echo "\n\n\n \n\n -
dbLayout . "'> + $menuText .= "\n\n\n \n"; + $menuText .= "
\n"; -
"; + // echo "
"; - echo $this->menuRenderMenu($row, $menu_count); + // $menuText .= "hi there"; + $menuText .= $this->menuRenderMenu($row, $menu_count); - echo "\n
"; - echo "\n\n\n\n\n\n"; - echo "

"; + // echo "\n
"; + $menuText .= "\n
\n"; + $menuText .= "\n\n\n"; + // echo "

"; } - - echo $rs->form_close(); + $menuText .= "\n\n
\n\n"; // End Column + $menuText .= $rs->form_close(); } - echo "
"; + else + { // placeholder + $menuText .= "
"; + } + + $menuText .= "
\n\n"; + + // --------------- + + if(isset($sc_style['MENU']['post']) && strpos($str, 'ret') !== false) { - echo $sc_style['MENU']['post']; + $menuText .= $sc_style['MENU']['post']; } + + } } + + echo $menuText; } else if(strstr($str, "SETSTYLE")) { @@ -1093,7 +1128,7 @@ class e_menuManager { } //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// - function menuRenderMenu($row,$menu_count ) + function menuRenderMenu($row,$menu_count,$rep = FALSE) { global $ns,$rs,$menu,$menu_info,$menu_act; // $menu_count is empty in here @@ -1130,58 +1165,67 @@ class e_menuManager { $conf = "{$menu_path}config"; } - $text .= ""; + $text .= $rs->form_option(MENLAN_25, TRUE, " "); + // $text .= $rs->form_option(MENLAN_15, "", "deac.{$menu_info}"); + + if ($conf) { - $text .= $rs->form_option(MENLAN_19." ".$menu_act, "", "move.{$menu_info}.".$menu_act); + // $text .= $rs->form_option("Configure", "", $conf); // TODO Check LAN availability } + + if ($menu_order != 1) + { + $text .= $rs->form_option(MENLAN_17, "", "inc.{$menu_info}"); + $text .= $rs->form_option(MENLAN_24, "", "top.{$menu_info}"); + } + if ($menu_count != $menu_order) + { + $text .= $rs->form_option(MENLAN_18, "", "dec.{$menu_info}"); + $text .= $rs->form_option(MENLAN_23, "", "bot.{$menu_info}"); + } + foreach ($this->menu_areas as $menu_act) + { + if ($menu != $menu_act) + { + $text .= $rs->form_option(MENLAN_19." ".$menu_act, "", "move.{$menu_info}.".$menu_act); + } + } + + // Visibility is an action icon now + //$text .= $rs->form_option(MENLAN_20, "", "adv.{$menu_info}"); + $text .= $rs->form_select_close(); } - // Visibility is an action icon now - //$text .= $rs->form_option(MENLAN_20, "", "adv.{$menu_info}"); - $text .= $rs->form_select_close(); + if($rep == true) + { + $text .= "
".$menu_id." {$pdeta}
+
'; } +*/ + + + if(!$this->dragDrop) + { + ob_start(); - ob_start(); - - $ns->tablerender($caption, $text); - $THEX = ob_get_contents(); - - ob_end_clean(); - return $THEX; + $ns->tablerender($caption, $text); + $THEX = ob_get_contents(); + ob_end_clean(); + + return $THEX; + } + else + { + return " +
".$caption."
+
".$text."
"; + + } + + } function menuSaveAjax() { - if(!$this->dragDrop){ return; } - + + + $this->debug = TRUE; + global $sql; - - list($area,$blockList) = explode(':', $_POST['value']); - $loc = intval(str_replace('portal-column-','',$area)); - - // list($e_block,$e_layout) = explode("--",$_POST['value']); - $blockArray = explode(",",$blockList); - - $srch = array('block-archive-','block-'); - $repl = array('',''); - - foreach($blockArray as $val) + list($tmp,$area) = explode("-",$_POST['area']); + + if($_POST['area'] == 'remove') { - list($b,$layout) = explode("--",$val); - - if(strpos($b,"block-archive")!==FALSE) - { - $insert[] = str_replace($srch,$repl,$b); - } - else - { - $update[] = str_replace($srch,$repl,$b); // not really accurate. - } + list($tmp,$deleteID) = explode("-",$_POST['removeid']); + $this->menuId = $deleteID; + $this->menuDeactivate(); + echo "Removed {$deleteId}"; + return; } - // Would be good if the ajax sent a query specific to 'moves'. + // Allow deletion by ajax, but not the rest when drag/drop disabled. - $this -> dbLayout = $layout; + if(!$this->dragDrop){ return; } - $this->menuActivateLoc = $loc; // location - $this->menuActivateIds = $insert; // array of ids, in order. - $this->menuActivate(); // Activate will not deal with menu Moving - need a way to determine if a move has occurred. + $this -> dbLayout = $_POST['layout']; + list($tmp,$insertID) = explode("-",$_POST['insert']); + $insert[] = $insertID; + print_r($_POST); + + if($_POST['mode'] == 'insert' && count($insert) && $area) // clear out everything before rewriting everything to db. + { + $this->menuActivateLoc = $area; // location + $this->menuActivateIds = $insert; // array of ids, in order. + $this->menuActivate(); + + } + elseif($_POST['mode'] == 'update') + { + $sql->db_Update("menus","menu_location = ".intval($area)." WHERE menu_id = ".intval($insertID)." LIMIT 1",$this->debug); + } + + $c = 0; + + if(count($_POST['list'])<2) + { + return; + } + + // resort the menus in this 'Area" + foreach($_POST['list'] as $val) + { + list($b,$id) = explode("-",$val); + $order[] = $id; + $sql->db_Update("menus","menu_order = ".$c." WHERE menu_id = ".intval($id)." LIMIT 1",$this->debug); + $c++; + } // same for delete etc. - echo "
"; + // echo "
"; } diff --git a/e107_themes/jayya/admin_theme.php b/e107_themes/jayya/admin_theme.php index fa004fc61..1d0cb4a7f 100644 --- a/e107_themes/jayya/admin_theme.php +++ b/e107_themes/jayya/admin_theme.php @@ -71,9 +71,17 @@ e107::js('inline'," $$('a.e-dialog-close').invoke('observe', 'click', function(ev) { parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); }); + + // Menu Manager Layout drop-down options + + $$('#menuManagerSelect').invoke('observe', 'change', function(ev) { + var link = ev.element().value; + $('menu_iframe').writeAttribute('data', link); + }); + // - + // alert('fix me : jayya/admin_theme.php (inline js)'); }, document, true); " ,'prototype');