1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Legacy Admin layout fixes and tests.

This commit is contained in:
Cameron 2021-01-17 10:36:17 -08:00
parent b286d66e88
commit 299c3717a7
8 changed files with 46 additions and 18 deletions

View File

@ -787,7 +787,7 @@ function render_clean() // still used by classis, tabbed etc.
{ {
global $td; global $td;
$text = ""; $text = "";
while ($td <= ADLINK_COLS) while ($td <= defset('ADLINK_COLS', 5))
{ {
$text .= "<td class='td' style='width:20%;'></td>"; $text .= "<td class='td' style='width:20%;'></td>";
$td++; $td++;
@ -799,7 +799,7 @@ function render_clean() // still used by classis, tabbed etc.
if(is_object($adp)) if(isset($adp) && is_object($adp))
{ {
$adp->render(); $adp->render();
} }

View File

@ -19,7 +19,7 @@ $text = "<div style='text-align:center'>
$admin_cat = e107::getNav()->adminCats(); $admin_cat = e107::getNav()->adminCats();
$newarray = e107::getNav()->adminLinks('core'); $newarray = e107::getNav()->adminLinks('core');
$plugin_array = e107::getNav()->adminLinks('plugin'); $plugin_array = e107::getNav()->adminLinks('plugin');
foreach ($admin_cat['id'] as $cat_key => $cat_id) foreach ($admin_cat['id'] as $cat_key => $cat_id)

View File

@ -24,6 +24,7 @@ foreach($newarray as $key=>$funcinfo)
$buts .= e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default'); $buts .= e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
} }
$text .= $buts; $text .= $buts;
$td = 0;
while ($td <= 5) { while ($td <= 5) {
$text .= "<td class='td' style='width:20%;' ></td>"; $text .= "<td class='td' style='width:20%;' ></td>";
$td++; $td++;

View File

@ -566,8 +566,11 @@ class admin_shortcodes
function sc_admin_log($parm=null) function sc_admin_log($parm=null)
{ {
e107::coreLan('log_messages', true);
if (getperms('0')) if (getperms('0'))
{ {
if (!function_exists('admin_log')) if (!function_exists('admin_log'))
{ {
function admin_log() function admin_log()
@ -575,7 +578,7 @@ class admin_shortcodes
$sql = e107::getDb(); $sql = e107::getDb();
$ns = e107::getRender(); $ns = e107::getRender();
$text = E_16_ADMINLOG." <a style='cursor: pointer' onclick=\"expandit('adminlog')\">".ADLAN_116."</a>\n"; $text = "<ul class='list-group'><li class='list-group-item'>".E_16_ADMINLOG." <a style='cursor: pointer' onclick=\"expandit('adminlog')\">".ADLAN_116."</a></li></ul>\n";
if (e_QUERY == 'logall') if (e_QUERY == 'logall')
{ {
$text .= "<div id='adminlog'>"; $text .= "<div id='adminlog'>";
@ -586,16 +589,16 @@ class admin_shortcodes
$text .= "<div style='display: none;' id='adminlog'>"; $text .= "<div style='display: none;' id='adminlog'>";
$cnt = $sql ->select('admin_log', '*', 'ORDER BY `dblog_datestamp` DESC LIMIT 0,10', 'no_where'); $cnt = $sql ->select('admin_log', '*', 'ORDER BY `dblog_datestamp` DESC LIMIT 0,10', 'no_where');
} }
$text .= ($cnt) ? '<ul>' : ''; $text .= ($cnt) ? '<ul class="list-group">' : '';
$gen = e107::getDateConvert(); $gen = e107::getDate();
while ($row = $sql ->fetch()) while ($row = $sql ->fetch())
{ {
$datestamp = $gen->convert_date($row['dblog_datestamp'], 'short'); $datestamp = $gen->convert_date($row['dblog_datestamp'], 'short');
$text .= "<li>{$datestamp} - {$row['dblog_title']}</li>"; $text .= "<li class='list-group-item'>{$datestamp} - ".defset($row['dblog_title'],$row['dblog_title'] )."</li>";
} }
$text .= ($cnt ? '</ul>' : ''); $text .= ($cnt ? '</ul>' : '');
$text .= "[ <a href='".e_ADMIN_ABS."admin_log.php?adminlog'>".ADLAN_117."</a> ]"; $text .= "<p><a class='btn btn-sm btn-primary' href='".e_ADMIN_ABS."admin_log.php'>".ADLAN_117."</a> ";
$text .= "<br />[ <a href='".e_ADMIN_ABS."admin_log.php?config'>".ADLAN_118."</a> ]"; $text .= "<a class='btn btn-sm btn-primary' href='".e_ADMIN_ABS."admin_log.php?mode=main&action=maintenance'>".ADLAN_118."</a></p>";
// $text .= "<br />[ <a href='".e_ADMIN."admin_log.php?purge' onclick=\"return jsconfirm('".LAN_CONFIRMDEL."')\">".ADLAN_118."</a> ]\n"; // $text .= "<br />[ <a href='".e_ADMIN."admin_log.php?purge' onclick=\"return jsconfirm('".LAN_CONFIRMDEL."')\">".ADLAN_118."</a> ]\n";

View File

@ -1057,7 +1057,7 @@ class e107Test extends \Codeception\Test\Unit
'search' => 'core/rewrite', 'search' => 'core/rewrite',
'system' => 'core/rewrite', 'system' => 'core/rewrite',
'user' => 'core/rewrite', 'user' => 'core/rewrite',
'gallery' => 'plugin/rewrite' // 'gallery' => 'plugin/rewrite'
); );

View File

@ -12,12 +12,11 @@
class e_menu_layoutTest extends \Codeception\Test\Unit class e_menu_layoutTest extends \Codeception\Test\Unit
{ {
/** @var e_menu_layout */
protected $menu; protected $menu;
protected function _before() protected function _before()
{ {
require_once(e_HANDLER."menumanager_class.php"); // require_once(e_HANDLER."menumanager_class.php");
} }
private function copydir( $src, $dst ) private function copydir( $src, $dst )

View File

@ -7,21 +7,45 @@
protected function _before() protected function _before()
{ {
define("SEP", " <span class='fa fa-angle-double-right e-breadcrumb'></span> "); if(!defined('SEP'))
{
define("SEP", " <span class='fa fa-angle-double-right e-breadcrumb'></span> ");
}
}
public function testAdminScripts()
{
$exclude = array('index.php', 'menus.php'); // FIXME menus defines e_ADMIN_AREA which messes up other tests.
$this->loadScripts(e_ADMIN, $exclude);
}
public function testAdminIncludes()
{
ob_start();
require_once(e_ADMIN."admin.php");
ob_end_clean();
$this->loadScripts(e_ADMIN."includes/");
}
public function testAdminLayouts()
{
$this->loadScripts(e_ADMIN.'includes/layouts/');
} }
public function testAdminScripts() private function loadScripts($folder, $exclude= array())
{ {
// $globalList = e107::getPref('lan_global_list'); // $globalList = e107::getPref('lan_global_list');
$list = scandir(e_ADMIN); $list = scandir($folder);
$config = e107::getConfig(); $config = e107::getConfig();
$preInstall = array('banner', 'page'); $preInstall = array('banner', 'page');
$exclude = array('index.php', 'menus.php'); // FIXME menus defines e_ADMIN_AREA which messes up other tests.
foreach($preInstall as $plug) foreach($preInstall as $plug)
{ {
@ -41,7 +65,7 @@
foreach($list as $file) foreach($list as $file)
{ {
$ext = pathinfo(e_ADMIN.$file, PATHINFO_EXTENSION); $ext = pathinfo($folder.$file, PATHINFO_EXTENSION);
if($ext !== 'php' || in_array($file, $exclude)) if($ext !== 'php' || in_array($file, $exclude))
{ {
@ -53,7 +77,7 @@
// test for PHP Notice/Warning etc. // test for PHP Notice/Warning etc.
$error = false; $error = false;
if(require_once(e_ADMIN.$file)) if(require_once($folder.$file))
{ {
$this->assertTrue(true, "loading ".$file); $this->assertTrue(true, "loading ".$file);
} }

View File

@ -16,6 +16,7 @@ if(!defined('e107_INIT'))
exit; exit;
} }
// e107::lan('theme');
class theme implements e_theme_render class theme implements e_theme_render
{ {