Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8ae1201e72
@ -2,24 +2,8 @@
|
||||
/**
|
||||
* Functions used in server plugins pages
|
||||
*/
|
||||
var pma_theme_image; // filled in server_plugins.php
|
||||
|
||||
AJAX.registerOnload('server_plugins.js', function () {
|
||||
// Add tabs
|
||||
$('#pluginsTabs').tabs({
|
||||
// Tab persistence
|
||||
cookie: { name: 'pma_serverStatusTabs', expires: 1 },
|
||||
show: function (event, ui) {
|
||||
// Fixes line break in the menu bar when the page overflows and scrollbar appears
|
||||
$('#topmenu').menuResizer('resize');
|
||||
// 'Plugins' tab is too high due to hiding of 'Modules' by negative left position,
|
||||
// hide tabs by changing display to fix it
|
||||
$(ui.panel).closest('.ui-tabs').find('> div').not(ui.panel).css('display', 'none');
|
||||
$(ui.panel).css('display', 'block');
|
||||
}
|
||||
});
|
||||
|
||||
// Make columns sortable, but only for tables with more than 1 data row
|
||||
// Make columns sortable, but only for tables with more than 1 data row
|
||||
var $tables = $('#plugins_plugins table:has(tbody tr + tr)');
|
||||
$tables.tablesorter({
|
||||
sortList: [[0, 0]],
|
||||
|
||||
@ -612,6 +612,13 @@ class PMA_Menu
|
||||
$tabs['plugins']['icon'] = 'b_engine.png';
|
||||
$tabs['plugins']['link'] = 'server_plugins.php';
|
||||
$tabs['plugins']['text'] = __('Plugins');
|
||||
$tabs['plugins']['active'] = in_array(
|
||||
basename($GLOBALS['PMA_PHP_SELF']),
|
||||
array(
|
||||
'server_plugins.php',
|
||||
'server_modules.php',
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$tabs['engine']['icon'] = 'b_engine.png';
|
||||
$tabs['engine']['link'] = 'server_engines.php';
|
||||
|
||||
@ -13,28 +13,94 @@ if (! defined('PHPMYADMIN')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html for plugin and module Info.
|
||||
* Get the HTML for the sub tabs
|
||||
*
|
||||
* @param Array $plugins Plugin list
|
||||
* @param string $activeUrl url of the active sub tab
|
||||
*
|
||||
* @param Array $modules Module list
|
||||
*
|
||||
* @return string
|
||||
* @return string HTML for sub tabs
|
||||
*/
|
||||
function PMA_getPluginAndModuleInfo($plugins, $modules)
|
||||
function PMA_getHtmlForPluginsSubTabs($activeUrl)
|
||||
{
|
||||
$html = '<script type="text/javascript">';
|
||||
$html .= 'pma_theme_image = "' . $GLOBALS['pmaThemeImage'] . '"';
|
||||
$html .= '</script>';
|
||||
$html .= '<div id="pluginsTabs">';
|
||||
$html .= '<ul>';
|
||||
$html .= '<li><a href="#plugins_plugins">' . __('Plugins') . '</a></li>';
|
||||
$html .= '<li><a href="#plugins_modules">' . __('Modules') . '</a></li>';
|
||||
$html .= '</ul>';
|
||||
$html .= PMA_getPluginTab($plugins);
|
||||
$html .= PMA_getModuleTab($modules);
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
$url_params = PMA_URL_getCommon();
|
||||
$items = array(
|
||||
array(
|
||||
'name' => __('Plugins'),
|
||||
'url' => 'server_plugins.php'
|
||||
),
|
||||
array(
|
||||
'name' => __('Modules'),
|
||||
'url' => 'server_modules.php'
|
||||
)
|
||||
);
|
||||
|
||||
$retval = '<ul id="topmenu2">';
|
||||
foreach ($items as $item) {
|
||||
$class = '';
|
||||
if ($item['url'] === $activeUrl) {
|
||||
$class = ' class="tabactive"';
|
||||
}
|
||||
$retval .= '<li>';
|
||||
$retval .= '<a' . $class;
|
||||
$retval .= ' href="' . $item['url'] . $url_params . '">';
|
||||
$retval .= $item['name'];
|
||||
$retval .= '</a>';
|
||||
$retval .= '</li>';
|
||||
}
|
||||
$retval .= '</ul>';
|
||||
$retval .= '<div class="clearfloat"></div>';
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the common SQL used to retrieve plugin and modules data
|
||||
*
|
||||
* @return string SQL
|
||||
*/
|
||||
function PMA_getServerPluginModuleSQL()
|
||||
{
|
||||
return "SELECT p.plugin_name, p.plugin_type, p.is_active, m.module_name,
|
||||
m.module_library, m.module_version, m.module_author,
|
||||
m.module_description, m.module_license
|
||||
FROM data_dictionary.plugins p
|
||||
JOIN data_dictionary.modules m USING (module_name)
|
||||
ORDER BY m.module_name, p.plugin_type, p.plugin_name";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns details about server plugins
|
||||
*
|
||||
* @return array server plugins data
|
||||
*/
|
||||
function PMA_getServerPlugins()
|
||||
{
|
||||
$sql = PMA_getServerPluginModuleSQL();
|
||||
$res = $GLOBALS['dbi']->query($sql);
|
||||
$plugins = array();
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
|
||||
$plugins[$row['plugin_type']][] = $row;
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($res);
|
||||
ksort($plugins);
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns details about server modules
|
||||
*
|
||||
* @return array server modules data
|
||||
*/
|
||||
function PMA_getServerModules()
|
||||
{
|
||||
$sql = PMA_getServerPluginModuleSQL();
|
||||
$res = $GLOBALS['dbi']->query($sql);
|
||||
$modules = array();
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
|
||||
$modules[$row['module_name']]['info'] = $row;
|
||||
$modules[$row['module_name']]['plugins'][$row['plugin_type']][] = $row;
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($res);
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
31
server_modules.php
Normal file
31
server_modules.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* object the server modules page
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* requirements
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
/**
|
||||
* Does the common work
|
||||
*/
|
||||
require 'libraries/server_common.inc.php';
|
||||
require 'libraries/server_plugins.lib.php';
|
||||
|
||||
$modules = PMA_getServerModules();
|
||||
|
||||
/**
|
||||
* Displays the page
|
||||
*/
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML('<div>');
|
||||
$response->addHTML(PMA_getHtmlForPluginsSubTabs('server_modules.php'));
|
||||
$response->addHTML(PMA_getModuleTab($modules));
|
||||
$response->addHTML('</div>');
|
||||
|
||||
exit;
|
||||
@ -26,32 +26,14 @@ $scripts->addFile('server_plugins.js');
|
||||
require 'libraries/server_common.inc.php';
|
||||
require 'libraries/server_plugins.lib.php';
|
||||
|
||||
/**
|
||||
* Prepare plugin list
|
||||
*/
|
||||
$sql = "SELECT p.plugin_name, p.plugin_type, p.is_active, m.module_name,
|
||||
m.module_library, m.module_version, m.module_author,
|
||||
m.module_description, m.module_license
|
||||
FROM data_dictionary.plugins p
|
||||
JOIN data_dictionary.modules m USING (module_name)
|
||||
ORDER BY m.module_name, p.plugin_type, p.plugin_name";
|
||||
$res = $GLOBALS['dbi']->query($sql);
|
||||
$plugins = array();
|
||||
$modules = array();
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
|
||||
$plugins[$row['plugin_type']][] = $row;
|
||||
$modules[$row['module_name']]['info'] = $row;
|
||||
$modules[$row['module_name']]['plugins'][$row['plugin_type']][] = $row;
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($res);
|
||||
|
||||
// sort plugin list (modules are already sorted)
|
||||
ksort($plugins);
|
||||
$plugins = PMA_getServerPlugins();
|
||||
|
||||
/**
|
||||
* Displays the page
|
||||
*/
|
||||
$response->addHTML(PMA_getHtmlForSubPageHeader('plugins'));
|
||||
$response->addHTML(PMA_getPluginAndModuleInfo($plugins, $modules));
|
||||
$response->addHTML('<div>');
|
||||
$response->addHTML(PMA_getHtmlForPluginsSubTabs('server_plugins.php'));
|
||||
$response->addHTML(PMA_getPluginTab($plugins));
|
||||
$response->addHTML('</div>');
|
||||
|
||||
exit;
|
||||
|
||||
@ -79,7 +79,6 @@ class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
|
||||
$plugins = array();
|
||||
$modules = array();
|
||||
|
||||
$row = array();
|
||||
$row["plugin_name"] = "plugin_name1";
|
||||
@ -92,22 +91,10 @@ class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
|
||||
$row["module_description"] = "module_description1";
|
||||
$row["is_active"] = true;
|
||||
$plugins[$row['plugin_type']][] = $row;
|
||||
$modules[$row['module_name']]['info'] = $row;
|
||||
$modules[$row['module_name']]['plugins'][$row['plugin_type']][] = $row;
|
||||
|
||||
$html = PMA_getPluginAndModuleInfo($plugins, $modules);
|
||||
$html = PMA_getPluginTab($plugins);
|
||||
|
||||
//validate 1: PMA_getPluginTab
|
||||
$this->assertContains(
|
||||
'<a href="#plugins_plugins">Plugins</a>',
|
||||
$html
|
||||
);
|
||||
//validate 2: PMA_getModuleTab
|
||||
$this->assertContains(
|
||||
'<a href="#plugins_modules">Modules</a>',
|
||||
$html
|
||||
);
|
||||
//validate 3:Items
|
||||
//validate 1:Items
|
||||
$this->assertContains(
|
||||
'<th>Plugin</th>',
|
||||
$html
|
||||
@ -116,18 +103,10 @@ class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
|
||||
'<th>Module</th>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<th>Plugin</th>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<th>Library</th>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<th>Plugin</th>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<th>Version</th>',
|
||||
$html
|
||||
@ -141,11 +120,15 @@ class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
|
||||
$html
|
||||
);
|
||||
|
||||
//validate 4: one Item HTML
|
||||
//validate 2: one Item HTML
|
||||
$this->assertContains(
|
||||
'<th>plugin_name1</th>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<td>module_name1</td>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<td>module_library1</td>',
|
||||
$html
|
||||
@ -155,11 +138,11 @@ class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<td>module_description1</td>',
|
||||
'<td>module_author1</td>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<td>module_author1</td>',
|
||||
'<td>module_license1</td>',
|
||||
$html
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user