Extend navigation tree item hiding to functions. procedures, events and views
This commit is contained in:
parent
18b2472580
commit
56b5c8e294
@ -179,13 +179,6 @@ $(function () {
|
||||
dialog.editorDialog(0, $(this));
|
||||
});
|
||||
|
||||
/** Export Routines, Triggers and Events */
|
||||
$('li.procedure a.ajax img, li.function a.ajax img, li.trigger a.ajax img, li.event a.ajax img').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
var dialog = new RTE.object();
|
||||
dialog.exportDialog($(this).parent());
|
||||
});
|
||||
|
||||
/** New index */
|
||||
$('li.new_index a.ajax').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
@ -213,7 +206,7 @@ $(function () {
|
||||
});
|
||||
|
||||
/** Hide navigation tree item */
|
||||
$('.hideNavItem').live('click', function (event) {
|
||||
$('a.hideNavItem.ajax').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
url: $(this).attr('href') + '&ajax_request=true',
|
||||
@ -228,7 +221,7 @@ $(function () {
|
||||
});
|
||||
|
||||
/** Show a dialog to choose navigation items to unhide */
|
||||
$('.showUnhide').live('click', function (event) {
|
||||
$('a.showUnhide.ajax').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
$.get($(this).attr('href') + '&ajax_request=1', function (data) {
|
||||
@ -258,7 +251,7 @@ $(function () {
|
||||
});
|
||||
|
||||
/** Unhide a hidden navigation tree item */
|
||||
$('.unhideNavItem').live('click', function (event) {
|
||||
$('a.unhideNavItem.ajax').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
var $tr = $(this).parents('tr');
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
|
||||
@ -98,7 +98,7 @@ class PMA_Navigation
|
||||
. "'" . PMA_Util::sqlAddSlashes($dbName) . "',"
|
||||
. "'" . (! empty($tableName)? PMA_Util::sqlAddSlashes($tableName) : "" )
|
||||
. "')";
|
||||
PMA_queryAsControlUser($sqlQuery, true);
|
||||
PMA_queryAsControlUser($sqlQuery, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,7 +128,7 @@ class PMA_Navigation
|
||||
? " AND `table_name`='" . PMA_Util::sqlAddSlashes($tableName) . "'"
|
||||
: ""
|
||||
);
|
||||
PMA_queryAsControlUser($sqlQuery, true);
|
||||
PMA_queryAsControlUser($sqlQuery, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,7 +154,7 @@ class PMA_Navigation
|
||||
. " AND `db_name`='" . PMA_Util::sqlAddSlashes($dbName) . "'"
|
||||
. " AND `table_name`='"
|
||||
. (! empty($tableName) ? PMA_Util::sqlAddSlashes($tableName) : '') . "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, true);
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
|
||||
$hidden = array();
|
||||
if ($result) {
|
||||
@ -168,26 +168,36 @@ class PMA_Navigation
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($result);
|
||||
|
||||
$typeMap = array(
|
||||
'event' => __('Events:'),
|
||||
'function' => __('Functions:'),
|
||||
'procedure' => __('Procedures:'),
|
||||
'table' => __('Tables:'),
|
||||
'view' => __('Views:'),
|
||||
);
|
||||
if (empty($tableName)) {
|
||||
if ((empty($itemType) || $itemType == 'table')
|
||||
&& isset($hidden['table'])
|
||||
) {
|
||||
$html .= '<h4>' . __('Tables:') . '</h4>';
|
||||
$html .= '<table width="100%"><tbody>';
|
||||
$odd = true;
|
||||
foreach ($hidden['table'] as $hiddenTable) {
|
||||
$html .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
|
||||
$html .= '<td>' . $hiddenTable . '</td>';
|
||||
$html .= '<td><a href="navigation.php?'
|
||||
. PMA_generate_common_url()
|
||||
. '&unhideNavItem=true&itemType=table'
|
||||
. '&itemName=' . urldecode($hiddenTable)
|
||||
. '&dbName=' . urldecode($dbName) . '"'
|
||||
. ' class="unhideNavItem ajax">'
|
||||
. PMA_Util::getIcon('b_undo.png', __('Unhide'))
|
||||
. '</a></td>';
|
||||
foreach ($typeMap as $t => $lable) {
|
||||
if ((empty($itemType) || $itemType == $t)
|
||||
&& isset($hidden[$t])
|
||||
) {
|
||||
$html .= '<h4>' . $lable . '</h4>';
|
||||
$html .= '<table width="100%"><tbody>';
|
||||
$odd = true;
|
||||
foreach ($hidden[$t] as $hiddenItem) {
|
||||
$html .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
|
||||
$html .= '<td>' . $hiddenItem . '</td>';
|
||||
$html .= '<td style="width:80px"><a href="navigation.php?'
|
||||
. PMA_generate_common_url()
|
||||
. '&unhideNavItem=true'
|
||||
. '&itemType=' . $t
|
||||
. '&itemName=' . urldecode($hiddenItem)
|
||||
. '&dbName=' . urldecode($dbName) . '"'
|
||||
. ' class="unhideNavItem ajax">'
|
||||
. PMA_Util::getIcon('b_undo.png', __('Unhide'))
|
||||
. '</a></td>';
|
||||
}
|
||||
$html .= '</tbody></table>';
|
||||
}
|
||||
$html .= '</tbody></table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -234,10 +234,10 @@ class Node_Database extends Node
|
||||
switch ($type) {
|
||||
case 'tables':
|
||||
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `TABLE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
|
||||
$query .= "AND `TABLE_TYPE`='BASE TABLE' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `TABLE_NAME` LIKE '%";
|
||||
@ -277,10 +277,10 @@ class Node_Database extends Node
|
||||
break;
|
||||
case 'views':
|
||||
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `TABLE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
|
||||
$query .= "AND `TABLE_TYPE`!='BASE TABLE' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `TABLE_NAME` LIKE '%";
|
||||
@ -320,10 +320,10 @@ class Node_Database extends Node
|
||||
break;
|
||||
case 'procedures':
|
||||
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `ROUTINE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$db'";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$escdDb'";
|
||||
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `ROUTINE_NAME` LIKE '%";
|
||||
@ -336,8 +336,8 @@ class Node_Database extends Node
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
} else {
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SHOW PROCEDURE STATUS WHERE `Db`='$db' ";
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SHOW PROCEDURE STATUS WHERE `Db`='$escdDb' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `Name` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
@ -360,10 +360,10 @@ class Node_Database extends Node
|
||||
break;
|
||||
case 'functions':
|
||||
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `ROUTINE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$db' ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$escdDb' ";
|
||||
$query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `ROUTINE_NAME` LIKE '%";
|
||||
@ -376,8 +376,8 @@ class Node_Database extends Node
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
} else {
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SHOW FUNCTION STATUS WHERE `Db`='$db' ";
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SHOW FUNCTION STATUS WHERE `Db`='$escdDb' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `Name` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
@ -400,10 +400,10 @@ class Node_Database extends Node
|
||||
break;
|
||||
case 'events':
|
||||
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `EVENT_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
|
||||
$query .= "WHERE `EVENT_SCHEMA`='$db' ";
|
||||
$query .= "WHERE `EVENT_SCHEMA`='$escdDb' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `EVENT_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
@ -415,8 +415,8 @@ class Node_Database extends Node
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
} else {
|
||||
$db = PMA_Util::backquote($db);
|
||||
$query = "SHOW EVENTS FROM $db ";
|
||||
$escdDb = PMA_Util::backquote($db);
|
||||
$query = "SHOW EVENTS FROM $escdDb ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "WHERE `Name` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
|
||||
@ -61,6 +61,31 @@ class Node_Event extends Node
|
||||
$query .= "AND `EVENT_NAME`='$event' ";
|
||||
return $GLOBALS['dbi']->fetchValue($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for hide button displayed infront of the event node
|
||||
*
|
||||
* @return HTML for hide button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$event = $this->real_name;
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php?'
|
||||
. PMA_generate_common_url()
|
||||
. '&hideNavItem=true&itemType=event'
|
||||
. '&itemName=' . urldecode($event)
|
||||
. '&dbName=' . urldecode($db) . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. PMA_Util::getImage('b_close', 'Hide')
|
||||
. '</a></span>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -62,6 +62,31 @@ class Node_Function extends Node
|
||||
$query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
|
||||
return $GLOBALS['dbi']->fetchValue($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for hide button displayed infront of the function node
|
||||
*
|
||||
* @return HTML for hide button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$function = $this->real_name;
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php?'
|
||||
. PMA_generate_common_url()
|
||||
. '&hideNavItem=true&itemType=function'
|
||||
. '&itemName=' . urldecode($function)
|
||||
. '&dbName=' . urldecode($db) . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. PMA_Util::getImage('b_close', 'Hide')
|
||||
. '</a></span>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -62,6 +62,31 @@ class Node_Procedure extends Node
|
||||
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
|
||||
return $GLOBALS['dbi']->fetchValue($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for hide button displayed infront of the table node
|
||||
*
|
||||
* @return HTML for hide button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$procedure = $this->real_name;
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php?'
|
||||
. PMA_generate_common_url()
|
||||
. '&hideNavItem=true&itemType=procedure'
|
||||
. '&itemName=' . urldecode($procedure)
|
||||
. '&dbName=' . urldecode($db) . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. PMA_Util::getImage('b_close', 'Hide')
|
||||
. '</a></span>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -232,7 +232,7 @@ class Node_Table extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for hide button displayed infront of a node
|
||||
* Returns HTML for hide button displayed infront of the table node
|
||||
*
|
||||
* @return HTML for hide button
|
||||
*/
|
||||
|
||||
@ -39,6 +39,31 @@ class Node_View extends Node
|
||||
. '&token=' . $GLOBALS['token']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for hide button displayed infront of the view node
|
||||
*
|
||||
* @return HTML for hide button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$view = $this->real_name;
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php?'
|
||||
. PMA_generate_common_url()
|
||||
. '&hideNavItem=true&itemType=view'
|
||||
. '&itemName=' . urldecode($view)
|
||||
. '&dbName=' . urldecode($db) . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. PMA_Util::getImage('b_close', 'Hide')
|
||||
. '</a></span>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user