From 01ff30c274ceb2f823a3bbff90b373438d54f519 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Tue, 22 May 2012 04:38:28 +0000 Subject: [PATCH] Bugfixe - corrects menu/page mixup in custom-pages. News-posts labelled correctly now and default field columns added. --- e107_admin/cpage.php | 45 ++++++++++++++++++++++++----------------- e107_admin/newspost.php | 24 ++++++++++++---------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index e296f496f..49e47a334 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -112,26 +112,32 @@ class page_admin extends e_admin_dispatcher { protected $modes = array( - 'main' => array( + 'page' => array( 'controller' => 'page_admin_ui', 'path' => null, 'ui' => 'page_admin_form_ui', 'uipath' => null - ) + ), + 'menu' => array( + 'controller' => 'page_admin_ui', + 'path' => null, + 'ui' => 'page_admin_form_ui', + 'uipath' => null + ) ); - - + protected $adminMenu = array( - 'main/list' => array('caption'=> CUSLAN_48, 'perm' => '5'), - 'main/menus' => array('caption'=> CUSLAN_49, 'perm' => 'J'), - 'main/create' => array('caption'=> CUSLAN_12, 'perm' => '5'), - 'main/createem' => array('caption'=> CUSLAN_31, 'perm' => 'J'), - 'main/options' => array('caption'=> LAN_OPTIONS, 'perm' => '0') + 'page/list' => array('caption'=> CUSLAN_48, 'perm' => '5'), + 'menu/list' => array('caption'=> CUSLAN_49, 'perm' => 'J'), + 'page/create' => array('caption'=> CUSLAN_12, 'perm' => '5'), + 'menu/create' => array('caption'=> CUSLAN_31, 'perm' => 'J'), + 'page/options' => array('caption'=> LAN_OPTIONS, 'perm' => '0') ); protected $adminMenuAliases = array( - 'main/edit' => 'main/list' + 'page/edit' => 'page/list', + 'menu/edit' => 'menu/list' ); protected $menuTitle = 'Custom Pages'; @@ -209,8 +215,8 @@ class page_admin_ui extends e_admin_ui function init() { - //FIX ME - mode not retained after using drop-down 'filter' or 'search'. - if($_GET['mode'] =='main' && $_GET['action'] =='menus') + //FIXME - mode not retained after using drop-down 'filter' or 'search'. + if($_GET['mode'] =='menu') { $this->listQry = "SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_theme != '' "; // without any Order or Limit. } @@ -266,9 +272,12 @@ class page_admin_ui extends e_admin_ui function createPage($mode=FALSE) { /* mode: FALSE == page, mode: TRUE == menu */ - - - + if($_GET['mode'] =='menu') + { + $mode = TRUE; + } + + global $e107, $e_userclass, $e_event; $frm = e107::getForm(); @@ -283,7 +292,7 @@ class page_admin_ui extends e_admin_ui $edit = ($sub_action == 'edit'); $caption =(!$mode ? ($edit ? CUSLAN_23 : CUSLAN_24) : ($edit ? CUSLAN_25 : CUSLAN_26)); - if ($sub_action == "edit" && !isset($_POST['preview']) && !isset($_POST['submit'])) + if ($_GET['action'] == "edit" && !isset($_POST['preview']) && !isset($_POST['submit'])) { //$url = e107::getUrl()->sc('page/view', $row, 'allow=page_id,page_title,page_sef'); @@ -403,7 +412,7 @@ class page_admin_ui extends e_admin_ui // $text .= ""; //
".display_help('cpage-help', 'cpage')." - + /* $text .= " @@ -413,7 +422,7 @@ class page_admin_ui extends e_admin_ui "; - + */ if(!$mode) { $text .= " diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index eb5737ac4..a5c0cb5a7 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -283,19 +283,19 @@ class news_sub_form_ui extends e_admin_form_ui class news_admin_ui extends e_admin_ui { - protected $pluginTitle = 'Media Categories'; - protected $pluginName = 'core'; - protected $table = "news"; - protected $pid = "news_id"; - protected $perPage = 20; //no limit - protected $batchDelete = true; - protected $batchCopy = true; - protected $listOrder = "news_id desc"; + protected $pluginTitle = ADLAN_0; // "News" + protected $pluginName = 'core'; + protected $table = "news"; + protected $pid = "news_id"; + protected $perPage = 20; //no limit + protected $batchDelete = true; + protected $batchCopy = true; + protected $listOrder = "news_id desc"; - protected $listQry = "SELECT n.*,u.user_id,u.user_name FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id "; // without any Order or Limit. + protected $listQry = "SELECT n.*,u.user_id,u.user_name FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id "; // without any Order or Limit. - protected $fields = array( + protected $fields = array( 'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE), 'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false), 'news_thumbnail' => array('title' => NWSLAN_67, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParams' => 'path={e_MEDIA}','readonly'=>false), @@ -319,7 +319,9 @@ class news_admin_ui extends e_admin_ui 'news_comment_total' => array('title' => LAN_NEWS_60, 'type' => 'number', 'width' => '10%', 'thclass' => '', 'class' => null, 'nosort' => false), 'options' => array('title' => LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center', 'nosort' => true, 'forced' => TRUE) - ); + ); + + protected $fieldpref = array('checkboxes','news_id', 'news_thumbnail', 'news_title', 'news_datestamp', 'news_category', 'options'); protected $cats = array();